Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog45
-rw-r--r--Makefile.am11
-rw-r--r--README93
-rw-r--r--acconfig.h2
-rw-r--r--configure.in28
-rw-r--r--data/DefaultWsdlHelpGenerator.aspx860
-rw-r--r--data/Makefile.am2
-rw-r--r--data/browscap.ini.gzbin23827 -> 26317 bytes
-rw-r--r--data/machine.config11
-rwxr-xr-xdoc/ChangeLog16
-rw-r--r--doc/ado-net14
-rw-r--r--doc/blogs2
-rw-r--r--doc/books27
-rw-r--r--doc/bugs7
-rw-r--r--doc/ccvs71
-rw-r--r--doc/compiling235
-rw-r--r--doc/crypto15
-rw-r--r--doc/download275
-rw-r--r--doc/drawing14
-rw-r--r--doc/faq15
-rw-r--r--doc/gtk-sharp7
-rwxr-xr-xdoc/ibmdb24
-rw-r--r--doc/index1010
-rwxr-xr-xdoc/languages23
-rw-r--r--doc/mailing-lists2
-rwxr-xr-xdoc/mono-build-w32.sh41
-rw-r--r--doc/mono-roadmap.html2
-rw-r--r--doc/mono-todo8
-rwxr-xr-xdoc/odbc8
-rw-r--r--doc/oldnews978
-rwxr-xr-xdoc/oracle33
-rw-r--r--doc/other2
-rw-r--r--doc/performance154
-rw-r--r--doc/postgresql2
-rw-r--r--doc/ppc6
-rw-r--r--doc/resources21
-rwxr-xr-xdoc/sqlclient26
-rwxr-xr-xdoc/sqlite2
-rwxr-xr-xdoc/sybase2
-rwxr-xr-xdoc/tdsclient2
-rw-r--r--doc/testing95
-rw-r--r--doc/web/commands4
-rw-r--r--doc/web/deploy/cm/cormissing.js3
-rw-r--r--doc/web/makefile2
-rw-r--r--doc/web/masterinfos/Makefile60
-rw-r--r--doc/web/team.xml36
-rw-r--r--doc/web/team/pedroas.pngbin0 -> 4539 bytes
-rw-r--r--doc/web/template.html.in12
-rwxr-xr-xdoc/xml-classes310
-rw-r--r--docs/assembly-bundle95
-rw-r--r--docs/embedded-api4
-rw-r--r--docs/exceptions5
-rw-r--r--docs/internal-calls81
-rw-r--r--docs/ir-desc30
-rw-r--r--docs/mini-porting.txt705
-rwxr-xr-xman/mcs.140
-rw-r--r--man/mono.16
-rw-r--r--man/wsdl.15
-rw-r--r--mcs/ChangeLog4
-rw-r--r--mcs/INSTALL.txt22
-rwxr-xr-xmcs/btests/CharacterLiterals.vb17
-rwxr-xr-xmcs/btests/CharacterLiterals1.vb11
-rwxr-xr-xmcs/btests/CharacterLiteralsC2.vb6
-rwxr-xr-xmcs/btests/CharacterLiteralsC3.vb5
-rwxr-xr-xmcs/btests/DateLiterals.vb48
-rwxr-xr-xmcs/btests/DateLiteralsC1.vb10
-rwxr-xr-xmcs/btests/DateLiteralsC10.vb12
-rwxr-xr-xmcs/btests/DateLiteralsC11.vb10
-rwxr-xr-xmcs/btests/DateLiteralsC12.vb14
-rwxr-xr-xmcs/btests/DateLiteralsC2.vb12
-rwxr-xr-xmcs/btests/DateLiteralsC3.vb10
-rwxr-xr-xmcs/btests/DateLiteralsC4.vb10
-rwxr-xr-xmcs/btests/DateLiteralsC5.vb10
-rwxr-xr-xmcs/btests/DateLiteralsC6.vb10
-rwxr-xr-xmcs/btests/DateLiteralsC7.vb10
-rwxr-xr-xmcs/btests/DateLiteralsC8.vb10
-rwxr-xr-xmcs/btests/DateLiteralsC9.vb10
-rwxr-xr-xmcs/btests/FloatingPointLiteralsTest.vb3
-rwxr-xr-xmcs/btests/Inheritance1.vb16
-rwxr-xr-xmcs/btests/InheritanceA.vb45
-rwxr-xr-xmcs/btests/InheritanceB.vb13
-rwxr-xr-xmcs/btests/InheritanceC.vb15
-rwxr-xr-xmcs/btests/InheritanceC1.vb12
-rwxr-xr-xmcs/btests/InheritanceC2.vb12
-rwxr-xr-xmcs/btests/InheritanceC3.vb15
-rwxr-xr-xmcs/btests/InheritanceD.vb27
-rwxr-xr-xmcs/btests/InheritanceE.vb20
-rwxr-xr-xmcs/btests/InterfaceA.vb20
-rwxr-xr-xmcs/btests/InterfaceB.vb29
-rwxr-xr-xmcs/btests/InterfaceC.vb40
-rwxr-xr-xmcs/btests/InterfaceC1.vb16
-rwxr-xr-xmcs/btests/InterfaceC2.vb19
-rwxr-xr-xmcs/btests/InterfaceD.vb18
-rwxr-xr-xmcs/btests/InterfaceE.vb30
-rwxr-xr-xmcs/btests/LiteralNothing.vb6
-rwxr-xr-xmcs/btests/MustInherit.vb34
-rwxr-xr-xmcs/btests/MustInheritC1.vb13
-rwxr-xr-xmcs/btests/MustInheritC2.vb12
-rwxr-xr-xmcs/btests/MustInheritC3.vb10
-rwxr-xr-xmcs/btests/NSA.vb5
-rwxr-xr-xmcs/btests/NSB.vb15
-rwxr-xr-xmcs/btests/NameSpaceA.vb11
-rwxr-xr-xmcs/btests/NameSpaceB.vb9
-rwxr-xr-xmcs/btests/NotInheritable.vb8
-rwxr-xr-xmcs/btests/NotInheritableC1.vb12
-rwxr-xr-xmcs/btests/NotInheritableC2.vb7
-rwxr-xr-xmcs/btests/Overloading.vb23
-rwxr-xr-xmcs/btests/OverloadingC1.vb10
-rwxr-xr-xmcs/btests/OverloadingC2.vb10
-rwxr-xr-xmcs/btests/OverloadingC3.vb10
-rwxr-xr-xmcs/btests/OverrideA.vb34
-rwxr-xr-xmcs/btests/OverrideB.vb29
-rwxr-xr-xmcs/btests/OverrideC1.vb18
-rwxr-xr-xmcs/btests/Scope.vb24
-rwxr-xr-xmcs/btests/ScopeC1.vb26
-rwxr-xr-xmcs/btests/ShadowsA.vb34
-rwxr-xr-xmcs/btests/ShadowsB.vb34
-rwxr-xr-xmcs/btests/ShadowsC.vb18
-rwxr-xr-xmcs/btests/ShadowsC1.vb28
-rwxr-xr-xmcs/btests/ShadowsC2.vb19
-rwxr-xr-xmcs/btests/ShadowsC3.vb15
-rwxr-xr-xmcs/btests/ShadowsD.vb22
-rwxr-xr-xmcs/btests/StringLiterals.vb23
-rwxr-xr-xmcs/btests/StringLiteralsC1.vb5
-rw-r--r--mcs/btests/Test.Sources115
-rw-r--r--mcs/class/ChangeLog5
-rwxr-xr-xmcs/class/Commons.Xml.Relaxng/.cvsignore2
-rw-r--r--mcs/class/I18N/Common/Handlers.cs113
-rw-r--r--mcs/class/I18N/Common/Manager.cs12
-rw-r--r--mcs/class/Makefile7
-rw-r--r--mcs/class/Microsoft.JScript/ChangeLog4
-rw-r--r--mcs/class/Microsoft.JScript/Microsoft.JScript.Vsa/ChangeLog7
-rwxr-xr-xmcs/class/Microsoft.JScript/Microsoft.JScript.Vsa/VsaEngine.cs61
-rw-r--r--mcs/class/Microsoft.JScript/Microsoft.JScript.dll.sources3
-rw-r--r--mcs/class/Microsoft.JScript/Microsoft.JScript/BinaryOp.cs3
-rw-r--r--mcs/class/Microsoft.JScript/Microsoft.JScript/BitwiseBinary.cs5
-rw-r--r--mcs/class/Microsoft.JScript/Microsoft.JScript/Block.cs42
-rw-r--r--mcs/class/Microsoft.JScript/Microsoft.JScript/ChangeLog99
-rw-r--r--mcs/class/Microsoft.JScript/Microsoft.JScript/Closure.cs3
-rw-r--r--mcs/class/Microsoft.JScript/Microsoft.JScript/CodeGenerator.cs17
-rw-r--r--mcs/class/Microsoft.JScript/Microsoft.JScript/Equality.cs14
-rw-r--r--mcs/class/Microsoft.JScript/Microsoft.JScript/FormalParameterList.cs39
-rw-r--r--mcs/class/Microsoft.JScript/Microsoft.JScript/FunctionDeclaration.cs125
-rw-r--r--mcs/class/Microsoft.JScript/Microsoft.JScript/GlobalScope.cs8
-rw-r--r--mcs/class/Microsoft.JScript/Microsoft.JScript/IdentificationTable.cs12
-rw-r--r--mcs/class/Microsoft.JScript/Microsoft.JScript/InstanceOf.cs5
-rw-r--r--mcs/class/Microsoft.JScript/Microsoft.JScript/JSLocalField.cs3
-rw-r--r--mcs/class/Microsoft.JScript/Microsoft.JScript/JSMethodInfo.cs8
-rw-r--r--mcs/class/Microsoft.JScript/Microsoft.JScript/JScriptParser.cs39
-rw-r--r--mcs/class/Microsoft.JScript/Microsoft.JScript/Literal.cs23
-rw-r--r--mcs/class/Microsoft.JScript/Microsoft.JScript/NumericBinary.cs13
-rw-r--r--mcs/class/Microsoft.JScript/Microsoft.JScript/NumericUnary.cs5
-rw-r--r--mcs/class/Microsoft.JScript/Microsoft.JScript/Plus.cs10
-rw-r--r--mcs/class/Microsoft.JScript/Microsoft.JScript/PostOrPrefixOperator.cs5
-rw-r--r--mcs/class/Microsoft.JScript/Microsoft.JScript/ReferenceAttribute.cs12
-rw-r--r--mcs/class/Microsoft.JScript/Microsoft.JScript/Relational.cs86
-rw-r--r--mcs/class/Microsoft.JScript/Microsoft.JScript/ScriptBlock.cs1
-rw-r--r--mcs/class/Microsoft.JScript/Microsoft.JScript/StrictEquality.cs6
-rw-r--r--mcs/class/Microsoft.JScript/Microsoft.JScript/SymbolTable.cs17
-rw-r--r--mcs/class/Microsoft.JScript/Microsoft.JScript/TODO5
-rw-r--r--mcs/class/Microsoft.JScript/Microsoft.JScript/TypeOf.cs6
-rw-r--r--mcs/class/Microsoft.JScript/Microsoft.JScript/UnaryOp.cs4
-rw-r--r--mcs/class/Microsoft.JScript/Microsoft.JScript/VariableDeclaration.cs11
-rw-r--r--mcs/class/Microsoft.JScript/Microsoft.JScript/VariableStatement.cs17
-rwxr-xr-xmcs/class/Microsoft.JScript/Microsoft.JScript/VsaCodeItem.cs5
-rwxr-xr-xmcs/class/Microsoft.JScript/Microsoft.JScript/VsaGlobalItem.cs13
-rwxr-xr-xmcs/class/Microsoft.JScript/Microsoft.JScript/VsaItem.cs16
-rwxr-xr-xmcs/class/Microsoft.JScript/Microsoft.JScript/VsaReferenceItem.cs11
-rw-r--r--mcs/class/Microsoft.JScript/Microsoft.JScript/VsaScriptScope.cs86
-rw-r--r--mcs/class/Microsoft.JScript/Microsoft.JScript/driver.cs5
-rwxr-xr-xmcs/class/Microsoft.JScript/Microsoft.JScript/expression.cs254
-rw-r--r--mcs/class/Microsoft.JScript/Microsoft.JScript/jscript-lexer-parser.g38
-rwxr-xr-xmcs/class/Microsoft.JScript/Microsoft.Vsa/BaseVsaEngine.cs3
-rwxr-xr-xmcs/class/Microsoft.JScript/Microsoft.Vsa/ChangeLog4
-rw-r--r--mcs/class/Microsoft.VisualBasic/.cvsignore2
-rw-r--r--mcs/class/Microsoft.VisualBasic/Changelog11
-rw-r--r--mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/.cvsignore3
-rw-r--r--mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/ChangeLog22
-rw-r--r--mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/FileSystem.cs45
-rw-r--r--mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Information.cs34
-rw-r--r--mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/ChangeLog3
-rw-r--r--mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/Utils.cs40
-rw-r--r--mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic_test.dll.sources10
-rw-r--r--mcs/class/Microsoft.VisualBasic/Test/Microsoft.VisualBasic/ChangeLog (renamed from mcs/class/Microsoft.VisualBasic/Test/ChangeLog)100
-rwxr-xr-x[-rw-r--r--]mcs/class/Microsoft.VisualBasic/Test/Microsoft.VisualBasic/CollectionTest.cs (renamed from mcs/class/Microsoft.VisualBasic/Test/CollectionTest.cs)1086
-rwxr-xr-x[-rw-r--r--]mcs/class/Microsoft.VisualBasic/Test/Microsoft.VisualBasic/ConversionTest.cs (renamed from mcs/class/Microsoft.VisualBasic/Test/ConversionTest.cs)0
-rwxr-xr-x[-rw-r--r--]mcs/class/Microsoft.VisualBasic/Test/Microsoft.VisualBasic/DateAndTimeTest.cs (renamed from mcs/class/Microsoft.VisualBasic/Test/DateAndTimeTest.cs)845
-rwxr-xr-xmcs/class/Microsoft.VisualBasic/Test/Microsoft.VisualBasic/FileSystemTest.cs40
-rw-r--r--mcs/class/Microsoft.VisualBasic/Test/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/ChangeLog8
-rwxr-xr-xmcs/class/Microsoft.VisualBasic/Test/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/UtilsTest.cs93
-rw-r--r--mcs/class/Microsoft.VisualBasic/Test/Microsoft.VisualBasic/StringsTest.cs (renamed from mcs/class/Microsoft.VisualBasic/Test/StringsTest.cs)3470
-rw-r--r--mcs/class/Microsoft.VisualBasic/Test/microsoftvisualbasic_test.args3
-rw-r--r--mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Messaging/ChangeLog4
-rw-r--r--mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Messaging/SoapTcpTransport.cs2
-rw-r--r--mcs/class/Microsoft.Web.Services/Test/standalone/WSE2/Microsoft.Web.Services.Messaging/.cvsignore1
-rw-r--r--mcs/class/Microsoft.Web.Services/Test/standalone/WSE2/Microsoft.Web.Services.Messaging/README5
-rw-r--r--mcs/class/Microsoft.Web.Services/Test/standalone/WSE2/Microsoft.Web.Services.Messaging/simple_soap.tcp_testmessage.cs46
-rw-r--r--mcs/class/Mono.CSharp.Debugger/ChangeLog44
-rw-r--r--mcs/class/Mono.CSharp.Debugger/MonoSymbolFile.cs122
-rw-r--r--mcs/class/Mono.CSharp.Debugger/MonoSymbolTable.cs303
-rwxr-xr-xmcs/class/Mono.CSharp.Debugger/MonoSymbolWriter.cs11
-rwxr-xr-xmcs/class/Mono.Directory.LDAP/.cvsignore6
-rw-r--r--mcs/class/Mono.GetOptions/.cvsignore5
-rw-r--r--mcs/class/Mono.PEToolkit/build/.cvsignore (renamed from mcs/class/Mono.PEToolkit/.cvsignore)1
-rw-r--r--mcs/class/Mono.Posix/ChangeLog5
-rw-r--r--mcs/class/Mono.Posix/Makefile16
-rw-r--r--mcs/class/Mono.Posix/Mono.Posix/ChangeLog13
-rw-r--r--mcs/class/Mono.Posix/Mono.Posix/Syscall.cs30
-rw-r--r--mcs/class/Mono.Posix/Mono.Posix/make-map.cs115
-rwxr-xr-xmcs/class/Mono.Security.Win32/.cvsignore6
-rwxr-xr-xmcs/class/Mono.Security/.cvsignore6
-rw-r--r--mcs/class/Mono.Security/Mono.Security.Cryptography/ChangeLog5
-rw-r--r--mcs/class/Mono.Security/Mono.Security.Cryptography/CryptoConvert.cs2
-rw-r--r--mcs/class/Npgsql/ChangeLog4
-rwxr-xr-xmcs/class/Npgsql/Makefile11
-rwxr-xr-xmcs/class/Npgsql/Npgsql/NpgsqlClosedState.cs8
-rwxr-xr-xmcs/class/Npgsql/Npgsql/NpgsqlCommand.cs11
-rw-r--r--mcs/class/Npgsql/Npgsql/NpgsqlCommandBuilder.cs4
-rwxr-xr-xmcs/class/Npgsql/Npgsql/NpgsqlConnection.cs234
-rwxr-xr-xmcs/class/Npgsql/Npgsql/NpgsqlConnector.cs119
-rwxr-xr-xmcs/class/Npgsql/Npgsql/NpgsqlConnectorPool.cs98
-rwxr-xr-xmcs/class/Npgsql/Npgsql/NpgsqlDataReader.cs6
-rwxr-xr-xmcs/class/Npgsql/Npgsql/NpgsqlEventLog.cs2
-rwxr-xr-xmcs/class/Npgsql/Npgsql/NpgsqlState.cs53
-rwxr-xr-xmcs/class/Npgsql/NpgsqlTypes/NpgsqlTypesHelper.cs22
-rw-r--r--mcs/class/Npgsql/Npgsql_test.dll.sources2
-rwxr-xr-xmcs/class/Npgsql/Test/CommandTests.cs103
-rwxr-xr-xmcs/class/Npgsql/Test/ConnectionTests.cs43
-rwxr-xr-xmcs/class/Npgsql/Test/DataAdapterTests.cs59
-rwxr-xr-xmcs/class/Npgsql/Test/DataReaderTests.cs20
-rw-r--r--mcs/class/System.Configuration.Install/.cvsignore2
-rw-r--r--mcs/class/System.Data.ObjectSpaces/System.Data.ObjectSpaces/ChangeLog6
-rwxr-xr-xmcs/class/System.Data.ObjectSpaces/System.Data.ObjectSpaces/DynamicAssembly.cs19
-rwxr-xr-xmcs/class/System.Data.ObjectSpaces/System.Data.ObjectSpaces/ObjectList.cs118
-rwxr-xr-xmcs/class/System.Data.ObjectSpaces/System.Data.ObjectSpaces/ObjectReader.cs24
-rwxr-xr-xmcs/class/System.Data.ObjectSpaces/System.Data.ObjectSpaces/ObjectSet.cs37
-rwxr-xr-xmcs/class/System.Data.ObjectSpaces/System.Data.ObjectSpaces/ObjectSources.cs31
-rwxr-xr-xmcs/class/System.Data.ObjectSpaces/System.Data.ObjectSpaces/PersistenceError.cs32
-rwxr-xr-xmcs/class/System.Data.ObjectSpaces/System.Data.ObjectSpaces/PersistenceOptions.cs28
-rwxr-xr-xmcs/class/System.Data.OracleClient/ChangeLog50
-rw-r--r--mcs/class/System.Data.OracleClient/System.Data.OracleClient.Oci/OciCalls.cs760
-rw-r--r--mcs/class/System.Data.OracleClient/System.Data.OracleClient.Oci/OciDefineHandle.cs41
-rw-r--r--mcs/class/System.Data.OracleClient/System.Data.OracleClient.Oci/OciDescriptorHandle.cs10
-rw-r--r--mcs/class/System.Data.OracleClient/System.Data.OracleClient.Oci/OciEnvironmentHandle.cs14
-rw-r--r--mcs/class/System.Data.OracleClient/System.Data.OracleClient.Oci/OciErrorHandle.cs2
-rw-r--r--mcs/class/System.Data.OracleClient/System.Data.OracleClient.Oci/OciHandle.cs122
-rw-r--r--mcs/class/System.Data.OracleClient/System.Data.OracleClient.Oci/OciLobLocator.cs91
-rw-r--r--mcs/class/System.Data.OracleClient/System.Data.OracleClient.Oci/OciServerHandle.cs16
-rw-r--r--mcs/class/System.Data.OracleClient/System.Data.OracleClient.Oci/OciServiceHandle.cs4
-rw-r--r--mcs/class/System.Data.OracleClient/System.Data.OracleClient.Oci/OciSessionHandle.cs22
-rw-r--r--mcs/class/System.Data.OracleClient/System.Data.OracleClient.Oci/OciStatementHandle.cs99
-rw-r--r--mcs/class/System.Data.OracleClient/System.Data.OracleClient.Oci/OciTransactionHandle.cs71
-rwxr-xr-xmcs/class/System.Data.OracleClient/System.Data.OracleClient.dll.sources1
-rwxr-xr-xmcs/class/System.Data.OracleClient/System.Data.OracleClient/OciGlue.cs28
-rwxr-xr-xmcs/class/System.Data.OracleClient/System.Data.OracleClient/OracleCommand.cs79
-rw-r--r--mcs/class/System.Data.OracleClient/System.Data.OracleClient/OracleDataReader.cs4
-rw-r--r--mcs/class/System.Data.OracleClient/System.Data.OracleClient/OracleParameter.cs19
-rw-r--r--mcs/class/System.Data.OracleClient/System.Data.OracleClient/OracleTransaction.cs5
-rw-r--r--mcs/class/System.Data/.cvsignore2
-rw-r--r--mcs/class/System.Data/ChangeLog8
-rwxr-xr-xmcs/class/System.Data/System.Data.Common/ChangeLog9
-rw-r--r--mcs/class/System.Data/System.Data.Common/DbDataAdapter.cs17
-rw-r--r--mcs/class/System.Data/System.Data.Common/DbDataPermission.cs9
-rw-r--r--mcs/class/System.Data/System.Data.OleDb/ChangeLog4
-rw-r--r--mcs/class/System.Data/System.Data.OleDb/OleDbPermission.cs4
-rwxr-xr-xmcs/class/System.Data/System.Data.Sql/ChangeLog4
-rw-r--r--mcs/class/System.Data/System.Data.Sql/ISqlParameterCollection.cs1
-rwxr-xr-xmcs/class/System.Data/System.Data.SqlClient/ChangeLog5
-rw-r--r--mcs/class/System.Data/System.Data.SqlClient/SqlClientPermission.cs2
-rwxr-xr-xmcs/class/System.Data/System.Data.dll.sources1
-rw-r--r--mcs/class/System.Data/System.Data/ChangeLog58
-rw-r--r--mcs/class/System.Data/System.Data/DataColumn.cs5
-rw-r--r--mcs/class/System.Data/System.Data/DataRelationCollection.cs7
-rw-r--r--mcs/class/System.Data/System.Data/DataRow.cs11
-rw-r--r--mcs/class/System.Data/System.Data/DataSet.cs676
-rw-r--r--mcs/class/System.Data/System.Data/DataView.cs3
-rwxr-xr-xmcs/class/System.Data/System.Data/TypedDataSetGenerator.cs69
-rwxr-xr-xmcs/class/System.Data/System.Data/XmlConstants.cs6
-rw-r--r--mcs/class/System.Data/System.Data/XmlDataLoader.cs218
-rw-r--r--mcs/class/System.Data/System.Data/XmlDiffLoader.cs189
-rw-r--r--mcs/class/System.Data/System.Data/XmlSchemaMapper.cs255
-rw-r--r--mcs/class/System.Data/System.Data_test.dll.sources1
-rw-r--r--mcs/class/System.Data/Test/System.Data/ChangeLog4
-rwxr-xr-xmcs/class/System.Data/Test/System.Data/TypedDataSetGeneratorTest.cs59
-rw-r--r--mcs/class/System.DirectoryServices/Assembly/AssemblyInfo.cs44
-rw-r--r--mcs/class/System.DirectoryServices/Assembly/ChangeLog6
-rw-r--r--mcs/class/System.DirectoryServices/Assembly/Consts.cs50
-rw-r--r--mcs/class/System.DirectoryServices/Assembly/Locale.cs24
-rw-r--r--mcs/class/System.DirectoryServices/ChangeLog4
-rw-r--r--mcs/class/System.DirectoryServices/System.DirectoryServices.Design/ChangeLog4
-rw-r--r--mcs/class/System.DirectoryServices/System.DirectoryServices.Design/DirectoryEntryConverter.cs24
-rwxr-xr-xmcs/class/System.DirectoryServices/System.DirectoryServices.dll.sources24
-rw-r--r--mcs/class/System.DirectoryServices/System.DirectoryServices/AssemblyInfo.cs82
-rw-r--r--mcs/class/System.DirectoryServices/System.DirectoryServices/ChangeLog9
-rw-r--r--mcs/class/System.DirectoryServices/System.DirectoryServices/DSDescriptionAttribute.cs29
-rw-r--r--mcs/class/System.DirectoryServices/System.DirectoryServices/DirectoryEntry.cs84
-rw-r--r--mcs/class/System.DirectoryServices/System.DirectoryServices/DirectorySearcher.cs107
-rw-r--r--mcs/class/System.DirectoryServices/System.DirectoryServices/DirectoryServicesPermissionAccess.cs22
-rw-r--r--mcs/class/System.DirectoryServices/System.DirectoryServices/SortOption.cs46
-rw-r--r--mcs/class/System.Drawing/ChangeLog16
-rw-r--r--mcs/class/System.Drawing/Makefile4
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Drawing2D/ChangeLog34
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Drawing2D/CombineMode.cs1
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Drawing2D/CompostingMode.cs1
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Drawing2D/CompostingQuality.cs1
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Drawing2D/CoordinateSpace.cs1
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Drawing2D/DashCap.cs1
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Drawing2D/DashStyle.cs1
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Drawing2D/FillMode.cs1
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Drawing2D/FlushIntention.cs1
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Drawing2D/GraphicsContainer.cs20
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Drawing2D/GraphicsPath.cs390
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Drawing2D/GraphicsPathIterator.cs2
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Drawing2D/GraphicsState.cs3
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Drawing2D/HatchStyle.cs1
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Drawing2D/InterpolationMode.cs1
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Drawing2D/LineCap.cs1
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Drawing2D/LineJoin.cs1
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Drawing2D/LinearGradientMode.cs1
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Drawing2D/Matrix.cs17
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Drawing2D/MatrixOrder.cs1
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Drawing2D/PathPointType.cs1
-rwxr-xr-xmcs/class/System.Drawing/System.Drawing.Drawing2D/PenAlignment.cs1
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Drawing2D/PenType.cs1
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Drawing2D/PixelOffsetMode.cs1
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Drawing2D/QualityMode.cs1
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Drawing2D/SmoothingMode.cs1
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Drawing2D/WarpMode.cs1
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Drawing2D/WrapMode.cs1
-rwxr-xr-xmcs/class/System.Drawing/System.Drawing.Imaging/BitmapData.cs29
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Imaging/BmpCodec.cs81
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Imaging/ChangeLog16
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Imaging/ColorAdjustType.cs1
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Imaging/ColorChannelFlag.cs1
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Imaging/ColorMapType.cs1
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Imaging/ColorMatrixFlag.cs1
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Imaging/ColorMode.cs1
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Imaging/EmfPlusRecordType.cs1
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Imaging/EmfType.cs1
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Imaging/Encoder.cs56
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Imaging/EncoderParameterValueType.cs1
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Imaging/EncoderValue.cs1
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Imaging/ImageAttributes.cs83
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Imaging/ImageCodecFlags.cs1
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Imaging/ImageFlags.cs1
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Imaging/ImageLockMode.cs1
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Imaging/Metafile.cs3
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Imaging/MetafileFrameUnit.cs1
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Imaging/MetafileType.cs1
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Imaging/PaletteFlags.cs1
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Imaging/PixelFormat.cs1
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Text/FontCollection.cs129
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Text/GenericFontFamilies.cs1
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Text/HotkeyPrefix.cs1
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Text/InstalledFontCollection.cs18
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Text/PrivateFontCollection.cs41
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Text/TextRenderingHint.cs1
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Text/changelog18
-rwxr-xr-xmcs/class/System.Drawing/System.Drawing.dll.sources2
-rwxr-xr-xmcs/class/System.Drawing/System.Drawing/Bitmap.cs243
-rwxr-xr-xmcs/class/System.Drawing/System.Drawing/Brush.cs10
-rw-r--r--mcs/class/System.Drawing/System.Drawing/ChangeLog145
-rw-r--r--mcs/class/System.Drawing/System.Drawing/Color.cs30
-rw-r--r--mcs/class/System.Drawing/System.Drawing/ContentAlignment.cs1
-rw-r--r--mcs/class/System.Drawing/System.Drawing/Font.cs27
-rw-r--r--mcs/class/System.Drawing/System.Drawing/FontFamily.cs257
-rw-r--r--mcs/class/System.Drawing/System.Drawing/FontStyle.cs1
-rwxr-xr-xmcs/class/System.Drawing/System.Drawing/Graphics.cs627
-rw-r--r--mcs/class/System.Drawing/System.Drawing/GraphicsUnit.cs1
-rw-r--r--mcs/class/System.Drawing/System.Drawing/Image.cs15
-rw-r--r--mcs/class/System.Drawing/System.Drawing/KnownColor.cs1
-rwxr-xr-xmcs/class/System.Drawing/System.Drawing/Pen.cs130
-rw-r--r--mcs/class/System.Drawing/System.Drawing/Point.cs2
-rw-r--r--mcs/class/System.Drawing/System.Drawing/PointConverter.cs3
-rw-r--r--mcs/class/System.Drawing/System.Drawing/PointF.cs3
-rw-r--r--mcs/class/System.Drawing/System.Drawing/RectangleConverter.cs3
-rw-r--r--mcs/class/System.Drawing/System.Drawing/RectangleF.cs1
-rw-r--r--mcs/class/System.Drawing/System.Drawing/RotateFlipType.cs1
-rw-r--r--mcs/class/System.Drawing/System.Drawing/Size.cs6
-rw-r--r--mcs/class/System.Drawing/System.Drawing/SizeF.cs20
-rw-r--r--mcs/class/System.Drawing/System.Drawing/SolidBrush.cs18
-rw-r--r--mcs/class/System.Drawing/System.Drawing/StringAligment.cs1
-rw-r--r--mcs/class/System.Drawing/System.Drawing/StringDigitSubstitute.cs1
-rw-r--r--mcs/class/System.Drawing/System.Drawing/StringFormat.cs2
-rw-r--r--mcs/class/System.Drawing/System.Drawing/StringFormatFlags.cs1
-rw-r--r--mcs/class/System.Drawing/System.Drawing/StringTrimming.cs1
-rw-r--r--mcs/class/System.Drawing/System.Drawing/StringUnit.cs1
-rw-r--r--mcs/class/System.Drawing/System.Drawing/SystemBrushes.cs207
-rw-r--r--mcs/class/System.Drawing/System.Drawing/SystemPens.cs108
-rw-r--r--mcs/class/System.Drawing/System.Drawing/TextureBrush.cs255
-rw-r--r--mcs/class/System.Drawing/System.Drawing/ToolboxBitmapAttribute.cs1
-rw-r--r--mcs/class/System.Drawing/System.Drawing/gdipFunctions.cs503
-rw-r--r--mcs/class/System.Drawing/System.Drawing/gdipStructs.cs51
-rw-r--r--mcs/class/System.Drawing/System.Drawing_test.dll.sources4
-rw-r--r--mcs/class/System.Drawing/Test/System.Drawing/BmpPaint.cs14
-rw-r--r--mcs/class/System.Drawing/Test/System.Drawing/ChangeLog11
-rw-r--r--mcs/class/System.Drawing/Test/System.Drawing/README10
-rw-r--r--mcs/class/System.Drawing/Test/System.Drawing/TestBitmap.cs143
-rw-r--r--mcs/class/System.Drawing/Test/System.Drawing/TestPoint.cs289
-rw-r--r--mcs/class/System.Drawing/Test/System.Drawing/TestPointF.cs110
-rw-r--r--mcs/class/System.Drawing/Test/System.Drawing/TestSize.cs164
-rw-r--r--mcs/class/System.Drawing/Test/System.Drawing/TestSizeF.cs145
-rw-r--r--mcs/class/System.Drawing/Test/System.Drawing/bitmaps/almogaver24bits.bmpbin0 -> 95214 bytes
-rw-r--r--mcs/class/System.Drawing/Test/System.Drawing/bitmaps/maketransparent.bmpbin0 -> 24534 bytes
-rw-r--r--mcs/class/System.Drawing/Test/System.Drawing/graphicsUi.cs130
-rwxr-xr-xmcs/class/System.Drawing/Test/System.Drawing/tests-ms.sh19
-rwxr-xr-xmcs/class/System.Drawing/Test/System.Drawing/tests.sh17
-rw-r--r--mcs/class/System.Drawing/gdiplus/ChangeLog279
-rw-r--r--mcs/class/System.Drawing/gdiplus/Makefile72
-rw-r--r--mcs/class/System.Drawing/gdiplus/bitmap.c356
-rw-r--r--mcs/class/System.Drawing/gdiplus/brush.c70
-rwxr-xr-xmcs/class/System.Drawing/gdiplus/empty.c1
-rw-r--r--mcs/class/System.Drawing/gdiplus/gdip.h432
-rw-r--r--mcs/class/System.Drawing/gdiplus/gdip_win32.c180
-rw-r--r--mcs/class/System.Drawing/gdiplus/gdip_win32.h112
-rw-r--r--mcs/class/System.Drawing/gdiplus/general.c149
-rw-r--r--mcs/class/System.Drawing/gdiplus/graphics-path.c762
-rw-r--r--mcs/class/System.Drawing/gdiplus/graphics-path.h82
-rw-r--r--mcs/class/System.Drawing/gdiplus/graphics.c787
-rw-r--r--mcs/class/System.Drawing/gdiplus/image.c136
-rw-r--r--mcs/class/System.Drawing/gdiplus/matrix.c327
-rw-r--r--mcs/class/System.Drawing/gdiplus/pen.c488
-rw-r--r--mcs/class/System.Drawing/gdiplus/solidbrush.c82
-rw-r--r--mcs/class/System.EnterpriseServices/Assembly/AssemblyInfo.cs44
-rw-r--r--mcs/class/System.EnterpriseServices/Assembly/ChangeLog4
-rw-r--r--mcs/class/System.EnterpriseServices/ChangeLog3
-rw-r--r--mcs/class/System.EnterpriseServices/System.EnterpriseServices.dll.sources1
-rw-r--r--mcs/class/System.Runtime.Remoting/.cvsignore2
-rw-r--r--mcs/class/System.Runtime.Serialization.Formatters.Soap/.cvsignore2
-rwxr-xr-xmcs/class/System.Security/.cvsignore6
-rwxr-xr-xmcs/class/System.Security/Assembly/AssemblyInfo.cs38
-rwxr-xr-xmcs/class/System.Security/Assembly/ChangeLog5
-rwxr-xr-xmcs/class/System.Security/Assembly/Locale.cs24
-rw-r--r--mcs/class/System.Security/ChangeLog4
-rw-r--r--mcs/class/System.Security/System.Security.Cryptography.Xml/ChangeLog7
-rw-r--r--mcs/class/System.Security/System.Security.Cryptography.Xml/SignedXml.cs2
-rw-r--r--mcs/class/System.Security/System.Security.Cryptography.Xml/Transform.cs2
-rw-r--r--mcs/class/System.Security/System.Security.dll.sources2
-rwxr-xr-xmcs/class/System.Web.Services/.cvsignore1
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Configuration/ChangeLog4
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Configuration/XmlFormatExtensionPrefixAttribute.cs2
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Description/ChangeLog56
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Description/ExtensionManager.cs30
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Description/HttpSimpleProtocolImporter.cs6
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Description/HttpSimpleProtocolReflector.cs4
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Description/ProtocolImporter.cs29
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Description/ProtocolReflector.cs68
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Description/ServiceDescription.cs36
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Description/ServiceDescriptionSerializerBase.cs4
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Description/SoapAddressBinding.cs2
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Description/SoapBodyBinding.cs4
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Description/SoapFaultBinding.cs2
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Description/SoapHeaderBinding.cs11
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Description/SoapHeaderFaultBinding.cs4
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Description/SoapOperationBinding.cs2
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Description/SoapProtocolImporter.cs148
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Description/SoapProtocolReflector.cs21
-rwxr-xr-xmcs/class/System.Web.Services/System.Web.Services.Discovery/ChangeLog6
-rwxr-xr-xmcs/class/System.Web.Services/System.Web.Services.Discovery/ContractReference.cs48
-rwxr-xr-xmcs/class/System.Web.Services/System.Web.Services.Discovery/DiscoveryClientProtocol.cs28
-rwxr-xr-xmcs/class/System.Web.Services/System.Web.Services.Discovery/DiscoveryDocumentReference.cs3
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Protocols/ChangeLog50
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Protocols/HttpSimpleClientProtocol.cs1
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Protocols/HttpSimpleWebServiceHandler.cs1
-rwxr-xr-xmcs/class/System.Web.Services/System.Web.Services.Protocols/HttpSoapWebServiceHandler.cs2
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Protocols/HttpWebClientProtocol.cs17
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Protocols/Methods.cs43
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapDocumentMethodAttribute.cs2
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapHeaderDirection.cs5
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapHttpClientProtocol.cs3
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapMessage.cs11
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Protocols/TypeStubManager.cs48
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Protocols/ValueCollectionParameterReader.cs2
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Protocols/WebServiceHandler.cs11
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Protocols/XmlReturnReader.cs4
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services.Protocols/XmlReturnWriter.cs4
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services/ChangeLog4
-rw-r--r--mcs/class/System.Web.Services/System.Web.Services/WebService.cs5
-rw-r--r--mcs/class/System.Web.Services/Test/standalone/ChangeLog17
-rw-r--r--mcs/class/System.Web.Services/Test/standalone/Makefile2
-rw-r--r--mcs/class/System.Web.Services/Test/standalone/client/external/BankCodeEJBHomeTest.cs2
-rw-r--r--mcs/class/System.Web.Services/Test/standalone/client/external/GlobalWeatherTest.cs52
-rw-r--r--mcs/class/System.Web.Services/Test/standalone/client/external/TemperatureServiceTest.cs26
-rw-r--r--mcs/class/System.Web.Services/Test/standalone/client/external/syndicateTest.cs45
-rw-r--r--mcs/class/System.Web.Services/Test/standalone/client/localhost/ConvDocEncBarTest.cs2
-rw-r--r--mcs/class/System.Web.Services/Test/standalone/client/localhost/ConvDocEncWraTest.cs2
-rw-r--r--mcs/class/System.Web.Services/Test/standalone/client/localhost/ConvDocLitBarTest.cs2
-rw-r--r--mcs/class/System.Web.Services/Test/standalone/client/localhost/ConvDocLitWraTest.cs118
-rw-r--r--mcs/class/System.Web.Services/Test/standalone/client/localhost/ConvRpcTest.cs2
-rw-r--r--mcs/class/System.Web.Services/Test/standalone/client/localhost/TestBinding4Test.cs49
-rw-r--r--mcs/class/System.Web.Services/Test/standalone/server/ConvDocEncBar.asmx2
-rw-r--r--mcs/class/System.Web.Services/Test/standalone/server/ConvDocEncWra.asmx2
-rw-r--r--mcs/class/System.Web.Services/Test/standalone/server/ConvDocLitBar.asmx2
-rw-r--r--mcs/class/System.Web.Services/Test/standalone/server/ConvDocLitWra.asmx2
-rw-r--r--mcs/class/System.Web.Services/Test/standalone/server/ConvRpc.asmx2
-rw-r--r--mcs/class/System.Web.Services/Test/standalone/server/TestBinding1.asmx29
-rw-r--r--mcs/class/System.Web.Services/Test/standalone/server/TestBinding2.asmx29
-rw-r--r--mcs/class/System.Web.Services/Test/standalone/server/TestBinding3.asmx52
-rw-r--r--mcs/class/System.Web.Services/Test/standalone/server/TestBinding4.asmx53
-rw-r--r--mcs/class/System.Web.Services/Test/standalone/services.xml493
-rw-r--r--mcs/class/System.Web.Services/Test/standalone/wsdl.ignore10
-rw-r--r--mcs/class/System.Web.Services/Test/standalone/wstest.cs123
-rw-r--r--mcs/class/System.Web/ChangeLog20
-rw-r--r--mcs/class/System.Web/System.Web.Caching/Cache.cs18
-rw-r--r--mcs/class/System.Web/System.Web.Caching/CacheDependency.cs15
-rw-r--r--mcs/class/System.Web/System.Web.Caching/CachedRawResponse.cs23
-rw-r--r--mcs/class/System.Web/System.Web.Caching/CachedVaryBy.cs44
-rw-r--r--mcs/class/System.Web/System.Web.Caching/ChangeLog52
-rw-r--r--mcs/class/System.Web/System.Web.Caching/ExpiresBuckets.cs2
-rw-r--r--mcs/class/System.Web/System.Web.Caching/OutputCacheModule.cs58
-rw-r--r--mcs/class/System.Web/System.Web.Compilation/AspGenerator.cs36
-rw-r--r--mcs/class/System.Web/System.Web.Compilation/BaseCompiler.cs135
-rw-r--r--mcs/class/System.Web/System.Web.Compilation/ChangeLog57
-rw-r--r--mcs/class/System.Web/System.Web.Compilation/GlobalAsaxCompiler.cs76
-rw-r--r--mcs/class/System.Web/System.Web.Compilation/PageCompiler.cs10
-rw-r--r--mcs/class/System.Web/System.Web.Compilation/TagAttributes.cs3
-rw-r--r--mcs/class/System.Web/System.Web.Compilation/TemplateControlCompiler.cs122
-rw-r--r--mcs/class/System.Web/System.Web.Compilation/UserControlCompiler.cs26
-rwxr-xr-xmcs/class/System.Web/System.Web.Configuration/AuthConfig.cs20
-rwxr-xr-xmcs/class/System.Web/System.Web.Configuration/AuthenticationConfigHandler.cs23
-rw-r--r--mcs/class/System.Web/System.Web.Configuration/ChangeLog32
-rw-r--r--mcs/class/System.Web/System.Web.Configuration/GlobalizationConfiguration.cs4
-rw-r--r--mcs/class/System.Web/System.Web.Configuration/HandlerFactoryProxy.cs2
-rw-r--r--mcs/class/System.Web/System.Web.Configuration/HandlerItem.cs4
-rw-r--r--mcs/class/System.Web/System.Web.Configuration/PagesConfiguration.cs60
-rw-r--r--mcs/class/System.Web/System.Web.Configuration/PagesConfigurationHandler.cs105
-rw-r--r--mcs/class/System.Web/System.Web.Configuration/TraceConfig.cs54
-rw-r--r--mcs/class/System.Web/System.Web.Configuration/TraceConfigurationHandler.cs89
-rw-r--r--mcs/class/System.Web/System.Web.Configuration/WebConfigurationSettings.cs19
-rw-r--r--mcs/class/System.Web/System.Web.Handlers/ChangeLog8
-rw-r--r--mcs/class/System.Web/System.Web.Handlers/TraceHandler.cs107
-rw-r--r--mcs/class/System.Web/System.Web.Hosting/ChangeLog10
-rw-r--r--mcs/class/System.Web/System.Web.Hosting/IAppDomainFactory.cs15
-rw-r--r--mcs/class/System.Web/System.Web.Hosting/IISAPIRuntime.cs5
-rw-r--r--mcs/class/System.Web/System.Web.Hosting/SimpleWorkerRequest.cs4
-rw-r--r--mcs/class/System.Web/System.Web.Security/ChangeLog8
-rw-r--r--mcs/class/System.Web/System.Web.Security/FormsAuthentication.cs26
-rw-r--r--mcs/class/System.Web/System.Web.Security/PassportIdentity.cs86
-rw-r--r--mcs/class/System.Web/System.Web.SessionState/ChangeLog13
-rw-r--r--mcs/class/System.Web/System.Web.SessionState/HttpSessionState.cs6
-rw-r--r--mcs/class/System.Web/System.Web.SessionState/SessionDictionary.cs12
-rw-r--r--mcs/class/System.Web/System.Web.SessionState/SessionInProcHandler.cs4
-rw-r--r--mcs/class/System.Web/System.Web.SessionState/SessionStateModule.cs2
-rw-r--r--mcs/class/System.Web/System.Web.SessionState/StateServerItem.cs2
-rw-r--r--mcs/class/System.Web/System.Web.UI.HtmlControls/ChangeLog7
-rw-r--r--mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlForm.cs22
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.HtmlControls/HtmlSelect.cs2
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/BulletedList.cs3
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/Calendar.cs31
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog55
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/CheckBoxList.cs4
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DataGrid.cs11
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/FontInfo.cs12
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/RadioButtonList.cs1
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/RangeValidator.cs4
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/Style.cs12
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/Xml.cs406
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/XmlHierarchyData.cs6
-rw-r--r--mcs/class/System.Web/System.Web.UI/ApplicationFileParser.cs22
-rw-r--r--mcs/class/System.Web/System.Web.UI/BasePartialCachingControl.cs126
-rw-r--r--mcs/class/System.Web/System.Web.UI/ChangeLog106
-rw-r--r--mcs/class/System.Web/System.Web.UI/Control.cs6
-rw-r--r--mcs/class/System.Web/System.Web.UI/HtmlTextWriter.cs2
-rw-r--r--mcs/class/System.Web/System.Web.UI/ObjectTagBuilder.cs28
-rwxr-xr-xmcs/class/System.Web/System.Web.UI/Page.cs35
-rw-r--r--mcs/class/System.Web/System.Web.UI/PageParser.cs17
-rw-r--r--mcs/class/System.Web/System.Web.UI/SimpleWebHandlerParser.cs8
-rw-r--r--mcs/class/System.Web/System.Web.UI/StaticPartialCachingControl.cs27
-rwxr-xr-xmcs/class/System.Web/System.Web.UI/TemplateControl.cs24
-rw-r--r--mcs/class/System.Web/System.Web.UI/TemplateControlParser.cs6
-rwxr-xr-xmcs/class/System.Web/System.Web.UI/TemplateParser.cs107
-rw-r--r--mcs/class/System.Web/System.Web.UI/UserControl.cs4
-rw-r--r--mcs/class/System.Web/System.Web.UI/UserControlParser.cs23
-rw-r--r--mcs/class/System.Web/System.Web.Util/ChangeLog23
-rw-r--r--mcs/class/System.Web/System.Web.Util/FileAction.cs22
-rw-r--r--mcs/class/System.Web/System.Web.Util/FileChangeEventHandler.cs22
-rw-r--r--mcs/class/System.Web/System.Web.Util/NativeFileChangeEventHandler.cs22
-rw-r--r--mcs/class/System.Web/System.Web.Util/TransactedCallback.cs11
-rw-r--r--mcs/class/System.Web/System.Web.Util/Transactions.cs32
-rw-r--r--mcs/class/System.Web/System.Web.Util/UrlUtils.cs22
-rw-r--r--mcs/class/System.Web/System.Web.Util/WebEqualComparer.cs22
-rw-r--r--mcs/class/System.Web/System.Web.Util/WebHashCodeProvider.cs32
-rw-r--r--mcs/class/System.Web/System.Web.Util/WorkItem.cs23
-rw-r--r--mcs/class/System.Web/System.Web.Util/WorkItemCallback.cs11
-rwxr-xr-xmcs/class/System.Web/System.Web.dll.sources16
-rw-r--r--mcs/class/System.Web/System.Web/ChangeLog132
-rw-r--r--mcs/class/System.Web/System.Web/HttpApplicationFactory.cs15
-rw-r--r--mcs/class/System.Web/System.Web/HttpApplicationState.cs459
-rw-r--r--mcs/class/System.Web/System.Web/HttpCachePolicy.cs46
-rw-r--r--mcs/class/System.Web/System.Web/HttpCacheVaryByHeaders.cs13
-rw-r--r--mcs/class/System.Web/System.Web/HttpCacheVaryByParams.cs3
-rw-r--r--mcs/class/System.Web/System.Web/HttpContext.cs3
-rw-r--r--mcs/class/System.Web/System.Web/HttpException.cs14
-rw-r--r--mcs/class/System.Web/System.Web/HttpRequest.cs162
-rw-r--r--mcs/class/System.Web/System.Web/HttpRequestValidationException.cs19
-rw-r--r--mcs/class/System.Web/System.Web/HttpResponse.cs34
-rw-r--r--mcs/class/System.Web/System.Web/HttpResponseHeader.cs3
-rw-r--r--mcs/class/System.Web/System.Web/HttpRuntime.cs16
-rw-r--r--mcs/class/System.Web/System.Web/HttpServerUtility.cs11
-rw-r--r--mcs/class/System.Web/System.Web/TraceContext.cs300
-rw-r--r--mcs/class/System.Web/System.Web/TraceData.cs427
-rw-r--r--mcs/class/System.Web/System.Web/TraceManager.cs103
-rw-r--r--mcs/class/System.Web/makefile3
-rw-r--r--mcs/class/System.Windows.Forms/ChangeLog5
-rw-r--r--mcs/class/System.Windows.Forms/Gtk/Appearance.cs19
-rw-r--r--mcs/class/System.Windows.Forms/Gtk/Application.cs103
-rw-r--r--mcs/class/System.Windows.Forms/Gtk/ButtonBase.cs8
-rw-r--r--mcs/class/System.Windows.Forms/Gtk/ChangeLog32
-rw-r--r--mcs/class/System.Windows.Forms/Gtk/CheckBox.cs147
-rw-r--r--mcs/class/System.Windows.Forms/Gtk/CheckState.cs26
-rw-r--r--mcs/class/System.Windows.Forms/Gtk/ComboBox.cs527
-rw-r--r--mcs/class/System.Windows.Forms/Gtk/ComboBoxStyle.cs20
-rw-r--r--mcs/class/System.Windows.Forms/Gtk/CommonDialog.cs21
-rw-r--r--mcs/class/System.Windows.Forms/Gtk/ContextMenu.cs3
-rw-r--r--mcs/class/System.Windows.Forms/Gtk/Control.cs61
-rw-r--r--mcs/class/System.Windows.Forms/Gtk/Cursor.cs15
-rw-r--r--mcs/class/System.Windows.Forms/Gtk/Cursors.cs160
-rw-r--r--mcs/class/System.Windows.Forms/Gtk/DataGrid.cs10
-rw-r--r--mcs/class/System.Windows.Forms/Gtk/DrawMode.cs26
-rw-r--r--mcs/class/System.Windows.Forms/Gtk/FileDialog.cs42
-rw-r--r--mcs/class/System.Windows.Forms/Gtk/FolderBrowserDialog.cs93
-rw-r--r--mcs/class/System.Windows.Forms/Gtk/FontDialog.cs12
-rw-r--r--mcs/class/System.Windows.Forms/Gtk/Form.cs49
-rw-r--r--mcs/class/System.Windows.Forms/Gtk/GroupBox.cs84
-rw-r--r--mcs/class/System.Windows.Forms/Gtk/HScrollBar.cs24
-rw-r--r--mcs/class/System.Windows.Forms/Gtk/InputLanguage.cs37
-rw-r--r--mcs/class/System.Windows.Forms/Gtk/Label.cs161
-rw-r--r--mcs/class/System.Windows.Forms/Gtk/ListBox.cs8
-rw-r--r--mcs/class/System.Windows.Forms/Gtk/ListControl.cs279
-rw-r--r--mcs/class/System.Windows.Forms/Gtk/MainMenu.cs17
-rw-r--r--mcs/class/System.Windows.Forms/Gtk/Makefile295
-rw-r--r--mcs/class/System.Windows.Forms/Gtk/Menu.cs87
-rw-r--r--mcs/class/System.Windows.Forms/Gtk/MenuItem.cs20
-rw-r--r--mcs/class/System.Windows.Forms/Gtk/MessageBox.cs371
-rw-r--r--mcs/class/System.Windows.Forms/Gtk/MessageBoxButtons.cs18
-rw-r--r--mcs/class/System.Windows.Forms/Gtk/MessageBoxDefaultButton.cs20
-rw-r--r--mcs/class/System.Windows.Forms/Gtk/MessageBoxIcon.cs26
-rw-r--r--mcs/class/System.Windows.Forms/Gtk/MessageBoxOptions.cs21
-rw-r--r--mcs/class/System.Windows.Forms/Gtk/OpenFileDialog.cs21
-rw-r--r--mcs/class/System.Windows.Forms/Gtk/Panel.cs61
-rw-r--r--mcs/class/System.Windows.Forms/Gtk/ProgressBar.cs117
-rw-r--r--mcs/class/System.Windows.Forms/Gtk/RadioButton.cs116
-rw-r--r--mcs/class/System.Windows.Forms/Gtk/SWFGtkConv.cs26
-rw-r--r--mcs/class/System.Windows.Forms/Gtk/SaveFileDialog.cs24
-rw-r--r--mcs/class/System.Windows.Forms/Gtk/ScrollBar.cs148
-rw-r--r--mcs/class/System.Windows.Forms/Gtk/ScrollableControl.cs4
-rw-r--r--mcs/class/System.Windows.Forms/Gtk/Shortcut.cs343
-rw-r--r--mcs/class/System.Windows.Forms/Gtk/StatusBar.cs4
-rw-r--r--mcs/class/System.Windows.Forms/Gtk/TabAlignment.cs21
-rw-r--r--mcs/class/System.Windows.Forms/Gtk/TabAppearance.cs20
-rw-r--r--mcs/class/System.Windows.Forms/Gtk/TabControl.cs445
-rw-r--r--mcs/class/System.Windows.Forms/Gtk/TabDrawMode.cs17
-rw-r--r--mcs/class/System.Windows.Forms/Gtk/TabPage.cs111
-rw-r--r--mcs/class/System.Windows.Forms/Gtk/TabSizeMode.cs20
-rw-r--r--mcs/class/System.Windows.Forms/Gtk/TextBoxBase.cs4
-rw-r--r--mcs/class/System.Windows.Forms/Gtk/Timer.cs4
-rw-r--r--mcs/class/System.Windows.Forms/Gtk/VScrollBar.cs22
-rw-r--r--mcs/class/System.Windows.Forms/SWFTest/.cvsignore5
-rw-r--r--mcs/class/System.Windows.Forms/System.Resources/ResXResourceReader.cs5
-rw-r--r--mcs/class/System.XML/ChangeLog12
-rw-r--r--mcs/class/System.XML/Makefile8
-rw-r--r--mcs/class/System.XML/Mono.Xml.Schema/ChangeLog73
-rw-r--r--mcs/class/System.XML/Mono.Xml.Schema/XsdIdentityState.cs43
-rw-r--r--mcs/class/System.XML/Mono.Xml.Schema/XsdKeyTable.cs29
-rw-r--r--mcs/class/System.XML/Mono.Xml.Schema/XsdParticleValidationState.cs71
-rw-r--r--mcs/class/System.XML/Mono.Xml.Schema/XsdValidatingReader.cs185
-rw-r--r--mcs/class/System.XML/Mono.Xml.Schema/XsdWildcard.cs68
-rw-r--r--mcs/class/System.XML/Mono.Xml.XPath/ChangeLog15
-rw-r--r--mcs/class/System.XML/Mono.Xml.XPath/DTMXPathDocument.cs5
-rw-r--r--mcs/class/System.XML/Mono.Xml.XPath/DTMXPathDocumentBuilder.cs36
-rw-r--r--mcs/class/System.XML/Mono.Xml.XPath/DTMXPathNavigator.cs74
-rw-r--r--mcs/class/System.XML/Mono.Xml.Xsl.Operations/ChangeLog16
-rw-r--r--mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslAttribute.cs2
-rw-r--r--mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslCopy.cs2
-rw-r--r--mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslIf.cs3
-rw-r--r--mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslNumber.cs7
-rw-r--r--mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslVariable.cs2
-rw-r--r--mcs/class/System.XML/Mono.Xml.Xsl/ChangeLog30
-rw-r--r--mcs/class/System.XML/Mono.Xml.Xsl/Emitter.cs6
-rw-r--r--mcs/class/System.XML/Mono.Xml.Xsl/GenericOutputter.cs54
-rw-r--r--mcs/class/System.XML/Mono.Xml.Xsl/HtmlEmitter.cs6
-rw-r--r--mcs/class/System.XML/Mono.Xml.Xsl/TextEmitter.cs11
-rw-r--r--mcs/class/System.XML/Mono.Xml.Xsl/XmlWriterEmitter.cs33
-rw-r--r--mcs/class/System.XML/Mono.Xml.Xsl/XslKey.cs2
-rw-r--r--mcs/class/System.XML/Mono.Xml.Xsl/XsltCompiledContext.cs7
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/BUGS-MS.txt24
-rw-r--r--mcs/class/System.XML/System.Xml.Schema/BuiltInDatatype.cs837
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/ChangeLog302
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/SchemaDataValueType.cs155
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/ValidationHandler.cs3
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchema.cs225
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaAll.cs100
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaAny.cs37
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaAttribute.cs2
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaChoice.cs150
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaCollection.cs195
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaComplexContentExtension.cs17
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaComplexContentRestriction.cs19
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaComplexType.cs547
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaContent.cs13
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaDatatype.cs5
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaElement.cs283
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaEnumerationFacet.cs5
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaFacet.cs27
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaFractionDigitsFacet.cs4
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaGroup.cs19
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaGroupBase.cs148
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaGroupRef.cs70
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaIdentityConstraint.cs1
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaKey.cs1
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaKeyref.cs2
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaLengthFacet.cs4
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaMaxExclusiveFacet.cs4
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaMaxInclusiveFacet.cs4
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaMaxLengthFacet.cs5
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaMinExclusiveFacet.cs4
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaMinInclusiveFacet.cs5
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaMinLengthFacet.cs5
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaObject.cs12
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaObjectTable.cs18
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaParticle.cs78
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaPatternFacet.cs5
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaReader.cs2
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaSequence.cs138
-rw-r--r--mcs/class/System.XML/System.Xml.Schema/XmlSchemaSet.cs129
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleContent.cs3
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleContentExtension.cs19
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleContentRestriction.cs19
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleType.cs33
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleTypeContent.cs4
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleTypeList.cs6
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleTypeRestriction.cs478
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleTypeUnion.cs6
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaTotalDigitsFacet.cs5
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaType.cs115
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaUnique.cs2
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaUtil.cs56
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaWhiteSpaceFacet.cs5
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaXPath.cs9
-rwxr-xr-xmcs/class/System.XML/System.Xml.Serialization/ChangeLog105
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/MapCodeGenerator.cs29
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/SoapCodeExporter.cs5
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/SoapReflectionImporter.cs35
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/TypeData.cs8
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/XmlAttributeAttribute.cs1
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/XmlCodeExporter.cs39
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/XmlMemberMapping.cs11
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/XmlReflectionImporter.cs124
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/XmlSchemaExporter.cs142
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/XmlSchemaImporter.cs88
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/XmlSerializationReaderInterpreter.cs21
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/XmlSerializationWriter.cs5
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/XmlSerializationWriterInterpreter.cs9
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/XmlTypeMapMember.cs29
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/XmlTypeMapping.cs5
-rw-r--r--mcs/class/System.XML/System.Xml.XPath/ChangeLog11
-rw-r--r--mcs/class/System.XML/System.Xml.XPath/DefaultContext.cs9
-rw-r--r--mcs/class/System.XML/System.Xml.XPath/Iterator.cs12
-rw-r--r--mcs/class/System.XML/System.Xml.Xsl/ChangeLog12
-rw-r--r--mcs/class/System.XML/System.Xml.Xsl/ManagedXslTransform.cs16
-rw-r--r--mcs/class/System.XML/System.Xml.Xsl/Multiplexer.cs4
-rwxr-xr-xmcs/class/System.XML/System.Xml.dll.sources1
-rw-r--r--mcs/class/System.XML/System.Xml/ChangeLog155
-rw-r--r--mcs/class/System.XML/System.Xml/DTDObjectModel.cs20
-rw-r--r--mcs/class/System.XML/System.Xml/DTDReader.cs150
-rw-r--r--mcs/class/System.XML/System.Xml/DTDValidatingReader.cs36
-rw-r--r--mcs/class/System.XML/System.Xml/XmlAttribute.cs28
-rw-r--r--mcs/class/System.XML/System.Xml/XmlAttributeCollection.cs11
-rwxr-xr-xmcs/class/System.XML/System.Xml/XmlConstructs.cs4
-rw-r--r--mcs/class/System.XML/System.Xml/XmlDocument.cs58
-rw-r--r--mcs/class/System.XML/System.Xml/XmlElement.cs35
-rw-r--r--mcs/class/System.XML/System.Xml/XmlEntityReference.cs8
-rwxr-xr-xmcs/class/System.XML/System.Xml/XmlException.cs6
-rw-r--r--mcs/class/System.XML/System.Xml/XmlNamespaceManager.cs101
-rw-r--r--mcs/class/System.XML/System.Xml/XmlNode.cs33
-rwxr-xr-xmcs/class/System.XML/System.Xml/XmlNodeReader.cs2
-rwxr-xr-xmcs/class/System.XML/System.Xml/XmlNotation.cs2
-rw-r--r--mcs/class/System.XML/System.Xml/XmlParserInput.cs2
-rw-r--r--mcs/class/System.XML/System.Xml/XmlReader.cs21
-rw-r--r--mcs/class/System.XML/System.Xml/XmlSecureResolver.cs30
-rw-r--r--mcs/class/System.XML/System.Xml/XmlTextReader.cs154
-rw-r--r--mcs/class/System.XML/System.Xml/XmlTextWriter.cs134
-rwxr-xr-xmcs/class/System.XML/System.Xml/XmlUrlResolver.cs18
-rw-r--r--mcs/class/System.XML/System.Xml/XmlValidatingReader.cs48
-rw-r--r--mcs/class/System.XML/System.Xml/XmlWriter.cs21
-rwxr-xr-xmcs/class/System.XML/Test/System.Xml.Schema/XmlSchemaCollectionTests.cs74
-rwxr-xr-xmcs/class/System.XML/Test/System.Xml.Schema/XmlSchemaDatatypeTests.cs75
-rw-r--r--mcs/class/System.XML/Test/System.Xml.Schema/XmlSchemaTests.cs91
-rwxr-xr-xmcs/class/System.XML/Test/System.Xml.Schema/standalone_tests/ChangeLog15
-rwxr-xr-xmcs/class/System.XML/Test/System.Xml.Schema/standalone_tests/Makefile35
-rwxr-xr-xmcs/class/System.XML/Test/System.Xml.Schema/standalone_tests/README41
-rwxr-xr-xmcs/class/System.XML/Test/System.Xml.Schema/standalone_tests/psci-ms-all.zipbin0 -> 39604 bytes
-rwxr-xr-xmcs/class/System.XML/Test/System.Xml.Schema/standalone_tests/test-masters.tar.gzbin0 -> 118426 bytes
-rwxr-xr-xmcs/class/System.XML/Test/System.Xml.Schema/standalone_tests/xs-psci-compare.cs302
-rwxr-xr-xmcs/class/System.XML/Test/System.Xml.Schema/standalone_tests/xsdtest.cs78
-rw-r--r--mcs/class/System.XML/Test/System.Xml.XPath/ChangeLog5
-rw-r--r--mcs/class/System.XML/Test/System.Xml.XPath/XPathNavigatorCommonTests.cs55
-rw-r--r--mcs/class/System.XML/Test/System.Xml.XPath/XPathNavigatorTests.cs1
-rw-r--r--mcs/class/System.XML/Test/System.Xml.Xsl/ChangeLog5
-rw-r--r--mcs/class/System.XML/Test/System.Xml.Xsl/XslTransformTests.cs8
-rwxr-xr-xmcs/class/System.XML/Test/System.Xml.Xsl/standalone_tests/ChangeLog4
-rwxr-xr-xmcs/class/System.XML/Test/System.Xml.Xsl/standalone_tests/xslttest.cs15
-rw-r--r--mcs/class/System.XML/Test/System.Xml/ChangeLog39
-rw-r--r--mcs/class/System.XML/Test/System.Xml/XmlAttributeCollectionTests.cs47
-rw-r--r--mcs/class/System.XML/Test/System.Xml/XmlDocumentTests.cs1
-rw-r--r--mcs/class/System.XML/Test/System.Xml/XmlDocumentTypeTests.cs13
-rw-r--r--mcs/class/System.XML/Test/System.Xml/XmlElementTests.cs29
-rw-r--r--mcs/class/System.XML/Test/System.Xml/XmlNodeReaderTests.cs5
-rw-r--r--mcs/class/System.XML/Test/System.Xml/XmlNodeTests.cs8
-rw-r--r--mcs/class/System.XML/Test/System.Xml/XmlTextReaderTests.cs14
-rw-r--r--mcs/class/System.XML/Test/System.Xml/XmlTextWriterTests.cs151
-rw-r--r--mcs/class/System.XML/Test/System.Xml/XmlUrlResolverTests.cs2
-rw-r--r--mcs/class/System.XML/Test/System.Xml/XmlWriterTests.cs7
-rw-r--r--mcs/class/System.XML/Test/System.Xml/XsdParticleValidationTests.cs7
-rw-r--r--mcs/class/System.XML/Test/System.Xml/XsdValidatingReaderTests.cs6
-rwxr-xr-xmcs/class/System.XML/Test/System.Xml/standalone_tests/ChangeLog7
-rwxr-xr-xmcs/class/System.XML/Test/System.Xml/standalone_tests/Makefile24
-rwxr-xr-xmcs/class/System.XML/Test/System.Xml/standalone_tests/README13
-rwxr-xr-xmcs/class/System.XML/Test/System.Xml/standalone_tests/xmltest.cs147
-rwxr-xr-xmcs/class/System.XML/Test/XmlFiles/xsd/2.xsd11
-rwxr-xr-xmcs/class/System.XML/Test/XmlFiles/xsd/3.xsd11
-rwxr-xr-xmcs/class/System.XML/Test/XmlFiles/xsd/4.xsd11
-rwxr-xr-xmcs/class/System.XML/Test/XmlFiles/xsd/5.xsd14
-rwxr-xr-xmcs/class/System.XML/Test/XmlFiles/xsd/6.xsd15
-rw-r--r--mcs/class/System.XML/Test/XmlFiles/xsd/ChangeLog4
-rw-r--r--mcs/class/System/.cvsignore2
-rw-r--r--mcs/class/System/ChangeLog10
-rw-r--r--mcs/class/System/Microsoft.CSharp/CSharpCodeCompiler.cs2
-rw-r--r--mcs/class/System/Microsoft.CSharp/CSharpCodeGenerator.cs37
-rw-r--r--mcs/class/System/Microsoft.CSharp/ChangeLog23
-rw-r--r--mcs/class/System/System.CodeDom/ChangeLog6
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeAttributeDeclaration.cs2
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeDelegateInvokeExpression.cs2
-rwxr-xr-xmcs/class/System/System.IO/ChangeLog39
-rw-r--r--mcs/class/System/System.IO/DefaultWatcher.cs262
-rw-r--r--mcs/class/System/System.IO/FAMWatcher.cs263
-rw-r--r--mcs/class/System/System.IO/FileAction.cs18
-rw-r--r--mcs/class/System/System.IO/FileSystemEventArgs.cs4
-rw-r--r--mcs/class/System/System.IO/FileSystemWatcher.cs715
-rw-r--r--mcs/class/System/System.IO/IFileWatcher.cs16
-rw-r--r--mcs/class/System/System.IO/SearchPattern.cs170
-rw-r--r--mcs/class/System/System.IO/WindowsWatcher.cs31
-rw-r--r--mcs/class/System/System.Net.Sockets/ChangeLog19
-rw-r--r--mcs/class/System/System.Net.Sockets/Socket.cs404
-rw-r--r--mcs/class/System/System.Net/ChangeLog68
-rw-r--r--mcs/class/System/System.Net/ChunkStream.cs2
-rw-r--r--mcs/class/System/System.Net/DigestClient.cs1
-rw-r--r--mcs/class/System/System.Net/Dns.cs2
-rw-r--r--mcs/class/System/System.Net/HttpWebRequest.cs11
-rw-r--r--mcs/class/System/System.Net/IPv6Address.cs1
-rw-r--r--mcs/class/System/System.Net/MonoHttpDate.cs5
-rw-r--r--mcs/class/System/System.Net/ServicePointManager.cs9
-rw-r--r--mcs/class/System/System.Net/WebClient.cs2
-rw-r--r--mcs/class/System/System.Net/WebConnection.cs157
-rw-r--r--mcs/class/System/System.Net/WebConnectionGroup.cs5
-rw-r--r--mcs/class/System/System.Net/WebConnectionStream.cs8
-rw-r--r--mcs/class/System/System.Text.RegularExpressions/ChangeLog10
-rw-r--r--mcs/class/System/System.Text.RegularExpressions/notes.txt6
-rw-r--r--mcs/class/System/System.Text.RegularExpressions/parser.cs6
-rw-r--r--mcs/class/System/System.Text.RegularExpressions/regex.cs2
-rwxr-xr-xmcs/class/System/System.dll.sources6
-rw-r--r--mcs/class/System/System/ChangeLog20
-rwxr-xr-xmcs/class/System/System/Uri.cs48
-rw-r--r--mcs/class/System/System_test.dll.sources2
-rw-r--r--mcs/class/System/Test/Microsoft.CSharp/ChangeLog4
-rwxr-xr-xmcs/class/System/Test/Microsoft.CSharp/CodeGeneratorIdentifierTest.cs75
-rw-r--r--mcs/class/System/Test/System.IO/ChangeLog4
-rwxr-xr-xmcs/class/System/Test/System.IO/FileSystemWatcherTest.cs86
-rw-r--r--mcs/class/System/Test/System.Net/HttpWebRequestTest.cs2
-rw-r--r--mcs/class/System/Test/System.Text.RegularExpressions/ChangeLog10
-rw-r--r--mcs/class/System/Test/System.Text.RegularExpressions/RegexBugs.cs16
-rw-r--r--mcs/class/System/Test/System/ChangeLog25
-rw-r--r--mcs/class/System/Test/System/UriBuilderTest.cs69
-rw-r--r--mcs/class/System/Test/System/UriTest.cs583
-rwxr-xr-xmcs/class/System/Test/System/UriTest2.cs75
-rwxr-xr-xmcs/class/System/Test/System/test-uri-list.txt4
-rwxr-xr-xmcs/class/System/Test/System/test-uri-props-manual.txt38
-rwxr-xr-xmcs/class/System/Test/System/test-uri-props.txt57
-rwxr-xr-xmcs/class/System/Test/System/test-uri-relative-list.txt95
-rwxr-xr-xmcs/class/System/Test/System/test-uri-relative-props.txt969
-rwxr-xr-xmcs/class/System/Test/System/uri-test-generator.cs9
-rw-r--r--mcs/class/corlib/.cvsignore2
-rw-r--r--mcs/class/corlib/ChangeLog37
-rw-r--r--mcs/class/corlib/Mono.Security.Cryptography/ChangeLog5
-rwxr-xr-xmcs/class/corlib/Mono.Security.Cryptography/CryptoConvert.cs2
-rw-r--r--mcs/class/corlib/System.Collections/ChangeLog16
-rw-r--r--mcs/class/corlib/System.Collections/Hashtable.cs15
-rw-r--r--mcs/class/corlib/System.Globalization/ChangeLog11
-rw-r--r--mcs/class/corlib/System.Globalization/CultureInfo.cs6
-rw-r--r--mcs/class/corlib/System.Globalization/NumberFormatInfo.cs2
-rw-r--r--mcs/class/corlib/System.IO/ChangeLog46
-rw-r--r--mcs/class/corlib/System.IO/FileStream.cs191
-rw-r--r--mcs/class/corlib/System.IO/IntPtrStream.cs20
-rw-r--r--mcs/class/corlib/System.IO/Path.cs23
-rw-r--r--mcs/class/corlib/System.IO/StreamWriter.cs131
-rw-r--r--mcs/class/corlib/System.IO/TextWriter.cs34
-rwxr-xr-xmcs/class/corlib/System.Reflection.Emit/AssemblyBuilder.cs226
-rw-r--r--mcs/class/corlib/System.Reflection.Emit/ChangeLog56
-rwxr-xr-xmcs/class/corlib/System.Reflection.Emit/CustomAttributeBuilder.cs9
-rw-r--r--mcs/class/corlib/System.Reflection.Emit/ILGenerator.cs12
-rw-r--r--mcs/class/corlib/System.Reflection.Emit/ModuleBuilder.cs19
-rw-r--r--mcs/class/corlib/System.Reflection.Emit/TypeBuilder.cs6
-rw-r--r--mcs/class/corlib/System.Reflection/Assembly.cs43
-rw-r--r--mcs/class/corlib/System.Reflection/ChangeLog30
-rw-r--r--mcs/class/corlib/System.Reflection/Module.cs9
-rw-r--r--mcs/class/corlib/System.Reflection/MonoGenericInst.cs37
-rwxr-xr-xmcs/class/corlib/System.Reflection/MonoProperty.cs35
-rw-r--r--mcs/class/corlib/System.Reflection/common.src25
-rw-r--r--mcs/class/corlib/System.Resources/ChangeLog30
-rw-r--r--mcs/class/corlib/System.Resources/Win32Resources.cs705
-rw-r--r--mcs/class/corlib/System.Runtime.InteropServices/ChangeLog4
-rw-r--r--mcs/class/corlib/System.Runtime.InteropServices/Marshal.cs13
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Messaging/AsyncResult.cs5
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Messaging/ChangeLog8
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Messaging/StackBuilderSink.cs13
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Proxies/ChangeLog4
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Proxies/RealProxy.cs1
-rwxr-xr-xmcs/class/corlib/System.Runtime.Remoting/ChangeLog11
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting/RemotingServices.cs6
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting/ServerIdentity.cs18
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting/TypeInfo.cs9
-rw-r--r--mcs/class/corlib/System.Security.Cryptography/ChangeLog10
-rw-r--r--mcs/class/corlib/System.Security.Cryptography/FromBase64Transform.cs40
-rw-r--r--mcs/class/corlib/System.Security.Permissions/ChangeLog9
-rw-r--r--mcs/class/corlib/System.Security.Permissions/FileIOPermission.cs19
-rw-r--r--mcs/class/corlib/System.Security.Permissions/PermissionSetAttribute.cs41
-rwxr-xr-xmcs/class/corlib/System.Security.Policy/AllMembershipCondition.cs14
-rw-r--r--mcs/class/corlib/System.Security.Policy/ApplicationDirectory.cs41
-rw-r--r--mcs/class/corlib/System.Security.Policy/ApplicationDirectoryMembershipCondition.cs42
-rw-r--r--mcs/class/corlib/System.Security.Policy/ChangeLog73
-rw-r--r--mcs/class/corlib/System.Security.Policy/CodeGroup.cs176
-rw-r--r--mcs/class/corlib/System.Security.Policy/Evidence.cs44
-rw-r--r--mcs/class/corlib/System.Security.Policy/FileCodeGroup.cs62
-rw-r--r--mcs/class/corlib/System.Security.Policy/FirstMatchCodeGroup.cs15
-rw-r--r--mcs/class/corlib/System.Security.Policy/Hash.cs22
-rw-r--r--mcs/class/corlib/System.Security.Policy/NetCodeGroup.cs16
-rwxr-xr-xmcs/class/corlib/System.Security.Policy/PermissionRequestEvidence.cs68
-rw-r--r--mcs/class/corlib/System.Security.Policy/PolicyLevel.cs310
-rw-r--r--mcs/class/corlib/System.Security.Policy/Publisher.cs48
-rw-r--r--mcs/class/corlib/System.Security.Policy/Site.cs124
-rwxr-xr-xmcs/class/corlib/System.Security.Policy/SiteMembershipCondition.cs127
-rw-r--r--mcs/class/corlib/System.Security.Policy/StrongName.cs38
-rw-r--r--mcs/class/corlib/System.Security.Policy/StrongNameMembershipCondition.cs60
-rw-r--r--mcs/class/corlib/System.Security.Policy/UnionCodeGroup.cs17
-rw-r--r--mcs/class/corlib/System.Security.Policy/Url.cs99
-rw-r--r--mcs/class/corlib/System.Security.Policy/UrlMembershipCondition.cs53
-rw-r--r--mcs/class/corlib/System.Security.Policy/ZoneMembershipCondition.cs14
-rw-r--r--mcs/class/corlib/System.Security/AllowPartiallyTrustedCallersAttribute.cs4
-rwxr-xr-xmcs/class/corlib/System.Security/ChangeLog64
-rwxr-xr-xmcs/class/corlib/System.Security/CodeAccessPermission.cs126
-rw-r--r--mcs/class/corlib/System.Security/NamedPermissionSet.cs13
-rw-r--r--mcs/class/corlib/System.Security/PermissionSet.cs99
-rw-r--r--mcs/class/corlib/System.Security/PolicyLevelType.cs37
-rwxr-xr-xmcs/class/corlib/System.Security/SecurityElement.cs145
-rw-r--r--mcs/class/corlib/System.Security/SecurityException.cs209
-rw-r--r--mcs/class/corlib/System.Security/SecurityManager.cs136
-rw-r--r--mcs/class/corlib/System.Security/SecurityZone.cs41
-rw-r--r--mcs/class/corlib/System.Security/SuppressUnmanagedCodeSecurityAttribute.cs30
-rw-r--r--mcs/class/corlib/System.Security/UnverifiableCodeAttribute.cs28
-rwxr-xr-xmcs/class/corlib/System.Text/ChangeLog19
-rw-r--r--mcs/class/corlib/System.Text/StringBuilder.cs1279
-rw-r--r--mcs/class/corlib/System.Threading/ChangeLog6
-rwxr-xr-xmcs/class/corlib/System.Threading/Thread.cs20
-rwxr-xr-xmcs/class/corlib/System/AppDomain.cs79
-rw-r--r--mcs/class/corlib/System/Array.cs14
-rw-r--r--mcs/class/corlib/System/ChangeLog99
-rw-r--r--mcs/class/corlib/System/Console.cs21
-rw-r--r--mcs/class/corlib/System/ContextBoundObject.cs1
-rw-r--r--mcs/class/corlib/System/DateTime.cs2
-rw-r--r--mcs/class/corlib/System/Environment.cs4
-rw-r--r--mcs/class/corlib/System/Exception.cs25
-rw-r--r--mcs/class/corlib/System/FloatingPointFormatter.cs15
-rwxr-xr-xmcs/class/corlib/System/MonoCustomAttrs.cs30
-rw-r--r--mcs/class/corlib/System/MonoType.cs88
-rw-r--r--mcs/class/corlib/System/String.cs41
-rw-r--r--mcs/class/corlib/System/TimeSpan.cs2
-rw-r--r--mcs/class/corlib/System/Type.cs11
-rw-r--r--mcs/class/corlib/Test/System.Collections/HashtableTest.cs2
-rw-r--r--mcs/class/corlib/Test/System.IO/ChangeLog36
-rwxr-xr-xmcs/class/corlib/Test/System.IO/DirectoryTest.cs7
-rw-r--r--mcs/class/corlib/Test/System.IO/FileStreamTest.cs2
-rw-r--r--mcs/class/corlib/Test/System.IO/FileSystemInfoTest.cs44
-rw-r--r--mcs/class/corlib/Test/System.IO/PathTest.cs74
-rw-r--r--mcs/class/corlib/Test/System.Reflection.Emit/AssemblyBuilderTest.cs2
-rw-r--r--mcs/class/corlib/Test/System.Reflection.Emit/ChangeLog17
-rw-r--r--mcs/class/corlib/Test/System.Reflection.Emit/TypeBuilderTest.cs34
-rw-r--r--mcs/class/corlib/Test/System.Runtime.Remoting/ChangeLog4
-rwxr-xr-xmcs/class/corlib/Test/System.Runtime.Remoting/SynchronizationAttributeTest.cs34
-rw-r--r--mcs/class/corlib/Test/System.Security.Permissions/ChangeLog8
-rw-r--r--mcs/class/corlib/Test/System.Security.Permissions/FileIOPermissionAttributeTest.cs66
-rw-r--r--mcs/class/corlib/Test/System.Security.Permissions/FileIOPermissionTest.cs193
-rw-r--r--mcs/class/corlib/Test/System.Security.Policy/ChangeLog53
-rw-r--r--mcs/class/corlib/Test/System.Security.Policy/CodeGroupTest.cs585
-rw-r--r--mcs/class/corlib/Test/System.Security.Policy/EvidenceTest.cs166
-rwxr-xr-xmcs/class/corlib/Test/System.Security.Policy/FileCodeGroupTest.cs164
-rwxr-xr-xmcs/class/corlib/Test/System.Security.Policy/FirstMatchCodeGroupTest.cs113
-rwxr-xr-xmcs/class/corlib/Test/System.Security.Policy/NetCodeGroupTest.cs107
-rwxr-xr-xmcs/class/corlib/Test/System.Security.Policy/PermissionRequestEvidenceTest.cs24
-rwxr-xr-xmcs/class/corlib/Test/System.Security.Policy/PolicyLevelTest.cs511
-rw-r--r--mcs/class/corlib/Test/System.Security.Policy/PublisherMembershipConditionTest.cs7
-rw-r--r--mcs/class/corlib/Test/System.Security.Policy/PublisherTest.cs8
-rwxr-xr-xmcs/class/corlib/Test/System.Security.Policy/SiteMembershipConditionTest.cs222
-rwxr-xr-xmcs/class/corlib/Test/System.Security.Policy/SiteTest.cs174
-rw-r--r--mcs/class/corlib/Test/System.Security.Policy/StrongNameTest.cs27
-rwxr-xr-xmcs/class/corlib/Test/System.Security.Policy/UnionCodeGroupTest.cs113
-rwxr-xr-xmcs/class/corlib/Test/System.Security.Policy/UrlMembershipConditionTest.cs309
-rwxr-xr-xmcs/class/corlib/Test/System.Security.Policy/UrlTest.cs141
-rw-r--r--mcs/class/corlib/Test/System.Security/ChangeLog37
-rwxr-xr-xmcs/class/corlib/Test/System.Security/CodeAccessPermissionTest.cs90
-rw-r--r--mcs/class/corlib/Test/System.Security/SecurityElementTest.cs545
-rwxr-xr-xmcs/class/corlib/Test/System.Security/SecurityExceptionTest.cs90
-rwxr-xr-xmcs/class/corlib/Test/System.Security/SecurityManagerTest.cs36
-rw-r--r--mcs/class/corlib/Test/System.Text/ChangeLog9
-rw-r--r--mcs/class/corlib/Test/System.Text/StringBuilderTest.cs28
-rwxr-xr-xmcs/class/corlib/Test/System/AppDomainSetupTest.cs2
-rw-r--r--mcs/class/corlib/Test/System/ChangeLog44
-rwxr-xr-xmcs/class/corlib/Test/System/ConvertTest.cs8
-rwxr-xr-xmcs/class/corlib/Test/System/DateTimeTest.cs25
-rw-r--r--mcs/class/corlib/Test/System/TypeTest.cs7
-rwxr-xr-xmcs/class/corlib/corlib.dll.sources7
-rwxr-xr-xmcs/class/corlib/corlib_test.dll.sources12
-rwxr-xr-xmcs/docs/compiler14
-rw-r--r--mcs/errors/ChangeLog67
-rw-r--r--mcs/errors/cs0102.cs7
-rw-r--r--mcs/errors/cs0108-2.cs10
-rw-r--r--mcs/errors/cs0111-2.cs9
-rw-r--r--mcs/errors/cs0116-2.cs4
-rw-r--r--mcs/errors/cs0157-2.cs15
-rw-r--r--mcs/errors/cs0157-3.cs15
-rw-r--r--mcs/errors/cs0157-4.cs17
-rw-r--r--mcs/errors/cs0246-2.cs6
-rw-r--r--mcs/errors/cs0246-3.cs6
-rw-r--r--mcs/errors/cs0246-4.cs4
-rw-r--r--mcs/errors/cs0428.cs12
-rw-r--r--mcs/errors/cs0592-4.cs9
-rw-r--r--mcs/errors/cs0592-5.cs12
-rw-r--r--mcs/errors/cs0592-6.cs11
-rw-r--r--mcs/errors/cs0663.cs7
-rw-r--r--mcs/errors/cs1585.cs11
-rw-r--r--mcs/errors/cs1593-2.cs14
-rw-r--r--mcs/errors/cs1662.cs13
-rw-r--r--mcs/errors/cs1667.cs13
-rw-r--r--mcs/errors/cs1676.cs13
-rw-r--r--mcs/errors/cs1678.cs13
-rw-r--r--mcs/errors/cs3001-1.cs7
-rw-r--r--mcs/errors/cs3001-2.cs10
-rw-r--r--mcs/errors/cs3001-3.cs13
-rw-r--r--mcs/errors/cs3001-4.cs17
-rw-r--r--mcs/errors/cs3001-5.cs9
-rw-r--r--mcs/errors/cs3001-6.cs15
-rw-r--r--mcs/errors/cs3001-7.cs14
-rw-r--r--mcs/errors/cs3001.cs9
-rw-r--r--mcs/errors/cs3002-1.cs17
-rw-r--r--mcs/errors/cs3002-10.cs9
-rw-r--r--mcs/errors/cs3002-2.cs18
-rw-r--r--mcs/errors/cs3002-3.cs9
-rw-r--r--mcs/errors/cs3002-4.cs13
-rw-r--r--mcs/errors/cs3002-5.cs15
-rw-r--r--mcs/errors/cs3002-6.cs11
-rw-r--r--mcs/errors/cs3002-7.cs9
-rw-r--r--mcs/errors/cs3002-8.cs9
-rw-r--r--mcs/errors/cs3002-9.cs12
-rw-r--r--mcs/errors/cs3002.cs15
-rw-r--r--mcs/errors/cs3003-1.cs11
-rw-r--r--mcs/errors/cs3003.cs9
-rw-r--r--mcs/errors/cs3008-1.cs9
-rw-r--r--mcs/errors/cs3008-2.cs11
-rw-r--r--mcs/errors/cs3008-3.cs8
-rw-r--r--mcs/errors/cs3008-4.cs8
-rw-r--r--mcs/errors/cs3008-5.cs9
-rw-r--r--mcs/errors/cs3008-6.cs9
-rw-r--r--mcs/errors/cs3008.cs9
-rw-r--r--mcs/errors/cs3010.cs13
-rw-r--r--mcs/errors/cs3011-1.cs11
-rw-r--r--mcs/errors/cs3011.cs14
-rw-r--r--mcs/errors/cs3014-1.cs11
-rw-r--r--mcs/errors/cs3014-2.cs8
-rw-r--r--mcs/errors/cs3014-3.cs8
-rw-r--r--mcs/errors/cs3014-4.cs7
-rw-r--r--mcs/errors/cs3014-5.cs8
-rw-r--r--mcs/errors/cs3014-6.cs10
-rw-r--r--mcs/errors/cs3014-7.cs11
-rw-r--r--mcs/errors/cs3014.cs9
-rw-r--r--mcs/errors/cs3015-1.cs10
-rw-r--r--mcs/errors/cs3015.cs10
-rw-r--r--mcs/errors/cs3016-1.cs17
-rw-r--r--mcs/errors/cs3016-2.cs14
-rw-r--r--mcs/errors/cs3016-3.cs14
-rw-r--r--mcs/errors/cs3016.cs14
-rwxr-xr-xmcs/errors/errors.txt4
-rw-r--r--mcs/gmcs/AssemblyInfo.cs2
-rwxr-xr-xmcs/gmcs/ChangeLog824
-rw-r--r--mcs/gmcs/Makefile22
-rwxr-xr-xmcs/gmcs/assign.cs9
-rw-r--r--mcs/gmcs/attribute.cs80
-rwxr-xr-xmcs/gmcs/cfold.cs33
-rwxr-xr-xmcs/gmcs/class.cs378
-rwxr-xr-xmcs/gmcs/codegen.cs163
-rwxr-xr-xmcs/gmcs/const.cs6
-rw-r--r--mcs/gmcs/convert.cs43
-rwxr-xr-xmcs/gmcs/cs-parser.jay223
-rwxr-xr-xmcs/gmcs/cs-tokenizer.cs297
-rwxr-xr-xmcs/gmcs/decl.cs228
-rw-r--r--mcs/gmcs/delegate.cs179
-rwxr-xr-xmcs/gmcs/driver.cs289
-rwxr-xr-xmcs/gmcs/ecore.cs57
-rwxr-xr-xmcs/gmcs/enum.cs4
-rwxr-xr-xmcs/gmcs/expression.cs400
-rw-r--r--mcs/gmcs/flowanalysis.cs1049
-rwxr-xr-xmcs/gmcs/gen-treedump.cs8
-rw-r--r--mcs/gmcs/generic.cs31
-rwxr-xr-xmcs/gmcs/interface.cs28
-rw-r--r--mcs/gmcs/iterators.cs13
-rw-r--r--mcs/gmcs/location.cs3
-rwxr-xr-xmcs/gmcs/modifiers.cs2
-rwxr-xr-xmcs/gmcs/namespace.cs3
-rwxr-xr-xmcs/gmcs/pending.cs81
-rw-r--r--mcs/gmcs/report.cs45
-rwxr-xr-xmcs/gmcs/rootcontext.cs25
-rwxr-xr-xmcs/gmcs/statement.cs1040
-rwxr-xr-xmcs/gmcs/support.cs139
-rwxr-xr-xmcs/gmcs/tree.cs2
-rwxr-xr-xmcs/gmcs/typemanager.cs157
-rw-r--r--mcs/jtests/ChangeLog4
-rw-r--r--mcs/jtests/Makefile47
-rw-r--r--mcs/jtests/Test.Sources5
-rw-r--r--mcs/jtests/assign-less-than-eq.js3
-rw-r--r--mcs/jtests/empty-func.js7
-rw-r--r--mcs/jtests/func-form-params.js3
-rw-r--r--mcs/jtests/func-nested.js19
-rw-r--r--mcs/jtests/func-total-locals.js5
-rw-r--r--mcs/jtests/global-assign-sum.js4
-rw-r--r--mcs/jtests/global-bool-lits.js2
-rw-r--r--mcs/jtests/global-id.js3
-rw-r--r--mcs/jtests/global-num.js1
-rw-r--r--mcs/jtests/global-sum.js3
-rw-r--r--mcs/jtests/greater-than-eq.js3
-rw-r--r--mcs/jtests/greater-than.js3
-rw-r--r--mcs/jtests/init-var-num.js1
-rw-r--r--mcs/jtests/init-var-string.js1
-rw-r--r--mcs/jtests/less-than-eq.js3
-rw-r--r--mcs/jtests/less-than.js3
-rw-r--r--mcs/jtests/simple-assign-bool.js3
-rw-r--r--mcs/jtests/simple-assign-num.js3
-rw-r--r--mcs/jtests/simple-assign-vars.js3
-rw-r--r--mcs/jtests/var-decl.js1
-rw-r--r--mcs/mbas/ChangeLog23
-rw-r--r--mcs/mbas/expression.cs2
-rw-r--r--mcs/mbas/genericparser.cs4
-rw-r--r--mcs/mbas/mb-tokenizer.cs6
-rw-r--r--mcs/mbas/report.cs2
-rw-r--r--mcs/mbas/testmbas/WriteOK.vb15
-rwxr-xr-xmcs/mbas/testsuite/testmbas.sh6
-rw-r--r--mcs/mbas/typemanager.cs103
-rwxr-xr-xmcs/mcs/ChangeLog346
-rw-r--r--mcs/mcs/Makefile8
-rw-r--r--mcs/mcs/TODO16
-rwxr-xr-xmcs/mcs/assign.cs9
-rw-r--r--mcs/mcs/attribute.cs82
-rwxr-xr-xmcs/mcs/class.cs102
-rwxr-xr-xmcs/mcs/codegen.cs96
-rwxr-xr-xmcs/mcs/const.cs6
-rw-r--r--mcs/mcs/convert.cs23
-rwxr-xr-xmcs/mcs/cs-parser.jay322
-rwxr-xr-xmcs/mcs/cs-tokenizer.cs47
-rwxr-xr-xmcs/mcs/decl.cs22
-rw-r--r--mcs/mcs/delegate.cs242
-rwxr-xr-xmcs/mcs/driver.cs75
-rwxr-xr-xmcs/mcs/ecore.cs63
-rwxr-xr-xmcs/mcs/enum.cs4
-rwxr-xr-xmcs/mcs/expression.cs351
-rw-r--r--mcs/mcs/flowanalysis.cs324
-rwxr-xr-xmcs/mcs/interface.cs4
-rw-r--r--mcs/mcs/iterators.cs4
-rwxr-xr-xmcs/mcs/namespace.cs13
-rwxr-xr-xmcs/mcs/parameter.cs2
-rwxr-xr-xmcs/mcs/pending.cs31
-rwxr-xr-xmcs/mcs/rootcontext.cs2
-rwxr-xr-xmcs/mcs/statement.cs639
-rwxr-xr-xmcs/mcs/tree.cs2
-rwxr-xr-xmcs/mcs/typemanager.cs48
-rwxr-xr-xmcs/monoresgen/.cvsignore1
-rwxr-xr-xmcs/monoresgen/ChangeLog5
-rwxr-xr-xmcs/monoresgen/monoresgen.cs37
-rw-r--r--mcs/tests/2test-5.cs22
-rwxr-xr-xmcs/tests/ChangeLog45
-rw-r--r--mcs/tests/Makefile10
-rw-r--r--mcs/tests/README.tests41
-rw-r--r--mcs/tests/cls-test-0.cs108
-rw-r--r--mcs/tests/cls-test-1.cs10
-rw-r--r--mcs/tests/cls-test-10.cs20
-rw-r--r--mcs/tests/cls-test-11.cs17
-rw-r--r--mcs/tests/cls-test-14.cs17
-rw-r--r--mcs/tests/cls-test-15.cs31
-rw-r--r--mcs/tests/cls-test-16.cs13
-rw-r--r--mcs/tests/cls-test-2.cs28
-rw-r--r--mcs/tests/cls-test-3.cs13
-rw-r--r--mcs/tests/cls-test-5.cs70
-rw-r--r--mcs/tests/cls-test-6.cs38
-rw-r--r--mcs/tests/cls-test-7.cs17
-rw-r--r--mcs/tests/gen-37.cs33
-rwxr-xr-xmcs/tests/gen-test.pl17
-rw-r--r--mcs/tests/test-102.cs18
-rw-r--r--mcs/tests/test-154.cs17
-rw-r--r--mcs/tests/test-205.cs3
-rw-r--r--mcs/tests/test-211.cs6
-rw-r--r--mcs/tests/test-222.cs22
-rw-r--r--mcs/tests/test-223.cs31
-rw-r--r--mcs/tests/test-224.cs74
-rw-r--r--mcs/tests/test-225.cs18
-rw-r--r--mcs/tests/test-226.cs25
-rw-r--r--mcs/tests/test-227.cs27
-rw-r--r--mcs/tests/test-228.cs41
-rwxr-xr-xmcs/tests/test-91.cs29
-rwxr-xr-xmcs/tests/test-99.cs20
-rw-r--r--mcs/tests/verify-8.cs12
-rw-r--r--mcs/tools/ChangeLog4
-rw-r--r--mcs/tools/Makefile2
-rwxr-xr-xmcs/tools/SqlSharp/.cvsignore1
-rw-r--r--mcs/tools/al/Al.cs618
-rw-r--r--mcs/tools/al/ChangeLog8
-rw-r--r--mcs/tools/al/Makefile7
-rw-r--r--mcs/tools/al/al.exe.sources1
-rwxr-xr-xmcs/tools/browsercaps-updater/.cvsignore1
-rwxr-xr-xmcs/tools/cilc/.cvsignore3
-rwxr-xr-xmcs/tools/disco/.cvsignore1
-rwxr-xr-xmcs/tools/genxs/.cvsignore1
-rwxr-xr-xmcs/tools/ictool/.cvsignore1
-rwxr-xr-xmcs/tools/mono-xsd/.cvsignore1
-rw-r--r--mcs/tools/mono-xsd/ChangeLog4
-rwxr-xr-xmcs/tools/mono-xsd/NewMonoXSD.cs3
-rwxr-xr-xmcs/tools/security/.cvsignore6
-rwxr-xr-xmcs/tools/soapsuds/.cvsignore1
-rwxr-xr-xmcs/tools/wsdl/.cvsignore1
-rw-r--r--mcs/tools/wsdl/ChangeLog10
-rwxr-xr-xmcs/tools/wsdl/MonoWSDL.cs24
-rw-r--r--mcs/tools/wsdl/SampleGenerator.cs880
-rw-r--r--mcs/tools/wsdl/wsdl.exe.sources1
-rw-r--r--mono/arch/mips/mips-codegen.h340
-rw-r--r--mono/arch/mips/test.c149
-rw-r--r--mono/arch/s390/tramp.c8
-rw-r--r--mono/dis/ChangeLog37
-rw-r--r--mono/dis/dump.c17
-rw-r--r--mono/dis/dump.h1
-rw-r--r--mono/dis/get.c148
-rw-r--r--mono/dis/get.h3
-rw-r--r--mono/dis/main.c11
-rw-r--r--mono/dis/monodis.16
-rw-r--r--mono/interpreter/ChangeLog24
-rw-r--r--mono/interpreter/interp.c48
-rw-r--r--mono/io-layer/ChangeLog25
-rw-r--r--mono/io-layer/Makefile.am2
-rw-r--r--mono/io-layer/atomic.h33
-rw-r--r--mono/io-layer/io.c3
-rw-r--r--mono/io-layer/shared.c12
-rw-r--r--mono/io-layer/socket-wrappers.h76
-rw-r--r--mono/io-layer/sockets.c1
-rw-r--r--mono/io-layer/sockets.h76
-rw-r--r--mono/io-layer/wait.c4
-rw-r--r--mono/metadata/ChangeLog316
-rw-r--r--mono/metadata/Makefile.am4
-rw-r--r--mono/metadata/appdomain.c46
-rw-r--r--mono/metadata/appdomain.h2
-rw-r--r--mono/metadata/assembly.c12
-rw-r--r--mono/metadata/class.c93
-rw-r--r--mono/metadata/class.h5
-rw-r--r--mono/metadata/debug-mono-symfile.h4
-rw-r--r--mono/metadata/exception.c19
-rw-r--r--mono/metadata/exception.h6
-rw-r--r--mono/metadata/file-io.c14
-rw-r--r--mono/metadata/filewatcher.c167
-rw-r--r--mono/metadata/filewatcher.h40
-rw-r--r--mono/metadata/gc.c1
-rw-r--r--mono/metadata/icall.c161
-rw-r--r--mono/metadata/image.c12
-rw-r--r--mono/metadata/image.h1
-rw-r--r--mono/metadata/loader.c45
-rw-r--r--mono/metadata/loader.h2
-rw-r--r--mono/metadata/marshal.c127
-rw-r--r--mono/metadata/marshal.h9
-rw-r--r--mono/metadata/metadata.c2
-rw-r--r--mono/metadata/mono-debug-debugger.c3
-rw-r--r--mono/metadata/mono-debug-debugger.h1
-rw-r--r--mono/metadata/object.c40
-rw-r--r--mono/metadata/object.h5
-rw-r--r--mono/metadata/process.c22
-rw-r--r--mono/metadata/profiler.c4
-rw-r--r--mono/metadata/rand.c2
-rw-r--r--mono/metadata/reflection.c496
-rw-r--r--mono/metadata/reflection.h12
-rw-r--r--mono/metadata/socket-io.c76
-rw-r--r--mono/metadata/string-icalls.c4
-rw-r--r--mono/metadata/threadpool.c7
-rw-r--r--mono/metadata/verify.c1
-rw-r--r--mono/mini/ChangeLog108
-rw-r--r--mono/mini/Makefile.am7
-rw-r--r--mono/mini/cpu-pentium.md2
-rw-r--r--mono/mini/debug-mini.c27
-rw-r--r--mono/mini/driver.c19
-rw-r--r--mono/mini/exceptions-ppc.c6
-rw-r--r--mono/mini/exceptions-sparc.c2
-rw-r--r--mono/mini/exceptions-x86.c3
-rw-r--r--mono/mini/exceptions.cs32
-rw-r--r--mono/mini/inssel.brg16
-rw-r--r--mono/mini/jit-icalls.c25
-rw-r--r--mono/mini/mini-porting.txt705
-rw-r--r--mono/mini/mini-ppc.c28
-rw-r--r--mono/mini/mini-ppc.h2
-rw-r--r--mono/mini/mini-x86.c46
-rw-r--r--mono/mini/mini.c103
-rw-r--r--mono/mini/mini.h26
-rw-r--r--mono/mini/objects.cs41
-rw-r--r--mono/mini/ssa.c14
-rw-r--r--mono/mini/tramp-ppc.c15
-rw-r--r--mono/mini/tramp-sparc.c4
-rw-r--r--mono/mini/tramp-x86.c20
-rw-r--r--mono/tests/ChangeLog18
-rw-r--r--mono/tests/Makefile.am7
-rw-r--r--mono/tests/custom-attr.cs30
-rwxr-xr-xmono/tests/pinvoke.cs8
-rw-r--r--mono/tests/pinvoke17.cs2
-rwxr-xr-xmono/tests/pinvoke2.cs41
-rw-r--r--mono/tests/setenv.cs17
-rw-r--r--mono/utils/ChangeLog17
-rw-r--r--mono/utils/Makefile.am6
-rw-r--r--mono/utils/mono-uri.c95
-rw-r--r--mono/utils/mono-uri.h7
-rw-r--r--mono/utils/strenc.c40
-rw-r--r--monowiz.win32.nsi179
-rw-r--r--runtime/Makefile.am8
-rw-r--r--scripts/Makefile.am16
-rw-r--r--scripts/al.in2
-rw-r--r--scripts/sn.in2
-rwxr-xr-xweb/ChangeLog16
-rw-r--r--web/ado-net14
-rw-r--r--web/blogs2
-rw-r--r--web/books27
-rw-r--r--web/bugs7
-rw-r--r--web/ccvs71
-rw-r--r--web/compiling235
-rw-r--r--web/crypto15
-rw-r--r--web/download275
-rw-r--r--web/drawing14
-rw-r--r--web/faq15
-rw-r--r--web/gtk-sharp7
-rwxr-xr-xweb/ibmdb24
-rw-r--r--web/index1010
-rwxr-xr-xweb/languages23
-rw-r--r--web/mailing-lists2
-rwxr-xr-xweb/mono-build-w32.sh41
-rw-r--r--web/mono-roadmap.html2
-rw-r--r--web/mono-todo8
-rwxr-xr-xweb/odbc8
-rw-r--r--web/oldnews978
-rwxr-xr-xweb/oracle33
-rw-r--r--web/other2
-rw-r--r--web/performance154
-rw-r--r--web/postgresql2
-rw-r--r--web/ppc6
-rw-r--r--web/resources21
-rwxr-xr-xweb/sqlclient26
-rwxr-xr-xweb/sqlite2
-rwxr-xr-xweb/sybase2
-rwxr-xr-xweb/tdsclient2
-rw-r--r--web/testing95
-rw-r--r--web/web/commands4
-rw-r--r--web/web/deploy/cm/cormissing.js3
-rw-r--r--web/web/makefile2
-rw-r--r--web/web/masterinfos/Makefile60
-rw-r--r--web/web/team.xml36
-rw-r--r--web/web/team/pedroas.pngbin0 -> 4539 bytes
-rw-r--r--web/web/template.html.in12
-rwxr-xr-xweb/xml-classes310
1373 files changed, 57918 insertions, 25082 deletions
diff --git a/ChangeLog b/ChangeLog
index a0f43e1395e..c6ac3ada40d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,48 @@
+
+Fri Jan 23 16:07:05 EST 2004 Paolo Molaro <lupus@ximian.com>
+
+ * configure.in, acconfig.h: check for truncl. Disable
+ version script on MacOSX (see bug #51590 if a check becomes
+ necessary).
+
+Fri Jan 23 21:26:01 CET 2004 Paolo Molaro <lupus@ximian.com>
+
+ * configure.in, acconfig.h: added check for socklen_t.
+
+2004-01-22 Zoltan Varga <vargaz@freemail.hu>
+
+ * Makefile.am: Do not install mono.pc on platforms without a JIT.
+
+2004-01-21 Zoltan Varga <vargaz@freemail.hu>
+
+ * Makefile.am (remove-binaries): Get rid of non-portable >& construct.
+
+2003-12-29 Miguel de Icaza <miguel@ximian.com>
+
+ * scripts/sn.in: Add sn script.
+
+2004-01-15 Zoltan Varga <vargaz@freemail.hu>
+
+ * scripts/Makefile.am: Add al.exe.
+
+ * scripts/al.in: New file.
+
+ * runtime/Makefile.am: Add al.exe.
+
+2004-01-10 Jackson Harper <jackson@ximian.com>
+
+ * data/machine.config: Add trace handler (Trace.axd) add trace
+ configuration handlers.
+
+2004-01-06 Martin Willemoes Hansen <mwh@sysrq.dk>
+
+ * doc/books: Added books on Web Services and ASP.NET
+
+2004-01-04 Daniel Morgan <danielmorgan@verizon.net>
+
+ * monowiz.win32.nsi: update the NSIS installer script for windows
+ to support NSIS 2.0 rc1 and Mono 0.29
+
2003-12-22 Bernie Solomon <bernard@ugsolutions.com>
* configure.in: missed in my last change
diff --git a/Makefile.am b/Makefile.am
index e603fb791f4..e1fdccc5c1b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -7,7 +7,11 @@ SUBDIRS = @libgc_dir@ mono doc docs runtime scripts man data samples
EXTRA_DIST= mono.pc.in mono.spec.in mint.pc.in
pkgconfigdir = $(libdir)/pkgconfig
+if JIT_SUPPORTED
pkgconfig_DATA= mono.pc mint.pc
+else
+pkgconfig_DATA= mint.pc
+endif
DISTCLEANFILES= mono.pc mint.pc
#
@@ -20,20 +24,21 @@ fullbuild: remove-binaries mcs-tree-safe-build xinstall-runtime mcs-rest install
mcs-tree-safe-build:
(cd ../mcs/jay; $(MAKE))
- (cd ../mcs/mcs; $(MAKE) MCS=mcs)
- (cd ../mcs/class/corlib; $(MAKE) MCS=mcs)
+ (cd ../mcs/mcs; $(MAKE) MCS=mcs BOOTSTRAP_MCS=mcs)
+ (cd ../mcs/class/corlib; $(MAKE) MCS=mcs BOOTSTRAP_MCS=mcs)
cp ../mcs/class/lib/mscorlib.dll runtime
cp ../mcs/mcs/mcs.exe runtime
xinstall-runtime:
if echo $(SUBDIRS) | grep "libgc " > /dev/null; then (cd libgc; $(MAKE) && $(MAKE) install); fi
(cd mono; $(MAKE) && $(MAKE) install)
+ (cd runtime; $(MAKE) install assemblies_DATA=mscorlib.dll monobins_DATA=mcs.exe)
mcs-rest:
(cd ../mcs/class; $(MAKE))
remove-binaries:
- rm ../mcs/class/lib/mscorlib.dll ../mcs/mcs/mcs.exe runtime/*dll runtime/*.exe >& /dev/null; echo
+ rm ../mcs/class/lib/mscorlib.dll ../mcs/mcs/mcs.exe runtime/*dll runtime/*.exe > /dev/null 2>&1; echo
win32getdeps:
diff --git a/README b/README
index c2875ca2e16..8b36a2280b6 100644
--- a/README
+++ b/README
@@ -8,6 +8,36 @@ This is Mono.
1. Compilation and Installation
===============================
+ a. Build Requirements
+ ---------------------
+
+ To build Mono, you will need the following components:
+
+ * pkg-config
+
+ Available from: http://www.freedesktop.org/Software/pkgconfig
+
+ * glib 2.0
+
+ Available from: http://www.gtk.org/
+
+ Optional dependencies:
+
+ * ICU library
+
+ http://oss.software.ibm.com/icu/index.html
+
+ You will need this one to get complete support for the international
+ features of the .NET Framework.
+
+ * Cairo and libgdiplus
+
+ If you want to get support for System.Drawing, you will need to get
+ both Libgdiplus and Cairo.
+
+ b. Building the Software
+ ------------------------
+
If you obtained this package as an officially released tarball,
this is very simple, use configure and make:
@@ -16,11 +46,51 @@ This is Mono.
make install
If you obtained this as a snapshot, you will need an existing
- Mono installation. To upgrade your installation do:
+ Mono installation. To upgrade your installation, unpack both
+ mono and mcs:
+ tar xzf mcs-XXXX.tar.gz
+ tar xzf mono-XXXX.tar.gz
+ cd mono-XXXX
./autogen.sh --prefix=/usr/local
make fullbuild
+ c. Upgrade from CVS
+ -------------------
+
+ If you are upgrading from CVS you will need an existing Mono installation.
+ First verify that you have a working installation:
+
+ echo 'class X { static void Main () { System.Console.Write("OK");}'}' > x.cs
+
+ Compile:
+
+ mcs x.cs
+
+ And run:
+
+ mono x.exe
+
+ If you get the output `OK' and no errors, you are ready to start your CVS upgrade.
+
+ First, make sure that you have up-to-date mcs and mono sources:
+
+ cvs co mono mcs
+
+ Then, go into the mono directory, and configure:
+
+ cd mono
+ ./autogen --prefix=/usr/local
+
+ Then compile using the special target `fullbuild':
+
+ make fullbuild
+
+ This step will compile and install at the same time.
+
+ Failure to follow these steps will result in a broken installation.
+
+
2. Using Mono
=============
@@ -47,7 +117,13 @@ This is Mono.
====================
doc/
- Contains documentation and the web site contents.
+ Contains the web site contents.
+
+ docs/
+ Technical documents about the Mono runtime.
+
+ data/
+ Configuration files installed as part of the Mono runtime.
mono/
The core of the Mono Runtime.
@@ -78,4 +154,17 @@ This is Mono.
arch/
Architecture specific portions.
+ man/
+
+ Manual pages for the various Mono commands and programs.
+
+ scripts/
+
+ Scripts used to invoke Mono and the corresponding program.
+
+ runtime/
+
+ A directory holding a pre-compiled version of the Mono
+ runtime.
+
diff --git a/acconfig.h b/acconfig.h
index 6a5c9f19549..023cad92f18 100644
--- a/acconfig.h
+++ b/acconfig.h
@@ -31,3 +31,5 @@
#undef HAVE_KW_THREAD
#undef HAVE_SIGNBIT
#undef USE_MACH_SEMA
+#undef HAVE_SOCKLEN_T
+#undef HAVE_TRUNCL
diff --git a/configure.in b/configure.in
index 3c9f56c274f..4deeea3e689 100644
--- a/configure.in
+++ b/configure.in
@@ -1,7 +1,7 @@
AC_INIT(README)
AC_CANONICAL_SYSTEM
AM_CONFIG_HEADER(config.h)
-AM_INIT_AUTOMAKE(mono,0.29.99)
+AM_INIT_AUTOMAKE(mono,0.30)
AM_MAINTAINER_MODE
dnl
@@ -27,6 +27,9 @@ libmono_ldflags=""
AC_SUBST(libmono_cflags)
AC_SUBST(libmono_ldflags)
+dnl if linker handles the version script
+no_version_script=no
+
# Thread configuration inspired by sleepycat's db
AC_MSG_CHECKING([host platform characteristics])
libgc_threads=no
@@ -98,6 +101,7 @@ case "$host" in
AC_DEFINE(NEED_LINK_UNLINK)
AC_DEFINE(PTHREAD_POINTER_ID)
AC_DEFINE(USE_MACH_SEMA)
+ no_version_script=yes
libdl=
libgc_threads=no
gc_default=none
@@ -110,6 +114,7 @@ case "$host" in
esac
AC_MSG_RESULT(ok)
AM_CONDITIONAL(PLATFORM_WIN32, test x$platform_win32 = xyes)
+AM_CONDITIONAL(NO_VERSION_SCRIPT, test x$no_version_script = xyes)
AC_CHECK_TOOL(CC, gcc, gcc)
AC_PROG_CC
@@ -671,6 +676,27 @@ else
AC_CHECK_LIB(psapi, main, LIBS="$LIBS -lpsapi", AC_ERROR(bad mingw install?))
fi
+dnl socklen_t check
+AC_MSG_CHECKING(for socklen_t)
+AC_TRY_COMPILE([
+#include <sys/types.h>
+#include <sys/socket.h>
+],[
+ socklen_t foo;
+],[
+ac_cv_c_socklen_t=yes
+ AC_DEFINE(HAVE_SOCKLEN_T)
+ AC_MSG_RESULT(yes)
+],[
+ AC_MSG_RESULT(no)
+])
+
+AC_CHECK_FUNCS(truncl, , AC_MSG_CHECKING(for truncl in math.h)
+ AC_TRY_LINK([#include <math.h>],
+ [ truncl(0.0); ],
+ AC_DEFINE(HAVE_TRUNCL) AC_MSG_RESULT(yes),
+ AC_MSG_RESULT(no)))
+
dnl ****************************
dnl *** Look for /dev/random ***
dnl ****************************
diff --git a/data/DefaultWsdlHelpGenerator.aspx b/data/DefaultWsdlHelpGenerator.aspx
index 6e029ee8448..bb23f56189d 100644
--- a/data/DefaultWsdlHelpGenerator.aspx
+++ b/data/DefaultWsdlHelpGenerator.aspx
@@ -86,7 +86,9 @@ void BuildOperationInfo ()
InParams = new ArrayList ();
OutParams = new ArrayList ();
- Binding binding = FindBinding (CurrentOperationBinding);
+ Port port = FindPort (CurrentOperationBinding, null);
+ Binding binding = descriptions.GetBinding (port.Binding);
+
PortType portType = descriptions.GetPortType (binding.Type);
Operation oper = FindOperation (portType, CurrentOperationName);
@@ -229,15 +231,33 @@ ArrayList FindServiceProtocols(string operName)
return table;
}
-Binding FindBinding (string portName)
+Port FindPort (string portName, string protocol)
{
Service service = descriptions[0].Services[0];
foreach (Port port in service.Ports)
- if (port.Name == portName)
- return descriptions.GetBinding (port.Binding);
+ {
+ if (portName == null)
+ {
+ Binding binding = descriptions.GetBinding (port.Binding);
+ if (GetProtocol (binding) == protocol) return port;
+ }
+ else if (port.Name == portName)
+ return port;
+ }
return null;
}
+string GetProtocol (Binding binding)
+{
+ if (binding.Extensions.Find (typeof(SoapBinding)) != null) return "Soap";
+ HttpBinding hb = (HttpBinding) binding.Extensions.Find (typeof(HttpBinding));
+ if (hb == null) return "";
+ if (hb.Verb == "POST") return "HttpPost";
+ if (hb.Verb == "GET") return "HttpGet";
+ return "";
+}
+
+
Operation FindOperation (PortType portType, string name)
{
foreach (Operation oper in portType.Operations) {
@@ -339,6 +359,40 @@ string GetTestResult ()
}
}
+string GenerateOperationMessages (string protocol, bool generateInput)
+{
+ if (!IsOperationSupported (protocol)) return "";
+
+ Port port;
+ if (protocol != "Soap") port = FindPort (null, protocol);
+ else port = FindPort (CurrentOperationBinding, null);
+
+ Binding binding = descriptions.GetBinding (port.Binding);
+ OperationBinding obin = FindOperation (binding, CurrentOperationName);
+ PortType portType = descriptions.GetPortType (binding.Type);
+ Operation oper = FindOperation (portType, CurrentOperationName);
+
+ HtmlSampleGenerator sg = new HtmlSampleGenerator (descriptions, schemas);
+ string txt = sg.GenerateMessage (port, obin, oper, protocol, generateInput);
+ if (protocol == "Soap") txt = WrapText (txt,CodeTextColumns);
+ txt = ColorizeXml (txt);
+ txt = txt.Replace ("@placeholder!","<span class='literal-placeholder'>");
+ txt = txt.Replace ("!placeholder@","</span>");
+ return txt;
+}
+
+bool IsOperationSupported (string protocol)
+{
+ if (CurrentPage != "op" || CurrentTab != "msg") return false;
+ if (protocol == "Soap") return true;
+
+ Port port = FindPort (null, protocol);
+ if (port == null) return false;
+ Binding binding = descriptions.GetBinding (port.Binding);
+ if (binding == null) return false;
+ return FindOperation (binding, CurrentOperationName) != null;
+}
+
//
// Proxy code generation
//
@@ -688,9 +742,765 @@ class Parameter
public string Description { get { return description; } set { description = value; } }
}
+public class HtmlSampleGenerator: SampleGenerator
+{
+ public HtmlSampleGenerator (ServiceDescriptionCollection services, XmlSchemas schemas)
+ : base (services, schemas)
+ {
+ }
+
+ protected override string GetLiteral (string s)
+ {
+ return "@placeholder!" + s + "!placeholder@";
+ }
+}
+
+
+ public class SampleGenerator
+ {
+ protected ServiceDescriptionCollection descriptions;
+ protected XmlSchemas schemas;
+ XmlSchemaElement anyElement;
+ ArrayList queue;
+ SoapBindingUse currentUse;
+ XmlDocument document = new XmlDocument ();
+
+ static readonly XmlQualifiedName anyType = new XmlQualifiedName ("anyType",XmlSchema.Namespace);
+ static readonly XmlQualifiedName arrayType = new XmlQualifiedName ("Array","http://schemas.xmlsoap.org/soap/encoding/");
+ static readonly XmlQualifiedName arrayTypeRefName = new XmlQualifiedName ("arrayType","http://schemas.xmlsoap.org/soap/encoding/");
+ const string SoapEnvelopeNamespace = "http://schemas.xmlsoap.org/soap/envelope/";
+ const string WsdlNamespace = "http://schemas.xmlsoap.org/wsdl/";
+ const string SoapEncodingNamespace = "http://schemas.xmlsoap.org/soap/encoding/";
+
+ class EncodedType
+ {
+ public EncodedType (string ns, XmlSchemaElement elem) { Namespace = ns; Element = elem; }
+ public string Namespace;
+ public XmlSchemaElement Element;
+ }
+
+ public SampleGenerator (ServiceDescriptionCollection services, XmlSchemas schemas)
+ {
+ descriptions = services;
+ this.schemas = schemas;
+ queue = new ArrayList ();
+ }
+
+ public string GenerateMessage (Port port, OperationBinding obin, Operation oper, string protocol, bool generateInput)
+ {
+ OperationMessage msg = null;
+ foreach (OperationMessage opm in oper.Messages)
+ {
+ if (opm is OperationInput && generateInput) msg = opm;
+ else if (opm is OperationOutput && !generateInput) msg = opm;
+ }
+ if (msg == null) return null;
+
+ switch (protocol) {
+ case "Soap": return GenerateHttpSoapMessage (port, obin, oper, msg);
+ case "HttpGet": return GenerateHttpGetMessage (port, obin, oper, msg);
+ case "HttpPost": return GenerateHttpPostMessage (port, obin, oper, msg);
+ }
+ return "Unknown protocol";
+ }
+
+ public string GenerateHttpSoapMessage (Port port, OperationBinding obin, Operation oper, OperationMessage msg)
+ {
+ string req = "";
+
+ if (msg is OperationInput)
+ {
+ SoapAddressBinding sab = port.Extensions.Find (typeof(SoapAddressBinding)) as SoapAddressBinding;
+ SoapOperationBinding sob = obin.Extensions.Find (typeof(SoapOperationBinding)) as SoapOperationBinding;
+ req += "POST " + new Uri (sab.Location).AbsolutePath + "\n";
+ req += "SOAPAction: " + sob.SoapAction + "\n";
+ req += "Content-Type: text/xml; charset=utf-8\n";
+ req += "Content-Length: " + GetLiteral ("string") + "\n";
+ req += "Host: " + GetLiteral ("string") + "\n\n";
+ }
+ else
+ {
+ req += "HTTP/1.0 200 OK\n";
+ req += "Content-Type: text/xml; charset=utf-8\n";
+ req += "Content-Length: " + GetLiteral ("string") + "\n\n";
+ }
+
+ req += GenerateSoapMessage (obin, oper, msg);
+ return req;
+ }
+
+ public string GenerateHttpGetMessage (Port port, OperationBinding obin, Operation oper, OperationMessage msg)
+ {
+ string req = "";
+
+ if (msg is OperationInput)
+ {
+ HttpAddressBinding sab = port.Extensions.Find (typeof(HttpAddressBinding)) as HttpAddressBinding;
+ HttpOperationBinding sob = obin.Extensions.Find (typeof(HttpOperationBinding)) as HttpOperationBinding;
+ string location = new Uri (sab.Location).AbsolutePath + sob.Location + "?" + BuildQueryString (msg);
+ req += "GET " + location + "\n";
+ req += "Host: " + GetLiteral ("string");
+ }
+ else
+ {
+ req += "HTTP/1.0 200 OK\n";
+ req += "Content-Type: text/xml; charset=utf-8\n";
+ req += "Content-Length: " + GetLiteral ("string") + "\n\n";
+
+ MimeXmlBinding mxb = (MimeXmlBinding) obin.Output.Extensions.Find (typeof(MimeXmlBinding)) as MimeXmlBinding;
+ if (mxb == null) return req;
+
+ Message message = descriptions.GetMessage (msg.Message);
+ XmlQualifiedName ename = null;
+ foreach (MessagePart part in message.Parts)
+ if (part.Name == mxb.Part) ename = part.Element;
+
+ if (ename == null) return req + GetLiteral("string");
+
+ StringWriter sw = new StringWriter ();
+ XmlTextWriter xtw = new XmlTextWriter (sw);
+ xtw.Formatting = Formatting.Indented;
+ currentUse = SoapBindingUse.Literal;
+ WriteRootElementSample (xtw, ename);
+ xtw.Close ();
+ req += sw.ToString ();
+ }
+
+ return req;
+ }
+
+ public string GenerateHttpPostMessage (Port port, OperationBinding obin, Operation oper, OperationMessage msg)
+ {
+ string req = "";
+
+ if (msg is OperationInput)
+ {
+ HttpAddressBinding sab = port.Extensions.Find (typeof(HttpAddressBinding)) as HttpAddressBinding;
+ HttpOperationBinding sob = obin.Extensions.Find (typeof(HttpOperationBinding)) as HttpOperationBinding;
+ string location = new Uri (sab.Location).AbsolutePath + sob.Location;
+ req += "POST " + location + "\n";
+ req += "Content-Type: application/x-www-form-urlencoded\n";
+ req += "Content-Length: " + GetLiteral ("string") + "\n";
+ req += "Host: " + GetLiteral ("string") + "\n\n";
+ req += BuildQueryString (msg);
+ }
+ else return GenerateHttpGetMessage (port, obin, oper, msg);
+
+ return req;
+ }
+
+ string BuildQueryString (OperationMessage opm)
+ {
+ string s = "";
+ Message msg = descriptions.GetMessage (opm.Message);
+ foreach (MessagePart part in msg.Parts)
+ {
+ if (s.Length != 0) s += "&";
+ s += part.Name + "=" + GetLiteral (part.Type.Name);
+ }
+ return s;
+ }
+
+ public string GenerateSoapMessage (OperationBinding obin, Operation oper, OperationMessage msg)
+ {
+ SoapOperationBinding sob = obin.Extensions.Find (typeof(SoapOperationBinding)) as SoapOperationBinding;
+ SoapBindingStyle style = (sob != null) ? sob.Style : SoapBindingStyle.Document;
+
+ MessageBinding msgbin = (msg is OperationInput) ? (MessageBinding) obin.Input : (MessageBinding)obin.Output;
+ SoapBodyBinding sbb = msgbin.Extensions.Find (typeof(SoapBodyBinding)) as SoapBodyBinding;
+ SoapBindingUse bodyUse = (sbb != null) ? sbb.Use : SoapBindingUse.Literal;
+
+ StringWriter sw = new StringWriter ();
+ XmlTextWriter xtw = new XmlTextWriter (sw);
+ xtw.Formatting = Formatting.Indented;
+
+ xtw.WriteStartDocument ();
+ xtw.WriteStartElement ("soap", "Envelope", SoapEnvelopeNamespace);
+ xtw.WriteAttributeString ("xmlns", "xsi", null, XmlSchema.InstanceNamespace);
+ xtw.WriteAttributeString ("xmlns", "xsd", null, XmlSchema.Namespace);
+
+ if (bodyUse == SoapBindingUse.Encoded)
+ {
+ xtw.WriteAttributeString ("xmlns", "soapenc", null, SoapEncodingNamespace);
+ xtw.WriteAttributeString ("xmlns", "tns", null, msg.Message.Namespace);
+ }
+
+ // Serialize headers
+ foreach (object ob in msgbin.Extensions)
+ {
+ SoapHeaderBinding hb = ob as SoapHeaderBinding;
+ if (hb == null) continue;
+
+ xtw.WriteStartElement ("soap", "Header", SoapEnvelopeNamespace);
+ WriteHeader (xtw, hb);
+ xtw.WriteEndElement ();
+ }
+
+ // Serialize body
+ xtw.WriteStartElement ("soap", "Body", SoapEnvelopeNamespace);
+
+ currentUse = bodyUse;
+ WriteBody (xtw, oper, msg, sbb, style);
+
+ xtw.WriteEndElement ();
+ xtw.WriteEndElement ();
+ xtw.Close ();
+ return sw.ToString ();
+ }
+
+ void WriteHeader (XmlTextWriter xtw, SoapHeaderBinding header)
+ {
+ Message msg = descriptions.GetMessage (header.Message);
+ if (msg == null) throw new InvalidOperationException ("Message " + header.Message + " not found");
+ MessagePart part = msg.Parts [header.Part];
+ if (part == null) throw new InvalidOperationException ("Message part " + header.Part + " not found in message " + header.Message);
+
+ currentUse = header.Use;
+
+ if (currentUse == SoapBindingUse.Literal)
+ WriteRootElementSample (xtw, part.Element);
+ else
+ WriteTypeSample (xtw, part.Type);
+ }
+
+ void WriteBody (XmlTextWriter xtw, Operation oper, OperationMessage opm, SoapBodyBinding sbb, SoapBindingStyle style)
+ {
+ Message msg = descriptions.GetMessage (opm.Message);
+ if (msg.Parts.Count > 0 && msg.Parts[0].Name == "parameters")
+ {
+ MessagePart part = msg.Parts[0];
+ if (part.Element == XmlQualifiedName.Empty)
+ WriteTypeSample (xtw, part.Type);
+ else
+ WriteRootElementSample (xtw, part.Element);
+ }
+ else
+ {
+ string elemName = oper.Name;
+ string ns = "";
+ if (opm is OperationOutput) elemName += "Response";
+
+ if (style == SoapBindingStyle.Rpc) {
+ xtw.WriteStartElement (elemName, sbb.Namespace);
+ ns = sbb.Namespace;
+ }
+
+ foreach (MessagePart part in msg.Parts)
+ {
+ if (part.Element == XmlQualifiedName.Empty)
+ {
+ XmlSchemaElement elem = new XmlSchemaElement ();
+ elem.SchemaTypeName = part.Type;
+ elem.Name = part.Name;
+ WriteElementSample (xtw, ns, elem);
+ }
+ else
+ WriteRootElementSample (xtw, part.Element);
+ }
+
+ if (style == SoapBindingStyle.Rpc)
+ xtw.WriteEndElement ();
+ }
+ WriteQueuedTypeSamples (xtw);
+ }
+
+ void WriteRootElementSample (XmlTextWriter xtw, XmlQualifiedName qname)
+ {
+ XmlSchemaElement elem = (XmlSchemaElement) schemas.Find (qname, typeof(XmlSchemaElement));
+ if (elem == null) throw new InvalidOperationException ("Element not found: " + qname);
+ WriteElementSample (xtw, qname.Namespace, elem);
+ }
+
+ void WriteElementSample (XmlTextWriter xtw, string ns, XmlSchemaElement elem)
+ {
+ bool sharedAnnType = false;
+ XmlQualifiedName root;
+
+ if (!elem.RefName.IsEmpty) {
+ XmlSchemaElement refElem = FindRefElement (elem);
+ if (refElem == null) throw new InvalidOperationException ("Global element not found: " + elem.RefName);
+ root = elem.RefName;
+ elem = refElem;
+ sharedAnnType = true;
+ }
+ else
+ root = new XmlQualifiedName (elem.Name, ns);
+
+ if (!elem.SchemaTypeName.IsEmpty)
+ {
+ XmlSchemaComplexType st = FindComplexTyype (elem.SchemaTypeName);
+ if (st != null)
+ WriteComplexTypeSample (xtw, st, root);
+ else
+ {
+ xtw.WriteStartElement (root.Name, root.Namespace);
+ if (currentUse == SoapBindingUse.Encoded)
+ xtw.WriteAttributeString ("type", XmlSchema.InstanceNamespace, GetQualifiedNameString (xtw, elem.SchemaTypeName));
+ xtw.WriteString (GetLiteral (FindBuiltInType (elem.SchemaTypeName)));
+ xtw.WriteEndElement ();
+ }
+ }
+ else if (elem.SchemaType == null)
+ {
+ xtw.WriteStartElement ("any");
+ xtw.WriteEndElement ();
+ }
+ else
+ WriteComplexTypeSample (xtw, (XmlSchemaComplexType) elem.SchemaType, root);
+ }
+
+ void WriteTypeSample (XmlTextWriter xtw, XmlQualifiedName qname)
+ {
+ XmlSchemaComplexType ctype = FindComplexTyype (qname);
+ if (ctype != null) {
+ WriteComplexTypeSample (xtw, ctype, qname);
+ return;
+ }
+
+ XmlSchemaSimpleType stype = (XmlSchemaSimpleType) schemas.Find (qname, typeof(XmlSchemaSimpleType));
+ if (stype != null) {
+ WriteSimpleTypeSample (xtw, stype);
+ return;
+ }
+
+ xtw.WriteString (GetLiteral (FindBuiltInType (qname)));
+ throw new InvalidOperationException ("Type not found: " + qname);
+ }
+
+ void WriteComplexTypeSample (XmlTextWriter xtw, XmlSchemaComplexType stype, XmlQualifiedName rootName)
+ {
+ WriteComplexTypeSample (xtw, stype, rootName, -1);
+ }
+
+ void WriteComplexTypeSample (XmlTextWriter xtw, XmlSchemaComplexType stype, XmlQualifiedName rootName, int id)
+ {
+ string ns = rootName.Namespace;
+
+ if (rootName.Name.IndexOf ("[]") != -1) rootName = arrayType;
+
+ if (currentUse == SoapBindingUse.Encoded) {
+ string pref = xtw.LookupPrefix (rootName.Namespace);
+ if (pref == null) pref = "q1";
+ xtw.WriteStartElement (pref, rootName.Name, rootName.Namespace);
+ ns = "";
+ }
+ else
+ xtw.WriteStartElement (rootName.Name, rootName.Namespace);
+
+ if (id != -1)
+ {
+ xtw.WriteAttributeString ("id", "id" + id);
+ if (rootName != arrayType)
+ xtw.WriteAttributeString ("type", XmlSchema.InstanceNamespace, GetQualifiedNameString (xtw, rootName));
+ }
+
+ WriteComplexTypeAttributes (xtw, stype);
+ WriteComplexTypeElements (xtw, ns, stype);
+
+ xtw.WriteEndElement ();
+ }
+
+ void WriteComplexTypeAttributes (XmlTextWriter xtw, XmlSchemaComplexType stype)
+ {
+ WriteAttributes (xtw, stype.Attributes, stype.AnyAttribute);
+ }
+
+ void WriteComplexTypeElements (XmlTextWriter xtw, string ns, XmlSchemaComplexType stype)
+ {
+ if (stype.Particle != null)
+ WriteParticleComplexContent (xtw, ns, stype.Particle);
+ else
+ {
+ if (stype.ContentModel is XmlSchemaSimpleContent)
+ WriteSimpleContent (xtw, (XmlSchemaSimpleContent)stype.ContentModel);
+ else if (stype.ContentModel is XmlSchemaComplexContent)
+ WriteComplexContent (xtw, ns, (XmlSchemaComplexContent)stype.ContentModel);
+ }
+ }
+
+ void WriteAttributes (XmlTextWriter xtw, XmlSchemaObjectCollection atts, XmlSchemaAnyAttribute anyat)
+ {
+ foreach (XmlSchemaObject at in atts)
+ {
+ if (at is XmlSchemaAttribute)
+ {
+ string ns;
+ XmlSchemaAttribute attr = (XmlSchemaAttribute)at;
+ XmlSchemaAttribute refAttr = attr;
+
+ // refAttr.Form; TODO
+
+ if (!attr.RefName.IsEmpty) {
+ refAttr = FindRefAttribute (attr.RefName);
+ if (refAttr == null) throw new InvalidOperationException ("Global attribute not found: " + attr.RefName);
+ }
+
+ string val;
+ if (!refAttr.SchemaTypeName.IsEmpty) val = FindBuiltInType (refAttr.SchemaTypeName);
+ else val = FindBuiltInType ((XmlSchemaSimpleType) refAttr.SchemaType);
+
+ xtw.WriteAttributeString (refAttr.Name, val);
+ }
+ else if (at is XmlSchemaAttributeGroupRef)
+ {
+ XmlSchemaAttributeGroupRef gref = (XmlSchemaAttributeGroupRef)at;
+ XmlSchemaAttributeGroup grp = (XmlSchemaAttributeGroup) schemas.Find (gref.RefName, typeof(XmlSchemaAttributeGroup));
+ WriteAttributes (xtw, grp.Attributes, grp.AnyAttribute);
+ }
+ }
+
+ if (anyat != null)
+ xtw.WriteAttributeString ("custom-attribute","value");
+ }
+
+ void WriteParticleComplexContent (XmlTextWriter xtw, string ns, XmlSchemaParticle particle)
+ {
+ WriteParticleContent (xtw, ns, particle, false);
+ }
+
+ void WriteParticleContent (XmlTextWriter xtw, string ns, XmlSchemaParticle particle, bool multiValue)
+ {
+ if (particle is XmlSchemaGroupRef)
+ particle = GetRefGroupParticle ((XmlSchemaGroupRef)particle);
+
+ if (particle.MaxOccurs > 1) multiValue = true;
+
+ if (particle is XmlSchemaSequence) {
+ WriteSequenceContent (xtw, ns, ((XmlSchemaSequence)particle).Items, multiValue);
+ }
+ else if (particle is XmlSchemaChoice) {
+ if (((XmlSchemaChoice)particle).Items.Count == 1)
+ WriteSequenceContent (xtw, ns, ((XmlSchemaChoice)particle).Items, multiValue);
+ else
+ WriteChoiceContent (xtw, ns, (XmlSchemaChoice)particle, multiValue);
+ }
+ else if (particle is XmlSchemaAll) {
+ WriteSequenceContent (xtw, ns, ((XmlSchemaAll)particle).Items, multiValue);
+ }
+ }
+
+ void WriteSequenceContent (XmlTextWriter xtw, string ns, XmlSchemaObjectCollection items, bool multiValue)
+ {
+ foreach (XmlSchemaObject item in items)
+ WriteContentItem (xtw, ns, item, multiValue);
+ }
+
+ void WriteContentItem (XmlTextWriter xtw, string ns, XmlSchemaObject item, bool multiValue)
+ {
+ if (item is XmlSchemaGroupRef)
+ item = GetRefGroupParticle ((XmlSchemaGroupRef)item);
+
+ if (item is XmlSchemaElement)
+ {
+ XmlSchemaElement elem = (XmlSchemaElement) item;
+ XmlSchemaElement refElem;
+ if (!elem.RefName.IsEmpty) refElem = FindRefElement (elem);
+ else refElem = elem;
+
+ int num = (elem.MaxOccurs == 1 && !multiValue) ? 1 : 2;
+ for (int n=0; n<num; n++)
+ {
+ if (currentUse == SoapBindingUse.Literal)
+ WriteElementSample (xtw, ns, refElem);
+ else
+ WriteRefTypeSample (xtw, ns, refElem);
+ }
+ }
+ else if (item is XmlSchemaAny)
+ {
+ xtw.WriteStartElement ("any"); xtw.WriteEndElement ();
+ if (multiValue) {
+ xtw.WriteStartElement ("any"); xtw.WriteEndElement ();
+ }
+ }
+ else if (item is XmlSchemaParticle) {
+ WriteParticleContent (xtw, ns, (XmlSchemaParticle)item, multiValue);
+ }
+ }
+
+ void WriteChoiceContent (XmlTextWriter xtw, string ns, XmlSchemaChoice choice, bool multiValue)
+ {
+ foreach (XmlSchemaObject item in choice.Items)
+ WriteContentItem (xtw, ns, item, multiValue);
+ }
+
+ void WriteSimpleContent (XmlTextWriter xtw, XmlSchemaSimpleContent content)
+ {
+ XmlSchemaSimpleContentExtension ext = content.Content as XmlSchemaSimpleContentExtension;
+ if (ext != null)
+ WriteAttributes (xtw, ext.Attributes, ext.AnyAttribute);
+
+ XmlQualifiedName qname = GetContentBaseType (content.Content);
+ xtw.WriteString (GetLiteral (FindBuiltInType (qname)));
+ }
+
+ string FindBuiltInType (XmlQualifiedName qname)
+ {
+ if (qname.Namespace == XmlSchema.Namespace)
+ return qname.Name;
+
+ XmlSchemaComplexType ct = FindComplexTyype (qname);
+ if (ct != null)
+ {
+ XmlSchemaSimpleContent sc = ct.ContentModel as XmlSchemaSimpleContent;
+ if (sc == null) throw new InvalidOperationException ("Invalid schema");
+ return FindBuiltInType (GetContentBaseType (sc.Content));
+ }
+
+ XmlSchemaSimpleType st = (XmlSchemaSimpleType) schemas.Find (qname, typeof(XmlSchemaSimpleType));
+ if (st != null)
+ return FindBuiltInType (st);
+
+ throw new InvalidOperationException ("Definition of type " + qname + " not found");
+ }
+
+ string FindBuiltInType (XmlSchemaSimpleType st)
+ {
+ if (st.Content is XmlSchemaSimpleTypeRestriction) {
+ return FindBuiltInType (GetContentBaseType (st.Content));
+ }
+ else if (st.Content is XmlSchemaSimpleTypeList) {
+ string s = FindBuiltInType (GetContentBaseType (st.Content));
+ return s + " " + s + " ...";
+ }
+ else if (st.Content is XmlSchemaSimpleTypeUnion)
+ {
+ // Check if all types of the union are equal. If not, then will use anyType.
+ XmlSchemaSimpleTypeUnion uni = (XmlSchemaSimpleTypeUnion) st.Content;
+ string utype = null;
+
+ // Anonymous types are unique
+ if (uni.BaseTypes.Count != 0 && uni.MemberTypes.Length != 0)
+ return "string";
+
+ foreach (XmlQualifiedName mt in uni.MemberTypes)
+ {
+ string qn = FindBuiltInType (mt);
+ if (utype != null && qn != utype) return "string";
+ else utype = qn;
+ }
+ return utype;
+ }
+ else
+ return "string";
+ }
+
+
+ XmlQualifiedName GetContentBaseType (XmlSchemaObject ob)
+ {
+ if (ob is XmlSchemaSimpleContentExtension)
+ return ((XmlSchemaSimpleContentExtension)ob).BaseTypeName;
+ else if (ob is XmlSchemaSimpleContentRestriction)
+ return ((XmlSchemaSimpleContentRestriction)ob).BaseTypeName;
+ else if (ob is XmlSchemaSimpleTypeRestriction)
+ return ((XmlSchemaSimpleTypeRestriction)ob).BaseTypeName;
+ else if (ob is XmlSchemaSimpleTypeList)
+ return ((XmlSchemaSimpleTypeList)ob).ItemTypeName;
+ else
+ return null;
+ }
+
+ void WriteComplexContent (XmlTextWriter xtw, string ns, XmlSchemaComplexContent content)
+ {
+ XmlQualifiedName qname;
+
+ XmlSchemaComplexContentExtension ext = content.Content as XmlSchemaComplexContentExtension;
+ if (ext != null) qname = ext.BaseTypeName;
+ else {
+ XmlSchemaComplexContentRestriction rest = (XmlSchemaComplexContentRestriction)content.Content;
+ qname = rest.BaseTypeName;
+ if (qname == arrayType) {
+ ParseArrayType (rest, out qname);
+ XmlSchemaElement elem = new XmlSchemaElement ();
+ elem.Name = "Item";
+ elem.SchemaTypeName = qname;
+
+ xtw.WriteAttributeString ("arrayType", SoapEncodingNamespace, qname.Name + "[2]");
+ WriteContentItem (xtw, ns, elem, true);
+ return;
+ }
+ }
+
+ // Add base map members to this map
+ XmlSchemaComplexType ctype = FindComplexTyype (qname);
+ WriteComplexTypeAttributes (xtw, ctype);
+
+ if (ext != null) {
+ // Add the members of this map
+ WriteAttributes (xtw, ext.Attributes, ext.AnyAttribute);
+ if (ext.Particle != null)
+ WriteParticleComplexContent (xtw, ns, ext.Particle);
+ }
+
+ WriteComplexTypeElements (xtw, ns, ctype);
+ }
+
+ void ParseArrayType (XmlSchemaComplexContentRestriction rest, out XmlQualifiedName qtype)
+ {
+ XmlSchemaAttribute arrayTypeAt = FindArrayAttribute (rest.Attributes);
+ XmlAttribute[] uatts = arrayTypeAt.UnhandledAttributes;
+ if (uatts == null || uatts.Length == 0) throw new InvalidOperationException ("arrayType attribute not specified in array declaration");
+
+ XmlAttribute xat = null;
+ foreach (XmlAttribute at in uatts)
+ if (at.LocalName == "arrayType" && at.NamespaceURI == WsdlNamespace)
+ { xat = at; break; }
+
+ if (xat == null)
+ throw new InvalidOperationException ("arrayType attribute not specified in array declaration");
+
+ string arrayType = xat.Value;
+ string type, ns;
+ int i = arrayType.LastIndexOf (":");
+ if (i == -1) ns = "";
+ else ns = arrayType.Substring (0,i);
+
+ int j = arrayType.IndexOf ("[", i+1);
+ if (j == -1) throw new InvalidOperationException ("Cannot parse WSDL array type: " + arrayType);
+ type = arrayType.Substring (i+1);
+ type = type.Substring (0, type.Length-2);
+
+ qtype = new XmlQualifiedName (type, ns);
+ }
+
+ XmlSchemaAttribute FindArrayAttribute (XmlSchemaObjectCollection atts)
+ {
+ foreach (object ob in atts)
+ {
+ XmlSchemaAttribute att = ob as XmlSchemaAttribute;
+ if (att != null && att.RefName == arrayTypeRefName) return att;
+
+ XmlSchemaAttributeGroupRef gref = ob as XmlSchemaAttributeGroupRef;
+ if (gref != null)
+ {
+ XmlSchemaAttributeGroup grp = (XmlSchemaAttributeGroup) schemas.Find (gref.RefName, typeof(XmlSchemaAttributeGroup));
+ att = FindArrayAttribute (grp.Attributes);
+ if (att != null) return att;
+ }
+ }
+ return null;
+ }
+
+ void WriteSimpleTypeSample (XmlTextWriter xtw, XmlSchemaSimpleType stype)
+ {
+ xtw.WriteString (GetLiteral (FindBuiltInType (stype)));
+ }
+
+ XmlSchemaParticle GetRefGroupParticle (XmlSchemaGroupRef refGroup)
+ {
+ XmlSchemaGroup grp = (XmlSchemaGroup) schemas.Find (refGroup.RefName, typeof (XmlSchemaGroup));
+ return grp.Particle;
+ }
+
+ XmlSchemaElement FindRefElement (XmlSchemaElement elem)
+ {
+ if (elem.RefName.Namespace == XmlSchema.Namespace)
+ {
+ if (anyElement != null) return anyElement;
+ anyElement = new XmlSchemaElement ();
+ anyElement.Name = "any";
+ anyElement.SchemaTypeName = anyType;
+ return anyElement;
+ }
+ return (XmlSchemaElement) schemas.Find (elem.RefName, typeof(XmlSchemaElement));
+ }
+
+ XmlSchemaAttribute FindRefAttribute (XmlQualifiedName refName)
+ {
+ if (refName.Namespace == XmlSchema.Namespace)
+ {
+ XmlSchemaAttribute at = new XmlSchemaAttribute ();
+ at.Name = refName.Name;
+ at.SchemaTypeName = new XmlQualifiedName ("string",XmlSchema.Namespace);
+ return at;
+ }
+ return (XmlSchemaAttribute) schemas.Find (refName, typeof(XmlSchemaAttribute));
+ }
+
+ void WriteRefTypeSample (XmlTextWriter xtw, string ns, XmlSchemaElement elem)
+ {
+ if (elem.SchemaTypeName.Namespace == XmlSchema.Namespace || schemas.Find (elem.SchemaTypeName, typeof(XmlSchemaSimpleType)) != null)
+ WriteElementSample (xtw, ns, elem);
+ else
+ {
+ xtw.WriteStartElement (elem.Name, ns);
+ xtw.WriteAttributeString ("href", "#id" + (queue.Count+1));
+ xtw.WriteEndElement ();
+ queue.Add (new EncodedType (ns, elem));
+ }
+ }
+
+ void WriteQueuedTypeSamples (XmlTextWriter xtw)
+ {
+ for (int n=0; n<queue.Count; n++)
+ {
+ EncodedType ec = (EncodedType) queue[n];
+ XmlSchemaComplexType st = FindComplexTyype (ec.Element.SchemaTypeName);
+ WriteComplexTypeSample (xtw, st, ec.Element.SchemaTypeName, n+1);
+ }
+ }
+
+ XmlSchemaComplexType FindComplexTyype (XmlQualifiedName qname)
+ {
+ if (qname.Name.IndexOf ("[]") != -1)
+ {
+ XmlSchemaComplexType stype = new XmlSchemaComplexType ();
+ stype.ContentModel = new XmlSchemaComplexContent ();
+
+ XmlSchemaComplexContentRestriction res = new XmlSchemaComplexContentRestriction ();
+ stype.ContentModel.Content = res;
+ res.BaseTypeName = arrayType;
+
+ XmlSchemaAttribute att = new XmlSchemaAttribute ();
+ att.RefName = arrayTypeRefName;
+ res.Attributes.Add (att);
+
+ XmlAttribute xat = document.CreateAttribute ("arrayType", WsdlNamespace);
+ xat.Value = qname.Namespace + ":" + qname.Name;
+ att.UnhandledAttributes = new XmlAttribute[] {xat};
+ return stype;
+ }
+
+ return (XmlSchemaComplexType) schemas.Find (qname, typeof(XmlSchemaComplexType));
+ }
+
+ string GetQualifiedNameString (XmlTextWriter xtw, XmlQualifiedName qname)
+ {
+ string pref = xtw.LookupPrefix (qname.Namespace);
+ if (pref != null) return pref + ":" + qname.Name;
+
+ xtw.WriteAttributeString ("xmlns", "q1", null, qname.Namespace);
+ return "q1:" + qname.Name;
+ }
+
+ protected virtual string GetLiteral (string s)
+ {
+ return s;
+ }
+
+ void GetOperationFormat (OperationBinding obin, out SoapBindingStyle style, out SoapBindingUse use)
+ {
+ style = SoapBindingStyle.Document;
+ use = SoapBindingUse.Literal;
+ SoapOperationBinding sob = obin.Extensions.Find (typeof(SoapOperationBinding)) as SoapOperationBinding;
+ if (sob != null) {
+ style = sob.Style;
+ SoapBodyBinding sbb = obin.Input.Extensions.Find (typeof(SoapBodyBinding)) as SoapBodyBinding;
+ if (sbb != null)
+ use = sbb.Use;
+ }
+ }
+ }
+
+
+
+
+
</script>
<head>
+ <link rel="alternate" type="text/xml" href="<%=Request.FilePath%>?disco"/>
+
<title><%=WebServiceName%> Web Service</title>
<style type="text/css">
BODY { font-family: Arial; margin-left: 20px; margin-top: 20px; font-size: x-small}
@@ -714,6 +1524,7 @@ class Parameter
.code-vb { font-size:10pt; font-family:courier }
.tabLabelOn { font-weight:bold }
.tabLabelOff {color: darkgray }
+ .literal-placeholder {color: darkblue; font-weight:bold}
A:link { color: black; }
A:visited { color: black; }
A:active { color: black; }
@@ -831,6 +1642,11 @@ function clearForm ()
<br>Supported protocols: <%#CurrentOperationProtocols%>
<% } %>
+<!--
+ **********************************************************
+ Operation description - Test form
+-->
+
<% if (CurrentTab == "test") {
if (CurrentOperationSupportsTest) {%>
Enter values for the parameters and click the 'Invoke' button to test this method:<br><br>
@@ -860,8 +1676,42 @@ function clearForm ()
The test form is not available for this operation because it has parameters with a complex structure.
<% } %>
<% } %>
+
+<!--
+ **********************************************************
+ Operation description - Message Layout
+-->
+
<% if (CurrentTab == "msg") { %>
- TODO
+
+ The following are sample SOAP requests and responses for each protocol supported by this method:
+ <br/><br/>
+
+ <% if (IsOperationSupported ("Soap")) { %>
+ <span class="label">Soap</span>
+ <br/><br/>
+ <div class="codePanel"><div class="code-xml"><%#GenerateOperationMessages ("Soap", true)%></div></div>
+ <br/>
+ <div class="codePanel"><div class="code-xml"><%#GenerateOperationMessages ("Soap", false)%></div></div>
+ <br/>
+ <% } %>
+ <% if (IsOperationSupported ("HttpGet")) { %>
+ <span class="label">HTTP Get</span>
+ <br/><br/>
+ <div class="codePanel"><div class="code-xml"><%#GenerateOperationMessages ("HttpGet", true)%></div></div>
+ <br/>
+ <div class="codePanel"><div class="code-xml"><%#GenerateOperationMessages ("HttpGet", false)%></div></div>
+ <br/>
+ <% } %>
+ <% if (IsOperationSupported ("HttpPost")) { %>
+ <span class="label">HTTP Post</span>
+ <br/><br/>
+ <div class="codePanel"><div class="code-xml"><%#GenerateOperationMessages ("HttpPost", true)%></div></div>
+ <br/>
+ <div class="codePanel"><div class="code-xml"><%#GenerateOperationMessages ("HttpPost", false)%></div></div>
+ <br/>
+ <% } %>
+
<% } %>
<%}%>
diff --git a/data/Makefile.am b/data/Makefile.am
index 41069f4678f..c04d80abe76 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -5,7 +5,7 @@ EXTRA_DIST = config.in \
DefaultWsdlHelpGenerator.aspx \
browscap.ini.gz
-mono_DATA = config.in \
+mono_DATA = config \
machine.config \
DefaultWsdlHelpGenerator.aspx \
browscap.ini
diff --git a/data/browscap.ini.gz b/data/browscap.ini.gz
index b84fbc0047d..129ddf2f272 100644
--- a/data/browscap.ini.gz
+++ b/data/browscap.ini.gz
Binary files differ
diff --git a/data/machine.config b/data/machine.config
index 05bc745d582..b3bf1b20e93 100644
--- a/data/machine.config
+++ b/data/machine.config
@@ -21,6 +21,8 @@
type="System.Web.Configuration.GlobalizationConfigurationHandler, System.Web" />
<section name="sessionState"
type="System.Web.SessionState.SessionStateSectionHandler, System.Web" />
+ <section name="trace"
+ type="System.Web.Configuration.TraceConfigurationHandler, System.Web" />
<section name="webServices"
type="System.Web.Services.Configuration.WebServicesConfigurationSectionHandler, System.Web.Services" />
<section name="webControls"
@@ -29,6 +31,10 @@
type="System.Web.Configuration.CompilationConfigurationHandler, System.Web" />
<section name="httpRuntime"
type="System.Web.Configuration.HttpRuntimeConfigurationHandler, System.Web" />
+ <section name="customErrors"
+ type="System.Web.Configuration.CustomErrorsConfigHandler, System.Web" />
+ <section name="pages"
+ type="System.Web.Configuration.PagesConfigurationHandler, System.Web" />
</sectionGroup>
<sectionGroup name="system.net">
<section name="settings"
@@ -69,6 +75,7 @@
</system.net>
<system.web>
<httpHandlers>
+ <add verb="*" path="Trace.axd" type="System.Web.Handlers.TraceHandler, System.Web" />
<add verb="*" path="*.aspx" type="System.Web.UI.PageHandlerFactory, System.Web" />
<add verb="*" path="*.asmx" validate="false"
type="System.Web.Services.Protocols.WebServiceHandlerFactory, System.Web.Services" />
@@ -140,6 +147,10 @@
minFreeThreads="8"
minLocalRequestFreeThreads="4"
appRequestQueueLimit="100" />
+ <pages buffer="true"
+ enableSessionState="true"
+ autoEventWireup="true"
+ validateRequest="true" />
</system.web>
<system.runtime.remoting>
diff --git a/doc/ChangeLog b/doc/ChangeLog
new file mode 100755
index 00000000000..608e10e6a23
--- /dev/null
+++ b/doc/ChangeLog
@@ -0,0 +1,16 @@
+2004-01-22 Atsushi Enomoto <atsushi@ximian.com>
+
+ * xml-classes : status update, additional infos.
+
+2004-01-16 Atsushi Enomoto <atsushi@ximian.com>
+
+ * web/commands : Added xml-classes (forgot to commit).
+ * mono-build-w32.sh : Added icu support as well as glib.
+ * ChangeLog : tiny fix
+
+2004-01-11 Atsushi Enomoto <atsushi@ximian.com>
+
+ * xml-classes : added v2 info. schema status updates.
+
+ Added ChangeLog. (There is no reason not to keep ChangeLog for
+ documents, at least for not a little changes ;-)
diff --git a/doc/ado-net b/doc/ado-net
index c78b62edfd1..61cd8bda102 100644
--- a/doc/ado-net
+++ b/doc/ado-net
@@ -47,7 +47,7 @@
<li><a href="http://www.go-mono.com/sqlclient.html">Microsoft SQL Server</a></li>
<li><a href="http://www.go-mono.com/sqlite.html">SQL Lite</a></li>
<li><a href="http://www.go-mono.com/sybase.html">Sybase</a></li>
- <li><a href="http://www.go-mono.com/tdsclient.html">TDS Generic</a></li>
+ <li><a href="http://www.go-mono.com/tdsclient.html">Older Microsoft SQL Server and Sybase databases</a></li>
</ul>
<p>Providers which we do not have, but we would like to have. Currently,
@@ -333,6 +333,12 @@
<td>System.Data /</br> System.Data.SqlClient</td>
<td>SqlTest.cs at</br> System.Data/Test</td>
</tr>
+
+ <tr>
+ <td>PostgreSQL</br> (Npgsql)</td>
+ <td>Npgsql /</br> Npgsql</td>
+ <td>*.cs at</br> Npgsql/Test</td>
+ </tr>
<tr>
<td>PostgreSQL</br> (Mono)</td>
@@ -349,13 +355,13 @@
<tr>
<td>Oracle</br> (Mono)</td>
<td>System.Data.OracleClient /</br> System.Data.OracleClient</td>
- <td>TestOracleClient.cs at</br> System.Data.OracleClient</td>
+ <td>TestOracleClient.cs at</br> System.Data.OracleClient/Test</td>
</tr>
<tr>
<td>ODBC</br> (Mono)</td>
- <td>System.Data.OracleClient /</br> System.Data.OracleClient</td>
- <td>TestOracleClient.cs at</br> System.Data.OracleClient</td>
+ <td>System.Data.Odbc /</br> System.Data</td>
+ <td>OdbcTest.cs (to connect to MS SQL Server)at</br> System.Data/Test</td>
</tr>
</table>
diff --git a/doc/blogs b/doc/blogs
index 4ed29e1010a..1fb66df3c07 100644
--- a/doc/blogs
+++ b/doc/blogs
@@ -21,7 +21,7 @@
<a href="http://primates.ximian.com/~martin/blog/rss.xml"><img align="center" src="images/xml.gif"></a>
<a href="http://primates.ximian.com/~martin/blog/">Martin Baulig</a>
<br>
- <a href="http://primates.ximian.com/~miguel/miguel2.rss"><img align="center" src="images/xml.gif"></a>
+ <a href="http://primates.ximian.com/~miguel/miguel.rss2"><img align="center" src="images/xml.gif"></a>
<a href="http://primates.ximian.com/~miguel/activity-log.php">Miguel de Icaza</a>
<br>
<a href="http://primates.ximian.com/~mkestner/blog/index.rdf"><img align="center" src="images/xml.gif"></a>
diff --git a/doc/books b/doc/books
index 52d454c42b9..00ed239bb73 100644
--- a/doc/books
+++ b/doc/books
@@ -1,10 +1,10 @@
-* Mono Books
+* Mono
<a href="http://www.amazon.de/exec/obidos/ASIN/3827264928/qid=1050051051/sr=2-1/ref=sr_2_3_1/028-2755135-1623712">
Mono: .NET-kompatible Anwendungen mit dem Open Source-Framework
</a>
-* C# Books
+* C#
A Programmer's Introduction to C# - Second Edition: Eric Gunnerson
@@ -16,8 +16,23 @@
* Remoting
- <a href="http://www.dotnetremoting.cc/book/AdvancedDotNetRemoting.asp">
- Advanced .NET Remoting: Ingo Rammer</a>
+ <a href="http://www.dotnetremoting.cc/book/AdvancedDotNetRemoting.asp">Advanced .NET Remoting: Ingo Rammer</a>
+
+* Threading
+
+ .NET Multithreading: Alan L. Dennis (ISBN 1-930110-54-5)
+
+* Web Services
+
+ Web Services: Architecture and Implementation with .NET: Keith Ballinger
+
+* ASP.NET
+
+ Essential ASP.NET with Examples in C# by Fritz Onion
+
+ ASP.NET in a Nutshell by G. Andrew Duthie & Matthew MacDonald
+
+ Programming ASP.NET by Jessy Liberty & Dan Hurtwitz
* Compiler Implementation
@@ -31,10 +46,6 @@
A Retargetable C Compiler - Design and Implementation: C. Fraser, David
Hanson
-* Threading
-
- .NET Multithreading: Alan L. Dennis (ISBN 1-930110-54-5)
-
* Reference Manuals
<a
diff --git a/doc/bugs b/doc/bugs
index 0fd50035fea..baf2bd5d7f6 100644
--- a/doc/bugs
+++ b/doc/bugs
@@ -19,9 +19,16 @@
* <a href="http://bugzilla.ximian.com/buglist.cgi?product=gtk%23&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&email1=&emailtype1=substring&emailassigned_to1=1&email2=&emailtype2=substring&emailreporter2=1&changedin=&chfieldfrom=&chfieldto=Now&chfieldvalue=&short_desc=&short_desc_type=substring&long_desc=&long_desc_type=substring&bug_file_loc=&bug_file_loc_type=substring&keywords=&keywords_type=anywords&op_sys_details=&op_sys_details_type=substring&version_details=&version_details_type=substring&cmdtype=doit&newqueryname=&order=Reuse+same+sort+as+last+time&form_name=query">[Query]</a> <a href="http://bugzilla.ximian.com/enter_bug.cgi?product=gtk%23">[Add]</a> Gtk#
+ * <a href="http://bugzilla.ximian.com/buglist.cgi?product=Mono%2FClass+Libraries&component=System.Web&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&email1=&emailtype1=substring&emailassigned_to1=1&email2=&emailtype2=substring&emailreporter2=1&changedin=&chfieldfrom=&chfieldto=Now&chfieldvalue=&short_desc=&short_desc_type=substring&long_desc=&long_desc_type=substring&bug_file_loc=&bug_file_loc_type=substring&keywords=&keywords_type=anywords&op_sys_details=&op_sys_details_type=substring&version_details=&version_details_type=substring&cmdtype=doit&order=Reuse+same+sort+as+last+time&form_name=query">[Query]</a> <a href="http://bugzilla.ximian.com/enter_bug.cgi?product=Mono%2FClass%20Libraries&component=System.Web">[Add]</a> ASP.NET WebForms
+
+ * <a href="http://bugzilla.ximian.com/buglist.cgi?product=Mono%2FClass+Libraries&component=System.Web.Services&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&email1=&emailtype1=substring&emailassigned_to1=1&email2=&emailtype2=substring&emailreporter2=1&changedin=&chfieldfrom=&chfieldto=Now&chfieldvalue=&short_desc=&short_desc_type=substring&long_desc=&long_desc_type=substring&bug_file_loc=&bug_file_loc_type=substring&keywords=&keywords_type=anywords&op_sys_details=&op_sys_details_type=substring&version_details=&version_details_type=substring&cmdtype=doit&order=Reuse+same+sort+as+last+time&form_name=query">[Query]</a> <a href="http://bugzilla.ximian.com/enter_bug.cgi?product=Mono%2FClass%20Libraries&component=System.Web.Services">[Add]</a> ASP.NET Web Services
+
* <a href="http://bugzilla.ximian.com/buglist.cgi?product=Mono%2FDebugger&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&email1=&emailtype1=substring&emailassigned_to1=1&email2=&emailtype2=substring&emailreporter2=1&changedin=&chfieldfrom=&chfieldto=Now&chfieldvalue=&short_desc=&short_desc_type=substring&long_desc=&long_desc_type=substring&bug_file_loc=&bug_file_loc_type=substring&keywords=&keywords_type=anywords&op_sys_details=&op_sys_details_type=substring&version_details=&version_details_type=substring&cmdtype=doit&newqueryname=&order=Reuse+same+sort+as+last+time&form_name=query">[Query]</a> <a href="http://bugzilla.ximian.com/enter_bug.cgi?product=Mono%2FDebugger">[Add]</a> Debugger.
+ * <a href="http://bugzilla.ximian.com/buglist.cgi?product=Mono+Develop&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&cmdtype=doit&order=Reuse+same+sort+as+last+time&form_name=query">[Query]</a> <a href="http://bugzilla.ximian.com/enter_bug.cgi?product=Mono+Develop">[Add]</a> Mono Develop.
+
* <a href="http://bugzilla.ximian.com/buglist.cgi?product=Mono+Tasks&product=Mono%2FClass+Libraries&product=Mono%2FCompilers&product=Mono%2FDebugger&product=Mono%2FDoctools&product=Mono%2FRuntime&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&email1=&emailtype1=substring&emailassigned_to1=1&email2=&emailtype2=substring&emailreporter2=1&changedin=&chfieldfrom=&chfieldto=Now&chfieldvalue=&short_desc=&short_desc_type=substring&long_desc=&long_desc_type=substring&bug_file_loc=&bug_file_loc_type=substring&keywords=&keywords_type=anywords&op_sys_details=&op_sys_details_type=substring&version_details=&version_details_type=substring&cmdtype=doit&newqueryname=&order=Reuse+same+sort+as+last+time&form_name=query">[Query]</a> All core components.
+
</ul>
<a name="goodbugreport"/>
diff --git a/doc/ccvs b/doc/ccvs
index 7cf37a8f821..85331cec89a 100644
--- a/doc/ccvs
+++ b/doc/ccvs
@@ -262,6 +262,77 @@
cvs commit file-1.cs file-2.cs
</pre>
+* Using SVN
+
+ This is a small tutorial for using SVN (subversion).
+ For a more complete tutorial on subversion, look at
+ <a href="http://svnbook.red-bean.com/">the svn book</a>
+ or <a href="http://subversion.tigris.org">the svn homepage</a>
+
+** Generating a key
+
+ Follow the cvs instructions above.
+
+** Checking out the sources
+
+ To checkout the sources for the first time use the command:
+
+ Note: You should be running 0.35.1 (latest) of svn before attempting
+ anything here.
+
+<pre>
+ svn co svn+ssh://mono-cvs.ximian.com/svn/monodevelop/trunk/MonoDevelop
+</pre>
+
+ If you have a different username on mono-cvs and the local computer
+ you can do the following:
+
+<pre>
+ svn co svn+ssh://username@mono-cvs.ximian.com/svn/monodevelop/trunk/MonoDevelop
+</pre>
+
+ before checking out.
+
+** Updating your sources
+
+ You can update your repository to the latest copy of MonoDevelop by
+ running the following command:
+
+<pre>
+ svn up
+</pre>
+
+ from inside your repository.
+
+** Committing your work
+
+ Before you commit anything, you should first update to the latest
+ sources by following the updating directions. After you are up to date
+ you need to run a:
+
+<pre>
+ svn add filename
+</pre>
+
+ for every file that you have created. You can get a list of these files
+ by running:
+
+<pre>
+ svn status
+</pre>
+
+ After all the files are added, run:
+
+<pre>
+ svn commit
+</pre>
+
+ to commit your changes.
+
+** For more information
+
+ Look at the MonoDevelop website (coming soon)
+
* Keeping track of changes.
We provide two e-mail based mechanisms to keep track of
diff --git a/doc/compiling b/doc/compiling
new file mode 100644
index 00000000000..521945434f1
--- /dev/null
+++ b/doc/compiling
@@ -0,0 +1,235 @@
+* Compiling Mono
+
+ This document describes how to compile and install Mono from
+ its source code. If you are only interested in running Mono,
+ you might want to install Mono from packages, which have been
+ tested.
+
+ The core of Mono is split in two components:
+
+ <ul>
+ * C components (available in the mono package)
+
+ * C# components (available in the mcs package).
+ </ul>
+
+ Mono is also available in various forms:
+
+ <dl>
+ <dt>Officially <a href="download.html">released</a> packages.</dt>
+ <dd>
+ <p>This is the format of choice for people to use, since these
+ have been tested and are known to build and work.
+ </dd>
+ <dt><a href="daily">Daily</a> packages.</dt>
+ <dd>
+ <p>This is a service offered for people who want to try out the
+ daily changes. Baked daily.</dd>
+ <dt>CVS source code.</dt>
+ <dd>
+ <p>These are available to Mono <a href="ccvs.html">developers</a> and
+ also for enthusiasts through <a href="anoncvs.html">anonymous CVS</a>.
+ </dd>
+ <dt>CVS snapshots.</dt>
+ <dd>
+ <p>Available for curious developers which do not necessarily want to
+ install the CVS source. Baked daily.
+ </dd>
+ </dl>
+
+* Compiling the code
+
+ There are a number of ways of compiling Mono
+
+ <ul>
+ <li>From the <a href="#scripts">scripts</A>
+
+ <LI><a href="#install">Manually</a> for the first time.
+
+ <li>Manually, <a href="#upgrade">while upgrading</a> to CVS
+ </ul>
+
+ (which is an easy way to get the latest CVS information)
+
+<a name="scripts">
+* Compiling with scripts
+
+ These scripts should be used for installing from packages, specially
+ on Windows, where dependencies have not always been installed.
+
+ There are scripts to help build mono for both Unix and Windows. Get
+ <a href="mono-build.sh">mono-build.sh</a> for Unix, or <a
+ href="mono-build-w32.sh">mono-build-w32.sh</a> for Windows.
+ These scripts automate the installation of GLIB and pkgconfig
+ (building from source on Unix, and using binary packages
+ provided by the GIMP for Windows project on Windows.) To use
+ the script, follow these simple steps:
+
+ <ul>
+ * Save the script for your platform somewhere (e.g. /usr/local/bin)
+ * Make the script executable (i.e chmod 755 /usr/local/bin/mono-build.sh)
+ * Create a directory to hold the mono source, and the compiled binaries (e.g. mkdir ~/mono)
+ * Change to the new directory (i.e. cd ~/mono)
+ * run the script (i.e. /usr/local/bin/mono-build.sh)
+ </ul>
+
+ The script requires wget on either platform, and building the
+ software requires make, gcc, automake, autoconf, and libtool.
+ You should install these packages from your distribution or
+ with the cygwin installer. You should also take care of setting
+ the right environment variables as the PKG_CONFIG_FLAGS, etc.
+
+ The script will download required packages from
+ www.go-mono.com and do a cvs checkout of mono in the current
+ directory. <b>IMPORTANT!:</b> The cvs server chosen defaults to
+ anonymous cvs;
+ set your CVSROOT environment variable before running the script to
+ select a particular cvs server.
+
+<a name="install">
+
+** Building the software manually
+
+ You will need to obtain the Mono dependencies first: <a
+ href="http://www.gtk.org">glib 2.x</a> and
+ <a href="http://www.freedesktop.org/software/pkgconfig">pkg-config</a>.
+
+*** Building From Packages
+
+ This applies to both the officially released packages, as well as the
+ daily tarball packages.
+
+ <ul>
+ Unpack the Mono runtime distribution:
+ <pre class="shell">
+ tar xzvf mono-X.XX.tar.gz
+ cd mono-X.XX</pre>
+ <p>
+
+ Then configure, compile and install:
+
+ <pre class="shell">
+ ./configure --prefix=/usr/local
+ make
+ make install</pre>
+
+ This will give you a runtime, C# compiler and runtime
+ libraries.
+
+ If you want to recompile the runtime and the compiler,
+ follow these steps, first unpack the MCS package:
+
+ <pre class="shell">
+ tar xzvf mcs-X.XX.tar.gz</pre>
+
+ Then use the following command to compile and install:
+
+ <pre class="shell">
+ ./configure --profile=atomic
+ make</pre>
+
+ You can change /usr/local to something else if you want.
+ </ul>
+
+*** Building from CVS
+
+ To upgrade your Mono installation from CVS, it is very
+ important that you update your Mono and MCS modules from CVS
+ at the same time. Failure to do so might result in a
+ problematic installation as the runtime and the class
+ libraries will be out of sync.
+
+ Run the following commands to update your CVS tree (more
+ details in <a href="ccvs.html">Cvs and Mono</a> and the <A
+ href="anoncvs.html">AnonCVS and Mono</a> pages).
+
+ <pre>
+ (cd mono; cvs update -dP .)
+ (cd mcs; cvs update -dP .)
+ </pre>
+
+ Then you can run:
+
+ <pre>
+ (cd mono; make fullbuild)
+ </pre>
+
+ Now you can install the result:
+
+ <pre>
+ (cd mono; make install)
+ </pre>
+
+ Notice that following the above procedure does not require you
+ to manually install the software in the `mcs' directory, as
+ the relevant files will be copied by the `mono' makefiles.
+
+* Software resources and notes
+
+ The required and additional software can be downloaded here:
+
+ * Microsoft's .NET Framework SDK from
+ <a href="http://msdn.microsoft.com/downloads">
+ msdn.microsoft.com/downloads</a>.
+
+ * Cygwin and the GNU Make tools from
+ <a href="http://www.cygwin.com">www.cygwin.com</a>.
+ Some people observed problems with autoconf 2.52. Installing
+ autoconf 2.13 helped in those cases.
+
+ * Precompiled GLIB 2.0 and pkg-config packages (and
+ their dependencies) by the <a href="http://www.gimp.org/~tml/gimp/win32//index.html">GIMP for Windows</a> project from
+ <a href="http://www.go-mono.com/archive/pkgconfig-0.11-20020310.zip">http://www.go-mono.com/archive/pkgconfig-0.11-20020310.zip</a><br>
+ <a href="http://www.go-mono.com/archive/glib-2.0.4-20020703.zip">http://www.go-mono.com/archive/glib-2.0.4-20020703.zip</a> <br>
+ <a href="http://www.go-mono.com/archive/glib-dev-2.0.4-20020703.zip">http://www.go-mono.com/archive/glib-dev-2.0.4-20020703.zip</a> <br>
+ <a href="http://www.go-mono.com/archive/libiconv-1.7.zip">http://www.go-mono.com/archive/libiconv-1.7.zip</a> <br>
+ <a href="http://www.go-mono.com/archive/libiconv-dev-1.7.zip">http://www.go-mono.com/archive/libiconv-dev-1.7-20020101.zip</a> <br>
+ <a href="http://www.go-mono.com/archive/libintl-0.10.40-20020101.zip">http://www.go-mono.com/archive/libintl-0.10.40-20020101.zip</a><br>
+
+
+ * Download the Mono source code from the
+ <a href="download.html">packaged versions</a> or
+ the <a href="http://www.go-mono.com/snapshots">
+ nightly snapshots</a> or the <a href="anoncvs.html">
+ Anonymous CVS</a>. The nightly snapshots are done every
+ night at 10pm EST (Boston Time). The nightly snapshots are
+ not guaranteed to build, but most of the time they should.
+ </ul>
+
+
+*** Notes on compiling GLIB 2.0 and pkg-config from source:
+
+
+ <ul>
+
+ * Some people observed problems with autoconf 2.52. Installing
+ autoconf 2.13 helped in those cases (don't forget to do a
+ `make maintainer-clean' after the update).
+
+ * Download, compile and install <a href="http://www.freedesktop.org/software/pkgconfig">pkg-config</a> from source.
+ (I had to change line 674 of
+ <nobr><tt>pkg-config-0.8.0/glib-1.2.8/gstrfuncs.c</tt></nobr> from
+ <nobr><tt>extern char *strsignal (int sig);</tt></nobr> to
+ <nobr><tt>extern const char *strsignal (int sig);</tt></nobr>.
+
+<pre class="shell">
+tar xzvf pkg-config-0.8.0.tar.gz
+cd pkg-config-0.8.0
+./configure --prefix=/usr
+make
+make install
+</pre>
+
+ * Download, compile and install <a href="ftp://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.7.tar.gz">libiconv</a> from source.<br>
+ If you dont have MS Visual C/C++ 4.0 or 5.0 or 6.0 you can also try
+ the binary package available at <a
+ href="http://www.gimp.org/~tml/gimp/win32/libiconv-1.9.1.bin.woe32.zip">
+ http://www.gimp.org/~tml/gimp/win32/libiconv-1.9.1.bin.woe32.zip</a>
+
+
+ * Download, compile and install the
+ <a href="ftp://ftp.gtk.org/pub/gtk/v2.0/glib-2.0.6.tar.gz">
+ glib 2.0</a> from source.
+
+ </ul>
+
diff --git a/doc/crypto b/doc/crypto
index d89b78cc45c..8080eb67709 100644
--- a/doc/crypto
+++ b/doc/crypto
@@ -138,9 +138,11 @@
* Additional algorithms: MD2, MD4, ARCFOUR (required for SSL)
* Convertion helpers
</ul>
-*** Namespace: Mono.Security.Protocol.Tls
+*** Namespace: Mono.Security.Protocol.*
<ul>
- * An 100% managed TLS implementation from Carlos Guzman Alvarez.
+ * Tls: An 100% managed TLS implementation from Carlos Guzman
+ Alvarez.
+ * Ntlm: NTLM authentication (used for HTTP and SQL Server).
</ul>
*** Namespace: Mono.Security.X509
<ul>
@@ -375,9 +377,8 @@
<b>monodoc</b> as I'm not a very good writer (at least in English).
</ul>
- Contact Sebastien Pouliot (<a href="mailto:spouliot@videotron.ca">home</a>
- , <a href="mailto:spouliot@motus.com">work</a>) if you need additional
- informations about the status of the cryptographic classes.
-
+ Contact <a href="mailto:spouliot@videotron.ca">Sebastien Pouliot</a> if
+ you need additional informations about the status of the cryptographic
+ classes.
<hr>
-Last reviewed: December 15, 2003 (post mono 0.29)
+Last reviewed: January 26, 2004 (post mono 0.29)
diff --git a/doc/download b/doc/download
index 31fbc7ea58d..ffce2efe8dc 100644
--- a/doc/download
+++ b/doc/download
@@ -33,7 +33,7 @@
<li><a href="archive/mono-0.29.tar.gz">Mono Runtime</a>
<li><a href="archive/xsp-0.8.tar.gz">XSP web server (0.8)</a>
<li><a href="archive/mod_mono-0.6.tar.gz">Apache Mono module 0.6 (mod_mono)</a>
- <li><a href="archive/monodoc-0.8.tar.gz">MonoDoc 0.8</a>
+ <li><a href="archive/monodoc-0.9.tar.gz">MonoDoc 0.9</a>
</ul>
</td>
</tr>
@@ -46,9 +46,8 @@
<td>
Packages are available on <a
href="http://www.ximian.com/products/redcarpet/download.html">Red
- Carpet's</a> Mono channel. <p>
- Install the Red Carpet client, or wait
- for the Mono installer to be made available this week.
+ Carpet's</a> Mono channel.
+
</td>
</tr>
<tr>
@@ -56,7 +55,7 @@
<img src="images/windows-36.gif"><b>Windows installer</b>
</td>
<td>
- Not available yet.
+ <a href="archive/mono-0.29-win32-1.exe">mono-0.29-win32-1.exe</a>
</td>
</tr>
</table>
@@ -95,7 +94,7 @@
<td>
<ul>
<li><a href="archive/redhat-90-i386/mono-0.28-1.ximian.6.1.src.rpm">mono-0.28-1.src.rpm (RH9)</a>
- <li><a href="archive/redhat-90-i386/mono-0.28-1.ximian.5.1.src.rpm">mono-0.28-1.src.rpm (RH8)</a>
+ <li><a href="archive/redhat-90-i386/mono-0.28-1.ximian.6.1.src.rpm">mono-0.28-1.src.rpm (RH8)</a>
</ul>
</td>
</tr>
@@ -194,7 +193,7 @@
<td>
<ul>
<li><a href="archive/redhat-90-i386/mono-0.26-1.ximian.6.1.src.rpm">mono-0.26-1.src.rpm (RH9)</a>
- <li><a href="archive/redhat-90-i386/mono-0.26-1.ximian.5.1.src.rpm">mono-0.26-1.src.rpm (RH8)</a>
+ <li><a href="archive/redhat-90-i386/mono-0.26-1.ximian.6.1.src.rpm">mono-0.26-1.src.rpm (RH8)</a>
</ul>
</td>
</tr>
@@ -221,7 +220,7 @@
<li><a href="archive/redhat-90-i386/monodoc-0.6-1.ximian.6.1.i386.rpm">monodoc-0.6-1.ximian.6.1.i386.rpm</a> (To be used only with CVS gtk-sharp)
<li><a href="archive/redhat-90-i386/monodoc-debuginfo-0.5-1.ximian.6.1.i386.rpm">monodoc-debuginfo-0.5-1.ximian.6.1.i386.rpm</a>
<li><a href="archive/redhat-90-i386/mono-wine-20030318-1.ximian.6.3.i386.rpm">mono-wine-20030318-1.ximian.6.3.i386.rpm</a>
- <li><a href="archive/redhat-90-i386/mono-wine-debuginfo-20030318-1.ximian.6.2.i386.rpm">mono-wine-debuginfo-20030318-1.ximian.6.3.i386.rpm</a>
+ <li><a href="archive/redhat-90-i386/mono-wine-debuginfo-20030318-1.ximian.6.3.i386.rpm">mono-wine-debuginfo-20030318-1.ximian.6.3.i386.rpm</a>
</ul>
</td>
<td bgcolor="#999999">
@@ -301,7 +300,7 @@
</td>
<td>
<ul>
- <li><a href="archive/mono-0.25-1.ximian.5.src.rpm">mono-0.25-1.src.rpm</a>
+ <li><a href="archive/redhat-80-i386/mono-0.25-1.ximian.5.1.src.rpm">mono-0.25-1.src.rpm</a>
</ul>
</td>
</tr>
@@ -856,7 +855,7 @@
<td>
<ul>
<li><a href="archive/libgc-6.1-1.src.rpm">libgc-6.1-1.src.rpm</a>
- <li><a href="archive/mono-0.20-1.src.rpm">mono-0.20-1.src.rpm</a>
+ <li><a href="archive/redhat-73-i386/mono-0.20-1.src.rpm">mono-0.20-1.src.rpm</a>
</ul>
</td>
</tr>
@@ -1170,7 +1169,6 @@
<ul>
* <a href="http://www.debianplanet.org/mono/">DebianPlanet</a>
- * <a href="http://www.superin.formativ.net/mono/mono.htm">Windows</a> (works without cygwin!)
</ul>
* Snapshots
@@ -1185,256 +1183,7 @@
The <a href="anoncvs.html">anoncvs</a> mirrors provided by
Hispalinux are updated every six hours.
-* Compiling the code
-
- There are a number of ways of compiling Mono
-
- <ul>
- <li>From the <a href="#scripts">scripts</A>
-
- <LI><a href="#install">Manually</a> for the first time.
-
- <li>Manually, <a href="#upgrade">while upgrading</a> to CVS
- </ul>
-
- (which is an easy way to get the latest CVS information)
-
-<a name="scripts">
-* Compiling with scripts
-
- There are scripts to help build mono for both Unix and Windows. Get
- <a href="mono-build.sh">mono-build.sh</a> for Unix, or <a
- href="mono-build-w32.sh">mono-build-w32.sh</a> for Windows.
- These scripts automate the installation of GLIB and pkgconfig
- (building from source on Unix, and using binary packages
- provided by the GIMP for Windows project on Windows.) To use
- the script, follow these simple steps:
-
- <ul>
- * Save the script for your platform somewhere (e.g. /usr/local/bin)
- * Make the script executable (i.e chmod 755 /usr/local/bin/mono-build.sh)
- * Create a directory to hold the mono source, and the compiled binaries (e.g. mkdir ~/mono)
- * Change to the new directory (i.e. cd ~/mono)
- * run the script (i.e. /usr/local/bin/mono-build.sh)
- </ul>
-
- The script requires wget on either platform, and building the
- software requires make, gcc, automake, autoconf, and libtool.
- You should install these packages from your distribution or
- with the cygwin installer. You should also take care of setting
- the right environment variables as the PKG_CONFIG_FLAGS, etc.
-
- The script will download required packages from
- www.go-mono.com and do a cvs checkout of mono in the current
- directory. <b>IMPORTANT!:</b> The cvs server chosen defaults to
- anonymous cvs;
- set your CVSROOT environment variable before running the script to
- select a particular cvs server.
-
-<a name="install">
-** Building the software manually
-
- You will need to obtain the Mono dependencies first: <a
- href="http://www.gtk.org">glib 2.x</a> and
- <a href="http://www.freedesktop.org/software/pkgconfig">pkg-config</a>.
-
-*** Building on Linux
-
- <ul>
- Unpack the Mono runtime distribution:
- <pre>
- tar xzvf mono-X.XX.tar.gz
- cd mono-X.XX
-
- </pre>
- <p>
-
- Then configure, compile and install:
-
- <pre>
-
- ./configure --prefix=/usr/local
- make
- make install</pre>
-
- This will give you a runtime, C# compiler and runtime
- libraries.
-
- If you want to recompile the runtime and the compiler,
- follow these steps, first unpack the MCS package:
-
- <pre>
- tar xzvf mcs-X.XX.tar.gz
-
- cd mcs-X.XX
- </pre>
-
- Then use the following command to compile and install:
-
- <pre>
-
- make -f makefile.gnu install prefix=/usr/local
- </pre>
-
- You can change /usr/local to something else if you want.
- </ul>
-
-
-*** On Windows, to install and work on the compiler and the class libraries:
-
-**** Install Cygwin and the GNU build tools, Microsoft's .NET Framework SDK and the precompiled GLIB 2.0 and pkg-config libraries.
-
- <ul>
-
- * Install <a href="http://www.cygwin.com">Cygwin</a>.
-
- * Install <a href="http://msdn.microsoft.com/downloads">
- Microsoft .NET Framework SDK</a>.
-
- * Change to the /usr/local directory
- of your Cygwin installation.<br>
- Unzip the precompiled packages listed above.
-
- </ul>
- <ul>
-
- * If you downloaded the Mono
- <a href="http://www.go-mono.com/snapshots">nightly snapshot
- </a>, untar the snapshot.
-
- * Change directories to "mcs".
-
- * Compile:
-
- <pre>
- make
- </pre>
- </ul>
-
-*** On Windows, to compile the mono runtime:
-
- <ul>
-
- * If you downloaded the Mono
- <a href="http://www.go-mono.com/snapshots">nightly snapshot
- </a>, untar the snapshot.
-
- * Change directories to "mono".
-
- * Configure, compile and install:
- <pre>
- ./configure --prefix=c:/mono
- make
- make install
- </pre>
-
- </ul>
-
-* Software resources and notes
-
- The required and additional software can be downloaded here:
-
- * Microsoft's .NET Framework SDK from
- <a href="http://msdn.microsoft.com/downloads">
- msdn.microsoft.com/downloads</a>.
-
- * Cygwin and the GNU Make tools from
- <a href="http://www.cygwin.com">www.cygwin.com</a>.
- Some people observed problems with autoconf 2.52. Installing
- autoconf 2.13 helped in those cases.
-
- * Precompiled GLIB 2.0 and pkg-config packages (and
- their dependencies) by the <a href="http://www.gimp.org/~tml/gimp/win32//index.html">GIMP for Windows</a> project from
- <a href="http://www.go-mono.com/archive/pkgconfig-0.11-20020310.zip">http://www.go-mono.com/archive/pkgconfig-0.11-20020310.zip</a><br>
- <a href="http://www.go-mono.com/archive/glib-2.0.4-20020703.zip">http://www.go-mono.com/archive/glib-2.0.4-20020703.zip</a> <br>
- <a href="http://www.go-mono.com/archive/glib-dev-2.0.4-20020703.zip">http://www.go-mono.com/archive/glib-dev-2.0.4-20020703.zip</a> <br>
- <a href="http://www.go-mono.com/archive/libiconv-1.7.zip">http://www.go-mono.com/archive/libiconv-1.7.zip</a> <br>
- <a href="http://www.go-mono.com/archive/libiconv-dev-1.7.zip">http://www.go-mono.com/archive/libiconv-dev-1.7-20020101.zip</a> <br>
- <a href="http://www.go-mono.com/archive/libintl-0.10.40-20020101.zip">http://www.go-mono.com/archive/libintl-0.10.40-20020101.zip</a><br>
-
-
- * Download the Mono source code from the
- <a href="#feb-11">packaged versions</a> or
- the <a href="http://www.go-mono.com/snapshots">
- nightly snapshots</a> or the <a href="anoncvs.html">
- Anonymous CVS</a>. The nightly snapshots are done every
- night at 10pm EST (Boston Time). The nightly snapshots are
- not guaranteed to build, but most of the time they should.
-
-
- </ul>
-
-
-*** Notes on compiling GLIB 2.0 and pkg-config from source:
-
-
- <ul>
-
- * Some people observed problems with autoconf 2.52. Installing
- autoconf 2.13 helped in those cases (don't forget to do a
- `make maintainer-clean' after the update).
-
- * Download, compile and install <a href="http://www.freedesktop.org/software/pkgconfig">pkg-config</a> from source.
- (I had to change line 674 of
- <nobr><tt>pkg-config-0.8.0/glib-1.2.8/gstrfuncs.c</tt></nobr> from
- <nobr><tt>extern char *strsignal (int sig);</tt></nobr> to
- <nobr><tt>extern const char *strsignal (int sig);</tt></nobr>.
-
-<pre>
-tar xzvf pkg-config-0.8.0.tar.gz
-cd pkg-config-0.8.0
-./configure --prefix=/usr
-make
-make install
-</pre>
-
- * Download, compile and install <a href="ftp://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.7.tar.gz">libiconv</a> from source.<br>
- If you dont have MS Visual C/C++ 4.0 or 5.0 or 6.0 you can also try
- the binary package available at <a
- href="http://www.gimp.org/win32/libiconv-dev-20001007.zip">
- http://www.gimp.org/win32/libiconv-dev-20001007.zip</a>.
-
-
- * Download, compile and install the
- <a href="ftp://ftp.gtk.org/pub/gtk/v2.0/glib-2.0.6.tar.gz">
- glib 2.0</a> from source.
-
- </ul>
-
-<a name="upgrading">
-** Upgrading
-
- To upgrade your Mono installation from CVS, it is very
- important that you update your Mono and MCS modules from CVS
- at the same time. Failure to do so might result in a
- problematic installation as the runtime and the class
- libraries will be out of sync.
-
- Run the following commands to update your CVS tree (more
- details in <a href="ccvs.html">Cvs and Mono</a> and the <A
- href="anoncvs.html">AnonCVS and Mono</a> pages).
-
- <pre>
- (cd mono; cvs update -dP .)
- (cd mcs; cvs update -dP .)
- </pre>
-
- Once you have updated your sources, remove any cached
- assemblies or old binaries from the Mono "runtime" directory,
- and then compile each component:
-
- <pre>
- (cd mono/runtime; rm *exe *dll)
- (cd mono; make)
- (cd mcs; make)
- </pre>
-
- Now you can install the result:
-
- <pre>
- (cd mono; make install)
- </pre>
+* Compilation
- Notice that following the above procedure does not require you
- to manually install the software in the `mcs' directory, as
- the relevant files will be copied by the `mono' makefiles.
+ For instructions on how to build Mono, please refer to the
+ <a href="compiling.html">compiling</a> page. \ No newline at end of file
diff --git a/doc/drawing b/doc/drawing
index 741e1606d2b..eb152415655 100644
--- a/doc/drawing
+++ b/doc/drawing
@@ -15,14 +15,20 @@
href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdicpp/GDIPlus/GDIPlusReference.asp">"GDI+
Flat API"</a>).
+ This means that the C# code is the same for Windows and Unix
+ systems. The following graph explains the situation:
+
<center>
<img src="images/system-drawing.png">
</center>
- In Windows Mono uses the GDI+ library that is included
- with the operating system, while in Unix we provide an
- implementation of this API which uses Cairo to do the heavy
- lifting.
+ In Windows Mono uses the GDI+ library that is included with
+ the operating system (<tt>GDIPLUS.DLL</tt>, while in Unix we
+ provide an implementation of this API in the
+ <tt>libgdiplus.so</tt> shared library. Our
+ <tt>libgdiplus.so</tt> has the same C Flat API as the
+ <tt>GDIPLUS.DLL</tt>. Our implementation uses Cairo to do
+ the heavy lifting.
The implementation of GDI+ lives in mcs/class/System.Drawing
in the gdiplus directory and requires <a
diff --git a/doc/faq b/doc/faq
index 5024fa67fdb..7646c85e73d 100644
--- a/doc/faq
+++ b/doc/faq
@@ -23,8 +23,8 @@
<a href="#problems">Mono Common Problems</a><br>
A <a
-href="http://www.es.gnome.org/documentacion/articulos/mono-puf/mono-puf/">Spanish
-translation</a> is also available
+href="http://www.monohispano.org/tutoriales/mono-puf//">Spanish
+translation</a> is also available (it is outdated though)
<a name="basics"></a>
** Basics
@@ -353,7 +353,7 @@ A: As long as your applications are 100% .NET and do not make use
Q: Where can I learn more about Gtk#?
-A: The following <a href="http://gtk-sharp.sourceforge.net>link</a> sends you to the page of the project.
+A: The following <a href="http://gtk-sharp.sourceforge.net">link</a> sends you to the page of the project.
Q: What can I do with Gtk#?.
@@ -760,7 +760,7 @@ Q: What about Soup? Can I use Soup without Mono?
A: Soup is a library for GNOME applications to create SOAP servers and
SOAP clients, and can be used without Mono. You can browse the
source code for soup using <a
- href="http://cvs.gnome.org/bonsai">GNOME's Bonsai</a>.
+ href="http://cvs.gnome.org/bonsai/">GNOME's Bonsai</a>.
Q: Can I use CORBA?
@@ -1053,12 +1053,13 @@ Q: Why don't you use Java? After all, there are many languages that
A: You can get very good tools for doing Java development on free
systems right now. <a href="http://www.redhat.com">Red Hat</a> has
contributed a <a href="http://gcc.gnu.org">GCC</a> <a
- href="http://gcc.gnu.org/java">front-end for Java</a> that can take
+ href="http://gcc.gnu.org/java/">front-end for Java</a> that can take
Java sources or Java byte codes and generate native executables; <a
- href="http://www.transvirtual.com">Transvirtual</a> has implemented
+ href="http://www.google.com/search?q=transvirtual">Transvirtual</a>
+ implemented
<a href="http://www.kaffe.org">Kaffe</a> a JIT engine for Java;
Intel also has a Java VM called <a
- href="http://www.intel.com/research/mrl/orp">ORP</a>.
+ href="http://www.intel.com/research/mrl/orp/">ORP</a>.
The JVM is not designed to be a general purpose virtual machine.
The Common Intermediate Language (CIL), on the other hand, is
diff --git a/doc/gtk-sharp b/doc/gtk-sharp
index 4d1bbf223c8..1630277d618 100644
--- a/doc/gtk-sharp
+++ b/doc/gtk-sharp
@@ -21,7 +21,7 @@
** Where to learn more.
Visit the official site for the <a href="http://gtk-sharp.sourceforge.net">Gtk# Project</a>.
- The <a href="http://www.go-mono.org/faq">Mono FAQ</a> has some useful
+ The <a href="http://www.go-mono.org/faq.html">Mono FAQ</a> has some useful
information too.
** GTK# On Linux
@@ -75,11 +75,6 @@ following:
<li>Microsoft .NET Framework at
<a href="http://msdn.microsoft.com/downloads/default.asp?url=/downloads/sample.asp?url=/msdn-files/027/000/976/msdncompositedoc.xml&frame=true">here</a> </li>
-<p>If you are running Windows 95/98/ME, then you will need Unicode support.
-Look in
-mono-list archives for information about how to get
-Mono to work on Windows 9x.
-<a href="http://lists.ximian.com/archives/public/mono-list/2002-December/004158.html">here</a>
<p>Environment Variables to set:
<ul>
diff --git a/doc/ibmdb2 b/doc/ibmdb2
index 3f148232652..0e395fffd38 100755
--- a/doc/ibmdb2
+++ b/doc/ibmdb2
@@ -49,14 +49,14 @@ In order to test.
<li>Have working mono and mcs setup</li>
<li>Have access to an IBM DB2 database. If you do not have access, download the
- <a href="http://www-3.ibm.com/software/data/db2/">IBM DB2</a> software. There
+ <a href="http://www-306.ibm.com/software/data/db2/">IBM DB2</a> software. There
are versions for Windows, Linux, AIX, and Sun Solaris.</li>
<li>Make sure the assembly Mono.Data.DB2Client.dll was built and installed
where the other class libraries are installed.</li>
<li>If you do not have the source to mcs, get the source from
- <a href="http://www.go-mono.com/download">here</a></li>
+ <a href="http://www.go-mono.com/download.html">here</a></li>
<li>Has a ConnectionString format like ODBC</li>
diff --git a/doc/index b/doc/index
index b6494fe705b..ca9dcb6c4bb 100644
--- a/doc/index
+++ b/doc/index
@@ -2,7 +2,7 @@
<table>
<tr>
- <td>
+ <td valign="top">
<a href="http://www.ximian.com">Ximian</a> announced the
launch of the Mono project, an effort to create an open source
implementation of the .NET Development Framework.
@@ -117,7 +117,8 @@
<img src="images/netmagazine.png">
</td>
<td>
- <a href="http://www.fawcette.com/dotnetmag/2003_TE/magazine/columns/trends/default.asp">May 31st, 2003</a>: CLI integration.
+
+ <a href="http://www.ftponline.com/wss/2003_TE/magazine/columns/trends">May 31st, 2003</a>: CLI integration.
</td>
</tr>
<tr>
@@ -149,6 +150,28 @@
</tr>
</table>
+@item Jan 18th, 2004: LDAP class libraries in Mono tutorial.
+
+ Sunil Kumar has written an <a
+ href="http://www.novell.com/coolsolutions/cooldev/features/a_net_cplus_ldap_library_cdev.html">introduction
+ to Novell.LDAP</a> class libraries, which are part of Mono.
+
+@item Jan 13th, 2004: MonoDoc 0.9 released.
+
+ A new edition of MonoDoc, the Mono Documentation Browser, has been released, available in source form from:
+ <a href="archive/monodoc-0.9.tar.gz">archive/monodoc-0.9.tar.gz</a>
+
+@item Jan 11th, 2004: Call for Stories
+
+ If you have a success story about using Mono or one of the Mono
+ components in any way, we want to hear about you. Please mail
+ your details to miguel@ximian.com
+
+@item Jan 4th, 2004: Windows Installer for Mono 0.29
+
+ There is a <a href="archive/mono-0.29-win32-1.exe">Windows
+ Installer for Mono 0.29</a> available now.
+
@item Dec 21st: Mono on PowerPC Progress.
Paolo reports today that the Mono JIT on the PowerPC was able
@@ -230,7 +253,8 @@
@item Oct 25th: GTK# 0.11+ Windows Installer available
- Johannes created a <a href="http://java.thn.htu.se/~toor/gtk-sharp/gtk-sharp-0.11-cvs.exe">Windows Installer for GTK# 0.11+</a> and works
+ Johannes created a Windows
+ Installer for GTK# 0.11+ and works
with Mono 0.28 for Windows.
@item Oct 21st: Mono Community at Novell Forge
@@ -336,7 +360,7 @@
href="images/finddlg.png">here</a>.
Johannes has patches to have Wine track the Gtk theme,
- screenshot <a href="http://www.sport-huettn.de/jroith/swfsample.png">here</a>
+ screenshot here (link got broken).
<b>Security:</b> New authenticode support from Sebastien has
been checked into CVS.
@@ -580,984 +604,6 @@
build system, we will be able to expose it (as part of the
NET_1_1 build).
-@item Jul 9th, 2003: ASP.NET web services, coverage tools.
-
- Web Services keep advancing: now we also support server-side
- authoring of Web Services as well as web service clients
- (which shipped in Mono 0.25). This works using our ASP.NET
- runtime, so it works with either XSP or the Apache module. The
- new Web Services work from Lluis added the missing bits:
- <ul>
- <li> .asmx files.
- <li> Method calls with complex parameters (whatever XmlSerializer can currently serialize, which is a quite a lot).
- <li> ref and out parameters.
- <li> Soap headers (In, Out and InOut).
- <li> Soap extensions, both global (configured in web.config) and particular to methods (configured using attributes).
- </ul>
-
- For more details, see Lluis <a href="http://lists.ximian.com/archives/public/mono-devel-list/2003-July/001449.html">post</a>
-
- GUI-wise: Work on <a href="http://xr.xwin.org">Xr</a> to
- implement System.Drawing continues. This will provide a full
- GDI+ implementation for Mono, and this will be hooked up into
- Gtk# and System.Windows.Forms.
-
- MonoDoc keeps moving along, with a new web-based version
- coming up next, and we are also exploring a collaborative
- extension to allow people to contribute documentation through
- their web browsers.
-
- Zoltan's Coverage analysis tool has been checked into CVS.
- With this tool it is now possible to find which class library
- code paths are missing regression tests. The module is
- `monocov'. Details are <a
- href="http://www.nexus.hu/vargaz/">here</a>. A fresh Gtk#
- version is available now.
-
- Jean's remoting-based Soap implenentation is also maturing.
-
-@item Jun 26th: Mono 0.25 has been released.
-
- We have released Mono 0.25. A list of the new features is
- available <a href="archive/mono-0.25.html">here</a>.
-
- Packages for Windows, and various Linux distributions are
- available on our <a href="download.html">download</a> page.
-
-@item Jun 17th, 2003: Web Services client; Profiling hooks
-
- Lluis and Gonzalo have checked into CVS the support for web
- services in the Mono runtime. This allows Mono to work as a
- web services client. We still require a WSDL compiler to
- compile the initial stub, but Erik has the beginning of a WSDL
- compiler ready and Atsushi has continued work on his
- experimental Xml Schema to C# class generator.
-
- As part of this, the Mono Http runtime has been rewritten to
- increase reliability, scalability and conformance to the
- specs. Also our io-layer has been extended to not have
- arbitrary limits. This was done as part of our collaboration
- with SourceGear.
-
- Paolo has commited the new pluggable profiling API to the Mono
- runtime: now the profiler is built as a module, and a new code
- coverage analysis has been checked in (and Zoltan already
- added improvements to it).
-
- Mark's Mozilla bindings continue to improve, and we will shortly
- migrate the Mono documentation browser to use Mozilla, to take
- advantage of the tutorial's use of CSS.
-
- Jackson's work on the IL assembler and Ben on running
- regression tests have provided us with a very needed tool in
- the Mono toolkit. One of the last missing pieces on the SDK.
-
- On the crypto world, we got Sebastien's certificate viewer
- checked into CVS and the crypto code keeps advancing by leaps
- and bounds.
-
- Alexandre and Aleksey Work continues on Windows.Forms on top
- of Wine and Gtk# (the former for full compatibility, the later
- for ease-of-authoring).
-
- Cesar checked in the beginning of the semantic analysis code
- for his JScript compiler, and will be working on it full time.
-
-@item Jun 11th, 2003: SourceGear and Ximian announce partnership
-
- Ximian, Inc., the leading provider of desktop and server
- solutions enabling enterprise Linux adoption, today announced
- that SourceGear Corporation will use Mono\x{2122} Project
- technology to offer cross-platform versions of its
- products. In addition, the companies have entered into a
- development partnership under which Ximian will provide
- custom Mono development to enable delivery of SourceGear
- products later this year. As a result, SourceGear will offer
- both UNIX and Linux clients for its SourceGear Vault source
- code management tool, enabling broader use of its solutions in
- mixed-platform development organizations.
-
- <a href="http://www.ximian.com/about_us/press_center/press_releases/index.html?pr=sourcegear">Read more...</a>
-
- Some technical details are available <a
- href="http://lists.ximian.com/archives/public/mono-list/2003-June/014334.html">here</a>.
-
-@item May 20th, 2003: OpenLink releases WineLib patches.
-
- OpenLink <a
- href="http://lists.ximian.com/archives/public/mono-winforms-list/2003-May/000284.html">announced</a>
- the release of Vladimir's work to turn Wine into a library
- that can be used dynamically from Mono. This work simplifies
- the work on System.Windows.Forms as it is no longer necessary
- have a special version of the GC, nor have a stub program.
- The patches are available <a
- href="http://www.openlinksw.com/mono/">here</a>.
-
- Mono packages for the Linux/s390 are available now in the <a
- href="download.html">download page</a>.
-
-@item May 10th, 2003: Eclipse runs on Mono
-
- Today Zoltan Varga announced that he got the <a
- href="http://www.eclipse.org">Eclipse IDE</a> running on top
- of Mono+<a href="http://www.ikvm.net">IKVM</a>.
-
- A screenshot of Eclipse running with Mono can be found <a
- href="images/ikvm-screenshot.png">here</a>
-
-@item May 6th, 2003: Mono 0.24 ships
-
- We have released Mono 0.24 which includes our new code
- generation engine. A list of the new features is available <a
- href="archive/mono-0.24.html">here</a>.
-
- Packages for Windows, and various Linux distributions are
- available on our <a href="download.html">download</a> page.
- We are shipping Gtk# and MonoDoc packages for the first time.
-
-@item Apr 21st, 2003: Virtuoso 3.0 ships.
-
- <a href="http://www.openlinksw.com">OpenLink's</a> released
- their <a href="http://www.openlinksw.com/press/virt3rel.htm">Virtuoso
- 3.0</a> database system. Virtuoso ships on Windows and Linux.
- On Linux they use Mono as their runtime to host C#, .NET and
- ASP.NET. Congratulations to OpenLink for their release.
-
- Virtuoso can be downloaded <a
- href="http://oplweb2.openlinksw.com:8080/download/virtuoso.vsp">here</a>
- and a demo is available <a
- href="http://demo.openlinksw.com:8890/tutorial/hosting/ho_s_2/ho_s_2.vsp">here</a>.
-
- OpenLink is contributing fixes and code to the Mono project on
- an ongoing basis.
-
- Jon Udell wrote a small <a
- href="http://www.infoworld.com/article/03/03/14/11stratdev_1.html">entry</a>
-
-@item Apr 19th, 2003: RelaxNG validating reader; Activities.
-
- Atsushi has created a <a
- href="http://www24.brinkster.com/ginga/RelaxngValidatingReader/">RelaxNG</a>
- validating XML reader.
-
- There is activity on the <a
- href="http://www.gotmono.com">GotMono forums</a> and the <a
- href="http://www.nullenvoid.com/gtksharp/wiki/">Gtk# Wiki</a>
-
-@item Apr 11th, 2003: First Mono Book is out; Team pages.
-
- The first book to cover Mono is out. This book is currently
- only available in German, you can find it <a
- href="http://www.amazon.de/exec/obidos/ASIN/3827264928/qid=1050051051/sr=2-1/ref=sr_2_3_1/028-2755135-1623712">here</a>
-
- We now have a page for the <a href="team.html">Mono Team</a>
- where we include a list of some of the people who have made
- Mono possible. If you have CVS access, please update the page
- to include your information.
-
-@item Apr 5th, 2003: New compilation engine.
-
- The new Mono compilation engine has been placed on CVS, the
- details are <a
- href="http://lists.ximian.com/archives/public/mono-list/2003-April/013269.html">here</a>
-
- Zoltan has commited his <a
- href="http://lists.ximian.com/archives/public/mono-devel-list/2003-April/000274.html">typed
- allocation</a> patches to CVS as well.
-
-@item Apr 3rd, 2003: NUnit 2.0 GTK# GUI; GtkMozEmbed; SWT#
-
- Gonzalo has checked in his <a href="http://gtk-sharp.sf.net">Gtk#</a>-based
- <a href="http://nunit.org">NUnit</a> tool. Screenshots are <a
- href="http://primates.ximian.com/~gonzalo/mono/shots/running.png">here</a>
- and <a
- href="http://primates.ximian.com/~gonzalo/mono/shots/finished.png">here</a>
-
- Mark has checked his bindings for Gtk-based Mozilla into CVS,
- module name: `GtkMozEmbed'. Read the <a
- href="http://lists.ximian.com/archives/public/mono-list/2003-April/013247.html">details</a>
-
- The SWT port to C# using Gtk is <a
- href="http://lists.ximian.com/archives/public/sd-mono-port/2003-March/000114.html">progressing</a>. Screenshots are
- <a href="http://www.roboto.ch/swt">here</a>.
-
-@item Mar 28th: Mono community site.
-
- <a href="http://www.gotmono.com">www.gotmono.com</a> has
- openend its door: Got Mono is a Mono Community site.
-
-@item Mar 25th: Second Mono Survey
-
- <table width="100%" cellpadding="0" cellspacing="1" border="0" bgcolor="blue">
- <tr>
- <td valign="top">
- <div style="background: #c0d0ff; margin: 0px 0px 0px 0px; padding: 1px;">
- What do you think about Mono?
-
- Is your company involved with the development and
- deployment of web applications? Is Linux becoming an
- important part of your company's business application
- strategy? Are you considering Mono for your next
- project? Would you like to shape the future of Mono
- and the use of Linux in business critical
- applications?
-
- If you answered yes to any of these questions, we
- would like to talk with you. If interested, please
- email us at <a
- href="mailto:mbadgett@ximian.com">mbadgett@ximian.com</a>.
- </div>
- </td>
- </tr>
- </table>
-
-@item Mar 20th: Windows.Forms and Wine.
-
- Alexandre has provided a modified version of the GC system
- that will work with and Mono. See the mono-winforms-list. It
- is now possible to run our Win32-based implementation of
- Windows.Forms with Mono on Linux.
-
-@item Mar 7th: Mono 0.23
-
- A new freshly baked release of Mono is available. Release
- notes are <a href="archive/mono-0.23">here</a>. This is mostly a
- bug fix release. No new features.
-
-@item Mar 5th, 2003: Mono 0.22; MonoDoc 0.2; Debugger 0.2.1: Release-o-Rama.
-
- Mono 0.22 has been released. See the <a
- href="archive/mono-0.22">release notes</a>. This is a bug fix
- release.
-
- A new preview of MonoDoc 0.2, the Mono Documentation browser
- has been <a href="http://lists.ximian.com/archives/public/gtk-sharp-list/2003-March/001266.html">released</a>.
-
- Martin also announced a <a
- href="http://lists.ximian.com/archives/public/mono-list/2003-March/012756.html">new
- release</a> of the Mono Debugger (both GUI and command line).
-
-@item Mar 3rd, 2003: The Mono Hackers Hall Of Fame welcomes Zoltan Varga
-
- The <a href="hackers.html">Mono Hackers Hall Of Fame</a>
- continues to show our appreciation to the excellent
- contributors that make <b>mono::</b> a successful free
- software project.
-
- Zoltan has contributed significantly to Mono, with bug reports and bug
- fixes as well as pushing the envelope of the things that can be done in
- and with the mono runtime: the gcc-based ngen compiler, code coverage
- and more recently his work with Reflection.Emit that got mono to the
- point of running the <a href="http://www.ikvm.net">IKVM</a> Java virtual
- machine.
-
-@item Mar 2nd, 2003: New Mono mailing list.
-
- A new mailing list for <a
- href="http://lists.ximian.com/mailman/listinfo/mono-devel-list">Mono
- Development</a> has been created.
-
-@item Feb 27th, 2003: Mono 0.21 released
-
- Mono 0.21 has been released. This is only a bug fix release.
- The <a href="archive/mono-0.21">release notes</a> are available.
-
- Windows binary is available <a href="archive/mono-0.21-win32-1.exe">here</a>
-
-@item Feb 25th, 2003: Mono 0.20 for Windows released; New Apache module released.
-
- Packages of Mono for Windows have been <a
- href="archive/mono-0.20-stable-win32-2.exe">released</a>.
- Thanks to Daniel, Johannes and Paolo for setting this up.
-
- Daniel has released a new version of his Mono Apache module that
- handles ASP.NET. The code is available at <a
- href="http://apacheworld.org/modmono/">here</a>
-
- Nick has posted an update on the progress on our <a
- href="http://lists.ximian.com/archives/public/mono-list/2003-February/012467.html">regression
- tests</a>. We are looking for more tests, and more volunteers to write them.
-
- Also, remember to contribute to the Gtk# documentation effort,
- momentum is picking up! See the entry for Feb 18th for more details.
-
-@item Feb, 23rd, 2003: Mono 0.20 released; Gtk# 0.8 released.
-
- Mono 0.20 has been released. Check out the <a
- href="archive/mono-0.20">release notes</a> for an overview of
- the changes. You can get it <a href="download.html">here</a>.
- There are no major features in this release, mostly bug fixes
- and performance improvements.
-
- Gtk# 0.8 has been <a
- href="http://lists.ximian.com/archives/public/gtk-sharp-list/2003-February/001114.html">released</a>
-
- <b>Important</b>: The contributed binaries for Windows
- binaries of Mono 0.20 contain a virus. Please read <a
- href="virus.html">this</a> if you installed the binary.
-
-@item Feb 18th, 2003: Volunteers to document Gtk#
-
- With the availability of a documentation browser, we are
- looking for volunteers to help us complete the documentation
- of the Gtk# binding for Mono.
-
- Experience with Gtk is useful, but not mandatory. We have
- checked in stubs, and we have instructions, and resources to
- how to complete this process <a
- href="documentation.html">here</a>. Mail the <a
- href="mailto:mono-docs-list@ximian.com">mono-docs-list@ximian.com</a>
- for further discussion.
-
-@item Feb 14th, 2003: OpenGL# bindings for Mono; Mono Basic updates.
-
- Mark Crichton has completed his OpenGL/GLUT bindings for
- Gnome. A screenshot can be seen <a
- href="sshots/oglcs.png">here</a>. The bindings are available
- on the Mono CVS repository on the module `glgen'. This is a
- straight binding to the C API.
-
- Marco has <a
- href="http://lists.ximian.com/archives/public/mono-list/2003-February/011752.html">posted
- an update</a> on the current state of the free VB.NET compiler
- for Mono.
-
- We are looking for contributors and maintainers to the
- JavaScript compiler as well (Janet)
-
-@item Feb 12th, 2003: New assemblies, Gtk# stub documentation, Authenticode, Polish site
-
- Mono now distributes a few new assemblies: Mono.Security.Win32
- as a layer to use the crypto functionality on Win32. The
- Mono.Posix assembly which contains functionality for taking
- advantage of Unix facilities.
-
- A <a href="http://www.go-mono.pl/">Mono site in Poland</a>.
-
- Stubs for the Gtk# documentation have been checked into CVS.
- If you want to contribute please read <a
- href="http://lists.ximian.com/archives/public/mono-list/2003-February/012108.html">this
- message</a>
-
- Mono development is moving quickly: Tim and Daniel have been
- improving the Oracle database provider and Sebastien Pouliot
- has got code signing to work using Authenticode with pure open
- source and managed code. Plenty of new VB.NET work from Marco
- (compiler) and Daniel (runtime). Also Jackson has resumed
- work on the IL assembler and the fully managed library to
- generate CIL images (Sergey wrote the first Mono.PEToolkit).
-
-@item Feb 11th, 2003: Mono Weekly News, New assemblies.
-
- <a href="http://monoevo.sourceforge.net/mwn/index.html">Mono
- Weekly News</a>: Includes a new interview, software
- announcements and the PHP/Mono integration.
-
-@item Feb 5th, 2003: MonoDoc 0.1
-
- A <a
- href="http://www.go-mono.com/archive/monodoc-0.1.tar.gz">preliminary
- release</a> of the Mono Documentation Browser is now availble.
- Release <a
- href="http://lists.ximian.com/archives/public/mono-list/2003-February/011935.html">notes</a>
-
-@item Jan, 22th, 2003: Mono wins award, OpenLink releases Virtuoso.
-
- Mono won the `Best Open Source Project' award at the Linux
- World Expo. A description is <a
- href="http://linuxtoday.com/news_story.php3?ltsn=2003-01-23-024-26-OP-EV">here</a>
-
- Open Link has a <a
- href="http://biz.yahoo.com/prnews/030123/neth013_1.html">press
- release</a> about Virtuoso 3.0: the first commercial product
- shipping that uses Mono.
-
-@item Jan, 20th, 2003: Mono 0.19 released; Screenshots page; Gtk# 0.7
-
- Mono 0.19 has been released. Check out the <a
- href="archive/mono-0.19">release notes</a> for an overview of
- the changes. You can get it <a href="download.html">here</a>.
- There are no major features in this release, mostly bug fixes
- and performance improvements.
-
- We have now a new section <a href="screenshots.html">with
- screenshots</a> of various Mono applications. You can see
- there the new released Debugger, as well as the work in
- progress on the documentation browser.
-
- <a href="http://gtk-sharp.sf.net">Gtk# 0.7</a> has been <a
- href="http://lists.ximian.com/archives/public/mono-list/2003-January/005222.html">released</a>
-
-@item Jan, 19th, 2003: Mono Debugger released.
-
- After six month of extensive development, Martin Baulig has
- released the first version of the Mono debugger. The Mono
- debugger is written in C# and can debug both managed and
- unmanaged applications, support for multiple-threaded
- applications and should be relatively easy to port to new
- platforms.
-
- Details of the release are available in <a
- href="http://lists.ximian.com/archives/public/mono-list/2003-January/005192.html">post</a>.
-
- The debugger contains both Gtk# and command line interfaces.
- The debugging file format used in Dwarf (its already supported
- by our class libraries and the Mono C# compiler; To debug C
- applications, you need a recent GCC, or to pass the -gdwarf-2
- flag to gcc).
-
-@item Jan, 17th, 2003: DB2 provider, MacOS X
-
- Christopher Bockner has contributed a DB2 System.Data client.
-
- MacOS X support on the runtime has been integrated into the
- distribution, and MCS works with it.
-
- Zoltan has managed to get <a
- href="http://radio.weblogs.com/0109845/">IKVM</a> (a Java VM
- for .NET) to run with Mono. The HelloWorld.class runs with
- the Mono runtime.
-
-@item Jan, 13th, 2003: Mono 0.18 released
-
- Mono 0.18 has been released. Check out the <a
- href="archive/mono-0.18">release notes</a> for an overview of
- the changes. You can get it <a href="download.html">here</a>.
-
-@item Jan 10th, 2003: Mono Weekly News.
-
- A new issue of the <a
- href="http://lists.ximian.com/archives/public/mono-list/2003-January/004903.html">Mono
- Weekly News</a> has been published.
-
- Check out the <a href="crypto.html">Crypto status</a> page
- that Sebastien has put together.
-
-@item Jan 3rd, 2003: Glade#, Code Coverage, Apache, MBas, Debugger.
-
- Rachel has made Glade# use attributes so binding C# widgets to
- the designed widgets is now easier than ever. Alp has
- improved this to use implicit names as well.
-
- Martin's Mono debugger now has support for multi-thread
- debugging. Special feature: breakpoints can be defined in a
- per-thread basis now.
-
- Daniel López has checked in his Apache module to integrate
- Mono and Mono's ASP.NET support as an Apache module. Gonzalo
- has folded his new Mono hosting classes into this module (they
- are now shared between XSP and mod_mono). You can get the
- mod_apache from CVS (module name: mod_mono).
-
- Mono Basic improvements: Marco has added support for more
- statements on the grammar.
-
- Zoltan has <a href="http://www.nexus.hu/vargaz2/">posted</a>
- his Code Coverage analysis tool for Mono.
-
-@item Dec 17th, 2002: Mono: Commercial uses.
-
- <a href="http://www.tipic.com">Tipic</a> today <a
- href="http://www.ximian.com/about_us/press_center/press_releases/index.html?pr=tipic_mono">announced</a>
- their work on porting their Instant Messaging Server platform
- to run on Mono.
-
- <a href="http://www.winfessor.com">Winfessor</a> also <a
- href="http://www.winfessor.com/press.asp">announced</a> the
- availability of their Jabber SDK to run on Mono.
-
- Also two weeks ago we mentioned <a
- href="http://www.openlinksw.com">OpenLink Software's</a> <a
- href="http://www.ximian.com/about_us/press_center/press_releases/index.html?pr=openlink_mono">announcement</a>
- of their product, also using Mono.
-
-@item Dec 10th, 2002: Gtk# 0.6 released; Mono 0.17 packages for Windows and Debian.
-
- Mike Kestner <a
- href="http://lists.ximian.com/archives/public/mono-list/2002-December/003961.html">announced
- Gtk# 0.6</a>. This new release includes many new features and
- bug fixes, and is the perfect companion to the <a
- href="archive/mono-0.17">Mono 0.17</a> release.
-
- Johannes has contributed a Windows-ready package of Mono 0.17,
- and its available from our <a
- href="download.html">download</a> page.
-
- Alp Toker has <a href="http://www.atoker.com/mono/">Debian packages</a>
-
-@item Dec 9th, 2002: Mono 0.17 has been released
-
- Mono 0.17 has been released. Check out the <a
- href="archive/mono-0.17">release notes</a> for a more detailed
- list. You can get it <a href="download.html">here</a>.
-
- Many new features as well as plenty of bug fixes. Many new
- System.Data providers and a more mature System.Web (ASP.NET)
- which can now be hosted in any web server. A simple <a
- href="archive/xsp-0.2.tar.gz">test web server</a> to host
- asp.net has been released as well.
-
- This version also integrates Neale's s390 port.
-
- This release also includes a new exception handling system
- that uses the gcc exception information that vastly improves
- our internalcall speed (15% faster mcs compilation times).
-
-@item Dec 8th, 2002: VB.NET, Oracle Provider.
-
- Marco has got the Mono Basic compiler up to speed (support for
- classes, modules, expressions, object creation, method
- invocation, local variables, and some statements). The
- compiler is based on the work from Rafael Teixeira on MCS.
-
- Screenshots: <a
- href="http://modgb.sourceforge.net/monobasic_snap.png">in
- Windows doing Windows.Forms</a> and in Linux doing <a
- href="images/gtk-vb.png">VB with Gtk#</a> (courtesy of Alp).
-
- Daniel Morgan has checked in his Oracle provider to the CVS
- repository as well.
-
-@item Nov 27th, 2002: Press release, tutorials, Windows Forms, ADO.NET, Magazine.
-
- <a
- href="http://www.business2.com/articles/mag/0,1640,45454,FF.html">The
- Penguin Takes Flight</a>: an article written by Erick
- Schonfeld appears on the December issue of <a
- href="http://www.business2.com/">Business 2.0</a> magazine.
-
- <a href="http://www.openlinksw.com">OpenLink</a> and <a
- href="http://www.ximian.com">Ximian</a> made <a
- href="http://www.ximian.com/about_us/press_center/press_releases/index.html?pr=openlink_mono">joint
- announcement</a> on the plans of OpenLink to ship their <a
- href="http://www.openlinksw.com/virtuoso/index.htm">Virtuoso</a>
- server on Unix using Mono.
-
- Martin Willemoes's <a href="gnometutorial">GNOME.NET
- tutorial</a> is now available from the main Mono site. This
- tutorial is a collaborative effort to teach developers how to
- use Mono to create Mono applications using <a href="http://gtk-sharp.sf.net">Gtk#</a>
-
- Dennis Hayes has posted and <a
- href="http://lists.ximian.com/archives/public/mono-list/2002-December/003800.html">update</a>
- on the work to get Windows.Forms working on Mono. There is a
- new test application that people can use to test their
- controls. If you are interested in working on Windows.Forms,
- you can participate in the <a
- href="http://lists.ximian.com/mailman/listinfo/mono-winforms-list">mono-winforms
- mailing list</a>
-
- Brian Ritchie has been working on an ADO.NET <a
- href="http://brianritchie.webhop.net/ideas/adocodegen.aspx">data
- layer</a> and an <a
- href="http://brianritchie.webhop.net/ideas/appserver.aspx">application
- server</a> for Mono.
-
- Dan Morgan has checked in his Oracle provider, and Tim Coleman
- continues to work on the TDS implementation of the data classes.
-
- The rest of the team has been working on bug fixing in the
- runtime, the compiler, and the class libraries. Also,
- compilation speed has increased recently by performing a
- number of simple optimizations in the compiler.
-
-@item Nov 19th, 2002: Crypto update; Books; Gtk# Datagrid; .NET ONE Slides
-
- Sebastien has got DSA and RSA signatures <a
- href="http://lists.ximian.com/archives/public/mono-list/2002-November/003497.html">working</a>
- as well as RSA <a
- href="http://lists.ximian.com/archives/public/mono-list/2002-November/003502.html">encryption</a>.
- We now distribute Chew Keong TAN's BigInteger classes.
-
- Brian has contributed a System.Data multiplexor in Mono, it
- can be found in the Mono.Data assembly. The details of this
- new technology are <a
- href="http://lists.ximian.com/archives/public/mono-list/2002-November/003400.html">here</a>.
- It works in Mono and the .NET Framework.
-
- Larry O'Brien has announced the candidate book for <a
- href="http://lists.ximian.com/archives/public/mono-list/2002-November/003500.html">
- Thinking in C#</a>. The book is Mono-friendly.
-
- Another book that covers mono (available in German only) is <a
- href="http://www.databecker.de/frames.php?PHPSESSD=4948515556575049525459495248485949485348&PHPSESSID=6cc68dbcfbcbacd7b82a984b0700d5d6&t=2">
- here</a>.
-
- Dan Morgan has implemented a DataGrid widget for Gtk#, you can
- see Windows screenshots for it <a
- href="images/GtkSharpDataGridScreenshot.png">here</a> and <a
- href="images/SqlSharpGtkScreenshot4.png">here</a>.
-
- Slides from the Mono developers for the .NET ONE conference are available now:
- <ul>
- <li><a
- href="http://primates.ximian.com/~miguel/slides-europe-nov-2002/DotNetOneKeynote.sxi">
- Mono Keynote presentation</a>
-
- <li><a href="http://primates.ximian.com/~lupus/slides/embed/">Hosting the Mono Runtime</a><br>
- The simple embedding of Mono in Perl is available <a
- href="http://primates.ximian.com/~lupus/slides/embed/Mono-0.01.tar.gz">here</a>
-
- <li><a href="http://primates.ximian.com/~lupus/slides/jit/">The Mono JIT compiler</a>
-
- <li><a href="http://primates.ximian.com/~miguel/slides-europe-nov-2002/Mono_C_Sharp_Overview_1007.sxi">
- Mono C# Compiler Overview</a>
- </ul>
-
- A couple of other presentations from Miguel's trip to Europe
- are available <a
- href="http://primates.ximian.com/~miguel/slides-europe-nov-2002/">here</a>
- in Open Office file format.
-
-@item Nov 8th, 2002: Mono s390, Database work, new JIT updates.
-
- Neale Ferguson has contributed <a href="download.html">RPM
- packages</a> of Mono for the Linux/s390.
-
- Tim Coleman posted an <a
- href="http://lists.ximian.com/archives/public/mono-list/2002-November/003329.html">update</a>
- on the improvements in the System.Data
-
- The new JIT engine can run 72 out of our 154 tests for the
- virtual machine, and it also got exception support this week.
-
-@item Nov 1st, 2002: TDS, Crypto, Gtk#, Winforms, bug fixes.
-
- Tim's SqlClient is <a
- href="http://lists.ximian.com/archives/public/mono-list/2002-November/003161.html">now
- capable</a> of communicating with the Microsoft SQL server
- using the TDS protocol. A screenshot showing a sample client
- running with <a href="http://gtk-sharp.sf.net">Gtk#</a> on
- Windows is shown <a
- href="images/SqlSharpGtkSceenshot3.png">here</a>
-
- Sebastien has made all symetric ciphers functional on all
- supported modes; All the classes in Security.Cryptography are
- present and the X590 certificates are now in too. Jackson has
- been working on the Security classes.
-
- Many bug fixes all over the place: class libraries (Dick,
- Piers, Ville, Zoltan, Gonzalo, Dan, Atsushi, Nick, Phillip),
- compiler, runtime engine. A big thank goes for everyone who
- has been providing bug reports for us to track down.
-
- Gaurav has been working on multiple WebControls. Gonzalo migrated
- the ASP.NET engine to use POST for interaction.
-
- In the Gtk# land saw the integration of gda, gnome-db and GStreamer
- bindings.
-
- Windows.Forms classes now build on Linux and Windows, check
- out the status pages for areas of collaboration.
-
-@item Oct 24th, 2002: S390 support, XSP/ASP.NET, Win32 contributors, TDS.
-
- Today Neal Ferguson's support for the IBM S390 was checked
- into CVS.
-
- The XSP processor has been fully integrated into the
- System.Web assembly, and Gonzalo has finished the hosting
- interfaces in Mono. This means that it is possible to embed
- ASP.NET with the same APIs used in Windows, and is possible to
- easily embed it with Apache for example. The XSP module has
- now become a shell for testing the System.Web classes.
-
- We are looking for contributors that know Win32 to contribute
- to the Windows.Forms implementation. If you want to help
- write some controls using the Win32 API, get in touch with our new <a
- href="http://lists.ximian.com/mailman/listinfo/mono-winforms-list">mono-winforms-list@ximian.com
- list</a> mailing list.
-
- Tim's TDS System.Data set of classes can now talk to SQL
- servers using the TDS protocol (version 4.2) with
- connection pooling. Currently it can connect, run
- transactions, update/insert/delete, and read some types. A
- data adapter is also coming soon.
-
-@item Oct 21th, 2002: Crypto, Winforms list, Database, GConf, Debugger.
-
- Sebastien Poliot has made a lot of progress, he reports that
- DES and TripleDES have been fixed; Rijndael and CFB modes
- still have problems in some configurations and some areas that
- are not supported by the .NET framework.
-
- Last week we created a new <a
- href="http://lists.ximian.com/mailman/listinfo/mono-winforms-list">mailing
- list</a> to discuss the Mono Winforms implementation.
-
- Tim has started a full C# implementation of the TDS protocol
- and the providers, and Brian continues his work on his ODBC
- binding.
-
- Rachel Hestilow has also checked in a binding for GConf. This
- binding <a
- href="http://toxic.magnesium.net/~hestilow/gconfsharp/intro.html">is
- unique</a> in that it uses some features in the CLI to support
- complex data types, and allows the user to keep only one
- representation of the types instead of two (the master types
- is defined in CLI-land). Also Property Editors (<a
- href="http://primates.ximian.com/~miguel/shots/gconf-shot.png">shot</a>)
- simplify the creation of user interfaces that bind their
- configuration to backend keys, following the <a
- href="http://developer.gnome.org/projects/gup/hig/1.0/">GNOME
- Human Interface Guidelines.</a>
-
- Martin is now on vacation, but before leaving he produced a
- number of documents detailing the state of the debugger. The
- major missing feature is full support for debugging unmanaged
- applications (it requires dwarf-2 handlers for types). We
- will do some polishing of the user interface (<a
- href="http://primates.ximian.com/~miguel/shots/debugger-4.png">new
- shot</a>) to expose the existing and rich functionality to the
- users and try to release a preview of the debugger at the same
- time as Mono 0.17.
-
-@item Oct 14th, 2002: Crypto, Database work, Debugger, Documentation.
-
- Brian, Daniel and Rodrigo have been busy working on the ODBC
- provider for Mono. Daniel posted some <a
- href="http://lists.ximian.com/archives/public/mono-list/2002-October/002755.html">updates</a>.
- Brian posted <a
- href="http://lists.ximian.com/archives/public/mono-list/2002-October/002758.html">details
- about the ODBC.NET</a> provider.
-
- Also Sebastien Pouliot has been improving the various
- cryptographic classes in Mono, something that we had not done
- in quite some time. We are looking for a way to handle
- big-nums. We need either a managed or unmanaged set of
- classes for handling large numbers, and some volunteers to
- expose this functionality to C# (Either as an internal
- assembly, or as a set of P/Invoke, Internal call wrappers).
-
- Martin has got our debugger to support adding breakpoints at
- file/line combos. This was more complex than generic
- breakpoints in routines, because these breakpoints are set on
- routines that probably have not been JITed just yet. Martin's
- focus now is on stabilizing our debugger and aim for a public
- release of it.
-
- We have also imported the ECMA documentation into a separate
- module, and with the help from Scott Bronson we will have the
- necessary XSLT tools to finish our native documentation
- browser for Mono. This together with the work from Adam will
- be the foundation for the <a href="classlib-doc.html">Mono
- Documentation Tools</a>.
-
-@item Oct 9th, 2002: Various Mono updates.
-
- Brian Ritchie, Daniel Morgan, Rodrigo Moya and Ville Palo have
- been working on various database providers. The MySQL has
- seen a lot of work, and a new ODBC provider is now on CVS and
- more extensive regression tests have been checked in.
-
- Dick Porter is our background hero and keeps fixing the
- low-level bugs in the portability layer. Now the Mono handle
- daemon should be a lot more robust and will no longer leave IPC
- regions. Gonzalo Paniagua has initiated the migration of XSP
- into the System.Web class libraries now that we have a
- complete HttpRuntime implementation. This means that you are
- able to embed the ASP.NET processor into any web server you
- want. This also includes support for the system-wide
- configuration file `machine.config'.
-
- Martin Baulig has been busy with the Mono Debugger, you can see how
- it looks <a
- href="http://primates.ximian.com/~miguel/debugger-1.png">here</a>
- and <a
- href="http://primates.ximian.com/~miguel/debugger-2.png">here</a>.
- Now local variables and breakpoints are supported, and we are
- working on the UI elements to simplify their use (as seen on
- the screenshot).
-
- <a href="http://gtk-sharp.sf.net">Gtk#</a> has seen a lot of
- activity specially as we start to build larger applications.
- Vladimir Vukicevic, Kristian Rietveld, Rachel Hestilow, Mike
- Kestner and Miguel de Icaza have been busy improving it.
- mPhoto which is a Photo management application for Mono and
- Gtk# is seen <a
- href="http://primates.ximian.com/~miguel/shots/mphoto-2.jpg">here</a>.
-
- Chris Toshok the man behind LDAP in Evolution continues to
- work on the Mono.LDAP# implementation.
-
- Dietmar Maurer and Paolo Molaro are still busy working on our
- new optimized JIT/ATC engine and are making great progress.
- The code base has been designed to ease the implementation of
- more advanced compiler optimizations, and optimizations can be
- chosen individually so they can be tuned for a particular
- processor, or use profile-based information to improve the
- performance.
-
-@item Oct 1st, 2002: Mono 0.16 released; Debugger updates.
-
- Mono 0.16 has been released. Source and RPMs are <a
- href="download.html">available</a>. The release notes are <a
- href="archive/mono-0.16">here</a>.
-
- Martin's debugger can debug both managed and unmanaged code.
- Recently Martin added support for locals, parameters, and
- breakpoints on top of the existing infrastructure (his
- debugger supported instruction-level and source-code level
- single-stepping).
-
-@item Sep 19th, 2002: Mono Survey.
-
- Help us plan for the future of Mono by filing out the <a
- href="http://primates.ximian.com/~miguel/monosurvey">First Mono
- Survey</a>
-
-@item Sep 17th, 2002: Mono Hackers Hall of Fame: Sergey Chaban
-
- The <a href="hackers.html">Mono Hackers Hall Of Fame</a>
- continues to show our appreciation to the excellent
- contributors that made <b>mono::</b> a successful free
- software project.
-
- This time the Hall of Fame welcomes Sergey Chaban. Sergey has
- been a long time contributor to the project, from the early
- work on the class libraries that were critical to Mono's
- origin: every time you use a Hashtable in Mono, it runs
- Sergey's code, to the low-level optimizations on the JIT
- engine and to his work on ILASM and the PEToolkit.
-
-
-@item Sep 16th, 2002: Documentation Tools, ILASM, Debugger, Mono LDAP, Winforms
-
- Adam Treat has started moving the documentation universe again. We
- have a new strategy to document our APIs (given that we have
- chosen <a href="classlib-doc.html">not to document the code
- inline</a>). This includes the use of a master reference file
- that will hold the entry points to document. All master files
- for our assemblies have been checked into CVS now.
-
- Sergey Chaban's Mono.PEToolkit and ILASM tools have been
- checked into CVS. Although ILASM is old and will soon be
- updated, we wanted to get the build issues sorted out.
-
- Martin Baulig's Mono Debugger is still on its early stages,
- but you can run and run step by step your C# code and C code
- (including the Mono runtime). Dwarf-2 is required to compile
- your code. The regular step, step-into, and assembly-level
- step and step-into are supported. And comes with a Gtk#
- UI. The debugger is written mostly in C# with some C glue
- code. Most of the work is on the engine, we will be working
- on making a good UI in the future.
-
- Chris Toshok of the Hungry Programmer's fame has checked in
- Mono.Directory.LDAP, a C# wrapper for the LDAP libraries.
- This is the substrate for implementing the
- System.DirectoryServices assembly.
-
- Andrew has also continued with some of the cryptographic
- classes implementation.
-
- After much public debate, we have chosen a new <a
- href="winforms.html">strategy to implement winforms</a>.
- Implementing a Gtk, Qt or Aqua based version of Winforms was
- going to be almost as complex as implementing Wine itself. So
- the new strategy is to only roll out a WineLib-based
- implementation.
-
-@item Sep 4th, 2002: .NET One 2002 Program available
-
- The <a
- href="http://www.sigs-datacom.de/sd/kongresse/dotnet_2002/index.htm">.NET
- ONE 2002</a> conference in Frankfurt is now available. Paolo
- will be talking about the Mono JIT and embedding the Mono
- runtime in your Windows and Linux applications. Mike Kestner
- will talk about <a href="http://gtk-sharp.sf.net">Gtk#</a> and
- the automatic binding generator used by Gtk# and Miguel will
- be talking about the Mono project on Monday's keynote and on
- the Mono C# compiler on Tuesday.
-
-@item Sep 3rd, 2002: Apache integration
-
- <a
- href="http://lists.ximian.com/archives/public/mono-list/2002-September/001862.html">Sterling</a>
- announced an Apache module that hosts
- Mono, and allows CIL code to run from within Apache, giving the
- module access to the Apache runtime. This uses the Mono embedding
- API.
-
-@item Aug 24th, 2002: Gtk# 0.4 released
-
- Shortly after <a href="download.html">Mono 0.15</a> was
- released a fresh version of <a
- href="http://gtk-sharp.sf.net">Gtk#</a> was <a
- href="http://lists.ximian.com/archives/public/mono-list/2002-August/001702.html">announced</a>.
-
-@item Aug 23rd, 2002: Mono 0.15 released
-
- Mono 0.15 has been released. Source and RPMs are <a
- href="download.html">available</a>. The release notes are <a
- href="archive/mono-0.15">here</a>
-
-@item Aug 21th, 2002: Portable.NET encodings integrated into Mono.
-
- Rhys Weatherley has contributed the Portable.NET encoders to
- the Mono class libraries. This is a great step towards
- cooperation between these projects. Thanks to Paolo for doing the
- merger on our side.
-
- His encoders are more complete than the iconv-based approach
- that mono used, which was unreliable under certain
- circumstances.
-
-@item Aug 20th, 2002: Remoting work, Resources, SPARC checkins, ADO.NET
-
- <b>San Francisco</b>: August 14th. Linux World Expo.
-
- Mark Crichton has checked in his patches to get the SPARC port
- on par with the PPC port.
-
- Dick has checked-in the resource reader and resource writers
- to the class libraries, and Dietmar checked in the C# support
- code for the remoting infrastructure.
-
- More work on System.Data: the LibGDA (our OleDB backend) based
- providers are quickly maturing, and recently they executed
- their first query.
-
-@item Aug 13th, 2002: MCS news, Gtk# progress, Windows.Forms, ADO.NET
-
- Martin Baulig has been fixing all the known bugs in the C#
- compiler and now has moved into improving the compilation
- speed and the generated code quality of MCS. Today we got a
- 50% speedup in the bootstrap of MCS going from 24 seconds to 12 seconds.
-
- Gtk# has been making a lot of progress, some interesting
- corner cases are now supported:, you can now create canvas items as
- well as using the tree widget. Here is a shot of <a
- href="images/mocil.png">MonoCIL</a>.
-
- On the runtime front, focus has been on improving remoting
- support, exception handling, as well as completing the support
- for structure marshaling.
-
- Patrik is also back in action: the HttpRuntime infrastructure
- is rapidly improving, and Gonzalo is working into moving XSP
- into our main class library and providing the missing pieces
- to integrate with Patrik's code.
-
- Dennis and his team are working on a WineLib-based
- implementation of Windows Forms to guarantee that the corner
- cases of Windows.Forms can be handled, and we are back on track again.
-
- A lot more work on the ADO.NET and WebServices has also been
- checked into CVS.
-
-@item Aug 1st, 2002: Mono Hackers Hall of Fame
-
- The <a href="hackers.html">Mono Hackers Hall Of Fame</a> has been started
- to show our appreciation to the excellent contributors that made <b>mono::</b>
- a successful free software project.
-
- The first, deserved, entry goes to
- Nick Drochak, who joined us in the first days of Mono and built the testing
- infrastructure for the C# assemblies, fixed tons of bugs and even adventured
- himself in the lands of the C runtime. His work is invaluable for keeping
- Mono on the right track through the daily changes in the codebase.
-
<h2>Older News</h2>
Click <a href="oldnews.html">here</a> to see the olds news.
diff --git a/doc/languages b/doc/languages
index 0f53720613b..046945817a2 100755
--- a/doc/languages
+++ b/doc/languages
@@ -34,7 +34,7 @@
* <a href="#python">Python</a>
</ul>
-<a name="Java">
+<a name="Java"></a>
** Java
There is a very interesting project to make a JavaVM for .NET
@@ -78,9 +78,6 @@
Examples:
<a href="http://www.oberon.ethz.ch/oberon.net/examples/">http://www.oberon.ethz.ch/oberon.net/examples/</a>
-
- <a href="http://www.superin.formativ.net/mono/oberon/oberon.zip">http://www.superin.formativ.net/mono/oberon/oberon.zip</a>
-
<a name="ComponentPascal">
** Component Pascal
@@ -93,9 +90,8 @@
<a name="Forth">
** Delta Forth
- The Delta Forth.NET project: <a
- href="www.dataman.ro/dforth">Home
- Page</a> and <a href="http://www.dataman.ro/dforth/index.html">more
+ The Delta Forth.NET project: <a href="http://www.dataman.ro/dforth">Home
+ Page</a> and <a href="http://www.dataman.ro/dforth">more
details here</a>.
@@ -105,17 +101,15 @@
A subset of Scheme language called <a
href="http://radio.weblogs.com/0101156/stories/2002/03/19/tachy.html">Tachy</a>
-<a name="Python">
+<a name="Python"></a>
** Python
<a href="mailto:brian@No.Spam.zope.com">Brian Lloyd</a> is
working on linking the Python runtime with the .NET runtime.
More information on the PS.NET project can be found <a
href="http://www.zope.org/Members/Brian/PythonNet">here</a>.
- An FAQ document is available <a
- href="http://www.zope.org/Members/Brian/PythonNet/FAQ.html">here</a>.
-<a name="dotlisp">
+<a name="dotlisp"></a>
** dotLisp
DotLisp is available from: <a
@@ -149,6 +143,13 @@
LCC is not an open source compiler, but it is free as long as you
do not profit from selling it.
+<a name="ada"></a>
+* ADA
+
+ A# is an ADA compiler for the CIL platform, it can be downloaded from:
+ <a
+ href="http://www.usafa.af.mil/dfcs/bios/mcc_html/a_sharp.html">http://www.usafa.af.mil/dfcs/bios/mcc_html/a_sharp.html</a>
+
<a name="Java">
* Java
diff --git a/doc/mailing-lists b/doc/mailing-lists
index 6955e35d8fb..ad2aa170ae4 100644
--- a/doc/mailing-lists
+++ b/doc/mailing-lists
@@ -159,7 +159,7 @@
<table>
<tr>
-<td><a href="http://www.google.com/search"><img src="mailing-lists_files/Logo_40wht.gif" border="0" alt="Google" align="middle"></a></td>
+<td><a href="http://www.google.com/search"><img src="images/Logo_40wht.gif" border="0" alt="Google" align="middle"></a></td>
<td>
<table>
diff --git a/doc/mono-build-w32.sh b/doc/mono-build-w32.sh
index d9e1f963c79..4e011f24d04 100755
--- a/doc/mono-build-w32.sh
+++ b/doc/mono-build-w32.sh
@@ -59,11 +59,13 @@ else
echo "Automake version new enough."
fi
-# Select the stable version anyway...
-if [ ! -z "${AUTO_STABLE}" -o -e /usr/autotool/stable ]; then
- export AUTO_STABLE=${AUTO_STABLE:-/usr/autotool/stable}
- export AUTO_DEVEL=${AUTO_STABLE}
-fi
+# This causes libgc-not-found problem
+#
+## Select the stable version anyway...
+#if [ ! -z "${AUTO_STABLE}" -o -e /usr/autotool/stable ]; then
+# export AUTO_STABLE=${AUTO_STABLE:-/usr/autotool/stable}
+# export AUTO_DEVEL=${AUTO_STABLE}
+#fi
# Need to install pkgconfig and set ACLOCAL_FLAGS if there is not a
# pkgconfig installed already. Otherwise set PKG_CONFIG_PATH to the
@@ -98,6 +100,15 @@ function aclocal_scan () {
return 1
}
+function install_icuconfig() {
+ if [ ! -f $here/install/bin/icu-config ]; then
+ wget http://www.go-mono.com/archive/icu-config
+ mv icu-config $here/install/bin
+ chmod 755 $here/install/bin/icu-config
+ fi
+}
+
+
function install_package() {
zipfile=$1
markerfile=$2
@@ -123,11 +134,13 @@ else
install_pkgconfig=yes
fi
-# But we still need to use the mingw libs for glib & co
-ACLOCAL_FLAGS="-I $here/install/share/aclocal $ACLOCAL_FLAGS"
+# This causes libgc-not-found problem
+#
+## But we still need to use the mingw libs for glib & co
+#ACLOCAL_FLAGS="-I $here/install/share/aclocal $ACLOCAL_FLAGS"
-export PATH
-export ACLOCAL_FLAGS
+#export PATH
+#export ACLOCAL_FLAGS
# Grab pkg-config, glib etc
if [ ! -d $here/install ]; then
@@ -146,6 +159,9 @@ install_package glib-dev-2.0.4-20020703.zip lib/glib-2.0.lib glib-dev
install_package libiconv-1.7.zip lib/iconv.dll iconv
install_package libintl-0.10.40-20020101.zip lib/libintl-1.dll intl
install_package libgc-dev.zip lib/gc.dll gc-dev
+install_package icu-2.6.1-Win32_msvc7.zip icu/bin/icuuc26.dll icu
+
+install_icuconfig
if [ $install_pkgconfig = "no" ]; then
echo "Fixing up the pkgconfig paths"
@@ -158,10 +174,9 @@ if [ $install_pkgconfig = "no" ]; then
fi
# Needed to find the libgc bits
-CPPFLAGS="$CPPFLAGS -I$here/install/include"
-LDFLAGS="$LDFLAGS -L$here/install/lib"
-export CPPFLAGS
-export LDFLAGS
+export CFLAGS="-I $here/install/include -I $here/install/icu/include"
+export LDFLAGS="-L$here/install/lib -L$here/install/icu/lib"
+export PATH="$here/install/icu/bin:$PATH"
# Make sure we build native w32, not cygwin
#CC="gcc -mno-cygwin"
diff --git a/doc/mono-roadmap.html b/doc/mono-roadmap.html
index 8f4b8037333..c57b040b058 100644
--- a/doc/mono-roadmap.html
+++ b/doc/mono-roadmap.html
@@ -73,6 +73,8 @@ vertical-align: top;
<p>
</center>
+<i>Last update: Jan 18th, 2004</i>
+
<h3>Introduction</h3>
<p>This document describes the high-level roadmap for <a
diff --git a/doc/mono-todo b/doc/mono-todo
index 4fc9d30087f..6f2a69c6fc7 100644
--- a/doc/mono-todo
+++ b/doc/mono-todo
@@ -91,7 +91,7 @@ Happy hacking!
by the MS runtime.
<td>Medium-hard (thesis subject)
<td>2-4 months
- <td>not assigned
+ <td><a href="http://bugzilla.ximian.com/show_bug.cgi?id=52605">52605</a>
</tr>
<tr>
@@ -126,13 +126,13 @@ Happy hacking!
support the generics requirements.
<td>Medium-hard
<td>2-3 months
- <td>not assigned
+ <td>lupus and Martin
</tr>
<tr>
<td>JIT (mono/mini/)
<td>Port the JIT to additional architectures.
- Currently ports are in the works for ppc, arm, sparc, s390. None of the ports
+ Currently ports are in the works for mips, arm, sparc, s390. None of the ports
are as feature-complete as the x86 one, yet, so help is needed in getting them
up to speed. Ports to more architectures are welcome as well.
<td>Medium-hard
@@ -162,7 +162,7 @@ Happy hacking!
stack walking to collect security info.
<td>Medium-hard (thesis subject)
<td>4-5 months
- <td>not assigned
+ <td><a href="http://bugzilla.ximian.com/show_bug.cgi?id=52606">52606</a>
</tr>
<tr>
diff --git a/doc/odbc b/doc/odbc
index 1381062048c..80143fcb7eb 100755
--- a/doc/odbc
+++ b/doc/odbc
@@ -25,7 +25,7 @@
<li>List of unixODBC <a href="http://www.unixodbc.org/drivers.html">drivers</a>
- <li>List of <a href="http://ourworld.compuserve.com/homepages/Ken_North/odbcvend.htm">ODBC Vendors</a>
+ <li>List of <a href="http://www.sqlsummit.com/odbcvend.htm">ODBC Vendors</a>
<li>ODBC can connect to various databases which has an ODBC driver installed:
<ul>
@@ -38,7 +38,7 @@
<li><a href="http://www.microsoft.com/sql/default.asp">Microsoft SQL Server</a> (
via <a href="http://www.freetds.org/">FreeTDS</a> on UNIX)</li>
<li><a href="http://www-3.ibm.com/software/data/db2/">IBM DB2 Universal Database</a></li>
- <li><a href="http://www.microsoft.com/office/access/default.asp">MS Access</a>
+ <li><a href="http://www.microsoft.com/office/access">MS Access</a>
(via <a href="http://mdbtools.sourceforge.net/">MDB Tools</a> on UNIX)</li>
</ul>
@@ -105,14 +105,14 @@
<li>For Unix, you will need unixODBC or iODBC installed</li>
- <li>Have acess to a <a href="http://www-3.ibm.com/software/data/db2/">IBM DB2 Universal Database</a> or
+ <li>Have acess to a <a href="http://www-306.ibm.com/software/data/db2/">IBM DB2 Universal Database</a> or
you can download from IBM</li>
<li>Read these web pages about Unix, ODBC, and IBM DB2
<ul>
<li><a href="http://www.unixodbc.com/doc/db2.html">unixODBC web page about IBM DB2</a></li>
- <li><a href="http://www-3.ibm.com/software/data/db2/udb/ad/v8/cli/t0010406">IBM web page about unixODBC and DB2</a></li>
+ <li><a href="http://www-306.ibm.com/software/data/db2/udb/ad/v8/cli/t0010406.htm">IBM web page about unixODBC and DB2</a></li>
</ul>
</li>
diff --git a/doc/oldnews b/doc/oldnews
index d88896302fa..a24afbd651f 100644
--- a/doc/oldnews
+++ b/doc/oldnews
@@ -1,3 +1,981 @@
+@item Jul 9th, 2003: ASP.NET web services, coverage tools.
+
+ Web Services keep advancing: now we also support server-side
+ authoring of Web Services as well as web service clients
+ (which shipped in Mono 0.25). This works using our ASP.NET
+ runtime, so it works with either XSP or the Apache module. The
+ new Web Services work from Lluis added the missing bits:
+ <ul>
+ <li> .asmx files.
+ <li> Method calls with complex parameters (whatever XmlSerializer can currently serialize, which is a quite a lot).
+ <li> ref and out parameters.
+ <li> Soap headers (In, Out and InOut).
+ <li> Soap extensions, both global (configured in web.config) and particular to methods (configured using attributes).
+ </ul>
+
+ For more details, see Lluis <a href="http://lists.ximian.com/archives/public/mono-devel-list/2003-July/001449.html">post</a>
+
+ GUI-wise: Work on <a href="http://xr.xwin.org">Xr</a> to
+ implement System.Drawing continues. This will provide a full
+ GDI+ implementation for Mono, and this will be hooked up into
+ Gtk# and System.Windows.Forms.
+
+ MonoDoc keeps moving along, with a new web-based version
+ coming up next, and we are also exploring a collaborative
+ extension to allow people to contribute documentation through
+ their web browsers.
+
+ Zoltan's Coverage analysis tool has been checked into CVS.
+ With this tool it is now possible to find which class library
+ code paths are missing regression tests. The module is
+ `monocov'. Details are <a
+ href="http://www.nexus.hu/vargaz/">here</a>. A fresh Gtk#
+ version is available now.
+
+ Jean's remoting-based Soap implenentation is also maturing.
+
+@item Jun 26th: Mono 0.25 has been released.
+
+ We have released Mono 0.25. A list of the new features is
+ available <a href="archive/mono-0.25.html">here</a>.
+
+ Packages for Windows, and various Linux distributions are
+ available on our <a href="download.html">download</a> page.
+
+@item Jun 17th, 2003: Web Services client; Profiling hooks
+
+ Lluis and Gonzalo have checked into CVS the support for web
+ services in the Mono runtime. This allows Mono to work as a
+ web services client. We still require a WSDL compiler to
+ compile the initial stub, but Erik has the beginning of a WSDL
+ compiler ready and Atsushi has continued work on his
+ experimental Xml Schema to C# class generator.
+
+ As part of this, the Mono Http runtime has been rewritten to
+ increase reliability, scalability and conformance to the
+ specs. Also our io-layer has been extended to not have
+ arbitrary limits. This was done as part of our collaboration
+ with SourceGear.
+
+ Paolo has commited the new pluggable profiling API to the Mono
+ runtime: now the profiler is built as a module, and a new code
+ coverage analysis has been checked in (and Zoltan already
+ added improvements to it).
+
+ Mark's Mozilla bindings continue to improve, and we will shortly
+ migrate the Mono documentation browser to use Mozilla, to take
+ advantage of the tutorial's use of CSS.
+
+ Jackson's work on the IL assembler and Ben on running
+ regression tests have provided us with a very needed tool in
+ the Mono toolkit. One of the last missing pieces on the SDK.
+
+ On the crypto world, we got Sebastien's certificate viewer
+ checked into CVS and the crypto code keeps advancing by leaps
+ and bounds.
+
+ Alexandre and Aleksey Work continues on Windows.Forms on top
+ of Wine and Gtk# (the former for full compatibility, the later
+ for ease-of-authoring).
+
+ Cesar checked in the beginning of the semantic analysis code
+ for his JScript compiler, and will be working on it full time.
+
+@item Jun 11th, 2003: SourceGear and Ximian announce partnership
+
+ Ximian, Inc., the leading provider of desktop and server
+ solutions enabling enterprise Linux adoption, today announced
+ that SourceGear Corporation will use Mono\x{2122} Project
+ technology to offer cross-platform versions of its
+ products. In addition, the companies have entered into a
+ development partnership under which Ximian will provide
+ custom Mono development to enable delivery of SourceGear
+ products later this year. As a result, SourceGear will offer
+ both UNIX and Linux clients for its SourceGear Vault source
+ code management tool, enabling broader use of its solutions in
+ mixed-platform development organizations.
+
+ <a href="http://www.ximian.com/about_us/press_center/press_releases/index.html?pr=sourcegear">Read more...</a>
+
+ Some technical details are available <a
+ href="http://lists.ximian.com/archives/public/mono-list/2003-June/014334.html">here</a>.
+
+@item May 20th, 2003: OpenLink releases WineLib patches.
+
+ OpenLink <a
+ href="http://lists.ximian.com/archives/public/mono-winforms-list/2003-May/000284.html">announced</a>
+ the release of Vladimir's work to turn Wine into a library
+ that can be used dynamically from Mono. This work simplifies
+ the work on System.Windows.Forms as it is no longer necessary
+ have a special version of the GC, nor have a stub program.
+ The patches are available <a
+ href="http://www.openlinksw.com/mono/">here</a>.
+
+ Mono packages for the Linux/s390 are available now in the <a
+ href="download.html">download page</a>.
+
+@item May 10th, 2003: Eclipse runs on Mono
+
+ Today Zoltan Varga announced that he got the <a
+ href="http://www.eclipse.org">Eclipse IDE</a> running on top
+ of Mono+<a href="http://www.ikvm.net">IKVM</a>.
+
+ A screenshot of Eclipse running with Mono can be found <a
+ href="images/ikvm-screenshot.png">here</a>
+
+@item May 6th, 2003: Mono 0.24 ships
+
+ We have released Mono 0.24 which includes our new code
+ generation engine. A list of the new features is available <a
+ href="archive/mono-0.24.html">here</a>.
+
+ Packages for Windows, and various Linux distributions are
+ available on our <a href="download.html">download</a> page.
+ We are shipping Gtk# and MonoDoc packages for the first time.
+
+@item Apr 21st, 2003: Virtuoso 3.0 ships.
+
+ <a href="http://www.openlinksw.com">OpenLink's</a> released
+ their <a href="http://www.openlinksw.com/press/virt3rel.htm">Virtuoso
+ 3.0</a> database system. Virtuoso ships on Windows and Linux.
+ On Linux they use Mono as their runtime to host C#, .NET and
+ ASP.NET. Congratulations to OpenLink for their release.
+
+ Virtuoso can be downloaded <a
+ href="http://oplweb2.openlinksw.com:8080/download/virtuoso.vsp">here</a>
+ and a demo is available <a
+ href="http://demo.openlinksw.com:8890/tutorial/hosting/ho_s_2/ho_s_2.vsp">here</a>.
+
+ OpenLink is contributing fixes and code to the Mono project on
+ an ongoing basis.
+
+ Jon Udell wrote a small <a
+ href="http://www.infoworld.com/article/03/03/14/11stratdev_1.html">entry</a>
+
+@item Apr 19th, 2003: RelaxNG validating reader; Activities.
+
+ Atsushi has created a <a
+ href="http://www24.brinkster.com/ginga/RelaxngValidatingReader/">RelaxNG</a>
+ validating XML reader.
+
+ There is activity on the <a
+ href="http://www.gotmono.com">GotMono forums</a> and the <a
+ href="http://www.nullenvoid.com/gtksharp/wiki/">Gtk# Wiki</a>
+
+@item Apr 11th, 2003: First Mono Book is out; Team pages.
+
+ The first book to cover Mono is out. This book is currently
+ only available in German, you can find it <a
+ href="http://www.amazon.de/exec/obidos/ASIN/3827264928/qid=1050051051/sr=2-1/ref=sr_2_3_1/028-2755135-1623712">here</a>
+
+ We now have a page for the <a href="team.html">Mono Team</a>
+ where we include a list of some of the people who have made
+ Mono possible. If you have CVS access, please update the page
+ to include your information.
+
+@item Apr 5th, 2003: New compilation engine.
+
+ The new Mono compilation engine has been placed on CVS, the
+ details are <a
+ href="http://lists.ximian.com/archives/public/mono-list/2003-April/013269.html">here</a>
+
+ Zoltan has commited his <a
+ href="http://lists.ximian.com/archives/public/mono-devel-list/2003-April/000274.html">typed
+ allocation</a> patches to CVS as well.
+
+@item Apr 3rd, 2003: NUnit 2.0 GTK# GUI; GtkMozEmbed; SWT#
+
+ Gonzalo has checked in his <a href="http://gtk-sharp.sf.net">Gtk#</a>-based
+ <a href="http://nunit.org">NUnit</a> tool. Screenshots are <a
+ href="http://primates.ximian.com/~gonzalo/mono/shots/running.png">here</a>
+ and <a
+ href="http://primates.ximian.com/~gonzalo/mono/shots/finished.png">here</a>
+
+ Mark has checked his bindings for Gtk-based Mozilla into CVS,
+ module name: `GtkMozEmbed'. Read the <a
+ href="http://lists.ximian.com/archives/public/mono-list/2003-April/013247.html">details</a>
+
+ The SWT port to C# using Gtk is <a
+ href="http://lists.ximian.com/archives/public/sd-mono-port/2003-March/000114.html">progressing</a>. Screenshots are
+ <a href="http://www.roboto.ch/swt">here</a>.
+
+@item Mar 28th: Mono community site.
+
+ <a href="http://www.gotmono.com">www.gotmono.com</a> has
+ openend its door: Got Mono is a Mono Community site.
+
+@item Mar 25th: Second Mono Survey
+
+ <table width="100%" cellpadding="0" cellspacing="1" border="0" bgcolor="blue">
+ <tr>
+ <td valign="top">
+ <div style="background: #c0d0ff; margin: 0px 0px 0px 0px; padding: 1px;">
+ What do you think about Mono?
+
+ Is your company involved with the development and
+ deployment of web applications? Is Linux becoming an
+ important part of your company's business application
+ strategy? Are you considering Mono for your next
+ project? Would you like to shape the future of Mono
+ and the use of Linux in business critical
+ applications?
+
+ If you answered yes to any of these questions, we
+ would like to talk with you. If interested, please
+ email us at <a
+ href="mailto:mbadgett@ximian.com">mbadgett@ximian.com</a>.
+ </div>
+ </td>
+ </tr>
+ </table>
+
+@item Mar 20th: Windows.Forms and Wine.
+
+ Alexandre has provided a modified version of the GC system
+ that will work with and Mono. See the mono-winforms-list. It
+ is now possible to run our Win32-based implementation of
+ Windows.Forms with Mono on Linux.
+
+@item Mar 7th: Mono 0.23
+
+ A new freshly baked release of Mono is available. Release
+ notes are <a href="archive/mono-0.23">here</a>. This is mostly a
+ bug fix release. No new features.
+
+@item Mar 5th, 2003: Mono 0.22; MonoDoc 0.2; Debugger 0.2.1: Release-o-Rama.
+
+ Mono 0.22 has been released. See the <a
+ href="archive/mono-0.22">release notes</a>. This is a bug fix
+ release.
+
+ A new preview of MonoDoc 0.2, the Mono Documentation browser
+ has been <a href="http://lists.ximian.com/archives/public/gtk-sharp-list/2003-March/001266.html">released</a>.
+
+ Martin also announced a <a
+ href="http://lists.ximian.com/archives/public/mono-list/2003-March/012756.html">new
+ release</a> of the Mono Debugger (both GUI and command line).
+
+@item Mar 3rd, 2003: The Mono Hackers Hall Of Fame welcomes Zoltan Varga
+
+ The <a href="hackers.html">Mono Hackers Hall Of Fame</a>
+ continues to show our appreciation to the excellent
+ contributors that make <b>mono::</b> a successful free
+ software project.
+
+ Zoltan has contributed significantly to Mono, with bug reports and bug
+ fixes as well as pushing the envelope of the things that can be done in
+ and with the mono runtime: the gcc-based ngen compiler, code coverage
+ and more recently his work with Reflection.Emit that got mono to the
+ point of running the <a href="http://www.ikvm.net">IKVM</a> Java virtual
+ machine.
+
+@item Mar 2nd, 2003: New Mono mailing list.
+
+ A new mailing list for <a
+ href="http://lists.ximian.com/mailman/listinfo/mono-devel-list">Mono
+ Development</a> has been created.
+
+@item Feb 27th, 2003: Mono 0.21 released
+
+ Mono 0.21 has been released. This is only a bug fix release.
+ The <a href="archive/mono-0.21">release notes</a> are available.
+
+ Windows binary is available <a href="archive/mono-0.21-win32-1.exe">here</a>
+
+@item Feb 25th, 2003: Mono 0.20 for Windows released; New Apache module released.
+
+ Packages of Mono for Windows have been <a
+ href="archive/mono-0.20-stable-win32-2.exe">released</a>.
+ Thanks to Daniel, Johannes and Paolo for setting this up.
+
+ Daniel has released a new version of his Mono Apache module that
+ handles ASP.NET. The code is available at <a
+ href="http://apacheworld.org/modmono/">here</a>
+
+ Nick has posted an update on the progress on our <a
+ href="http://lists.ximian.com/archives/public/mono-list/2003-February/012467.html">regression
+ tests</a>. We are looking for more tests, and more volunteers to write them.
+
+ Also, remember to contribute to the Gtk# documentation effort,
+ momentum is picking up! See the entry for Feb 18th for more details.
+
+@item Feb, 23rd, 2003: Mono 0.20 released; Gtk# 0.8 released.
+
+ Mono 0.20 has been released. Check out the <a
+ href="archive/mono-0.20">release notes</a> for an overview of
+ the changes. You can get it <a href="download.html">here</a>.
+ There are no major features in this release, mostly bug fixes
+ and performance improvements.
+
+ Gtk# 0.8 has been <a
+ href="http://lists.ximian.com/archives/public/gtk-sharp-list/2003-February/001114.html">released</a>
+
+ <b>Important</b>: The contributed binaries for Windows
+ binaries of Mono 0.20 contain a virus. Please read <a
+ href="virus.html">this</a> if you installed the binary.
+
+@item Feb 18th, 2003: Volunteers to document Gtk#
+
+ With the availability of a documentation browser, we are
+ looking for volunteers to help us complete the documentation
+ of the Gtk# binding for Mono.
+
+ Experience with Gtk is useful, but not mandatory. We have
+ checked in stubs, and we have instructions, and resources to
+ how to complete this process <a
+ href="documentation.html">here</a>. Mail the <a
+ href="mailto:mono-docs-list@ximian.com">mono-docs-list@ximian.com</a>
+ for further discussion.
+
+@item Feb 14th, 2003: OpenGL# bindings for Mono; Mono Basic updates.
+
+ Mark Crichton has completed his OpenGL/GLUT bindings for
+ Gnome. A screenshot can be seen <a
+ href="sshots/oglcs.png">here</a>. The bindings are available
+ on the Mono CVS repository on the module `glgen'. This is a
+ straight binding to the C API.
+
+ Marco has <a
+ href="http://lists.ximian.com/archives/public/mono-list/2003-February/011752.html">posted
+ an update</a> on the current state of the free VB.NET compiler
+ for Mono.
+
+ We are looking for contributors and maintainers to the
+ JavaScript compiler as well (Janet)
+
+@item Feb 12th, 2003: New assemblies, Gtk# stub documentation, Authenticode, Polish site
+
+ Mono now distributes a few new assemblies: Mono.Security.Win32
+ as a layer to use the crypto functionality on Win32. The
+ Mono.Posix assembly which contains functionality for taking
+ advantage of Unix facilities.
+
+ A <a href="http://www.go-mono.pl/">Mono site in Poland</a>.
+
+ Stubs for the Gtk# documentation have been checked into CVS.
+ If you want to contribute please read <a
+ href="http://lists.ximian.com/archives/public/mono-list/2003-February/012108.html">this
+ message</a>
+
+ Mono development is moving quickly: Tim and Daniel have been
+ improving the Oracle database provider and Sebastien Pouliot
+ has got code signing to work using Authenticode with pure open
+ source and managed code. Plenty of new VB.NET work from Marco
+ (compiler) and Daniel (runtime). Also Jackson has resumed
+ work on the IL assembler and the fully managed library to
+ generate CIL images (Sergey wrote the first Mono.PEToolkit).
+
+@item Feb 11th, 2003: Mono Weekly News, New assemblies.
+
+ <a href="http://monoevo.sourceforge.net/mwn/index.html">Mono
+ Weekly News</a>: Includes a new interview, software
+ announcements and the PHP/Mono integration.
+
+@item Feb 5th, 2003: MonoDoc 0.1
+
+ A <a
+ href="http://www.go-mono.com/archive/monodoc-0.1.tar.gz">preliminary
+ release</a> of the Mono Documentation Browser is now availble.
+ Release <a
+ href="http://lists.ximian.com/archives/public/mono-list/2003-February/011935.html">notes</a>
+
+@item Jan, 22th, 2003: Mono wins award, OpenLink releases Virtuoso.
+
+ Mono won the `Best Open Source Project' award at the Linux
+ World Expo. A description is <a
+ href="http://linuxtoday.com/news_story.php3?ltsn=2003-01-23-024-26-OP-EV">here</a>
+
+ Open Link has a <a
+ href="http://biz.yahoo.com/prnews/030123/neth013_1.html">press
+ release</a> about Virtuoso 3.0: the first commercial product
+ shipping that uses Mono.
+
+@item Jan, 20th, 2003: Mono 0.19 released; Screenshots page; Gtk# 0.7
+
+ Mono 0.19 has been released. Check out the <a
+ href="archive/mono-0.19">release notes</a> for an overview of
+ the changes. You can get it <a href="download.html">here</a>.
+ There are no major features in this release, mostly bug fixes
+ and performance improvements.
+
+ We have now a new section <a href="screenshots.html">with
+ screenshots</a> of various Mono applications. You can see
+ there the new released Debugger, as well as the work in
+ progress on the documentation browser.
+
+ <a href="http://gtk-sharp.sf.net">Gtk# 0.7</a> has been <a
+ href="http://lists.ximian.com/archives/public/mono-list/2003-January/005222.html">released</a>
+
+@item Jan, 19th, 2003: Mono Debugger released.
+
+ After six month of extensive development, Martin Baulig has
+ released the first version of the Mono debugger. The Mono
+ debugger is written in C# and can debug both managed and
+ unmanaged applications, support for multiple-threaded
+ applications and should be relatively easy to port to new
+ platforms.
+
+ Details of the release are available in <a
+ href="http://lists.ximian.com/archives/public/mono-list/2003-January/005192.html">post</a>.
+
+ The debugger contains both Gtk# and command line interfaces.
+ The debugging file format used in Dwarf (its already supported
+ by our class libraries and the Mono C# compiler; To debug C
+ applications, you need a recent GCC, or to pass the -gdwarf-2
+ flag to gcc).
+
+@item Jan, 17th, 2003: DB2 provider, MacOS X
+
+ Christopher Bockner has contributed a DB2 System.Data client.
+
+ MacOS X support on the runtime has been integrated into the
+ distribution, and MCS works with it.
+
+ Zoltan has managed to get <a
+ href="http://radio.weblogs.com/0109845/">IKVM</a> (a Java VM
+ for .NET) to run with Mono. The HelloWorld.class runs with
+ the Mono runtime.
+
+@item Jan, 13th, 2003: Mono 0.18 released
+
+ Mono 0.18 has been released. Check out the <a
+ href="archive/mono-0.18">release notes</a> for an overview of
+ the changes. You can get it <a href="download.html">here</a>.
+
+@item Jan 10th, 2003: Mono Weekly News.
+
+ A new issue of the <a
+ href="http://lists.ximian.com/archives/public/mono-list/2003-January/004903.html">Mono
+ Weekly News</a> has been published.
+
+ Check out the <a href="crypto.html">Crypto status</a> page
+ that Sebastien has put together.
+
+@item Jan 3rd, 2003: Glade#, Code Coverage, Apache, MBas, Debugger.
+
+ Rachel has made Glade# use attributes so binding C# widgets to
+ the designed widgets is now easier than ever. Alp has
+ improved this to use implicit names as well.
+
+ Martin's Mono debugger now has support for multi-thread
+ debugging. Special feature: breakpoints can be defined in a
+ per-thread basis now.
+
+ Daniel López has checked in his Apache module to integrate
+ Mono and Mono's ASP.NET support as an Apache module. Gonzalo
+ has folded his new Mono hosting classes into this module (they
+ are now shared between XSP and mod_mono). You can get the
+ mod_apache from CVS (module name: mod_mono).
+
+ Mono Basic improvements: Marco has added support for more
+ statements on the grammar.
+
+ Zoltan has <a href="http://www.nexus.hu/vargaz2/">posted</a>
+ his Code Coverage analysis tool for Mono.
+
+@item Dec 17th, 2002: Mono: Commercial uses.
+
+ <a href="http://www.tipic.com">Tipic</a> today <a
+ href="http://www.ximian.com/about_us/press_center/press_releases/index.html?pr=tipic_mono">announced</a>
+ their work on porting their Instant Messaging Server platform
+ to run on Mono.
+
+ <a href="http://www.winfessor.com">Winfessor</a> also <a
+ href="http://www.winfessor.com/press.asp">announced</a> the
+ availability of their Jabber SDK to run on Mono.
+
+ Also two weeks ago we mentioned <a
+ href="http://www.openlinksw.com">OpenLink Software's</a> <a
+ href="http://www.ximian.com/about_us/press_center/press_releases/index.html?pr=openlink_mono">announcement</a>
+ of their product, also using Mono.
+
+@item Dec 10th, 2002: Gtk# 0.6 released; Mono 0.17 packages for Windows and Debian.
+
+ Mike Kestner <a
+ href="http://lists.ximian.com/archives/public/mono-list/2002-December/003961.html">announced
+ Gtk# 0.6</a>. This new release includes many new features and
+ bug fixes, and is the perfect companion to the <a
+ href="archive/mono-0.17">Mono 0.17</a> release.
+
+ Johannes has contributed a Windows-ready package of Mono 0.17,
+ and its available from our <a
+ href="download.html">download</a> page.
+
+ Alp Toker has <a href="http://www.atoker.com/mono/">Debian packages</a>
+
+@item Dec 9th, 2002: Mono 0.17 has been released
+
+ Mono 0.17 has been released. Check out the <a
+ href="archive/mono-0.17">release notes</a> for a more detailed
+ list. You can get it <a href="download.html">here</a>.
+
+ Many new features as well as plenty of bug fixes. Many new
+ System.Data providers and a more mature System.Web (ASP.NET)
+ which can now be hosted in any web server. A simple <a
+ href="archive/xsp-0.2.tar.gz">test web server</a> to host
+ asp.net has been released as well.
+
+ This version also integrates Neale's s390 port.
+
+ This release also includes a new exception handling system
+ that uses the gcc exception information that vastly improves
+ our internalcall speed (15% faster mcs compilation times).
+
+@item Dec 8th, 2002: VB.NET, Oracle Provider.
+
+ Marco has got the Mono Basic compiler up to speed (support for
+ classes, modules, expressions, object creation, method
+ invocation, local variables, and some statements). The
+ compiler is based on the work from Rafael Teixeira on MCS.
+
+ Screenshots: <a
+ href="http://modgb.sourceforge.net/monobasic_snap.png">in
+ Windows doing Windows.Forms</a> and in Linux doing <a
+ href="images/gtk-vb.png">VB with Gtk#</a> (courtesy of Alp).
+
+ Daniel Morgan has checked in his Oracle provider to the CVS
+ repository as well.
+
+@item Nov 27th, 2002: Press release, tutorials, Windows Forms, ADO.NET, Magazine.
+
+ <a
+ href="http://www.business2.com/articles/mag/0,1640,45454,FF.html">The
+ Penguin Takes Flight</a>: an article written by Erick
+ Schonfeld appears on the December issue of <a
+ href="http://www.business2.com/">Business 2.0</a> magazine.
+
+ <a href="http://www.openlinksw.com">OpenLink</a> and <a
+ href="http://www.ximian.com">Ximian</a> made <a
+ href="http://www.ximian.com/about_us/press_center/press_releases/index.html?pr=openlink_mono">joint
+ announcement</a> on the plans of OpenLink to ship their <a
+ href="http://www.openlinksw.com/virtuoso/index.htm">Virtuoso</a>
+ server on Unix using Mono.
+
+ Martin Willemoes's <a href="gnometutorial">GNOME.NET
+ tutorial</a> is now available from the main Mono site. This
+ tutorial is a collaborative effort to teach developers how to
+ use Mono to create Mono applications using <a href="http://gtk-sharp.sf.net">Gtk#</a>
+
+ Dennis Hayes has posted and <a
+ href="http://lists.ximian.com/archives/public/mono-list/2002-December/003800.html">update</a>
+ on the work to get Windows.Forms working on Mono. There is a
+ new test application that people can use to test their
+ controls. If you are interested in working on Windows.Forms,
+ you can participate in the <a
+ href="http://lists.ximian.com/mailman/listinfo/mono-winforms-list">mono-winforms
+ mailing list</a>
+
+ Brian Ritchie has been working on an ADO.NET <a
+ href="http://brianritchie.webhop.net/ideas/adocodegen.aspx">data
+ layer</a> and an <a
+ href="http://brianritchie.webhop.net/ideas/appserver.aspx">application
+ server</a> for Mono.
+
+ Dan Morgan has checked in his Oracle provider, and Tim Coleman
+ continues to work on the TDS implementation of the data classes.
+
+ The rest of the team has been working on bug fixing in the
+ runtime, the compiler, and the class libraries. Also,
+ compilation speed has increased recently by performing a
+ number of simple optimizations in the compiler.
+
+@item Nov 19th, 2002: Crypto update; Books; Gtk# Datagrid; .NET ONE Slides
+
+ Sebastien has got DSA and RSA signatures <a
+ href="http://lists.ximian.com/archives/public/mono-list/2002-November/003497.html">working</a>
+ as well as RSA <a
+ href="http://lists.ximian.com/archives/public/mono-list/2002-November/003502.html">encryption</a>.
+ We now distribute Chew Keong TAN's BigInteger classes.
+
+ Brian has contributed a System.Data multiplexor in Mono, it
+ can be found in the Mono.Data assembly. The details of this
+ new technology are <a
+ href="http://lists.ximian.com/archives/public/mono-list/2002-November/003400.html">here</a>.
+ It works in Mono and the .NET Framework.
+
+ Larry O'Brien has announced the candidate book for <a
+ href="http://lists.ximian.com/archives/public/mono-list/2002-November/003500.html">
+ Thinking in C#</a>. The book is Mono-friendly.
+
+ Another book that covers mono (available in German only) is <a
+ href="http://www.databecker.de/frames.php?PHPSESSD=4948515556575049525459495248485949485348&PHPSESSID=6cc68dbcfbcbacd7b82a984b0700d5d6&t=2">
+ here</a>.
+
+ Dan Morgan has implemented a DataGrid widget for Gtk#, you can
+ see Windows screenshots for it <a
+ href="images/GtkSharpDataGridScreenshot.png">here</a> and <a
+ href="images/SqlSharpGtkScreenshot4.png">here</a>.
+
+ Slides from the Mono developers for the .NET ONE conference are available now:
+ <ul>
+ <li><a
+ href="http://primates.ximian.com/~miguel/slides-europe-nov-2002/DotNetOneKeynote.sxi">
+ Mono Keynote presentation</a>
+
+ <li><a href="http://primates.ximian.com/~lupus/slides/embed/">Hosting the Mono Runtime</a><br>
+ The simple embedding of Mono in Perl is available <a
+ href="http://primates.ximian.com/~lupus/slides/embed/Mono-0.01.tar.gz">here</a>
+
+ <li><a href="http://primates.ximian.com/~lupus/slides/jit/">The Mono JIT compiler</a>
+
+ <li><a href="http://primates.ximian.com/~miguel/slides-europe-nov-2002/Mono_C_Sharp_Overview_1007.sxi">
+ Mono C# Compiler Overview</a>
+ </ul>
+
+ A couple of other presentations from Miguel's trip to Europe
+ are available <a
+ href="http://primates.ximian.com/~miguel/slides-europe-nov-2002/">here</a>
+ in Open Office file format.
+
+@item Nov 8th, 2002: Mono s390, Database work, new JIT updates.
+
+ Neale Ferguson has contributed <a href="download.html">RPM
+ packages</a> of Mono for the Linux/s390.
+
+ Tim Coleman posted an <a
+ href="http://lists.ximian.com/archives/public/mono-list/2002-November/003329.html">update</a>
+ on the improvements in the System.Data
+
+ The new JIT engine can run 72 out of our 154 tests for the
+ virtual machine, and it also got exception support this week.
+
+@item Nov 1st, 2002: TDS, Crypto, Gtk#, Winforms, bug fixes.
+
+ Tim's SqlClient is <a
+ href="http://lists.ximian.com/archives/public/mono-list/2002-November/003161.html">now
+ capable</a> of communicating with the Microsoft SQL server
+ using the TDS protocol. A screenshot showing a sample client
+ running with <a href="http://gtk-sharp.sf.net">Gtk#</a> on
+ Windows is shown <a
+ href="images/SqlSharpGtkSceenshot3.png">here</a>
+
+ Sebastien has made all symetric ciphers functional on all
+ supported modes; All the classes in Security.Cryptography are
+ present and the X590 certificates are now in too. Jackson has
+ been working on the Security classes.
+
+ Many bug fixes all over the place: class libraries (Dick,
+ Piers, Ville, Zoltan, Gonzalo, Dan, Atsushi, Nick, Phillip),
+ compiler, runtime engine. A big thank goes for everyone who
+ has been providing bug reports for us to track down.
+
+ Gaurav has been working on multiple WebControls. Gonzalo migrated
+ the ASP.NET engine to use POST for interaction.
+
+ In the Gtk# land saw the integration of gda, gnome-db and GStreamer
+ bindings.
+
+ Windows.Forms classes now build on Linux and Windows, check
+ out the status pages for areas of collaboration.
+
+@item Oct 24th, 2002: S390 support, XSP/ASP.NET, Win32 contributors, TDS.
+
+ Today Neal Ferguson's support for the IBM S390 was checked
+ into CVS.
+
+ The XSP processor has been fully integrated into the
+ System.Web assembly, and Gonzalo has finished the hosting
+ interfaces in Mono. This means that it is possible to embed
+ ASP.NET with the same APIs used in Windows, and is possible to
+ easily embed it with Apache for example. The XSP module has
+ now become a shell for testing the System.Web classes.
+
+ We are looking for contributors that know Win32 to contribute
+ to the Windows.Forms implementation. If you want to help
+ write some controls using the Win32 API, get in touch with our new <a
+ href="http://lists.ximian.com/mailman/listinfo/mono-winforms-list">mono-winforms-list@ximian.com
+ list</a> mailing list.
+
+ Tim's TDS System.Data set of classes can now talk to SQL
+ servers using the TDS protocol (version 4.2) with
+ connection pooling. Currently it can connect, run
+ transactions, update/insert/delete, and read some types. A
+ data adapter is also coming soon.
+
+@item Oct 21th, 2002: Crypto, Winforms list, Database, GConf, Debugger.
+
+ Sebastien Poliot has made a lot of progress, he reports that
+ DES and TripleDES have been fixed; Rijndael and CFB modes
+ still have problems in some configurations and some areas that
+ are not supported by the .NET framework.
+
+ Last week we created a new <a
+ href="http://lists.ximian.com/mailman/listinfo/mono-winforms-list">mailing
+ list</a> to discuss the Mono Winforms implementation.
+
+ Tim has started a full C# implementation of the TDS protocol
+ and the providers, and Brian continues his work on his ODBC
+ binding.
+
+ Rachel Hestilow has also checked in a binding for GConf. This
+ binding <a
+ href="http://toxic.magnesium.net/~hestilow/gconfsharp/intro.html">is
+ unique</a> in that it uses some features in the CLI to support
+ complex data types, and allows the user to keep only one
+ representation of the types instead of two (the master types
+ is defined in CLI-land). Also Property Editors (<a
+ href="http://primates.ximian.com/~miguel/shots/gconf-shot.png">shot</a>)
+ simplify the creation of user interfaces that bind their
+ configuration to backend keys, following the <a
+ href="http://developer.gnome.org/projects/gup/hig/1.0/">GNOME
+ Human Interface Guidelines.</a>
+
+ Martin is now on vacation, but before leaving he produced a
+ number of documents detailing the state of the debugger. The
+ major missing feature is full support for debugging unmanaged
+ applications (it requires dwarf-2 handlers for types). We
+ will do some polishing of the user interface (<a
+ href="http://primates.ximian.com/~miguel/shots/debugger-4.png">new
+ shot</a>) to expose the existing and rich functionality to the
+ users and try to release a preview of the debugger at the same
+ time as Mono 0.17.
+
+@item Oct 14th, 2002: Crypto, Database work, Debugger, Documentation.
+
+ Brian, Daniel and Rodrigo have been busy working on the ODBC
+ provider for Mono. Daniel posted some <a
+ href="http://lists.ximian.com/archives/public/mono-list/2002-October/002755.html">updates</a>.
+ Brian posted <a
+ href="http://lists.ximian.com/archives/public/mono-list/2002-October/002758.html">details
+ about the ODBC.NET</a> provider.
+
+ Also Sebastien Pouliot has been improving the various
+ cryptographic classes in Mono, something that we had not done
+ in quite some time. We are looking for a way to handle
+ big-nums. We need either a managed or unmanaged set of
+ classes for handling large numbers, and some volunteers to
+ expose this functionality to C# (Either as an internal
+ assembly, or as a set of P/Invoke, Internal call wrappers).
+
+ Martin has got our debugger to support adding breakpoints at
+ file/line combos. This was more complex than generic
+ breakpoints in routines, because these breakpoints are set on
+ routines that probably have not been JITed just yet. Martin's
+ focus now is on stabilizing our debugger and aim for a public
+ release of it.
+
+ We have also imported the ECMA documentation into a separate
+ module, and with the help from Scott Bronson we will have the
+ necessary XSLT tools to finish our native documentation
+ browser for Mono. This together with the work from Adam will
+ be the foundation for the <a href="classlib-doc.html">Mono
+ Documentation Tools</a>.
+
+@item Oct 9th, 2002: Various Mono updates.
+
+ Brian Ritchie, Daniel Morgan, Rodrigo Moya and Ville Palo have
+ been working on various database providers. The MySQL has
+ seen a lot of work, and a new ODBC provider is now on CVS and
+ more extensive regression tests have been checked in.
+
+ Dick Porter is our background hero and keeps fixing the
+ low-level bugs in the portability layer. Now the Mono handle
+ daemon should be a lot more robust and will no longer leave IPC
+ regions. Gonzalo Paniagua has initiated the migration of XSP
+ into the System.Web class libraries now that we have a
+ complete HttpRuntime implementation. This means that you are
+ able to embed the ASP.NET processor into any web server you
+ want. This also includes support for the system-wide
+ configuration file `machine.config'.
+
+ Martin Baulig has been busy with the Mono Debugger, you can see how
+ it looks <a
+ href="http://primates.ximian.com/~miguel/debugger-1.png">here</a>
+ and <a
+ href="http://primates.ximian.com/~miguel/debugger-2.png">here</a>.
+ Now local variables and breakpoints are supported, and we are
+ working on the UI elements to simplify their use (as seen on
+ the screenshot).
+
+ <a href="http://gtk-sharp.sf.net">Gtk#</a> has seen a lot of
+ activity specially as we start to build larger applications.
+ Vladimir Vukicevic, Kristian Rietveld, Rachel Hestilow, Mike
+ Kestner and Miguel de Icaza have been busy improving it.
+ mPhoto which is a Photo management application for Mono and
+ Gtk# is seen <a
+ href="http://primates.ximian.com/~miguel/shots/mphoto-2.jpg">here</a>.
+
+ Chris Toshok the man behind LDAP in Evolution continues to
+ work on the Mono.LDAP# implementation.
+
+ Dietmar Maurer and Paolo Molaro are still busy working on our
+ new optimized JIT/ATC engine and are making great progress.
+ The code base has been designed to ease the implementation of
+ more advanced compiler optimizations, and optimizations can be
+ chosen individually so they can be tuned for a particular
+ processor, or use profile-based information to improve the
+ performance.
+
+@item Oct 1st, 2002: Mono 0.16 released; Debugger updates.
+
+ Mono 0.16 has been released. Source and RPMs are <a
+ href="download.html">available</a>. The release notes are <a
+ href="archive/mono-0.16">here</a>.
+
+ Martin's debugger can debug both managed and unmanaged code.
+ Recently Martin added support for locals, parameters, and
+ breakpoints on top of the existing infrastructure (his
+ debugger supported instruction-level and source-code level
+ single-stepping).
+
+@item Sep 19th, 2002: Mono Survey.
+
+ Help us plan for the future of Mono by filing out the <a
+ href="http://primates.ximian.com/~miguel/monosurvey">First Mono
+ Survey</a>
+
+@item Sep 17th, 2002: Mono Hackers Hall of Fame: Sergey Chaban
+
+ The <a href="hackers.html">Mono Hackers Hall Of Fame</a>
+ continues to show our appreciation to the excellent
+ contributors that made <b>mono::</b> a successful free
+ software project.
+
+ This time the Hall of Fame welcomes Sergey Chaban. Sergey has
+ been a long time contributor to the project, from the early
+ work on the class libraries that were critical to Mono's
+ origin: every time you use a Hashtable in Mono, it runs
+ Sergey's code, to the low-level optimizations on the JIT
+ engine and to his work on ILASM and the PEToolkit.
+
+
+@item Sep 16th, 2002: Documentation Tools, ILASM, Debugger, Mono LDAP, Winforms
+
+ Adam Treat has started moving the documentation universe again. We
+ have a new strategy to document our APIs (given that we have
+ chosen <a href="classlib-doc.html">not to document the code
+ inline</a>). This includes the use of a master reference file
+ that will hold the entry points to document. All master files
+ for our assemblies have been checked into CVS now.
+
+ Sergey Chaban's Mono.PEToolkit and ILASM tools have been
+ checked into CVS. Although ILASM is old and will soon be
+ updated, we wanted to get the build issues sorted out.
+
+ Martin Baulig's Mono Debugger is still on its early stages,
+ but you can run and run step by step your C# code and C code
+ (including the Mono runtime). Dwarf-2 is required to compile
+ your code. The regular step, step-into, and assembly-level
+ step and step-into are supported. And comes with a Gtk#
+ UI. The debugger is written mostly in C# with some C glue
+ code. Most of the work is on the engine, we will be working
+ on making a good UI in the future.
+
+ Chris Toshok of the Hungry Programmer's fame has checked in
+ Mono.Directory.LDAP, a C# wrapper for the LDAP libraries.
+ This is the substrate for implementing the
+ System.DirectoryServices assembly.
+
+ Andrew has also continued with some of the cryptographic
+ classes implementation.
+
+ After much public debate, we have chosen a new <a
+ href="winforms.html">strategy to implement winforms</a>.
+ Implementing a Gtk, Qt or Aqua based version of Winforms was
+ going to be almost as complex as implementing Wine itself. So
+ the new strategy is to only roll out a WineLib-based
+ implementation.
+
+@item Sep 4th, 2002: .NET One 2002 Program available
+
+ The <a
+ href="http://www.sigs-datacom.de/sd/kongresse/dotnet_2002/index.htm">.NET
+ ONE 2002</a> conference in Frankfurt is now available. Paolo
+ will be talking about the Mono JIT and embedding the Mono
+ runtime in your Windows and Linux applications. Mike Kestner
+ will talk about <a href="http://gtk-sharp.sf.net">Gtk#</a> and
+ the automatic binding generator used by Gtk# and Miguel will
+ be talking about the Mono project on Monday's keynote and on
+ the Mono C# compiler on Tuesday.
+
+@item Sep 3rd, 2002: Apache integration
+
+ <a
+ href="http://lists.ximian.com/archives/public/mono-list/2002-September/001862.html">Sterling</a>
+ announced an Apache module that hosts
+ Mono, and allows CIL code to run from within Apache, giving the
+ module access to the Apache runtime. This uses the Mono embedding
+ API.
+
+@item Aug 24th, 2002: Gtk# 0.4 released
+
+ Shortly after <a href="download.html">Mono 0.15</a> was
+ released a fresh version of <a
+ href="http://gtk-sharp.sf.net">Gtk#</a> was <a
+ href="http://lists.ximian.com/archives/public/mono-list/2002-August/001702.html">announced</a>.
+
+@item Aug 23rd, 2002: Mono 0.15 released
+
+ Mono 0.15 has been released. Source and RPMs are <a
+ href="download.html">available</a>. The release notes are <a
+ href="archive/mono-0.15">here</a>
+
+@item Aug 21th, 2002: Portable.NET encodings integrated into Mono.
+
+ Rhys Weatherley has contributed the Portable.NET encoders to
+ the Mono class libraries. This is a great step towards
+ cooperation between these projects. Thanks to Paolo for doing the
+ merger on our side.
+
+ His encoders are more complete than the iconv-based approach
+ that mono used, which was unreliable under certain
+ circumstances.
+
+@item Aug 20th, 2002: Remoting work, Resources, SPARC checkins, ADO.NET
+
+ <b>San Francisco</b>: August 14th. Linux World Expo.
+
+ Mark Crichton has checked in his patches to get the SPARC port
+ on par with the PPC port.
+
+ Dick has checked-in the resource reader and resource writers
+ to the class libraries, and Dietmar checked in the C# support
+ code for the remoting infrastructure.
+
+ More work on System.Data: the LibGDA (our OleDB backend) based
+ providers are quickly maturing, and recently they executed
+ their first query.
+
+@item Aug 13th, 2002: MCS news, Gtk# progress, Windows.Forms, ADO.NET
+
+ Martin Baulig has been fixing all the known bugs in the C#
+ compiler and now has moved into improving the compilation
+ speed and the generated code quality of MCS. Today we got a
+ 50% speedup in the bootstrap of MCS going from 24 seconds to 12 seconds.
+
+ Gtk# has been making a lot of progress, some interesting
+ corner cases are now supported:, you can now create canvas items as
+ well as using the tree widget. Here is a shot of <a
+ href="images/mocil.png">MonoCIL</a>.
+
+ On the runtime front, focus has been on improving remoting
+ support, exception handling, as well as completing the support
+ for structure marshaling.
+
+ Patrik is also back in action: the HttpRuntime infrastructure
+ is rapidly improving, and Gonzalo is working into moving XSP
+ into our main class library and providing the missing pieces
+ to integrate with Patrik's code.
+
+ Dennis and his team are working on a WineLib-based
+ implementation of Windows Forms to guarantee that the corner
+ cases of Windows.Forms can be handled, and we are back on track again.
+
+ A lot more work on the ADO.NET and WebServices has also been
+ checked into CVS.
+
+@item Aug 1st, 2002: Mono Hackers Hall of Fame
+
+ The <a href="hackers.html">Mono Hackers Hall Of Fame</a> has been started
+ to show our appreciation to the excellent contributors that made <b>mono::</b>
+ a successful free software project.
+
+ The first, deserved, entry goes to
+ Nick Drochak, who joined us in the first days of Mono and built the testing
+ infrastructure for the C# assemblies, fixed tons of bugs and even adventured
+ himself in the lands of the C runtime. His work is invaluable for keeping
+ Mono on the right track through the daily changes in the codebase.
+
@item Looking for volunteers
We are looking for volunteers to help complete various pieces
diff --git a/doc/oracle b/doc/oracle
index 16188b522ab..28d81bee4eb 100755
--- a/doc/oracle
+++ b/doc/oracle
@@ -8,9 +8,7 @@
<li>Works on Windows and Linux</li>
- <li>Works with Oracle 8i</li>
-
- <li>May work with Oracle 9i</li>
+ <li>Works with Oracle 8i and 9i.</li>
<li>Uses the Oracle CLI (Call Level Interface) which is a C library (API) for the Oracle Client
software</li>
@@ -30,23 +28,15 @@
** Current Status
<ul>
- <li>OracleConnection can connect and disconnect to an Oracle 8i database on
+ <li>OracleConnection can connect and disconnect to an Oracle 8i or 9i database on
Windows and Linux via OCI (Oracle Call-level Interface)</li>
- <li>No longer uses a glue library (a library between the System.Data.OracleClient.dll
- assembly and the oci library). In Current Mono cvs, System.Data.OracleClient
- directly platform invokes into the oci library thanks to Tim Coleman.</li>
-
<li>Can have multiple connections with different transactions where each transaction is
separated from the others, so a rollback or commit in one transaction
does not affect the other.</li>
<li>Can execute simple DML SQL statements, such as,
INSERT a row into the EMP table via the OracleCommand's ExecuteNonQuery method</li>
-
- <li>The System.Data.OracleClient.dll assembly can be built with mcs/mono via
- the makefile.gnu for System.Data.OracleClient or csc/.net via the
- System.Data.OracleClient.build nant build file.</li>
<li>Can retrieve data via ExecuteReader and OracleDataReader. Currently,
supports character, numeric, some date data types. ExecuteScalar
@@ -66,8 +56,7 @@
<li>Lots of missing functionality and bugs.</li>
- <li>Works with SQL# command-line and GTK# versions in cvs. Only works with
- simple character data though.</li>
+ <li>Works with SQL# command-line and GTK# GUI versions.</li>
</ul>
@@ -79,12 +68,12 @@
<li>transactions (WORKING)</li>
<li>Stored Procedures, Functions, and Packages support</li>
<li>Be able to fill a DataTable in a DataSet via a data adapter (IN PROGRESS)</li>
- <li>Support for Oracle 8i (WORKING</li>
- <li>Support for Oracle 9i (UNKNOWN)</li>
+ <li>Support for Oracle 8i and 9i (WORKING)</li>
<li>Support LOBs</li>
<li>Support all the data types</li>
<li>Implement Connection pooling</li>
<li>Security</li>
+ <li>Once Oracle 10g is released, make sure Mono works with Oracle 10g.</li>
</ul>
@@ -99,9 +88,7 @@
Registration to the <a href="http://technet.oracle.com/">Oracle Technology Network</a> is free. If installing on Linux,
I suggest you do a lot of searching to see how others installed Oracle on Linux.</li>
- <li>Make sure System.Data.OracleClient.dll assembly is built, if not, go
- into System.Data.OracleClient and do a make -f makefile.gnu (on Linux) or
- ../../nant/NAnt.exe (on Windows using Cygwin).</li>
+ <li>Make sure System.Data.OracleClient.dll assembly is built.</li>
<li>Take a look at TestOracleClient.cs found at mcs/class/System.Data.OracleClient/Test</li>
@@ -161,12 +148,10 @@
-r System.Data.OracleClient.dll
</pre>
</li>
- <li>Build on Windows via Cygwin:
+ <li>Build on Windows:
<pre>
- mono C:/cygwin/home/MyHome/mono/install/bin/mcs.exe \
- TestExample.cs \
- -lib:C:/cygwin/home/MyHome/mono/install/lib \
- -r System.Data.dll -r System.Data.OracleClient.dll
+ mcs TestExample.cs /r:System.Data.dll \
+ /r:System.Data.OracleClient.dll
</pre>
</li>
</ul>
diff --git a/doc/other b/doc/other
index 5dcc7e40fa3..0c259caea7b 100644
--- a/doc/other
+++ b/doc/other
@@ -10,6 +10,8 @@
<li><a href="http://www.go-mono.pl">Mono Poland</a>:
Mono site for polish users.
+ <li><a href="http://primates.ximian.com/~atsushi/mono-jp/">Mono Japanese Translation</a>:
+ Mono site Japanese translation pages. Translated sources are maintained at <a href="http://forge.novell.com/modules/xfmod/project/?mono-jp">Novell Forge</a>.
</ul>
* User sites
diff --git a/doc/performance b/doc/performance
index dfe1e475373..96f687b5ec1 100644
--- a/doc/performance
+++ b/doc/performance
@@ -5,13 +5,19 @@
These are just guidelines, and you should still profile your
code to find the actual performance problems in your
- application.
+ application. It is never a smart idea to make a change with the
+ hopes of improving the performance of your code without first
+ measuring. In general, these guidelines should serve as ideas
+ to help you figure out `how can I make this method run faster'.
+
+ It is up to you to figure out, `Which method is running slowly.'
** Using the Mono profiler
-
- To obtain memory consumption and measure the time spent on
- functions and the number of times a function is called in
- Mono, you can invoke the runtime with the --profile flag, like this:
+
+ So, how does one measure what method are running slowly? A profiler
+ helps with this task. Mono includes a profiler that is built
+ into the runtime system. You can invoke this profiler on your program
+ by running with the --profile flag.
<pre>
mono --profile program.exe
@@ -21,8 +27,16 @@
for profiling. The default Mono profiler will record the time
spent on a routine, the number of times the routine called,
the memory consumed by each method broken down by invoker, and
- the total amount of memory consumed, this is what it looks
- like:
+ the total amount of memory consumed.
+
+ It does this by asking the JIT to insert a call to the profiler
+ every time a method is entered or left. The profiler times the
+ amount of time elapsed between the beginning and the end of the
+ call. The profiler is also notified of allocations.
+
+ When the program has finished executing, the profiler prints the
+ data in human readable format. It looks like:
+
<pre>
Total time spent compiling 227 methods (sec): 0.07154
Slowest method to compile (sec): 0.01893: System.Console::.cctor()
@@ -44,10 +58,42 @@ Total mem Method
Total memory allocated: 448 KB
</pre>
+ At the top, it shows each method that is called. The data is sorted
+ by the total time that the program spent within the method. Then
+ it shows how many times the method was called, and the average time
+ per call.
+
+ Below this, it shows the top callers of the method. This is very useful
+ data. If you find, for example, that the method Data::Computate () takes
+ a very long time to run, you can look to see if any of the calls can be
+ avoided.
+
+ Two warnings must be given about the method data. First,
+ the profiler has an overhead associated with it. As such,
+ a high number of calls to a method may show up as comsuming
+ lots of time, when in reality they do not consume much time
+ at all. If you see a method that has a very high number of
+ calls, you may be able to ignore it. However, do consider
+ removing calls if possible, as that will sometimes help
+ performance. This problem is often seen with the use
+ of built in collection types.
+
+ Secondly, due to the nature of the profiler, recursive calls
+ have extermely large times (because the profiler double counts
+ when the method calls itself). One easy way to see this problem
+ is that if a method is shown as taking more time than the Main
+ method, it is very likely recursive, and causing this problem.
+
+ Below the method data, allocation data is shown. This shows
+ how much memory each method allocates. The number beside
+ the method is the total amount of memory. Below that, it
+ is broken down into types. Then, the caller data is given. This
+ data is again useful when you want to figure out how to eliminate calls.
+
You might want to keep a close eye on the memory consumption
and on the method invocation counts. A lot of the
performance gains in MCS for example came from reducing its
- memory usage, as opposed to changes in the execution path.
+ memory usage, as opposed to changes in the execution path.
** Memory Management in the .NET/Mono world.
@@ -57,6 +103,83 @@ Total memory allocated: 448 KB
is a great productivity gain, but if you create thousands of
objects, that will make the garbage collector do more work,
and it might slow down your application.
+
+ Remember, each time you allocate an object, the GC is forced
+ to find space for the object. Each object has an 8 byte overhead
+ (4 to tell what type it is, then 4 for a sync block). If
+ the GC finds that it is running out of room, it will scan every
+ object for pointers, looking for unreferenced objects. If you allocate
+ extra objects, the GC then must take the effort to free the objects.
+
+ Mono uses the Boehm GC, which is a conservative collector,
+ and this might lead to some memory fragmentation and unlike
+ generational GC systems, it has to scan the entire allocated
+ memory pool.
+
+*** Boxing
+ The .NET framework provides a rich hierchy of object types.
+ Each object not only has value information, but also type
+ information associated with it. This type information makes
+ many types of programs easier to write. It also has a cost
+ associated with it. The type information takes up space.
+
+ In order to reduce the cost of type information, almost every
+ Object Oriented language has the concept of `primitatives'.
+ They usually map to types such as integers and bools. These
+ types do not have any type information associated with them.
+
+ However, the language also must be able to treat primitatives
+ as first class datums -- in the class with objects. Languages
+ handle this issue in different ways. Some choose to make a
+ special class for each primative, and force the user to do an
+ operation such as:
+<pre>
+// This is Java
+list.add (new Integer (1));
+System.out.println (list.get (1).intValue ());
+</pre>
+
+ The C# design team was not satisfied with this type
+ of construct. They added a notion of `boxing' to the language.
+
+ Boxing preforms the same thing as Java's <code>new Integer (1)</code>.
+ The user is not forced to write the extra code. However,
+ behind the scenes the <em>same thing</em> is being done
+ by the runtime. Each time a primative is cast to an object,
+ a new object is allocated.
+
+ You must be careful when casting a primative to an object.
+ Note that because it is an implicit conversion, you will
+ not see it in your code. For example, boxing is happening here:
+
+<pre>
+ArrayList foo = new ArrayList ();
+foo.Add (1);
+</pre>
+
+ In high performance code, this operation can be very costly.
+
+*** Using structs instead of classes for small objects
+
+ For small objects, you might want to consider using value
+ types (structs) instead of object (classes).
+
+ However, you must be careful that you do not use the struct
+ as an object, in that case it will actually be more costly.
+
+ As a rule of thumb, only use structs if you have a small
+ number of fields (totaling less than 32 bytes), and
+ need to pass the item `by value'. You should not box the object.
+
+*** Assisting the Garbage Collector
+
+ Although the Garbage Collector will do the right thing in
+ terms of releasing and finalizing objects on time, you can
+ assist the garbage collector by clearing the fields that
+ points to objects. This means that some objects might be
+ elegible for collection earlier than they would, this can help
+ reduce the memory consumption and reduce the work that the GC
+ has to do.
** foreach
@@ -79,18 +202,3 @@ Total memory allocated: 448 KB
when to use a manual loop. The best thing to do is to always
use foreach, and only when profile shows a problem, replace
foreach with for loops.
-
-*** Using structs instead of classes for small objects
-
- For small objects, you might want to consider using value
- types (structs) instead of object (classes).
-
-** Assisting the Garbage Collector
-
- Although the Garbage Collector will do the right thing in
- terms of releasing and finalizing objects on time, you can
- assist the garbage collector by clearing the fields that
- points to objects. This means that some objects might be
- elegible for collection earlier than they would, this can help
- reduce the memory consumption and reduce the work that the GC
- has to do.
diff --git a/doc/postgresql b/doc/postgresql
index 6e5bb4f2483..cbe6c2f87d8 100644
--- a/doc/postgresql
+++ b/doc/postgresql
@@ -545,8 +545,8 @@ mono TestExample.exe
"User ID=postgres;" +
"Password=fun2db;";
IDbConnection dbcon;
- dbcon.Open();
dbcon = new NpgsqlConnection(connectionString);
+ dbcon.Open();
IDbCommand dbcmd = dbcon.CreateCommand();
// requires a table to be created named employee
// with columns firstname and lastname
diff --git a/doc/ppc b/doc/ppc
index 56026d4d6b1..1b6dcbeb0a6 100644
--- a/doc/ppc
+++ b/doc/ppc
@@ -13,7 +13,9 @@
*** Jitter
- Start the port
+ Works on MacOS X 10.2 and Linux/PPC.
+
+ There are known problems on MacOS 10.3
** Documentation
@@ -28,6 +30,6 @@
*** Calling conventions:
- <a href="http://www.esofta.com/softspecs.html">The PowerPC SystemV ABI specification</a>
+ <a href="http://refspecs.freestandards.org/elf/elfspec_ppc.pdf">The PowerPC SystemV ABI specification</a>
diff --git a/doc/resources b/doc/resources
index d4ecf266daa..9588bdc9829 100644
--- a/doc/resources
+++ b/doc/resources
@@ -9,7 +9,7 @@
** Microsoft .NET
- The <a href="http://msdn.microsoft.com/net">Microsoft.NET site.</a>
+ The <a href="http://msdn.microsoft.com/netframework">Microsoft.NET site.</a>
The Microsoft .NET Framework can be downloaded <a
href="http://msdn.microsoft.com/library/default.asp?url=/downloads/list/netdevframework.asp">here</a>
@@ -74,21 +74,13 @@
<li><a href="http://www.gotdotnet.com/userarea/keywordsrch.aspx?keyword=winchurn">http://www.gotdotnet.com/userarea/keywordsrch.aspx?keyword=winchurn</a>
</ul>
-** Presentations
-
- Currently the <a href="Presentations/O-Reilly">O'Reilly</a>
- presentation on Mono is available. Arturo Espinosa has given
- a talk on Mono in Mexico and made <a
- href="http://construct.ximian.com/~arturo/Presentations/Mono.OLS/html">spanish
- slides</a>
-
** ECMA Documentation.
You can get the documentation for the ECMA specs from:
<ul>
- * <a href="http://www.ecma-international.org/publications/standards/ECMA-334.HTM">C# Language Specification</a>
- * <a href="http://www.ecma-international.org/publications/standards/ECMA-335.HTM">Common Language Infrastructure</a>
+ * <a href="http://www.ecma-international.org/publications/standards/Ecma-334.HTM">C# Language Specification</a>
+ * <a href="http://www.ecma-international.org/publications/standards/Ecma-335.HTM">Common Language Infrastructure</a>
</ul>
@@ -97,7 +89,6 @@
<ul>
* <a href="http://msdn.microsoft.com/net/ecma">At MSDN</a>
* <a href="http://www.dotnetexperts.com">Dot Net Experts</a>
- * <a href="http://developer.intel.com/software/idap/ecma">Intel</a>
* <a href="http://lightning.csse.monash.edu.au/.net/CLI">Monash University</a>
</ul>
@@ -153,7 +144,7 @@
<li><b>Class Libraries</b></li>
<ul>
- * <a href="http://9mm.com/~ogl/sdldotnet/">SDL for
+ * <a href="http://cs-sdl.sourceforge.net/">SDL for
.NET:</a> Bindings for the popular SDL graphics library.
@@ -193,10 +184,6 @@
* <a
href="http://www.southern-storm.com.au/portable_net.html">Portable.NET:</a>
Another implementation of the CLI and C# compiler.
-
- * A Free (GFDL) tutorial on C# in Spanish with
- examples, slides, and extras (under development). Get it <a
- href="http://geneura.ugr.es/~jaime/csharp/">here</a>.
</ul>
** GNOME Documentation
diff --git a/doc/sqlclient b/doc/sqlclient
index d17f4695593..c5eb1f9cc40 100755
--- a/doc/sqlclient
+++ b/doc/sqlclient
@@ -31,11 +31,14 @@
<ul>
- <li>Able to connect to Microsoft SQL Server 7/2000 databases</li>
+ <li>Thanks to Sebastien Pouliot, we now have NT Authentication (Integrated Security) support. This support was
+ added after the release of Mono 0.29. So, you either get it from cvs or wait for the Mono 0.30 release.</li>
+
+ <li>Able to connect to Microsoft SQL Server 7/2000 databases via SQL Server authentication and NT Authentication.</li>
<li>Connection pooling works.</li>
- <li>Stored Procedures work</li>
+ <li>Stored Procedures work.</li>
<li>Parameters work.</li>
@@ -59,8 +62,6 @@
<li>Uses TDS Protocol Version 7.0</li>
- <li><a href="http://www.go-mono.com/tds-providers.html">Design of the Microsoft SQL Server, Sybase, and TDS Providers in Mono</a></li>
-
<li>Works in the SQL# command-line and GTK# GUI version</li>
</ul>
@@ -71,9 +72,9 @@
<li>Needs more testing</li>
- <li>Would like to figure out how to connect via Trusted_Connection or Integrated Security</li>
-
<li>Start work on TDS Protocol Version 8.0 support</li>
+
+ <li>Add support for .NET 1.2 and 2.0 and Microsoft SQL Server (Yukon) support</li>
</ul>
@@ -89,9 +90,10 @@
</ul>
</li>
- <li>If using Microsoft SQL Server 2000, make sure
+ <li><b>IMPORTANT:</b> If using Microsoft SQL Server 2000, make sure
you are using at least Service Pack 3 for Microsoft SQL Server 2000. If using
- MSDE 2000, make sure you have the special Service Pack 3 for MSDE 2000.</li>
+ MSDE 2000, make sure you have the special Service Pack 3 for MSDE 2000. You
+ can get it from <a href="http://www.microsoft.com/sql/downloads/2000/sp3.asp">here</a></li>
<li>For those that only have MSDE installed. You can change the authentication mode
from Windows Only Authentication to SQL Server and Windows Authentications (also knows as Mixed-mode authentication)
@@ -121,11 +123,17 @@
to explicitly use a User ID and Password
authenticated by SQL Server.</li>
- <li>Has a connection string format:
+ <li>Has a connection string format for SQL Server Authentication:
<pre>
Server=hostname;Database=databaseName;User ID=userid;Password=password
</pre>
</li>
+ <li>Has a connection string format for NT Authentication:
+<pre>
+ Server=hostname;Database=databaseName;User ID=windowsUserid;Password=windowsPassword;Integrated Security=SSPI
+</pre>
+ </li>
+
<li>The Server part can be used three ways:
<table border=1>
diff --git a/doc/sqlite b/doc/sqlite
index 6730477202c..89dace1c929 100755
--- a/doc/sqlite
+++ b/doc/sqlite
@@ -25,7 +25,7 @@
<li>Created by Vladimir Vukicevic so he could have a database of
thumbnail images for mPhoto. mPhoto is GUI application
for cataloging images. mPhoto runs on Mono
- and uses <a href="http:www.go-mono.com/gtk-sharp.html">GTK#</a> for its GUI.</li>
+ and uses <a href="http://www.go-mono.com/gtk-sharp.html">GTK#</a> for its GUI.</li>
<li>Bugs with Mono or the data provider should be reported
in Mono's Bugzilla <a href="http://bugzilla.ximian.com/">here</a>. If you
diff --git a/doc/sybase b/doc/sybase
index 5b0c3ccba81..85deca1a67c 100755
--- a/doc/sybase
+++ b/doc/sybase
@@ -17,8 +17,6 @@
<li>Requires the assembly Mono.Data.Tds.dll which implements the TDS protocol in 100% C#.</li>
<li>Uses TDS Protocol Version 5.0</li>
-
- <li>Does not support trusted connections</li>
<li>Bugs with Mono or the data provider should be reported
in Mono's Bugzilla <a href="http://bugzilla.ximian.com/">here</a>. If you
diff --git a/doc/tdsclient b/doc/tdsclient
index fdfe6926c9f..2c58aea698f 100755
--- a/doc/tdsclient
+++ b/doc/tdsclient
@@ -18,8 +18,6 @@
<li>Uses TDS Protocol Version 4.2 by default</li>
- <li>Does not support trusted connections</li>
-
<li>Bugs with Mono or the data provider should be reported
in Mono's Bugzilla <a href="http://bugzilla.ximian.com/">here</a>. If you
do not have Bugzilla user account, it is free
diff --git a/doc/testing b/doc/testing
index d4d6ecbcc3e..d8504b1f34c 100644
--- a/doc/testing
+++ b/doc/testing
@@ -17,6 +17,11 @@
<li><a href="#runtime"><b>Runtime tests</b></a>: Tests for
the virtual machine.
+
+ <li><a href="#aspnet"><b>ASP.NET tests</b></a>: ASP.NET tests.
+
+ <li><a href="#ws"><b>Web Services tests</b></a>: Web Services
+ client/server tests.
</ul>
<a name="unit"></a>
@@ -29,6 +34,29 @@
that they work correctly. Mono also needs a testing framework
to make it easy to write and run lots of tests.
+ In some classes, we might also provide standalone tests because of
+ some reasons such as too huge testcases, another downloading and so on.
+ (For example, managed XSLT has standalone test which downloads and
+ expands some megabytes of OASIS test suite.)
+
+ Here I list them up as long as I know. If you are going to add another
+ standalone tests, please add one line here. It is also recommended that
+ you add some notes on how to build and run tests.
+
+ <ul>
+
+ * Mono.Data/test/
+ * System.Data/Test, and some individual ADO.NET libraries:
+ there are some standalone tests. See the bottom of <a href="ado-net.html">
+ ADO.NET page</a> for detail.
+ * System.Web/Test/TestMonoWeb : see README
+ * System.Web.Services/Test/standalone : see README
+ * System.Windows.Forms/SWFTest/
+ * System.XML/Tests/System.Xml.Schema/standalone_tests : see README
+ * System.XML/System.Xml.Serialization/standalone_tests/
+ * System.XML/Tests/System.Xml.Xsl/standalone_tests : see README
+
+ </ul>
** Getting started
@@ -56,8 +84,8 @@
testing.
Once all of that is done, you can do a 'make test' from the top mcs
- directory. Your test class will be automagically included in the
- build and the tests will be run along with all the others.
+ directory. Your test class needs also to be listed in the
+ .sources file at the top of the Test directory.
* Tips on writing Unit tests.
@@ -126,7 +154,7 @@
bug in their runtime or something is misleading or wrong in their
documentation. In this case, please put a detailed description of the
problem to mcs/class/doc/API-notes and do also report it to the
- <a href="mailing-lists">mailing list</a> - we'll forward this to the
+ <a href="mailing-lists.html">mailing list</a> - we'll forward this to the
Microsoft people from time to time to help them fix their documentation
and runtime.
@@ -179,4 +207,63 @@
<pre>
cd mono/mono/tests
make test
-</pre> \ No newline at end of file
+</pre>
+
+<a name="aspnet"></a>
+* ASP.NET tests
+
+ XSP, the Mono ASP.NET server has tests for ASP.NET pages. It uses
+ <a href="http://nunitasp.sourceforge.net">NUnitAsp</a>. Right now
+ it only has standalone tests, ie., tests that do not need their own
+ global.asax or web.config files.
+
+ If you want to run them, get the xsp CVS module and install it. Then:
+<pre>
+ cd xsp/nunit-tests
+ make
+ cd standalone
+ xsp
+</pre>
+
+ And from another terminal:
+<pre>
+ cd xsp/nunit-tests/standalone
+ nunit-console standalone-tests.dll
+</pre>
+
+<a name="ws"></a>
+* Web Services tests
+
+ The Test directory for the System.Web.Services assembly contains a
+ standalone test suite for testing web services. It tests:
+
+ <ul>
+ <li>Proxy generation using the wsdl tool</li>
+ <li>Access to web services using the generated client proxies</li>
+ <li>Execution of web services in the server</li>
+ </ul>
+
+ This suite not only tests web services running on XSP, but it can also test
+ services running on other platforms and that are available in internet. This
+ will help track down interoperability issues.
+
+ To build the test suite, just run:
+
+<pre>
+ cd mcs/class/System.Web.Services/Test/standalone
+ xsp --root server
+</pre>
+
+ And from another terminal:
+<pre>
+ cd mcs/class/System.Web.Services/Test/standalone
+ make
+ nunit-console testclient.dll
+</pre>
+
+ This will download the wsdl documents, generate the proxies, build a dll with
+ the proxies, and build the nunit tests. Then you can use nunit-console or
+ gnunit to run the tests (the nunit dll is testclient.dll).
+
+ Read the README file in mcs/class/System.Web.Services/Test/standalone for
+ more info.
diff --git a/doc/web/commands b/doc/web/commands
index 64d07a368ff..dd5c6184d44 100644
--- a/doc/web/commands
+++ b/doc/web/commands
@@ -20,6 +20,7 @@
1,CVS access,ccvs.html,ccvs.src
1,AnonCVS access,anoncvs.html,anoncvs.src
1,Forge,forge.html,forge.src
+1,Compiling,compiling.html,compiling.src
0,Contributing,contributing.html,contributing.src
1,Hackers,hackers.html,hackers.src
1,Documentation,documentation.html,documentation.src
@@ -33,7 +34,7 @@
0,Resources,resources.html,resources.src
1,Beginning,mono-beginning.html,mono-beginning.src
1,Mailing Lists,mailing-lists.html,mailing-lists.src
-1,Blogs,http://www.go-mono.com/monologue
+1,Blogs,http://www.go-mono.com/monologue/
1,Ideas,ideas.html,ideas.src
1,Passport,passport.html,passport.src
1,Books,books.html,books.src
@@ -59,6 +60,7 @@
1,Crypto,crypto.html,crypto.src
1,Java,java.html,java.src
1,Windows.Forms,winforms.html,winforms.src
+1,XML Classes,xml-classes.html,xml-classes.src
0,Class Status,class-status.html,class-status.src,cm/cormissing.css,cm/cormissing.js
1,corlib,class-status-corlib.html,class-status-corlib.src,cm/cormissing.css,cm/cormissing.js
1,System,class-status-System.html,class-status-System.src,cm/cormissing.css,cm/cormissing.js
diff --git a/doc/web/deploy/cm/cormissing.js b/doc/web/deploy/cm/cormissing.js
index 6ff9d555337..2f2e74dcb85 100644
--- a/doc/web/deploy/cm/cormissing.js
+++ b/doc/web/deploy/cm/cormissing.js
@@ -216,6 +216,9 @@ function clickHandler (evt)
if (strAssembly)
{
+ if (strAssembly == 'mscorlib')
+ strAssembly = 'corlib';
+
strRoot = strRoot + strAssembly + '/';
if (strNamespace)
{
diff --git a/doc/web/makefile b/doc/web/makefile
index 763ada755b8..96904620b08 100644
--- a/doc/web/makefile
+++ b/doc/web/makefile
@@ -21,6 +21,7 @@ OBJECTS= \
deploy/documentation.html \
deploy/download.html \
deploy/drawing.html \
+ deploy/compiling.html \
deploy/crypto.html \
deploy/embedded-api.html \
deploy/faq.html \
@@ -68,6 +69,7 @@ OBJECTS= \
deploy/testing.html \
deploy/tools.html \
deploy/winforms.html \
+ deploy/xml-classes.html \
deploy/class-library.html \
deploy/classlib-doc.html \
deploy/class-status.html \
diff --git a/doc/web/masterinfos/Makefile b/doc/web/masterinfos/Makefile
new file mode 100644
index 00000000000..15848834024
--- /dev/null
+++ b/doc/web/masterinfos/Makefile
@@ -0,0 +1,60 @@
+# Note that you will need Microsoft.NET to generate those masterinfos
+
+# Customize to indicate your own installation dir.
+DLL_PATH=c:/WINDOWS/Microsoft.NET/Framework/v1.1.4322
+
+all: \
+ mscorlib.xml \
+ System.xml \
+ System.Xml.xml \
+ System.Data.xml \
+ System.Web.xml \
+ System.Web.Services.xml \
+ System.Runtime.Serialization.Formatters.Soap.xml \
+ System.Drawing.xml \
+ System.Security.xml \
+ System.DirectoryServices.xml \
+ System.Windows.Forms.xml \
+ Cscompmgd.xml
+
+mscorlib.xml :
+ mono-api-info $(DLL_PATH)/mscorlib.dll > mscorlib.xml
+
+System.xml :
+ mono-api-info $(DLL_PATH)/System.dll > System.xml
+
+System.Xml.xml :
+ mono-api-info $(DLL_PATH)/System.Xml.dll > System.Xml.xml
+
+System.Data.xml :
+ mono-api-info $(DLL_PATH)/System.Data.dll > System.Data.xml
+
+System.Web.xml :
+ mono-api-info $(DLL_PATH)/System.Web.dll > System.Web.xml
+
+System.Web.Services.xml :
+ mono-api-info $(DLL_PATH)/System.Web.Services.dll > System.Web.Services.xml
+
+System.Runtime.Serialization.Formatters.Soap.xml :
+ mono-api-info $(DLL_PATH)/System.Runtime.Serialization.Formatters.Soap.dll > System.Runtime.Serialization.Formatters.Soap.xml
+
+System.Drawing.xml :
+ mono-api-info $(DLL_PATH)/System.Drawing.dll > System.Drawing.xml
+
+System.Security.xml :
+ mono-api-info $(DLL_PATH)/System.Security.dll > System.Security.xml
+
+System.DirectoryServices.xml :
+ mono-api-info $(DLL_PATH)/System.DirectoryServices.dll > System.DirectoryServices.xml
+
+System.Windows.Forms.xml :
+ mono-api-info $(DLL_PATH)/System.Windows.Forms.dll > System.Windows.Forms.xml
+
+Cscompmgd.xml :
+ mono-api-info $(DLL_PATH)/Cscompmgd.dll > Cscompmgd.xml
+
+
+clean:
+ rm mscorlib.xml System.xml System.Xml.xml System.Data.xml System.Web.xml System.Web.Services.xml System.Runtime.Serialization.Formatters.Soap.xml System.Drawing.xml System.Security.xml System.DirectoryServices.xml System.Windows.Forms.xml Cscompmgd.xml
+
+
diff --git a/doc/web/team.xml b/doc/web/team.xml
index 68eabbc85fb..6b7e7a7e1bf 100644
--- a/doc/web/team.xml
+++ b/doc/web/team.xml
@@ -418,7 +418,7 @@
<image>timc.png</image>
- <location>Kitchener-Waterloo, Canada</location>
+ <location>Waterloo, Ontario, Canada</location>
<tasks>
@@ -915,7 +915,7 @@
</name>
- <e-mail>justdandy43@hotmail.com</e-mail>
+ <e-mail>danielmorgan@verizon.net</e-mail>
<image>none.png</image>
@@ -1543,7 +1543,7 @@
</name>
- <e-mail>jmas@softcatala.org</e-mail>
+ <e-mail>jordi [at] ximian.com</e-mail>
<image>jordi.png</image>
@@ -1555,9 +1555,39 @@
<tasks>
+ <task>System.Drawing implementation</task>
<task>Windows.Forms implementation</task>
</tasks>
</contributor>
+
+ <contributor>
+
+ <name>
+
+ <first-name>Pedro</first-name>
+
+ <last-name>Abelleira Seco</last-name>
+
+ </name>
+
+ <e-mail>pedroabelleira@yahoo.es</e-mail>
+
+ <image>pedroas.png</image>
+
+ <location>Galicia, Spain</location>
+
+ <organization></organization>
+
+ <description>Developer</description>
+
+ <tasks>
+
+ <task>MonoDevelop</task>
+
+ </tasks>
+
+ </contributor>
+
</contributors>
diff --git a/doc/web/team/pedroas.png b/doc/web/team/pedroas.png
new file mode 100644
index 00000000000..a639c6f33ab
--- /dev/null
+++ b/doc/web/team/pedroas.png
Binary files differ
diff --git a/doc/web/template.html.in b/doc/web/template.html.in
index f82aeb5e917..87f42ed24ef 100644
--- a/doc/web/template.html.in
+++ b/doc/web/template.html.in
@@ -2,7 +2,7 @@
<html>
<head>
<title>#TITLE#</title>
-<link rel="icon" href="../MonoIcon.png" type="image/png">
+<link rel="icon" href="MonoIcon.png" type="image/png">
<!-- background-image: url("images/bgsquares.gif"); -->
<style type="text/css">
<!--
@@ -38,6 +38,12 @@
border-bottom: 2px solid #dddddd;
}
+ .shell {
+ border-style: solid; background: #000000; color: #bbbbbb;
+ #777777; border-width:
+ 1px; padding: 2pt;
+ margin:15px;
+ }
// -->
</style>
#CSS#
@@ -58,11 +64,11 @@
</td>
<td>
<a class="topmenu" href="download.html">Downloads</a> |
- <a class="topmenu" href="http://go-mono.com/daily">Daily snapshots</a> |
+ <a class="topmenu" href="http://go-mono.com/daily/">Daily snapshots</a> |
<a class="topmenu" href="screenshots.html">Screenshots</a> |
<a class="topmenu" href="http://www.go-mono.com:8080">Documentation</a> |
<a class="topmenu" href="bugs.html">Bugs</a> |
- <a class="topmenu" href="blogs.html">Blogs</a>
+ <a class="topmenu" href="http://www.go-mono.com/monologue/">Blogs</a>
</td>
</tr>
</table>
diff --git a/doc/xml-classes b/doc/xml-classes
new file mode 100755
index 00000000000..eb2607e34c6
--- /dev/null
+++ b/doc/xml-classes
@@ -0,0 +1,310 @@
+* XML Classes
+
+** Abstract
+
+ XML library is used by several field of Mono such as ADO.NET and XML
+ Digital Signature (xmldsig). Here I write about System.Xml.dll and
+ related tools. This page won't include any classes which are in other
+ assemblies such as XmlDataDocument.
+
+ Note that current corlib has its own XML parser class named Mono.Xml.MiniParser.
+
+ Basically System.XML.dll feature has finished, or almost finished, so
+ I write this page mainly for bugs and improvement hints.
+
+
+** System.Xml namespace
+
+
+*** Document Object Model (Core)
+
+ DOM feature has already implemented. There is still missing feature.
+
+ <ul>
+ * ID constraint support is problematic because W3C DOM does not
+ specify handling of ID attributes into non-adapted element.
+ (MS.NET also looks incomplete in this area).
+ * I think, event feature is not fully tested. There are no
+ concrete desctiption on which events are risen, so we have to
+ do some experiment on MS.NET.
+ </ul>
+
+*** Xml Writer
+
+ Here XmlWriter almost equals to XmlTextWriter. If you want to see
+ another implementation, check XmlNodeWriter.cs used in monodoc.
+
+ XmlTextWriter is completed. However, it looks nearly twice as slow as
+ MS.NET (I tried 1.1)
+
+*** XmlResolver
+
+ Currently XmlTextReader uses specified XmlResolver. If nothing was supplied,
+ then it uses XmlUrlResolver. XmlResolver is used to parse external DTD,
+ importing XSL stylesheets and schemas etc.
+
+ However, XmlUrlResolver is still buggy (mainly because System.Uri is also
+ incomplete yet) and this results in several loading error.
+
+ XmlSecureResolver, which is introduced in MS .NET Framework 1.1 is basically
+ implemented, but it requires CAS (code access security) feature. We need to
+ fixup this class after ongoing CAS effort works.
+
+ You might also be interested in an improved <a href="http://codeblogs.ximian.com/blogs/benm/archives/000039.html">XmlCachingResolver</a> by Ben Maurer.
+
+*** XmlNameTable
+
+ XmlNameTable itself is implemented. However, it should be actually used in
+ several classes. Currently it makes sense if compared names are both in
+ the table, they should be simply compared using ReferenceEquals(). We
+ have partially done in XmlNamespaceManager (in .NET 1.2 methods; if the
+ build is not NET_1_2 then it is internal use only).
+
+*** Xml Stream Reader
+
+ When we are using ASCII document, we don't care which encoding we are using.
+ However, XmlTextReader must be aware of the specified encoding in XML
+ declaration. So we have internal XmlStreamReader class (and currently
+ XmlInputStream class. This may disappear since XmlStreamReader is enough to
+ handle this problem).
+
+ However, there seems some problems in these classes on reading network
+ stream (especially on Linux). This should be fixed soon, if we found the
+ actual reason.
+
+*** XML Reader
+
+ XmlTextReader, XmlNodeReader and XmlValidatingReader are almost finished.
+
+ <ul>
+ * Most of the OASIS conformance test passes as Microsoft
+ does, but about W3C tests, it is still not perfect.
+ * I won't add any XDR support on XmlValidatingReader. (I haven't
+ ever seen XDR used other than Microsoft's BizTalk Server 2000,
+ and Now they have 2002 with XML Schema support)
+ </ul>
+
+ XmlTextReader and XmlValidatingReader should be faster than now. Currently
+ XmlTextReader looks nearly twice as slow as MS.NET, and XmlValidatingReader
+ (which uses this slow XmlTextReader) looks nearly three times slower. (Note
+ that XmlValidatingReader won't be slow as itself. It uses schema validating
+ reader and dtd validating reader.)
+
+
+**** Some Advantages
+
+ The design of Mono's XmlValidatingReader is radically different from
+ that of Microsoft's implementation. Under MS.NET, DTD content validation
+ engine is in fact simple replacement of XML Schema validation engine.
+ Mono's DTD validation is designed fully separate and does validation
+ as normal XML parser does. For example, Mono allows non-deterministic DTD.
+
+ Another advantage of this XmlValidatingReader is support for *any* XmlReader.
+ Microsoft supports only XmlTextReader.
+
+ I added extra support interface named "IHasXmlParserContext", which is
+ considered in XmlValidatingReader.ResolveEntity(). Microsoft failed to
+ design XmlReader to support pluggable use of XmlReader (i.e. wrapping use
+ of other XmlReader) since XmlParserContext is required to support both
+ entity resolution and namespace manager. (In .NET 1.2, Microsoft also
+ supported similar to IHasXmlParserContext, named IXmlNamespaceResolver,
+ but it still does not provide any DTD information.)
+
+ We also have RELAX NG validating reader. See mcs/class/Commons.Xml.Relaxng.
+
+
+** System.Xml.Schema
+
+*** Summary
+
+ Basically it is completed. We can compile complex and simple types, refer to
+ external schemas, extend or restrict other types, or use substitution groups.
+ You can test how current schema validation engine is (in)complete by using
+ standalone test module
+ (see mcs/class/System.XML/Test/System.Xml.Schema/standalone_tests).
+ At least in my box, msxsdtest fails only 30 cases with bugfixed catalog.
+
+*** Schema Object Model
+
+ Completed, except for some things to be fixed:
+
+ <ul>
+ * Complete facet support. Currently some of them is missing.
+ Recently David Sheldon is doing several fixes on them.
+ * ContentTypeParticle for pointless xs:choice is incomplete
+ (It is because fixing this arose another bugs in
+ compilation. Interestingly, MS.NET also fails around here,
+ so it might be nature of ContentTypeParticle design)
+ * Some derivation by restriction (DBR) handling is incorrect.
+ </ul>
+
+*** Validating Reader
+
+ XML Schema validation feature is (currently) implemented on
+ Mono.Xml.Schema.XsdValidatingReader, which is internally used in
+ XmlValidatingReader.
+
+ Basically this is implemented and actually its feature is almost complete,
+ but I have only did validation feature testing. So we have to write more
+ tests on properties, methods, and events (validation errors).
+
+
+** System.Xml.Serialization
+
+ Lluis rules ;-)
+
+ Well, in fact XmlSerializer is almost finished and is on bugfix phase.
+
+ However, we appliciate more tests. Please try
+
+ <ul>
+ * System.Web.Services to invoke SOAP services.
+ * xsd.exe and wsdl.exe to create classes.
+ </ul>
+
+ And if any problems were found, please file it to bugzilla.
+
+ Lluis also built interesting standalone test system placed under
+ mcs/class/System.Web.Services/Test/standalone.
+
+ You might also interested in genxs, which enables you to create custom
+ XML serializer. This is not included in Microsoft.NET.
+ See mcs/tools/genxs for the details.
+
+
+** System.Xml.XPath and System.Xml.Xsl
+
+ There are two implementations for XSLT. One (and historical) implementation
+ is based on libxslt. Now we uses fully implemented managed XSLT.
+
+ As for Managed XSLT, we support msxsl:script.
+
+ It would be nice if we can support <a href="http://www.exslt.org/">EXSLT</a>.
+ <a href="http://msdn.microsoft.com/WebServices/default.aspx?pull=/library/en-us/dnexxml/html/xml05192003.asp">Microsoft has already done it</a>, but it
+ is not good code since it depends on internal concrete derivatives of
+ XPathNodeIterator classes. In general, .NET's "extension objects" is not
+ usable to return node-sets, so if we support EXSLT, it has to be done
+ internally inside our System.XML.dll. Volunteers are welcome.
+
+ Our managed XSLT implementation is still inefficient. XslTransform.Load()
+ and .Transform() looks three times slower (However it depends on
+ XmlTextReader which is also slow, so we are starting optimization from
+ that class, not XSLT itself). These number are only for specific cases,
+ and there might be more critical point on XSLT engine (mainly
+ XPathNodeIterator).
+
+
+** System.Xml and ADO.NET v2.0
+
+ Microsoft introduced the first beta version of .NET Framework 1.2 runtime
+ and sdk (and Visual Studio Whidbey). They are now available on MSDN
+ _subscriber_ download (i.e. it is not publicly downloadable yet). It
+ contains several new classes.
+
+ There are two assemblies related to System.Xml v2.0; System.Xml.dll and
+ System.Data.SqlXml.dll (here I treat sqlxml.dll as part of System.Xml v2.0,
+ but note that it is also one of the ADO.NET 2.0 feature). There are several
+ namespaces such as MS.Internal.Xml and System.Xml. Note that .NET Framework
+ is pre-release version and MS.Internal.Xml namespace apparently shows that
+ it is not in stable status as yet.
+
+ System.Xml 2.0 contains several features such as:
+
+ <ul>
+ * XPathNavigator2 and XPathDocument2
+ * XML Query
+ * XmlAdapter
+ * XSLT IL generator (similar to Apache XSLTC) - it is
+ internal use
+ </ul>
+
+ Tim Coleman started ADO.NET 2.0 related works. Currently I have no plan to
+ implement System.Xml v2.0 classes and won't touch with them immediately,
+ but will start in next some months. If any of you wants to try this
+ frontier, we welcome your effort.
+
+*** XPathNavigator2
+
+ System.Xml v2.0 implementation will be started from XPathDocument2 and
+ XPathNavigator2 implementations. Firstly, its document structure and
+ basic navigation feature will be implemented. And next, XPath2 engine
+ should be implemented (XPathNavigator2 looks very different from
+ XPathNavigator). Another requirement is schema based validation feature.
+ It needs some schema improvements, such like IXmlInfosetReader support.
+ (IXmlInfosetReader is in MS.Internal.Xml.)
+
+*** XML Query
+
+ XML Query is a new face XML data manipulation language (well, at least new
+ to .NET world). It is similar to SQL, but intended to manipulate and to
+ support XML. It is similar to XSLT, but extended to support new features
+ such as XML Schema based datatypes.
+
+ XML Query implementation can be found mainly in System.Xml.Query and
+ MS.Internal.Xml.Query namespaces. Note that they are in
+ System.Data.SqlXml.dll.
+
+ MSDN documentation says that there are two kind of API for XML Query: High
+ Level API and Low Level API. At the time of this beta version, the Low Level
+ API is described not released yet (though it may be MS.Internal.Xml.*
+ classes). However, to implement the High Level API, the Low Level API will
+ be used. They looks to have interesting class structures in MS.Internal.Xml
+ related stuff, so it would be nice (and I will) start to learn about them.
+
+ They looks to have IL generator classes, but it would be difficult to
+ start from them.
+
+*** System.Data.Mapping
+
+ System.Data.Mapping and System.Data.Mapping.RelationalSchema are the
+ namespaces for mapping support between database and xml. This is at
+ stubbing phase (incomplete as yet).
+
+*** XmlAdapter
+
+ XmlAdapter is used to support XML based query and update using
+ XPathDocument2 and XPathNavigator2. This class is designed to synthesize
+ ADO.NET and System.Xml. It connects to databases, and querys data however
+ in XML shape into XPathDocument2, using Mapping schema above. This must be
+ done after several classes such as XPathDocument2 and MappingSchema.
+
+
+** Miscellaneous Class Libraries
+
+*** RELAX NG
+
+ I implemented an experimental RelaxngValidatingReader. It is far from
+ complete, especially simplification stuff (see RELAX NG spec chapter 4),
+ some constraints (in chapter 7), and datatype handling.
+
+ I am planning improvements (starts with renaming classes, giving more
+ kind error messages, supporting compact syntax and even object mapping),
+ but it is still my wishlist.
+
+
+** Tools
+
+*** xsd.exe
+
+ See <a href="ado-net.html">ADO.NET page</a>.
+
+ Microsoft has another inference class from XmlReader to XmlSchemaCollection
+ (Microsoft.XsdInference). It may be useful, but it won't be so easy.
+
+
+** Miscellaneous
+
+ Sometimes I hear complain about System.dll and System.Xml.dll mutual
+ dependency: System.dll references to System.Xml.dll (e.g.
+ System.Configuration.ConfigXmlDocument extended from XmlDocument), while
+ System.Xml.dll vice versa (e.g. XmlUrlResolver.ResolveUri takes System.Uri).
+ Since they are in public method signatures, so at least we cannot get rid
+ of these mutual references.
+
+ However, for those who really want to build System.Xml.dll without System.dll,
+ I created <a href="http://primates.ximian.com/~atsushi/System_DummyClasses.cs">dummy classes in System.dll</a>. To build System.Xml.dll in such way, remove
+ <code>/r:System.dll</code> from Makefile, and add this source to
+ System.Xml.dll.sources. Note that this is at the point of Mono 0.30 release.
+
+ Also note that you still need System.dll to run mcs.
+
diff --git a/docs/assembly-bundle b/docs/assembly-bundle
index 25da5533370..3e64e147cb1 100644
--- a/docs/assembly-bundle
+++ b/docs/assembly-bundle
@@ -1,42 +1,57 @@
- HOWTO bundle assemblies inside the mono runtime.
-
-Bundling assemblies inside the mono runtime may be useful for a number
-of reasons:
- * creating a standalone complete runtime that can be more easily
- distributed
- * having an application run against a known set of assemblies
- that has been tested
-
-Of course, there are drawbacks, too: if there has been fixes to the assemblies,
-replacing them means recompiling the runtime as well and if there are other mono apps,
-unless they use the same mono binary, there will be less opportunities for
-the operating system to optimize memory usage. So use this feature only
-when really needed.
-
-To bundle a set of assemblies, you need to create a file that lists the assembly
-names and the relative files. Empty lines and lines starting with # are ignored:
-
-== cut cut ==
-# Sample bundle template
-mscorlib: /path/to/mscorlib/assembly.dll
-myapp: /path/to/myapp.exe
-== cut cut ==
-
-Next you need to build the mono runtime using a special configure option:
-
- ./configure --with-bundle=/path/to/bundle/template
-
-The path to the template should be an absolute path.
-
-The script metadata/make-bundle.pl will take the specifie assemblies and embed
-them inside the runtime where the loading routines can find them before
-searching for them on disk.
-
-There are still two issues to solve:
- * config files: sometimes they are needed but they are not yet bundled
- inside the library ()
- * building with the included libgc makes it not possible to build a mono
- binary statically linked to libmono: this needs to be fixed to make bundles
- really useful
+ HOWTO bundle assemblies inside the mono runtime.
+ Paolo Molaro (lupus@ximian.com)
+
+* Intent
+
+ Bundling assemblies inside the mono runtime may be useful for a number
+ of reasons:
+
+ * creating a standalone complete runtime that can be more easily
+ distributed
+
+ * having an application run against a known set of assemblies
+ that has been tested
+
+ Of course, there are drawbacks, too: if there has been fixes
+ to the assemblies, replacing them means recompiling the
+ runtime as well and if there are other mono apps, unless they
+ use the same mono binary, there will be less opportunities for
+ the operating system to optimize memory usage. So use this
+ feature only when really needed.
+
+* Creating the Bundle
+
+ To bundle a set of assemblies, you need to create a file that
+ lists the assembly names and the relative files. Empty lines
+ and lines starting with # are ignored:
+
+ == cut cut ==
+ # Sample bundle template
+ mscorlib: /path/to/mscorlib/assembly.dll
+ myapp: /path/to/myapp.exe
+ == cut cut ==
+
+ Next you need to build the mono runtime using a special configure option:
+
+ ./configure --with-bundle=/path/to/bundle/template
+
+ The path to the template should be an absolute path.
+
+ The script metadata/make-bundle.pl will take the specifie
+ assemblies and embed them inside the runtime where the loading
+ routines can find them before searching for them on disk.
+
+* Open Issues
+
+ There are still two issues to solve:
+
+ * config files: sometimes they are needed but they are
+ not yet bundled inside the library ()
+
+ * building with the included libgc makes it not
+ possible to build a mono binary statically linked to
+ libmono: this needs to be fixed to make bundles
+ really useful.
+
diff --git a/docs/embedded-api b/docs/embedded-api
index 1df64744bb6..1fd739ae2ba 100644
--- a/docs/embedded-api
+++ b/docs/embedded-api
@@ -1,7 +1,7 @@
Embedding the Mono runtime, preliminary version
-
- Miguel de Icaza, Paolo Molaro.
+ Miguel de Icaza (miguel@ximian.com),
+ Paolo Molaro (lupus@ximian.com)
This document describes how to embed the Mono runtime in your
application, and how to invoke CIL methods from C, and how to
diff --git a/docs/exceptions b/docs/exceptions
index 881b207de1f..d5ecaeead43 100644
--- a/docs/exceptions
+++ b/docs/exceptions
@@ -1,5 +1,6 @@
-Author: Dietmar Maurer (dietmar@ximian.com)
-(C) 2001 Ximian, Inc.
+ Exception Implementation in the Mono Runtime
+ Dietmar Maurer (dietmar@ximian.com)
+ (C) 2001 Ximian, Inc.
Exception implementation (jit):
===============================
diff --git a/docs/internal-calls b/docs/internal-calls
index 2f3d4abbda0..1fed33078e4 100644
--- a/docs/internal-calls
+++ b/docs/internal-calls
@@ -1,7 +1,19 @@
+ Internal Call Topics
-* How to map C# types for use in the C implementation of internal calls
+* Introduction
+
+ The Common Language Infrastructure allows for methods to be
+ implemented in unmanaged code. Unlike the Platform Invocation
+ services which provide marshalling and unmarshalling of data
+ from managed to unmanaged and viceversa the Internal calls do
+ not perform any kind of marshalling.
+
+* Basic Type mapping
+
+ The following lists how the C# types are exposed to the C API.
C# type C type
+ -----------------------------
char gunichar2
bool MonoBoolean
sbyte signed char
@@ -16,44 +28,57 @@
object MonoObject*
string MonoString*
-For ref and out paramaters you'll use the corresponding pointer type.
-Arrays of any type must be described with a MonoArray* and the elements
-must be accessed with the mono_array_* macros.
-Any other type that has a matching C structure representation, should use
-a pointer to the struct instead of a generic MonoObject pointer.
+* Pointers
-Instance methods that are internal calls will receive as first argument
-the instance object, so you must account for it in the C method signature:
+ For ref and out paramaters you'll use the corresponding
+ pointer type.
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- public extern override int GetHashCode ();
+ So if you have a C# type listed as "ref int", you should use
+ "int *" in your implementation.
-becaomes:
+* Arrays
- gint32 ves_icall_System_String_GetHashCode (MonoString *this);
+ Arrays of any type must be described with a MonoArray* and the
+ elements must be accessed with the mono_array_* macros.
+* Other Structures
+ Any other type that has a matching C structure representation,
+ should use a pointer to the struct instead of a generic
+ MonoObject pointer.
-* How to hook internal calls with the runtime
-
-Once you require an internal call in corlib, you need to create a C
-implementation for it and register it in a static table in metadata/icall.c.
-Add an entry in the table like:
+* Instance Methods.
- "System.String::GetHashCode", ves_icall_System_String_GetHashCode,
+ Instance methods that are internal calls will receive as first argument
+ the instance object, so you must account for it in the C method signature:
-Note that you need to include the full namespace.name of the class.
-If there are overloaded methods, you need also to specify the signature
-of _all_ of them:
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern override int GetHashCode ();
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- public extern override void DoSomething ();
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- public extern override void DoSomething (bool useful);
+ becomes:
-should be mapped with:
+ gint32 ves_icall_System_String_GetHashCode (MonoString *this);
- "Namespace.ClassName::DoSomething()", ves_icall_Namespace_ClassName_DoSomething,
- "Namespace.ClassName::DoSomething(bool)", ves_icall_Namespace_ClassName_DoSomething_bool,
+* How to hook internal calls with the runtime
+ Once you require an internal call in corlib, you need to
+ create a C implementation for it and register it in a static
+ table in metadata/icall.c. Add an entry in the table like:
+
+ "System.String::GetHashCode", ves_icall_System_String_GetHashCode,
+
+ Note that you need to include the full namespace.name of the
+ class. If there are overloaded methods, you need also to
+ specify the signature of _all_ of them:
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern override void DoSomething ();
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern override void DoSomething (bool useful);
+
+ should be mapped with:
+
+ "Namespace.ClassName::DoSomething()", ves_icall_Namespace_ClassName_DoSomething,
+ "Namespace.ClassName::DoSomething(bool)", ves_icall_Namespace_ClassName_DoSomething_bool,
+
diff --git a/docs/ir-desc b/docs/ir-desc
new file mode 100644
index 00000000000..25ad5c11564
--- /dev/null
+++ b/docs/ir-desc
@@ -0,0 +1,30 @@
+Mono Intermediate Representation Documentation
+
+Operation: OP_LOCALLOC
+ inst_left:
+ The value
+ ins->inst_left = *sp;
+ ins->cil_code = ip;
+
+ This is the equivalent of alloca() in a C implementation: it
+ allocates a bunch of bytes on the stack dynamically. Local
+ variables are allocated statically in the stack instead.
+
+ It is implemented by moving the stack pointer according to the
+ platform ABI: you may need to keep a specific frame register
+ to address local variables when LOCALLOC is used (the PPC code
+ does this, for example: ifyou're doing the s390 port I suggest
+ starting from that)
+
+Operation: OP_CALL_HANDLER.
+
+ cil_code:
+ Points to the CIL where the LEAVE or LEAVE_S
+ instruction was found.
+
+ inst_target_bb:
+ The target basic block for this invocation.
+
+ This instruction must call the target basic block.
+
+ \ No newline at end of file
diff --git a/docs/mini-porting.txt b/docs/mini-porting.txt
index 918ac8d1c68..25be0a77566 100644
--- a/docs/mini-porting.txt
+++ b/docs/mini-porting.txt
@@ -1,349 +1,424 @@
- Mono JIT porting guide.
- Paolo Molaro (lupus@ximian.com)
+ Mono JIT porting guide.
+ Paolo Molaro (lupus@ximian.com)
* Introduction
-This documents describes the process of porting the mono JIT
-to a new CPU architecture. The new mono JIT has been designed
-to make porting easier though at the same time enable the port
-to take full advantage from the new architecture features and
-instructions. Knowledge of the mini architecture (described in the
-mini-doc.txt file) is a requirement for understanding this guide,
-as well as an earlier document about porting the mono interpreter
-(available on the web site).
-
-There are six main areas that a port needs to implement to
-have a fully-functional JIT for a given architecture:
-
- 1) instruction selection
- 2) native code emission
- 3) call conventions and register allocation
- 4) method trampolines
- 5) exception handling
- 6) minor helper methods
-
-To take advantage of some not-so-common processor features (for example
-conditional execution of instructions as may be found on ARM or ia64), it may
-be needed to develop an high-level optimization, but doing so is not a
-requirement for getting the JIT to work.
-
-We'll see in more details each of the steps required, note, though,
-that a new port may just as well start from a cut&paste of an existing
-port to a similar architecture (for example from x86 to amd64, or from
-powerpc to sparc).
-The architecture specific code is split from the rest of the JIT,
-for example the x86 specific code and data is all included in the
-following files in the distribution:
-
- mini-x86.h mini-x86.c
- inssel-x86.brg
- cpu-pentium.md
- tramp-x86.c
- exceptions-x86.c
-
-I suggest a similar split for other architectures as well.
-
-Note that this document is still incomplete: some sections are only
-sketched and some are missing, but the important info to get a port
-going is already described.
+ This documents describes the process of porting the mono JIT
+ to a new CPU architecture. The new mono JIT has been designed
+ to make porting easier though at the same time enable the port
+ to take full advantage from the new architecture features and
+ instructions. Knowledge of the mini architecture (described in
+ the mini-doc.txt file) is a requirement for understanding this
+ guide, as well as an earlier document about porting the mono
+ interpreter (available on the web site).
+
+ There are six main areas that a port needs to implement to
+ have a fully-functional JIT for a given architecture:
+
+ 1) instruction selection
+ 2) native code emission
+ 3) call conventions and register allocation
+ 4) method trampolines
+ 5) exception handling
+ 6) minor helper methods
+
+ To take advantage of some not-so-common processor features
+ (for example conditional execution of instructions as may be
+ found on ARM or ia64), it may be needed to develop an
+ high-level optimization, but doing so is not a requirement for
+ getting the JIT to work.
+
+ We'll see in more details each of the steps required, note,
+ though, that a new port may just as well start from a
+ cut&paste of an existing port to a similar architecture (for
+ example from x86 to amd64, or from powerpc to sparc).
+
+ The architecture specific code is split from the rest of the
+ JIT, for example the x86 specific code and data is all
+ included in the following files in the distribution:
+
+ mini-x86.h mini-x86.c
+ inssel-x86.brg
+ cpu-pentium.md
+ tramp-x86.c
+ exceptions-x86.c
+
+ I suggest a similar split for other architectures as well.
+
+ Note that this document is still incomplete: some sections are
+ only sketched and some are missing, but the important info to
+ get a port going is already described.
* Architecture-specific instructions and instruction selection.
-The JIT already provides a set of instructions that can be easily
-mapped to a great variety of different processor instructions.
-Sometimes it may be necessary or advisable to add a new instruction
-that represent more closely an instruction in the architecture.
-Note that a mini instruction can be used to represent also a short
-sequence of CPU low-level instructions, but note that each
-instruction represents the minimum amount of code the instruction
-scheduler will handle (i.e., the scheduler won't schedule the instructions
-that compose the low-level sequence as individual instructions, but just
-the whole sequence, as an indivisible block).
-New instructions are created by adding a line in the mini-ops.h file,
-assigning an opcode and a name. To specify the input and output for
-the instruction, there are two different places, depending on the context
-in which the instruction gets used.
-If the instruction is used in the tree representation, the input and output
-types are defined by the BURG rules in the *.brg files (the usual
-non-terminals are 'reg' to represent a normal register, 'lreg' to
-represent a register or two that hold a 64 bit value, freg for a
-floating point register).
-If an instruction is used as a low-level CPU instruction, the info
-is specified in a machine description file. The description file is
-processed by the genmdesc program to provide a data structure that
-can be easily used from C code to query the needed info about the
-instruction.
-As an example, let's consider the add instruction for both x86 and ppc:
-
-x86 version:
- add: dest:i src1:i src2:i len:2 clob:1
-ppc version:
- add: dest:i src1:i src2:i len:4
-
-Note that the instruction takes two input integer registers on both CPU,
-but on x86 the first source register is clobbered (clob:1) and the length
-in bytes of the instruction differs.
-Note that integer adds and floating point adds use different opcodes, unlike
-the IL language (64 bit add is done with two instructions on 32 bit architectures,
-using a add that sets the carry and an add with carry).
-A specific CPU port may assign any meaning to the clob field for an instruction
-since the value will be processed in an arch-specific file anyway.
-See the top of the existing cpu-pentium.md file for more info on other fields:
-the info may or may not be applicable to a different CPU, in this latter case
-the info can be ignored.
-The code in mini.c together with the BURG rules in inssel.brg, inssel-float.brg
-and inssel-long32.brg provides general purpose mappings from the tree representation
-to a set of instructions that should be easily implemented in any architecture.
-To allow for additional arch-specific functionality, an arch-specific BURG file
-can be used: in this file arch-specific instructions can be selected that provide
-better performance than the general instructions or that provide functionality
-that is needed by the JIT but that cannot be expressed in a general enough way.
-As an example, x86 has the special instruction "push" to make it easier to
-implement the default call convention (passing arguments on the stack): almost
-all the other architectures don't have such an instruction (and don't need it anyway),
-so we added a special rule in the inssel-x86.brg file for it.
-
-So, one of the first things needed in a port is to write a cpu-$(arch).md machine
-description file and fill it with the needed info. As a start, only a few
-instructions can be specified, like the ones required to do simple integer
-operations. The default rules of the instruction selector will emit the common
-instructions and so we're ready to go for the next step in porting the JIT.
-
+ The JIT already provides a set of instructions that can be
+ easily mapped to a great variety of different processor
+ instructions. Sometimes it may be necessary or advisable to
+ add a new instruction that represent more closely an
+ instruction in the architecture. Note that a mini instruction
+ can be used to represent also a short sequence of CPU
+ low-level instructions, but note that each instruction
+ represents the minimum amount of code the instruction
+ scheduler will handle (i.e., the scheduler won't schedule the
+ instructions that compose the low-level sequence as individual
+ instructions, but just the whole sequence, as an indivisible
+ block).
+
+ New instructions are created by adding a line in the
+ mini-ops.h file, assigning an opcode and a name. To specify
+ the input and output for the instruction, there are two
+ different places, depending on the context in which the
+ instruction gets used.
+
+ If the instruction is used in the tree representation, the
+ input and output types are defined by the BURG rules in the
+ *.brg files (the usual non-terminals are 'reg' to represent a
+ normal register, 'lreg' to represent a register or two that
+ hold a 64 bit value, freg for a floating point register).
+
+ If an instruction is used as a low-level CPU instruction, the
+ info is specified in a machine description file. The
+ description file is processed by the genmdesc program to
+ provide a data structure that can be easily used from C code
+ to query the needed info about the instruction.
+
+ As an example, let's consider the add instruction for both x86
+ and ppc:
+
+ x86 version:
+ add: dest:i src1:i src2:i len:2 clob:1
+ ppc version:
+ add: dest:i src1:i src2:i len:4
+
+ Note that the instruction takes two input integer registers on
+ both CPU, but on x86 the first source register is clobbered
+ (clob:1) and the length in bytes of the instruction differs.
+
+ Note that integer adds and floating point adds use different
+ opcodes, unlike the IL language (64 bit add is done with two
+ instructions on 32 bit architectures, using a add that sets
+ the carry and an add with carry).
+
+ A specific CPU port may assign any meaning to the clob field
+ for an instruction since the value will be processed in an
+ arch-specific file anyway.
+
+ See the top of the existing cpu-pentium.md file for more info
+ on other fields: the info may or may not be applicable to a
+ different CPU, in this latter case the info can be ignored.
+
+ The code in mini.c together with the BURG rules in inssel.brg,
+ inssel-float.brg and inssel-long32.brg provides general
+ purpose mappings from the tree representation to a set of
+ instructions that should be easily implemented in any
+ architecture. To allow for additional arch-specific
+ functionality, an arch-specific BURG file can be used: in this
+ file arch-specific instructions can be selected that provide
+ better performance than the general instructions or that
+ provide functionality that is needed by the JIT but that
+ cannot be expressed in a general enough way.
+
+ As an example, x86 has the special instruction "push" to make
+ it easier to implement the default call convention (passing
+ arguments on the stack): almost all the other architectures
+ don't have such an instruction (and don't need it anyway), so
+ we added a special rule in the inssel-x86.brg file for it.
+
+ So, one of the first things needed in a port is to write a
+ cpu-$(arch).md machine description file and fill it with the
+ needed info. As a start, only a few instructions can be
+ specified, like the ones required to do simple integer
+ operations. The default rules of the instruction selector will
+ emit the common instructions and so we're ready to go for the
+ next step in porting the JIT.
+
*) Native code emission
-Since the first step in porting mono to a new CPU is to port the interpreter,
-there should be already a file that allows the emission of binary native code
-in a buffer for the architecture. This file should be placed in the
- mono/arch/$(arch)/
-directory.
-
-The bulk of the code emission happens in the mini-$(arch).c file, in a function
-called mono_arch_output_basic_block (). This function takes a basic block, walks the
-list of instructions in the block and emits the binary code for each.
-Optionally a peephole optimization pass is done on the basic block, but this can be
-left for later, when the port actually works.
-This function is very simple, there is just a big switch on the instruction opcode
-and in the corresponding case the functions or macros to emit the binary native code
-are used. Note that in this function the lengths of the instructions are used to
-determine if the buffer for the code needs enlarging.
-
-To complete the code emission for a method, a few other functions need
-implementing as well:
-
- mono_arch_emit_prolog ()
- mono_arch_emit_epilog ()
- mono_arch_patch_code ()
-
-mono_arch_emit_prolog () will emit the code to setup the stack frame for a method,
-optionally call the callbacks used in profiling and tracing, and move the
-arguments to their home location (in a caller-save register if the variable was
-allocated to one, or in a stack location if the argument was passed in a volatile
-register and wasn't allocated a non-volatile one). caller-save registers used by the
-function are saved in the prolog as well.
-
-mono_arch_emit_epilog () will emit the code needed to return from the function,
-optionally calling the profiling or tracing callbacks. At this point the basic blocks
-or the code that was moved out of the normal flow for the function can be emitted
-as well (this is usually done to provide better info for the static branch predictor).
-In the epilog, caller-save registers are restored if they were used.
-Note that, to help exception handling and stack unwinding, when there is a transition
-from managed to unmanaged code, some special processing needs to be done (basically,
-saving all the registers and setting up the links in the Last Managed Frame
-structure).
-
-When the epilog has been emitted, the upper level code arranges for the buffer of
-memory that contains the native code to be copied in an area of executable memory
-and at this point, instructions that use relative addressing need to be patched
-to have the right offsets: this work is done by mono_arch_patch_code ().
+ Since the first step in porting mono to a new CPU is to port
+ the interpreter, there should be already a file that allows
+ the emission of binary native code in a buffer for the
+ architecture. This file should be placed in the
+
+ mono/arch/$(arch)/
+
+ directory.
+
+ The bulk of the code emission happens in the mini-$(arch).c
+ file, in a function called mono_arch_output_basic_block
+ (). This function takes a basic block, walks the list of
+ instructions in the block and emits the binary code for each.
+ Optionally a peephole optimization pass is done on the basic
+ block, but this can be left for later, when the port actually
+ works.
+
+ This function is very simple, there is just a big switch on
+ the instruction opcode and in the corresponding case the
+ functions or macros to emit the binary native code are
+ used. Note that in this function the lengths of the
+ instructions are used to determine if the buffer for the code
+ needs enlarging.
+
+ To complete the code emission for a method, a few other
+ functions need implementing as well:
+
+ mono_arch_emit_prolog ()
+ mono_arch_emit_epilog ()
+ mono_arch_patch_code ()
+
+ mono_arch_emit_prolog () will emit the code to setup the stack
+ frame for a method, optionally call the callbacks used in
+ profiling and tracing, and move the arguments to their home
+ location (in a caller-save register if the variable was
+ allocated to one, or in a stack location if the argument was
+ passed in a volatile register and wasn't allocated a
+ non-volatile one). caller-save registers used by the function
+ are saved in the prolog as well.
+
+ mono_arch_emit_epilog () will emit the code needed to return
+ from the function, optionally calling the profiling or tracing
+ callbacks. At this point the basic blocks or the code that was
+ moved out of the normal flow for the function can be emitted
+ as well (this is usually done to provide better info for the
+ static branch predictor). In the epilog, caller-save
+ registers are restored if they were used.
+
+ Note that, to help exception handling and stack unwinding,
+ when there is a transition from managed to unmanaged code,
+ some special processing needs to be done (basically, saving
+ all the registers and setting up the links in the Last Managed
+ Frame structure).
+
+ When the epilog has been emitted, the upper level code
+ arranges for the buffer of memory that contains the native
+ code to be copied in an area of executable memory and at this
+ point, instructions that use relative addressing need to be
+ patched to have the right offsets: this work is done by
+ mono_arch_patch_code ().
* Call conventions and register allocation
-To account for the differences in the call conventions, a few functions need to
-be implemented.
-
-mono_arch_allocate_vars () assigns to both arguments and local variables
-the offset relative to the frame register where they are stored, dead
-variables are simply discarded. The total amount of stack needed is calculated.
-
-mono_arch_call_opcode () is the function that more closely deals with the call
-convention on a given system. For each argument to a function call, an instruction
-is created that actually puts the argument where needed, be it the stack or a
-specific register. This function can also re-arrange th order of evaluation
-when multiple arguments are involved if needed (like, on x86 arguments are pushed
-on the stack in reverse order). The function needs to carefully take into accounts
-platform specific issues, like how structures are returned as well as the
-differences in size and/or alignment of managed and corresponding unmanaged
-structures.
-
-The other chunk of code that needs to deal with the call convention and other
-specifics of a CPU, is the local register allocator, implemented in a function
-named mono_arch_local_regalloc (). The local allocator deals with a basic block
-at a time and basically just allocates registers for temporary
-values during expression evaluation, spilling and unspilling as necessary.
-The local allocator needs to take into account clobbering information, both
-during simple instructions and during function calls and it needs to deal
-with other architecture-specific weirdnesses, like instructions that take
-inputs only in specific registers or output only is some.
-Some effort will be put later in moving most of the local register allocator to
-a common file so that the code can be shared more for similar, risc-like CPUs.
-The register allocator does a first pass on the instructions in a block, collecting
-liveness information and in a backward pass on the same list performs the
-actual register allocation, inserting the instructions needed to spill values,
-if necessary.
-
-When this part of code is implemented, some testing can be done with the generated
-code for the new architecture. Most helpful is the use of the --regression
-command line switch to run the regression tests (basic.cs, for example).
-Note that the JIT will try to initialize the runtime, but it may not be able yet to
-compile and execute complex code: commenting most of the code in the mini_init()
-function in mini.c is needed to let the JIT just compile the regression tests.
-Also, using multiple -v switches on the command line makes the JIT dump an
-increasing amount of information during compilation.
-
-
+ To account for the differences in the call conventions, a few functions need to
+ be implemented.
+
+ mono_arch_allocate_vars () assigns to both arguments and local
+ variables the offset relative to the frame register where they
+ are stored, dead variables are simply discarded. The total
+ amount of stack needed is calculated.
+
+ mono_arch_call_opcode () is the function that more closely
+ deals with the call convention on a given system. For each
+ argument to a function call, an instruction is created that
+ actually puts the argument where needed, be it the stack or a
+ specific register. This function can also re-arrange th order
+ of evaluation when multiple arguments are involved if needed
+ (like, on x86 arguments are pushed on the stack in reverse
+ order). The function needs to carefully take into accounts
+ platform specific issues, like how structures are returned as
+ well as the differences in size and/or alignment of managed
+ and corresponding unmanaged structures.
+
+ The other chunk of code that needs to deal with the call
+ convention and other specifics of a CPU, is the local register
+ allocator, implemented in a function named
+ mono_arch_local_regalloc (). The local allocator deals with a
+ basic block at a time and basically just allocates registers
+ for temporary values during expression evaluation, spilling
+ and unspilling as necessary.
+
+ The local allocator needs to take into account clobbering
+ information, both during simple instructions and during
+ function calls and it needs to deal with other
+ architecture-specific weirdnesses, like instructions that take
+ inputs only in specific registers or output only is some.
+
+ Some effort will be put later in moving most of the local
+ register allocator to a common file so that the code can be
+ shared more for similar, risc-like CPUs. The register
+ allocator does a first pass on the instructions in a block,
+ collecting liveness information and in a backward pass on the
+ same list performs the actual register allocation, inserting
+ the instructions needed to spill values, if necessary.
+
+ When this part of code is implemented, some testing can be
+ done with the generated code for the new architecture. Most
+ helpful is the use of the --regression command line switch to
+ run the regression tests (basic.cs, for example).
+
+ Note that the JIT will try to initialize the runtime, but it
+ may not be able yet to compile and execute complex code:
+ commenting most of the code in the mini_init() function in
+ mini.c is needed to let the JIT just compile the regression
+ tests. Also, using multiple -v switches on the command line
+ makes the JIT dump an increasing amount of information during
+ compilation.
+
+
* Method trampolines
-To get better startup performance, the JIT actually compiles a method only when
-needed. To achieve this, when a call to a method is compiled, we actually emit a
-call to a magic trampoline. The magic trampoline is a function written in assembly
-that invokes the compiler to compile the given method and jumps to the newly compiled
-code, ensuring the arguments it received are passed correctly to the actual method.
-Before jumping to the new code, though, the magic trampoline takes care of patching
-the call site so that next time the call will go directly to the method instead of the
-trampoline. How does this all work?
-mono_arch_create_jit_trampoline () creates a small function that just
-preserves the arguments passed to it and adds an additional argument (the method
-to compile) before calling the generic trampoline. This small function is called
-the specific trampoline, because it is method-specific (the method to compile
-is hard-code in the instruction stream).
-The generic trampoline saves all the arguments that could get clobbered
-and calls a C function that will do two things:
-
-*) actually call the JIT to compile the method
-*) identify the calling code so that it can be patched to call directly
-the actual method
-
-If the 'this' argument to a method is a boxed valuetype that is passed to
-a method that expects just a pointer to the data, an additional unboxing
-trampoline will need to be inserted as well.
-
+ To get better startup performance, the JIT actually compiles a
+ method only when needed. To achieve this, when a call to a
+ method is compiled, we actually emit a call to a magic
+ trampoline. The magic trampoline is a function written in
+ assembly that invokes the compiler to compile the given method
+ and jumps to the newly compiled code, ensuring the arguments
+ it received are passed correctly to the actual method.
+
+ Before jumping to the new code, though, the magic trampoline
+ takes care of patching the call site so that next time the
+ call will go directly to the method instead of the
+ trampoline. How does this all work?
+
+ mono_arch_create_jit_trampoline () creates a small function
+ that just preserves the arguments passed to it and adds an
+ additional argument (the method to compile) before calling the
+ generic trampoline. This small function is called the specific
+ trampoline, because it is method-specific (the method to
+ compile is hard-code in the instruction stream).
+
+ The generic trampoline saves all the arguments that could get
+ clobbered and calls a C function that will do two things:
+
+ *) actually call the JIT to compile the method
+ *) identify the calling code so that it can be patched to call directly
+ the actual method
+
+ If the 'this' argument to a method is a boxed valuetype that
+ is passed to a method that expects just a pointer to the data,
+ an additional unboxing trampoline will need to be inserted as
+ well.
+
* Exception handling
-Exception handling is likely the most difficult part of the port, as it needs
-to deal with unwinding (both managed and unmanaged code) and calling
-catch and filter blocks. It also needs to deal with signals, because mono
-takes advantage of the MMU in the CPU and of the operation system to
-handle dereferences of the NULL pointer. Some of the function needed
-to implement the mechanisms are:
-
-mono_arch_get_throw_exception () returns a function that takes an exception object
-and invokes an arch-specific function that will enter the exception processing.
-To do so, all the relevant registers need to be saved and passed on.
-
-mono_arch_handle_exception () this function takes the exception thrown and
-a context that describes the state of the CPU at the time the exception was
-thrown. The function needs to implement the exception handling mechanism,
-so it makes a search for an handler for the exception and if none is found,
-it follows the unhandled exception path (that can print a trace and exit or
-just abort the current thread). The difficulty here is to unwind the stack
-correctly, by restoring the register state at each call site in the call chain,
-calling finally, filters and handler blocks while doing so.
-
-As part of exception handling a couple of internal calls need to be implemented
-as well.
-ves_icall_get_frame_info () returns info about a specific frame.
-mono_jit_walk_stack () walks the stack and calls a callback with info for
-each frame found.
-ves_icall_get_trace () return an array of StackFrame objects.
-
+ Exception handling is likely the most difficult part of the
+ port, as it needs to deal with unwinding (both managed and
+ unmanaged code) and calling catch and filter blocks. It also
+ needs to deal with signals, because mono takes advantage of
+ the MMU in the CPU and of the operation system to handle
+ dereferences of the NULL pointer. Some of the function needed
+ to implement the mechanisms are:
+
+ mono_arch_get_throw_exception () returns a function that takes
+ an exception object and invokes an arch-specific function that
+ will enter the exception processing. To do so, all the
+ relevant registers need to be saved and passed on.
+
+ mono_arch_handle_exception () this function takes the
+ exception thrown and a context that describes the state of the
+ CPU at the time the exception was thrown. The function needs
+ to implement the exception handling mechanism, so it makes a
+ search for an handler for the exception and if none is found,
+ it follows the unhandled exception path (that can print a
+ trace and exit or just abort the current thread). The
+ difficulty here is to unwind the stack correctly, by restoring
+ the register state at each call site in the call chain,
+ calling finally, filters and handler blocks while doing so.
+
+ As part of exception handling a couple of internal calls need
+ to be implemented as well.
+
+ ves_icall_get_frame_info () returns info about a specific
+ frame.
+
+ mono_jit_walk_stack () walks the stack and calls a callback with info for
+ each frame found.
+
+ ves_icall_get_trace () return an array of StackFrame objects.
+
** Code generation for filter/finally handlers
-Filter and finally handlers are called from 2 different locations:
-
- 1.) from within the method containing the exception clauses
- 2.) from the stack unwinding code
-
-To make this possible we implement them like subroutines, ending with a
-"return" statement. The subroutine does not save the base pointer, because we
-need access to the local variables of the enclosing method. Its is possible
-that instructions inside those handlers modify the stack pointer, thus we save
-the stack pointer at the start of the handler, and restore it at the end. We
-have to use a "call" instruction to execute such finally handlers.
-
-The MIR code for filter and finally handlers looks like:
-
- OP_START_HANDLER
- ...
- OP_END_FINALLY | OP_ENDFILTER(reg)
-
-OP_START_HANDLER: should save the stack pointer somewhere
-OP_END_FINALLY: restores the stack pointers and returns.
-OP_ENDFILTER (reg): restores the stack pointers and returns the value in "reg".
-
+ Filter and finally handlers are called from 2 different locations:
+
+ 1.) from within the method containing the exception clauses
+ 2.) from the stack unwinding code
+
+ To make this possible we implement them like subroutines,
+ ending with a "return" statement. The subroutine does not save
+ the base pointer, because we need access to the local
+ variables of the enclosing method. Its is possible that
+ instructions inside those handlers modify the stack pointer,
+ thus we save the stack pointer at the start of the handler,
+ and restore it at the end. We have to use a "call" instruction
+ to execute such finally handlers.
+
+ The MIR code for filter and finally handlers looks like:
+
+ OP_START_HANDLER
+ ...
+ OP_END_FINALLY | OP_ENDFILTER(reg)
+
+ OP_START_HANDLER: should save the stack pointer somewhere
+ OP_END_FINALLY: restores the stack pointers and returns.
+ OP_ENDFILTER (reg): restores the stack pointers and returns the value in "reg".
+
** Calling finally/filter handlers
-There is a special opcode to call those handler, its called OP_CALL_HANDLER. It
-simple emits a call instruction.
-
-Its a bit more complex to call handler from outside (in the stack unwinding
-code), because we have to restore the whole context of the method first. After that
-we simply emit a call instruction to invoke the handler. Its usually
-possible to use the same code to call filter and finally handlers (see
-arch_get_call_filter).
-
+ There is a special opcode to call those handler, its called
+ OP_CALL_HANDLER. It simple emits a call instruction.
+
+ Its a bit more complex to call handler from outside (in the
+ stack unwinding code), because we have to restore the whole
+ context of the method first. After that we simply emit a call
+ instruction to invoke the handler. Its usually possible to use
+ the same code to call filter and finally handlers (see
+ arch_get_call_filter).
+
** Calling catch handlers
-Catch handlers are always called from the stack unwinding code. Unlike finally clauses
-or filters, catch handler never return. Instead we simply restore the whole
-context, and restart execution at the catch handler.
-
+ Catch handlers are always called from the stack unwinding
+ code. Unlike finally clauses or filters, catch handler never
+ return. Instead we simply restore the whole context, and
+ restart execution at the catch handler.
+
** Passing Exception objects to catch handlers and filters.
-We use a local variable to store exception objects. The stack unwinding code
-must store the exception object into this variable before calling catch handler
-or filter.
-
+ We use a local variable to store exception objects. The stack
+ unwinding code must store the exception object into this
+ variable before calling catch handler or filter.
+
* Minor helper methods
-A few minor helper methods are referenced from the arch-independent code.
-Some of them are:
-
-*) mono_arch_cpu_optimizations ()
- This function returns a mask of optimizations that should be enabled for the
- current CPU and a mask of optimizations that should be excluded, instead.
-
-*) mono_arch_regname ()
- Returns the name for a numeric register.
-
-*) mono_arch_get_allocatable_int_vars ()
- Returns a list of variables that can be allocated to the integer registers
- in the current architecture.
-
-*) mono_arch_get_global_int_regs ()
- Returns a list of caller-save registers that can be used to allocate variables
- in the current method.
-
-*) mono_arch_instrument_mem_needs ()
-*) mono_arch_instrument_prolog ()
-*) mono_arch_instrument_epilog ()
- Functions needed to implement the profiling interface.
-
-
+ A few minor helper methods are referenced from the arch-independent code.
+ Some of them are:
+
+ *) mono_arch_cpu_optimizations ()
+ This function returns a mask of optimizations that
+ should be enabled for the current CPU and a mask of
+ optimizations that should be excluded, instead.
+
+ *) mono_arch_regname ()
+ Returns the name for a numeric register.
+
+ *) mono_arch_get_allocatable_int_vars ()
+ Returns a list of variables that can be allocated to
+ the integer registers in the current architecture.
+
+ *) mono_arch_get_global_int_regs ()
+ Returns a list of caller-save registers that can be
+ used to allocate variables in the current method.
+
+ *) mono_arch_instrument_mem_needs ()
+ *) mono_arch_instrument_prolog ()
+ *) mono_arch_instrument_epilog ()
+ Functions needed to implement the profiling interface.
+
+
* Writing regression tests
-Regression tests for the JIT should be written for any bug found in the JIT
-in one of the *.cs files in the mini directory. Eventually all the operations
-of the JIT should be tested (including the ones that get selected only when
-some specific optimization is enabled).
-
+ Regression tests for the JIT should be written for any bug
+ found in the JIT in one of the *.cs files in the mini
+ directory. Eventually all the operations of the JIT should be
+ tested (including the ones that get selected only when some
+ specific optimization is enabled).
+
* Platform specific optimizations
-An example of a platform-specific optimization is the peephole optimization:
-we look at a small window of code at a time and we replace one or more
-instructions with others that perform better for the given architecture or CPU.
-
+ An example of a platform-specific optimization is the peephole
+ optimization: we look at a small window of code at a time and
+ we replace one or more instructions with others that perform
+ better for the given architecture or CPU.
+
diff --git a/man/mcs.1 b/man/mcs.1
index 31b1350d54c..e135642da12 100755
--- a/man/mcs.1
+++ b/man/mcs.1
@@ -117,6 +117,15 @@ name will be the file name.
Links to the specified RESOURCE. The optional ID can be used to give
a name to the linked resource.
.TP
+.I -r:ASSEMBLY1[,ASSEMBLY2], \-r ASSEMBLY1[,ASSEMBLY2]
+Reference the named assemblies. Use this to use classes from the named
+assembly in your program. The assembly will be loaded from either the
+system directory where all the assemblies live, or from the path
+explicitly given with the -L option.
+.PP
+You can also use a semicolon to separate the assemblies instead of a
+comma.
+.TP
.I \-recurse:PATTERN, --recurse PATTERN
Does recursive compilation using the specified pattern. In Unix the
shell will perform globbing, so you migth want to use it like this:
@@ -137,22 +146,6 @@ in the compilation process.
.I \-unsafe, -unsafe+
Enables compilation of unsafe code.
.TP
-.I \-warnaserror, \-warnaserror+
-Treat warnings as errors.
-.TP
-.I \-warn:LEVEL
-Sets the warning level. 0 is the lowest warning level, and 4 is the
-highest. The default is 2.
-.TP
-.I -r:ASSEMBLY1[,ASSEMBLY2], \-r ASSEMBLY1[,ASSEMBLY2]
-Reference the named assemblies. Use this to use classes from the named
-assembly in your program. The assembly will be loaded from either the
-system directory where all the assemblies live, or from the path
-explicitly given with the -L option.
-.PP
-You can also use a semicolon to separate the assemblies instead of a
-comma.
-.TP
.I \-v
Debugging. Turns on verbose yacc parsing.
.TP
@@ -162,6 +155,21 @@ Turns on C# 2.0 language features.
.I \-\-version
Shows the compiler version.
.TP
+.I \-warnaserror, \-warnaserror+
+Treat warnings as errors.
+.TP
+.I \-warn:LEVEL
+Sets the warning level. 0 is the lowest warning level, and 4 is the
+highest. The default is 2.
+.TP
+.I \-win32res:FILE
+Specifies a Win32 resource file (.res) to be bundled into the
+resulting assembly.
+.TP
+.I \-win32icon:FILE
+Attaches the icon specified in FILE on the output into the resulting
+assembly.
+.TP
.I \-\-
Use this to stop option parsing, and allow option-looking parameters
to be passed on the command line.
diff --git a/man/mono.1 b/man/mono.1
index db2d2fc192f..eeef2f1a241 100644
--- a/man/mono.1
+++ b/man/mono.1
@@ -265,6 +265,12 @@ new and might have some bugs. Basically we recommend Managed XSLT
solution, but if it contains some blocking bugs, then you can also
use traditional libxslt. If you want to use msxsl:script, you have
to select Managed XSLT.
+.TP
+.I "MONO_MANAGED_WATCHER"
+If set to any value, System.IO.FileSystemWatcher will use the default
+managed implementation (slow). If unset, mono will try to use FAM under
+Unix systems and native API calls on Windows, falling back to the
+managed implementation on error.
.SH FILES
On Unix assemblies are loaded from the installation lib directory. If you set
`prefix' to /usr, the assemblies will be located in /usr/lib. On
diff --git a/man/wsdl.1 b/man/wsdl.1
index 89db62003ae..2c36a7e791a 100644
--- a/man/wsdl.1
+++ b/man/wsdl.1
@@ -46,6 +46,11 @@ The target file for generated code.
The protocol for which to generate code. It can be Soap (default), HttpGet or
HttpPost.
.TP
+.I "-sample:METHOD"
+This will display XML request and reply of the sample invocations to
+that SOAP message. You can use the -protocol: option to render the
+message in different forms.
+.TP
.I "-server"
Generate a server skeleton instead of a client proxy.
.TP
diff --git a/mcs/ChangeLog b/mcs/ChangeLog
index 5a14f0dd4e1..311c33bdb1d 100644
--- a/mcs/ChangeLog
+++ b/mcs/ChangeLog
@@ -1,3 +1,7 @@
+2004-01-14 Martin Willemoes Hansen <mwh@sysrq.dk>
+
+ * INSTALL.txt: Fixed, autogen should be autogen.sh
+
2003-12-01 Cesar Lopez Nataren <cesar@ciencias.unam.mx>
* Added dirs mcs/jtest and mcs/jerrors.
diff --git a/mcs/INSTALL.txt b/mcs/INSTALL.txt
index edfd8da5293..cc8338f46e2 100644
--- a/mcs/INSTALL.txt
+++ b/mcs/INSTALL.txt
@@ -9,22 +9,32 @@ be supplemented by the class libraries, which are written in C#. This
package contains the components written in C#: class libraries,
compilers and tools.
-Build Process for Users.
-========================
+*********************************************************************
+* *
+* NOTICE *
+* *
+* Unless you are developing the class libraries, you should *
+* not need to do any build steps in this directory. *
+* *
+* Go to ../mono and read the README file to compile and *
+* install. *
+* *
+*********************************************************************
If you only want to build a snapshot or a fresh CVS checkout of the
sources, you should go into the `mono' sibling directory and issue the
-following command:
+make fullbuild command, like this:
- ./autogen --prefix=/usr/local
+ cd ../mono
+ ./autogen.sh --prefix=/usr/local
make fullbuild
That will build and install the code in a single pass. The
compilation is bundled with the build due to dependencies on the class
libraries on the runtime.
-Build Features for Developers.
-==============================
+Build Features for Developers of Mono.
+======================================
These instructions apply to both Linux and Windows. To build this
package, you must already have a C# compiler installed. This means
diff --git a/mcs/btests/CharacterLiterals.vb b/mcs/btests/CharacterLiterals.vb
new file mode 100755
index 00000000000..a5134dd4161
--- /dev/null
+++ b/mcs/btests/CharacterLiterals.vb
@@ -0,0 +1,17 @@
+Module CharacterLiterals
+ Sub Main()
+ Dim c As Char
+ c = "x"
+
+ c = "X"
+
+ Dim a As String = "X"c
+ If a <> c Then
+ Throw New System.Exception("a is not same as c")
+ End If
+
+ 'the outcome should be "x"
+ c = """x"""
+ End Sub
+
+End Module
diff --git a/mcs/btests/CharacterLiterals1.vb b/mcs/btests/CharacterLiterals1.vb
new file mode 100755
index 00000000000..7fef6207f64
--- /dev/null
+++ b/mcs/btests/CharacterLiterals1.vb
@@ -0,0 +1,11 @@
+Module CharacterLiterals1
+ Sub Main()
+ Dim c As Char
+ c = "x"c
+
+ Dim a As String = "X"
+ If a <> c Then
+ Throw New System.Exception("a is not same as c")
+ End If
+ End Sub
+End Module
diff --git a/mcs/btests/CharacterLiteralsC2.vb b/mcs/btests/CharacterLiteralsC2.vb
new file mode 100755
index 00000000000..c7c41f95ee8
--- /dev/null
+++ b/mcs/btests/CharacterLiteralsC2.vb
@@ -0,0 +1,6 @@
+Module CharacterLiteralsC2
+ Sub Main()
+ Dim ch As Char
+ ch = "xc"c
+ End Sub
+End Module
diff --git a/mcs/btests/CharacterLiteralsC3.vb b/mcs/btests/CharacterLiteralsC3.vb
new file mode 100755
index 00000000000..09c6a0c4d39
--- /dev/null
+++ b/mcs/btests/CharacterLiteralsC3.vb
@@ -0,0 +1,5 @@
+Module CharacterLiteralsC3
+ Sub Main()
+ c = ""x"
+ End Sub
+End Module
diff --git a/mcs/btests/DateLiterals.vb b/mcs/btests/DateLiterals.vb
new file mode 100755
index 00000000000..e6db41af0de
--- /dev/null
+++ b/mcs/btests/DateLiterals.vb
@@ -0,0 +1,48 @@
+Module DateLiterals
+ Sub Main()
+ Dim d As Date
+ dim d1 as Date
+
+ d = # 12/1/2001 3:24:59 PM #
+ d1 = # 12-01-2001 3:24:59 PM #
+
+ if d1 <> d then
+ Throw new System.Exception("#A1 : values d and d1 are not same")
+ end if
+
+ d = # 12/01/2001 #
+ d1 = # 12/01/2001 12:00:00 AM#
+
+ if d1 <> d then
+ Throw new System.Exception("#A2 : values d and d1 are not same")
+ end if
+
+ d = # 3:24:59 #
+ d1 = # 01/01/0001 3:24:59 AM#
+
+ if d1 <> d then
+ Throw new System.Exception("#A3 : values d and d1 are not same")
+ end if
+
+ d = # 15:24:59 #
+ d1 = # 01/01/0001 3:24:59 PM#
+
+ if d1 <> d then
+ Throw new System.Exception("#A4 : values d and d1 are not same")
+ end if
+
+ d = # 3 PM #
+ d1 = # 01/01/0001 15:00:00 #
+
+ if d1 <> d then
+ Throw new System.Exception("#A5 : values d and d1 are not same")
+ end if
+
+ d = # 3:13 PM #
+ d1 = # 01/01/0001 3:13:00 PM#
+
+ if d1 <> d then
+ Throw new System.Exception("#A6 : values d and d1 are not same")
+ end if
+ End Sub
+End Module
diff --git a/mcs/btests/DateLiteralsC1.vb b/mcs/btests/DateLiteralsC1.vb
new file mode 100755
index 00000000000..665b07932cf
--- /dev/null
+++ b/mcs/btests/DateLiteralsC1.vb
@@ -0,0 +1,10 @@
+Module DateLiterals
+ Sub Main()
+ Dim d As Date
+
+ d = # 15/01/2002 #
+ End Sub
+End Module
+
+
+
diff --git a/mcs/btests/DateLiteralsC10.vb b/mcs/btests/DateLiteralsC10.vb
new file mode 100755
index 00000000000..1ba9596f3cd
--- /dev/null
+++ b/mcs/btests/DateLiteralsC10.vb
@@ -0,0 +1,12 @@
+Module DateLiterals
+ Sub Main()
+ Dim d As Date
+
+ ' if minuts and seconds are not specified
+ ' AM or PM must be specified
+ d = # 1 #
+ End Sub
+End Module
+
+
+
diff --git a/mcs/btests/DateLiteralsC11.vb b/mcs/btests/DateLiteralsC11.vb
new file mode 100755
index 00000000000..7a07a1e41b6
--- /dev/null
+++ b/mcs/btests/DateLiteralsC11.vb
@@ -0,0 +1,10 @@
+Module DateLiterals
+ Sub Main()
+ Dim d As Date
+
+ d = 23:05:07
+ End Sub
+End Module
+
+
+
diff --git a/mcs/btests/DateLiteralsC12.vb b/mcs/btests/DateLiteralsC12.vb
new file mode 100755
index 00000000000..8181d77abbb
--- /dev/null
+++ b/mcs/btests/DateLiteralsC12.vb
@@ -0,0 +1,14 @@
+' This test case runs on .Net 1.1 as well
+' Though the vb spec says the date format should be as follows
+' #[Whitespace+]DateOrTime[Whitespace+]#
+
+Module DateLiterals
+ Sub Main()
+ Dim d As Date
+
+ d = #01/01/2004 5:05:07PM#
+ End Sub
+End Module
+
+
+
diff --git a/mcs/btests/DateLiteralsC2.vb b/mcs/btests/DateLiteralsC2.vb
new file mode 100755
index 00000000000..8d9eb13fbb7
--- /dev/null
+++ b/mcs/btests/DateLiteralsC2.vb
@@ -0,0 +1,12 @@
+Module DateLiterals
+ Sub Main()
+ Dim d As Date
+
+ d = # 12/40/2002 #
+
+ d = # 11/31/2002 #
+ End Sub
+End Module
+
+
+
diff --git a/mcs/btests/DateLiteralsC3.vb b/mcs/btests/DateLiteralsC3.vb
new file mode 100755
index 00000000000..9c513a13341
--- /dev/null
+++ b/mcs/btests/DateLiteralsC3.vb
@@ -0,0 +1,10 @@
+Module DateLiterals
+ Sub Main()
+ Dim d As Date
+
+ d = # 11/31/2002 #
+ End Sub
+End Module
+
+
+
diff --git a/mcs/btests/DateLiteralsC4.vb b/mcs/btests/DateLiteralsC4.vb
new file mode 100755
index 00000000000..73bf5af35dd
--- /dev/null
+++ b/mcs/btests/DateLiteralsC4.vb
@@ -0,0 +1,10 @@
+Module DateLiterals
+ Sub Main()
+ Dim d As Date
+
+ d = # 12/31/02 #
+ End Sub
+End Module
+
+
+
diff --git a/mcs/btests/DateLiteralsC5.vb b/mcs/btests/DateLiteralsC5.vb
new file mode 100755
index 00000000000..94a6946f329
--- /dev/null
+++ b/mcs/btests/DateLiteralsC5.vb
@@ -0,0 +1,10 @@
+Module DateLiterals
+ Sub Main()
+ Dim d As Date
+
+ d = # 13:05:07 PM #
+ End Sub
+End Module
+
+
+
diff --git a/mcs/btests/DateLiteralsC6.vb b/mcs/btests/DateLiteralsC6.vb
new file mode 100755
index 00000000000..7b11dd7936e
--- /dev/null
+++ b/mcs/btests/DateLiteralsC6.vb
@@ -0,0 +1,10 @@
+Module DateLiterals
+ Sub Main()
+ Dim d As Date
+
+ d = # 25:05:07 #
+ End Sub
+End Module
+
+
+
diff --git a/mcs/btests/DateLiteralsC7.vb b/mcs/btests/DateLiteralsC7.vb
new file mode 100755
index 00000000000..930691afa1f
--- /dev/null
+++ b/mcs/btests/DateLiteralsC7.vb
@@ -0,0 +1,10 @@
+Module DateLiterals
+ Sub Main()
+ Dim d As Date
+
+ d = # 13:05:07 AM #
+ End Sub
+End Module
+
+
+
diff --git a/mcs/btests/DateLiteralsC8.vb b/mcs/btests/DateLiteralsC8.vb
new file mode 100755
index 00000000000..63a76d8edfd
--- /dev/null
+++ b/mcs/btests/DateLiteralsC8.vb
@@ -0,0 +1,10 @@
+Module DateLiterals
+ Sub Main()
+ Dim d As Date
+
+ d = # 11:65:07 PM #
+ End Sub
+End Module
+
+
+
diff --git a/mcs/btests/DateLiteralsC9.vb b/mcs/btests/DateLiteralsC9.vb
new file mode 100755
index 00000000000..ee43c0f9037
--- /dev/null
+++ b/mcs/btests/DateLiteralsC9.vb
@@ -0,0 +1,10 @@
+Module DateLiterals
+ Sub Main()
+ Dim d As Date
+
+ d = # 11:00:60 PM #
+ End Sub
+End Module
+
+
+
diff --git a/mcs/btests/FloatingPointLiteralsTest.vb b/mcs/btests/FloatingPointLiteralsTest.vb
new file mode 100755
index 00000000000..73845b8e608
--- /dev/null
+++ b/mcs/btests/FloatingPointLiteralsTest.vb
@@ -0,0 +1,3 @@
+Module FloatingPointLiteralsTest
+
+End Module
diff --git a/mcs/btests/Inheritance1.vb b/mcs/btests/Inheritance1.vb
new file mode 100755
index 00000000000..b4d1b160b13
--- /dev/null
+++ b/mcs/btests/Inheritance1.vb
@@ -0,0 +1,16 @@
+' this could be a compile time exception too
+' But MS vb 7.0 is throwing type cast exception at runtime
+' hence I am keeping it as a Negetive-Runtime-Test candidate
+
+Public Class C1
+End Class
+
+Public Class C2
+ Inherits C1
+End Class
+
+Module InheritanceC3
+ Sub Main()
+ Dim b As C2 = New C1()
+ End Sub
+End Module
diff --git a/mcs/btests/InheritanceA.vb b/mcs/btests/InheritanceA.vb
new file mode 100755
index 00000000000..861034fa064
--- /dev/null
+++ b/mcs/btests/InheritanceA.vb
@@ -0,0 +1,45 @@
+' if a class is not derived from any class
+' means it is derived from Object class
+
+Public Class C1
+ Function f1()
+ If GetType(C1).ToString <> "C1" Then
+ Throw New System.Exception("#A1 Unexpected result")
+ End If
+ End Function
+
+ Function fn() As Integer
+ Return 5
+ End Function
+End Class
+
+Public Class C2
+ Inherits C1
+ Function f2()
+ f1()
+ End Function
+
+
+End Class
+
+Public Class c3
+ Inherits C2
+
+End Class
+
+Module Inheritance
+ Sub Main()
+ Dim c1 As New C1()
+ c1.f1()
+
+ Dim c2 As New C2()
+ c2.f1()
+ c2.f2()
+ c2.fn()
+
+ Dim c3 As New c3()
+ c3.f1()
+ c3.f2()
+ c3.fn()
+ End Sub
+End Module \ No newline at end of file
diff --git a/mcs/btests/InheritanceB.vb b/mcs/btests/InheritanceB.vb
new file mode 100755
index 00000000000..5cd09f2392c
--- /dev/null
+++ b/mcs/btests/InheritanceB.vb
@@ -0,0 +1,13 @@
+Public Class C1
+End Class
+
+Public Class C2
+ Inherits C1
+End Class
+
+Module InheritanceB
+ Sub Main()
+ Dim b As C1 = New C2()
+ Dim d As C2 = New C2()
+ End Sub
+End Module
diff --git a/mcs/btests/InheritanceC.vb b/mcs/btests/InheritanceC.vb
new file mode 100755
index 00000000000..3c7122897b7
--- /dev/null
+++ b/mcs/btests/InheritanceC.vb
@@ -0,0 +1,15 @@
+Public Interface I1
+End Interface
+
+Public Interface I2
+End Interface
+
+Public Interface I3
+ Inherits I1
+ Inherits I2
+End Interface
+
+Module InheritanceC
+ Sub Main()
+ End Sub
+End Module
diff --git a/mcs/btests/InheritanceC1.vb b/mcs/btests/InheritanceC1.vb
new file mode 100755
index 00000000000..b4ef6c72949
--- /dev/null
+++ b/mcs/btests/InheritanceC1.vb
@@ -0,0 +1,12 @@
+Public Class C1
+ Inherits C2
+End Class
+
+Public Class C2
+ Inherits C1
+End Class
+
+Module InheritanceC1
+ Sub Main()
+ End Sub
+End Module
diff --git a/mcs/btests/InheritanceC2.vb b/mcs/btests/InheritanceC2.vb
new file mode 100755
index 00000000000..b784776a8cc
--- /dev/null
+++ b/mcs/btests/InheritanceC2.vb
@@ -0,0 +1,12 @@
+Public Class C1
+End Class
+
+Public Class C2
+ Dim a As String
+ Inherits C1
+End Class
+
+Module InheritanceC2
+ Sub Main()
+ End Sub
+End Module
diff --git a/mcs/btests/InheritanceC3.vb b/mcs/btests/InheritanceC3.vb
new file mode 100755
index 00000000000..7f3409d3790
--- /dev/null
+++ b/mcs/btests/InheritanceC3.vb
@@ -0,0 +1,15 @@
+Public Class C1
+End Class
+
+Public Class C2
+End Class
+
+Public Class C3
+ Inherits C1
+ Inherits C2
+End Class
+
+Module InheritanceC3
+ Sub Main()
+ End Sub
+End Module
diff --git a/mcs/btests/InheritanceD.vb b/mcs/btests/InheritanceD.vb
new file mode 100755
index 00000000000..c5a3ceafdf5
--- /dev/null
+++ b/mcs/btests/InheritanceD.vb
@@ -0,0 +1,27 @@
+Interface IBase
+ Function F(ByVal i As Integer)
+End Interface
+
+Interface ILeft
+ Inherits IBase
+End Interface
+
+Interface IRight
+ Inherits IBase
+End Interface
+
+Interface IDerived
+ Inherits ILeft, IRight
+End Interface
+
+Class D
+ Implements IDerived
+
+ Function F(ByVal i As Integer) Implements IDerived.F
+ End Function
+End Class
+
+Module InheritanceD
+ Sub Main()
+ End Sub
+End Module \ No newline at end of file
diff --git a/mcs/btests/InheritanceE.vb b/mcs/btests/InheritanceE.vb
new file mode 100755
index 00000000000..df7965b1581
--- /dev/null
+++ b/mcs/btests/InheritanceE.vb
@@ -0,0 +1,20 @@
+Public Class C1
+ Public Overridable Sub F1()
+ End Sub
+End Class
+
+Public Class C2
+ Inherits C1
+
+ Public Overrides Sub F1()
+ End Sub
+End Class
+
+Module InheritanceE
+ Sub Main()
+ Dim d As C2 = New C2()
+ End Sub
+End Module
+
+
+
diff --git a/mcs/btests/InterfaceA.vb b/mcs/btests/InterfaceA.vb
new file mode 100755
index 00000000000..12c8a8a7afe
--- /dev/null
+++ b/mcs/btests/InterfaceA.vb
@@ -0,0 +1,20 @@
+Interface I
+ Function F()
+End Interface
+
+Class C
+ Implements I
+
+ Function F() Implements I.F
+ End Function
+End Class
+
+Module InterfaceA
+ Sub Main()
+ Dim x As C = New C()
+ x.F()
+
+ Dim y As I = New C()
+ y.F()
+ End Sub
+End Module
diff --git a/mcs/btests/InterfaceB.vb b/mcs/btests/InterfaceB.vb
new file mode 100755
index 00000000000..339c04b9d15
--- /dev/null
+++ b/mcs/btests/InterfaceB.vb
@@ -0,0 +1,29 @@
+Interface ILeft
+ Sub F()
+End Interface
+
+Interface IRight
+ Sub F()
+End Interface
+
+Interface ILeftRight
+ Inherits ILeft, IRight
+End Interface
+
+Class LeftRight
+ Implements ILeftRight
+
+ Sub LeftF() Implements ILeft.F
+ End Sub
+
+ Sub RightF() Implements IRight.F
+ End Sub
+End Class
+
+Module InterfaceB
+ Sub main()
+ Dim lr As New LeftRight()
+ lr.LeftF()
+ lr.RightF()
+ End Sub
+End Module
diff --git a/mcs/btests/InterfaceC.vb b/mcs/btests/InterfaceC.vb
new file mode 100755
index 00000000000..e66095b3824
--- /dev/null
+++ b/mcs/btests/InterfaceC.vb
@@ -0,0 +1,40 @@
+
+Interface I
+ Function F()
+End Interface
+
+MustInherit Class C1
+ Implements I
+
+ Function F() Implements I.F
+ End Function
+End Class
+
+MustInherit Class C2
+ Implements I
+
+ MustOverride Function F() Implements I.F
+End Class
+
+
+Class DC1
+ Inherits C1
+End Class
+
+Class DC2
+ Inherits C2
+
+ Overrides Function F()
+ End Function
+End Class
+
+Module InterfaceC
+ Sub Main()
+ Dim x As DC1 = New DC1()
+ x.F()
+
+ Dim y As DC2 = New DC2()
+ y.F()
+ End Sub
+End Module
+
diff --git a/mcs/btests/InterfaceC1.vb b/mcs/btests/InterfaceC1.vb
new file mode 100755
index 00000000000..dffed139a70
--- /dev/null
+++ b/mcs/btests/InterfaceC1.vb
@@ -0,0 +1,16 @@
+Interface I
+ Function F()
+End Interface
+
+Class C
+ Implements I
+
+ Function F() Implements I.F
+ End Function
+End Class
+
+Module InterfaceC1
+ Sub Main()
+ Dim x As I = New I()
+ End Sub
+End Module
diff --git a/mcs/btests/InterfaceC2.vb b/mcs/btests/InterfaceC2.vb
new file mode 100755
index 00000000000..1a9fed33913
--- /dev/null
+++ b/mcs/btests/InterfaceC2.vb
@@ -0,0 +1,19 @@
+Interface I
+ Function F1(ByVal i As Integer)
+ Function F2(ByVal i As Integer)
+End Interface
+
+Class B
+ Implements I
+
+ Overridable Function CF1(ByVal i As Integer) Implements I.F1
+ End Function
+
+ Overridable Function CF2(ByVal i As Integer) Implements I.F1
+ End Function
+End Class
+
+Module InterfaceC3
+ Sub Main()
+ End Sub
+End Module
diff --git a/mcs/btests/InterfaceD.vb b/mcs/btests/InterfaceD.vb
new file mode 100755
index 00000000000..7f058a859bc
--- /dev/null
+++ b/mcs/btests/InterfaceD.vb
@@ -0,0 +1,18 @@
+Interface I
+ Function F1(ByVal i As Integer)
+ Function F2(ByVal i As Integer)
+End Interface
+
+Class C
+ Implements I
+
+ Function F(ByVal i As Integer) Implements I.F1, I.F2
+ End Function
+End Class
+
+Module InterfaceD
+ Sub Main()
+ Dim x As C = New C()
+ x.F(10)
+ End Sub
+End Module
diff --git a/mcs/btests/InterfaceE.vb b/mcs/btests/InterfaceE.vb
new file mode 100755
index 00000000000..ef60fcb1686
--- /dev/null
+++ b/mcs/btests/InterfaceE.vb
@@ -0,0 +1,30 @@
+Interface I
+ Function F1(ByVal i As Integer)
+ Function F2(ByVal i As Integer)
+End Interface
+
+Class B
+ Implements I
+
+ Overridable Function CF1(ByVal i As Integer) Implements I.F1
+ End Function
+
+ Overridable Function CF2(ByVal i As Integer) Implements I.F2
+ End Function
+End Class
+
+Class D
+ Inherits B
+ Overrides Function CF2(ByVal i As Integer)
+ End Function
+End Class
+
+Module InterfaceE
+ Sub Main()
+ Dim x As D = New D()
+ x.CF1(10)
+ x.CF2(10)
+ End Sub
+End Module
+
+
diff --git a/mcs/btests/LiteralNothing.vb b/mcs/btests/LiteralNothing.vb
new file mode 100755
index 00000000000..4b6fe0fc44f
--- /dev/null
+++ b/mcs/btests/LiteralNothing.vb
@@ -0,0 +1,6 @@
+Module LiteralNothing
+ Sub Main()
+ Dim x As Object
+ x = Nothing
+ End Sub
+End Module
diff --git a/mcs/btests/MustInherit.vb b/mcs/btests/MustInherit.vb
new file mode 100755
index 00000000000..9ebaa96ee03
--- /dev/null
+++ b/mcs/btests/MustInherit.vb
@@ -0,0 +1,34 @@
+MustInherit Class C1
+ Public Function F1()
+ Dim a As Integer = 10
+ End Function
+
+ Public MustOverride Function F2()
+End Class
+
+Class C2
+ Inherits C1
+ Public Overrides Function F2()
+ End Function
+End Class
+
+MustInherit Class C3
+ Public MustOverride Function func()
+End Class
+
+MustInherit Class C4
+ Inherits C3
+End Class
+
+Class C5
+ Inherits C4
+ Public Overrides Function func()
+ End Function
+End Class
+
+Module Module1
+ Sub Main()
+ Dim x As C1 = Nothing
+ x = New C2()
+ End Sub
+End Module
diff --git a/mcs/btests/MustInheritC1.vb b/mcs/btests/MustInheritC1.vb
new file mode 100755
index 00000000000..0876a936418
--- /dev/null
+++ b/mcs/btests/MustInheritC1.vb
@@ -0,0 +1,13 @@
+MustInherit Class C1
+ Public Function F1()
+ Dim a As Integer = 10
+ End Function
+
+ Public MustOverride Function F2()
+End Class
+
+Module MustInheritC1
+ Sub Main()
+ Dim x As C1 = New C1()
+ End Sub
+End Module
diff --git a/mcs/btests/MustInheritC2.vb b/mcs/btests/MustInheritC2.vb
new file mode 100755
index 00000000000..93cfd5e1088
--- /dev/null
+++ b/mcs/btests/MustInheritC2.vb
@@ -0,0 +1,12 @@
+MustInherit Class C1
+ Public MustOverride Function F1()
+End Class
+
+Class C2
+ Inherits C1
+End Class
+
+Module MustInheritC2
+ Sub Main()
+ End Sub
+End Module
diff --git a/mcs/btests/MustInheritC3.vb b/mcs/btests/MustInheritC3.vb
new file mode 100755
index 00000000000..04fde97d5e3
--- /dev/null
+++ b/mcs/btests/MustInheritC3.vb
@@ -0,0 +1,10 @@
+Class C1
+ Public MustOverride Function F1()
+End Class
+
+Module MustInheritC3
+ Sub Main()
+ End Sub
+End Module
+
+
diff --git a/mcs/btests/NSA.vb b/mcs/btests/NSA.vb
new file mode 100755
index 00000000000..78ce1bcffbc
--- /dev/null
+++ b/mcs/btests/NSA.vb
@@ -0,0 +1,5 @@
+Namespace nms1
+ Public Class NSA
+ Public z As Integer = 5
+ End Class
+End Namespace \ No newline at end of file
diff --git a/mcs/btests/NSB.vb b/mcs/btests/NSB.vb
new file mode 100755
index 00000000000..1abb8bf412e
--- /dev/null
+++ b/mcs/btests/NSB.vb
@@ -0,0 +1,15 @@
+Namespace nms1
+ Module NSB
+ Public Function f() As Integer
+ Dim c As NSA = New NSA()
+ Return c.z
+ End Function
+
+ Sub Main()
+ Dim i As Integer = f()
+ If i <> 5 Then
+ Throw New System.Exception("value of nms1.NSA.z got changed")
+ End If
+ End Sub
+ End Module
+End Namespace \ No newline at end of file
diff --git a/mcs/btests/NameSpaceA.vb b/mcs/btests/NameSpaceA.vb
new file mode 100755
index 00000000000..4a715ac436a
--- /dev/null
+++ b/mcs/btests/NameSpaceA.vb
@@ -0,0 +1,11 @@
+Namespace ns1
+ Class c1
+ Public a As Integer = 5
+ End Class
+End Namespace
+
+Namespace ns2
+ Class c2
+ Public b As Integer
+ End Class
+End Namespace \ No newline at end of file
diff --git a/mcs/btests/NameSpaceB.vb b/mcs/btests/NameSpaceB.vb
new file mode 100755
index 00000000000..6e5b8755cf0
--- /dev/null
+++ b/mcs/btests/NameSpaceB.vb
@@ -0,0 +1,9 @@
+Module NSB
+ Sub Main()
+ Dim c1 As ns1.c1 = New ns1.c1()
+ Dim c2 As ns2.c2 = New ns2.c2()
+ If c1.a <> 5 Then
+ Throw New System.Exception("value of ns1.c1.a got changed")
+ End If
+ End Sub
+End Module
diff --git a/mcs/btests/NotInheritable.vb b/mcs/btests/NotInheritable.vb
new file mode 100755
index 00000000000..4bf3650d400
--- /dev/null
+++ b/mcs/btests/NotInheritable.vb
@@ -0,0 +1,8 @@
+NotInheritable Class C1
+End Class
+
+Module Module1
+ Sub Main()
+ Dim x As New C1()
+ End Sub
+End Module
diff --git a/mcs/btests/NotInheritableC1.vb b/mcs/btests/NotInheritableC1.vb
new file mode 100755
index 00000000000..6a9c4076bc0
--- /dev/null
+++ b/mcs/btests/NotInheritableC1.vb
@@ -0,0 +1,12 @@
+NotInheritable Class C1
+End Class
+
+Class C2
+ Inherits C1
+End Class
+
+Module Module1
+ Sub Main()
+ End Sub
+End Module
+
diff --git a/mcs/btests/NotInheritableC2.vb b/mcs/btests/NotInheritableC2.vb
new file mode 100755
index 00000000000..b8f966da33d
--- /dev/null
+++ b/mcs/btests/NotInheritableC2.vb
@@ -0,0 +1,7 @@
+MustInherit NotInheritable Class C1
+End Class
+
+Module Module1
+ Sub Main()
+ End Sub
+End Module
diff --git a/mcs/btests/Overloading.vb b/mcs/btests/Overloading.vb
new file mode 100755
index 00000000000..1d0e5965534
--- /dev/null
+++ b/mcs/btests/Overloading.vb
@@ -0,0 +1,23 @@
+Class c
+ Function f()
+ End Function
+
+ Function f(ByVal i As Integer)
+ End Function
+
+ Function f(ByVal s As String)
+ End Function
+
+ Function f(ByVal i1 As Integer, ByVal i2 As Integer)
+ End Function
+End Class
+
+
+Module Overloading
+ Sub s()
+ End Sub
+
+ Sub Main()
+ End Sub
+
+End Module
diff --git a/mcs/btests/OverloadingC1.vb b/mcs/btests/OverloadingC1.vb
new file mode 100755
index 00000000000..1829aa4f049
--- /dev/null
+++ b/mcs/btests/OverloadingC1.vb
@@ -0,0 +1,10 @@
+Module OverloadingC1
+ Function f(ByVal i As Integer)
+ End Function
+
+ Function f(ByRef i As Integer)
+ End Function
+
+ Sub Main()
+ End Sub
+End Module
diff --git a/mcs/btests/OverloadingC2.vb b/mcs/btests/OverloadingC2.vb
new file mode 100755
index 00000000000..a1f87ac2136
--- /dev/null
+++ b/mcs/btests/OverloadingC2.vb
@@ -0,0 +1,10 @@
+Module OverloadingC2
+ Function f(ByRef i As Integer)
+ End Function
+
+ Function f(ByVal i1 As Integer, Optional ByVal i2 As Integer = 5)
+ End Function
+
+ Sub Main()
+ End Sub
+End Module
diff --git a/mcs/btests/OverloadingC3.vb b/mcs/btests/OverloadingC3.vb
new file mode 100755
index 00000000000..69a2729f44d
--- /dev/null
+++ b/mcs/btests/OverloadingC3.vb
@@ -0,0 +1,10 @@
+Module OverloadingC3
+ Public Function f(ByVal i As Integer)
+ End Function
+
+ Private Function f(ByRef i As Integer)
+ End Function
+
+ Sub Main()
+ End Sub
+End Module
diff --git a/mcs/btests/OverrideA.vb b/mcs/btests/OverrideA.vb
new file mode 100755
index 00000000000..5c8dcacb80f
--- /dev/null
+++ b/mcs/btests/OverrideA.vb
@@ -0,0 +1,34 @@
+Class B
+ Overridable Function F() As Integer
+ Return 5
+ End Function
+End Class
+
+Class D
+ Inherits B
+
+ Overrides Function F() As Integer
+ ' you should be able to access
+ ' the members of base class
+ ' using 'MyBase' as follows
+ MyBase.F()
+
+ Return 10
+ End Function
+End Class
+
+Module OverrideA
+ Sub Main()
+ Dim x As B
+
+ x = New B()
+ If x.F() <> 5 Then
+ Throw New System.Exception("#A1, unexpected result from base class")
+ End If
+
+ x = New D()
+ If x.F() <> 10 Then
+ Throw New System.Exception("#A2, unexpected result from derived class")
+ End If
+ End Sub
+End Module
diff --git a/mcs/btests/OverrideB.vb b/mcs/btests/OverrideB.vb
new file mode 100755
index 00000000000..94ceb23c961
--- /dev/null
+++ b/mcs/btests/OverrideB.vb
@@ -0,0 +1,29 @@
+Class B
+ Public Overridable Sub F1()
+ End Sub
+
+ Public Overridable Sub F2()
+ End Sub
+End Class
+
+Class D
+ Inherits B
+
+ Public NotOverridable Overrides Sub F1()
+ End Sub
+
+ Public Overrides Sub F2()
+ End Sub
+End Class
+
+Class D1
+ Inherits D
+
+ Public Overrides Sub F2()
+ End Sub
+End Class
+
+Module OverrideB
+ Sub Main()
+ End Sub
+End Module
diff --git a/mcs/btests/OverrideC1.vb b/mcs/btests/OverrideC1.vb
new file mode 100755
index 00000000000..04b842edd5a
--- /dev/null
+++ b/mcs/btests/OverrideC1.vb
@@ -0,0 +1,18 @@
+Class B
+ Public NotOverridable Sub F1()
+ End Sub
+End Class
+
+Class D
+ Inherits B
+
+ Public Overrides Sub F1()
+ End Sub
+End Class
+
+
+Module OverrideC1
+ Sub Main()
+ End Sub
+End Module
+
diff --git a/mcs/btests/Scope.vb b/mcs/btests/Scope.vb
new file mode 100755
index 00000000000..f8d56ba9ccf
--- /dev/null
+++ b/mcs/btests/Scope.vb
@@ -0,0 +1,24 @@
+Module Scope
+ Dim i As Integer = 5
+
+ Function f1()
+ If i <> 5 Then
+ Throw New System.Exception("#A1, value of i is not correct")
+ End If
+ End Function
+
+ Function f2()
+ Dim i As Integer = 10
+ If i <> 10 Then
+ Throw New System.Exception("#A2, value of i is not correct")
+ End If
+ If Scope.i <> 5 Then
+ Throw New System.Exception("#A3, value of i is not correct")
+ End If
+ End Function
+
+ Sub Main()
+ f1()
+ f2()
+ End Sub
+End Module
diff --git a/mcs/btests/ScopeC1.vb b/mcs/btests/ScopeC1.vb
new file mode 100755
index 00000000000..5aa5ae669df
--- /dev/null
+++ b/mcs/btests/ScopeC1.vb
@@ -0,0 +1,26 @@
+Class C1
+ Shared Function F()
+ End Function
+
+ Shared Function F(ByVal i As Integer)
+ End Function
+
+ Class C2
+ Shared Function F(ByVal i1 As Integer, ByVal i2 As Integer)
+ End Function
+
+ Function fnc()
+ F(10, 20)
+ F()
+ F(10)
+ End Function
+
+ End Class
+End Class
+
+
+
+Module ScopeC1
+ Sub Main()
+ End Sub
+End Module
diff --git a/mcs/btests/ShadowsA.vb b/mcs/btests/ShadowsA.vb
new file mode 100755
index 00000000000..957009582b7
--- /dev/null
+++ b/mcs/btests/ShadowsA.vb
@@ -0,0 +1,34 @@
+Class B
+ Function F()
+ End Function
+
+ Function F(ByVal i As Integer)
+ End Function
+
+ Function F1()
+ End Function
+
+ Function F1(ByVal i As Integer)
+ End Function
+End Class
+
+Class D
+ Inherits B
+
+ Overloads Function F()
+ End Function
+
+ Shadows Function F1(ByVal i As Integer)
+ End Function
+End Class
+
+Module ShadowA
+ Sub Main()
+ Dim x As D = New D()
+
+ x.F()
+ x.F(10)
+ x.F1(20)
+ End Sub
+
+End Module
diff --git a/mcs/btests/ShadowsB.vb b/mcs/btests/ShadowsB.vb
new file mode 100755
index 00000000000..2bdd917dffc
--- /dev/null
+++ b/mcs/btests/ShadowsB.vb
@@ -0,0 +1,34 @@
+' As per MS VB Specification (section 4.3.3)
+' this program should compile.
+' But MS VB compiler 7.0 is unable to compile it.
+' Still I am keeping this in positive test cases
+' May move it later to negative tests section
+' after clarifying it with later versions of MS VB compilers.
+
+' In derived class if you
+' override a method whithout
+' shadowing or overloading should get shadowed
+' in the derived class by default
+' But it should throw an warning during compilation
+
+
+Class B
+ Function F()
+ End Function
+
+ Function F(ByVal i As Integer)
+ End Function
+End Class
+
+Class D
+ Inherits B
+
+ Function F()
+ End Function
+End Class
+
+Module ShadowsB
+ Sub Main()
+ End Sub
+
+End Module
diff --git a/mcs/btests/ShadowsC.vb b/mcs/btests/ShadowsC.vb
new file mode 100755
index 00000000000..ebc25c50ae0
--- /dev/null
+++ b/mcs/btests/ShadowsC.vb
@@ -0,0 +1,18 @@
+Interface ILeft
+ Sub F()
+End Interface
+
+Interface IRight
+ Sub F()
+End Interface
+
+Interface ILeftRight
+ Inherits ILeft, IRight
+ Shadows Sub F()
+End Interface
+
+
+Module ShadowsC
+ Sub Main()
+ End Sub
+End Module
diff --git a/mcs/btests/ShadowsC1.vb b/mcs/btests/ShadowsC1.vb
new file mode 100755
index 00000000000..a232b88e18a
--- /dev/null
+++ b/mcs/btests/ShadowsC1.vb
@@ -0,0 +1,28 @@
+Class B
+ Function F()
+ End Function
+
+ Function F(ByVal i As Integer)
+ End Function
+
+
+ Function F(ByVal i As String)
+ End Function
+End Class
+
+Class D
+ Inherits B
+ ' all other overloaded methods should become unavailable
+ Shadows Function F()
+ End Function
+End Class
+
+Module ShadowA_C1
+ Sub Main()
+ Dim x As D = New D()
+ x.F(10)
+ x.F("abc")
+ End Sub
+
+End Module
+
diff --git a/mcs/btests/ShadowsC2.vb b/mcs/btests/ShadowsC2.vb
new file mode 100755
index 00000000000..712d94a718c
--- /dev/null
+++ b/mcs/btests/ShadowsC2.vb
@@ -0,0 +1,19 @@
+Class B
+ Function F()
+ End Function
+
+ Function F(ByVal i As Integer)
+ End Function
+End Class
+
+Class D
+ Inherits B
+
+ Overloads Shadows Function F()
+ End Function
+End Class
+
+Module ShadowsC2
+ Sub Main()
+ End Sub
+End Module
diff --git a/mcs/btests/ShadowsC3.vb b/mcs/btests/ShadowsC3.vb
new file mode 100755
index 00000000000..b257fba68d8
--- /dev/null
+++ b/mcs/btests/ShadowsC3.vb
@@ -0,0 +1,15 @@
+MustInherit Class B
+ MustOverride Function F()
+End Class
+
+Class D
+ Inherits B
+
+ Shadows Function F()
+ End Function
+End Class
+
+Module ShadowsC3
+ Sub Main()
+ End Sub
+End Module
diff --git a/mcs/btests/ShadowsD.vb b/mcs/btests/ShadowsD.vb
new file mode 100755
index 00000000000..1062ca06761
--- /dev/null
+++ b/mcs/btests/ShadowsD.vb
@@ -0,0 +1,22 @@
+Class B
+ Public Shared Sub F()
+ End Sub
+End Class
+
+Class D
+ Inherits B
+
+ Private Shared Shadows Sub F()
+ End Sub
+End Class
+
+Class D1
+ Inherits D
+End Class
+
+Module ShadowsD
+ Sub Main()
+ Dim x As New D1()
+ x.F()
+ End Sub
+End Module
diff --git a/mcs/btests/StringLiterals.vb b/mcs/btests/StringLiterals.vb
new file mode 100755
index 00000000000..59eea0d4a00
--- /dev/null
+++ b/mcs/btests/StringLiterals.vb
@@ -0,0 +1,23 @@
+Module StringLiterals
+ Sub main()
+ Dim c As Char
+ c = "x"
+
+ Dim a As String = "xyz"
+ a = "xyz1"
+
+ If a = "xyz1" Then
+ End If
+
+ 'Escaped " mark
+ ' each "" represents a single " in a string
+ a = ("a""b""")
+
+ Dim x As String = "hi"
+ Dim y As String = "hi"
+
+ If Not x Is y Then
+ Throw New System.Exception("x and y are different instances")
+ End If
+ End Sub
+End Module
diff --git a/mcs/btests/StringLiteralsC1.vb b/mcs/btests/StringLiteralsC1.vb
new file mode 100755
index 00000000000..ce23165cb57
--- /dev/null
+++ b/mcs/btests/StringLiteralsC1.vb
@@ -0,0 +1,5 @@
+Module StringLiteralsC1
+ Sub main()
+ Dim x As String = "b"b"
+ End Sub
+End Module
diff --git a/mcs/btests/Test.Sources b/mcs/btests/Test.Sources
index 83b97345a4b..bbe606b9256 100644
--- a/mcs/btests/Test.Sources
+++ b/mcs/btests/Test.Sources
@@ -1,31 +1,106 @@
-TEST_SOURCES = BoolLiteralTest1 \
-BoolLiteralTest \
+#
+# All positive test cases goes here
+#
+
+TEST_SOURCES = \
+Test1 \
+Test2 \
+misc1 \
+misc2 \
+Identifier \
+StringTypeCharTest \
+SingleTypeCharTest \
+IntegerTypeCharTest\
DecimalTypeCharTest \
DoubleTypeCharTest \
-Identifier \
-IdentifierFail1 \
+LongTypeCharTest\
+IntegerLiteralTest \
IntegerLiteral1Test \
IntegerLiteral2Test \
-IntegerLiteralTest1 \
-IntegerLiteralTest2 \
-IntegerLiteralTest3 \
-IntegerLiteralTest4 \
-IntegerLiteralTest \
-IntegerTypeCharTest \
-LongTypeCharTest \
-misc1 \
-misc2 \
-SingleTypeCharTest \
-StringLiteralTest \
-StringTypeCharTest \
-Test1 \
-Test2
+BoolLiteralTest \
+StringLiterals \
+CharacterLiterals \
+DateLiterals \
+FloatingPointLiteralsTest \
+LiteralNothing \
+InheritanceA \
+InheritanceB \
+InheritanceC \
+InheritanceD \
+InheritanceE \
+MustInherit \
+InterfaceA \
+InterfaceB \
+InterfaceC \
+InterfaceD \
+InterfaceE \
+NotInheritable \
+NameSpace* \
+NS* \
+Overloading \
+OverrideA \
+OverrideB \
+Scope \
+ShadowsA \
+ShadowsB \
+ShadowsC \
+ShadowsD
+
+# All negetive test cases which should
+# fail during compilation goes here
-TEST_NGTIVE_COMPILATION_SOURCES = IdentifierFail2 \
+TEST_NGTIVE_COMPILATION_SOURCES = \
+IdentifierFail1 \
+IdentifierFail2 \
IdentifierFail3 \
IdentifierFail4 \
IntegerLiteralTestC1 \
IntegerLiteralTestC2 \
IntegerLiteralTestC3 \
-IntegerLiteralTestC4
+IntegerLiteralTestC4 \
+BoolLiteralTest1 \
+CharacterLiteralsC2 \
+CharacterLiteralsC3 \
+DateLiteralsC1 \
+DateLiteralsC2 \
+DateLiteralsC3 \
+DateLiteralsC4 \
+DateLiteralsC5 \
+DateLiteralsC6 \
+DateLiteralsC7 \
+DateLiteralsC8 \
+DateLiteralsC9 \
+DateLiteralsC10 \
+DateLiteralsC11 \
+DateLiteralsC12 \
+InheritanceC1 \
+InheritanceC2 \
+InheritanceC3 \
+MustInheritC1 \
+MustInheritC2 \
+MustInheritC3 \
+InterfaceC1 \
+InterfaceC2 \
+NotInheritableC1 \
+NotInheritableC2 \
+OverloadingC1 \
+OverloadingC2 \
+OverloadingC3 \
+OverrideC1 \
+ScopeC1 \
+ShadowsC1 \
+ShadowsC2 \
+ShadowsC3 \
+StringLiteralsC1
+
+# All negetive test cases which should fail at
+# runtime goes here
+
+TEST_NGTIVE_RUNTIME_SOURCES = \
+IntegerLiteralTest1 \
+IntegerLiteralTest2 \
+IntegerLiteralTest3 \
+IntegerLiteralTest4 \
+CharacterLiterals1 \
+Inheritance1
diff --git a/mcs/class/ChangeLog b/mcs/class/ChangeLog
index 0f88f374528..52d2eee6b4d 100644
--- a/mcs/class/ChangeLog
+++ b/mcs/class/ChangeLog
@@ -1,3 +1,8 @@
+2004-01-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Makefile: disabled Mono.Posix for other platforms than linux until
+ it builds properly.
+
2003-12-17 Sebastien Pouliot <spouliot@videotron.ca>
* Makefile: Moved Mono.Security before Mono.Data.Tds because it's
diff --git a/mcs/class/Commons.Xml.Relaxng/.cvsignore b/mcs/class/Commons.Xml.Relaxng/.cvsignore
new file mode 100755
index 00000000000..89b8c807cdf
--- /dev/null
+++ b/mcs/class/Commons.Xml.Relaxng/.cvsignore
@@ -0,0 +1,2 @@
+Commons.Xml.Relaxng_test.dll
+Commons.Xml.Relaxng_test.pdb \ No newline at end of file
diff --git a/mcs/class/I18N/Common/Handlers.cs b/mcs/class/I18N/Common/Handlers.cs
index 0b709b2f0dc..4bce2add460 100644
--- a/mcs/class/I18N/Common/Handlers.cs
+++ b/mcs/class/I18N/Common/Handlers.cs
@@ -26,6 +26,7 @@ namespace I18N.Common
{
using System;
+using System.Collections;
// This class provides an internal list of handlers, for runtime
// engines that do not implement the altered "GetFile" semantics.
@@ -198,7 +199,119 @@ public sealed class Handlers
"I18N.West.CP865",
"I18N.West.ENCibm865"
};
+
+ static Hashtable aliases;
+ public static string GetAlias (string name)
+ {
+ if (aliases == null)
+ BuildHash ();
+ return aliases [name] as string;
+ }
+
+ static void BuildHash ()
+ {
+ aliases = new Hashtable (new CaseInsensitiveHashCodeProvider (),
+ new CaseInsensitiveComparer ());
+
+ aliases.Add ("arabic", "iso_8859_6");
+ aliases.Add ("csISOLatinArabic", "iso_8859_6");
+ aliases.Add ("ECMA_114", "iso_8859_6");
+ aliases.Add ("ISO_8859_6:1987", "iso_8859_6");
+ aliases.Add ("iso_ir_127", "iso_8859_6");
+
+ aliases.Add ("cp1256" ,"windows_1256");
+
+ aliases.Add ("csISOLatin4", "iso_8859_4");
+ aliases.Add ("ISO_8859_4:1988", "iso_8859_4");
+ aliases.Add ("iso_ir_110", "iso_8859_4");
+ aliases.Add ("l4", "iso_8859_4");
+ aliases.Add ("latin4", "iso_8859_4");
+
+ aliases.Add ("cp852" ,"ibm852");
+
+ aliases.Add ("csISOLatin2", "iso_8859_2");
+ aliases.Add ("iso_8859_2:1987", "iso_8859_2");
+ aliases.Add ("iso8859_2", "iso_8859_2");
+ aliases.Add ("iso_ir_101", "iso_8859_2");
+ aliases.Add ("l2", "iso_8859_2");
+ aliases.Add ("latin2", "iso_8859_2");
+
+ aliases.Add ("x-cp1250", "windows_1250");
+
+ aliases.Add ("chinese", "gb2312");
+ aliases.Add ("CN-GB", "gb2312");
+ aliases.Add ("csGB2312", "gb2312");
+ aliases.Add ("csGB231280", "gb2312");
+ aliases.Add ("csISO58GB231280", "gb2312");
+ aliases.Add ("GB_2312_80", "gb2312");
+ aliases.Add ("GB231280", "gb2312");
+ aliases.Add ("GB2312_80", "gb2312");
+ aliases.Add ("GBK", "gb2312");
+ aliases.Add ("iso_ir_58", "gb2312");
+
+ aliases.Add ("cn-big5", "big5");
+ aliases.Add ("csbig5", "big5");
+ aliases.Add ("x-x-big5", "big5");
+
+ aliases.Add ("cp866", "ibm866");
+
+ aliases.Add ("csISOLatin5", "iso_8859_5");
+ aliases.Add ("csISOLatinCyrillic", "iso_8859_5");
+ aliases.Add ("cyrillic", "iso_8859_5");
+ aliases.Add ("ISO_8859_5:1988", "iso_8859_5");
+ aliases.Add ("iso_ir_144", "iso_8859_5");
+ aliases.Add ("l5", "iso_8859_5");
+
+ aliases.Add ("csKOI8R", "koi8_r");
+ aliases.Add ("koi", "koi8_r");
+ aliases.Add ("koi8", "koi8_r");
+ aliases.Add ("koi8r", "koi8_r");
+
+ aliases.Add ("koi8ru", "koi8_u");
+
+ aliases.Add ("x-cp1251", "windows_1251");
+
+ aliases.Add ("csISOLatinGreek", "iso_8859_7");
+ aliases.Add ("ECMA_118", "iso_8859_7");
+ aliases.Add ("ELOT_928", "iso_8859_7");
+ aliases.Add ("greek", "iso_8859_7");
+ aliases.Add ("greek8", "iso_8859_7");
+ aliases.Add ("ISO_8859_7:1987", "iso_8859_7");
+ aliases.Add ("iso_ir_126", "iso_8859_7");
+
+ aliases.Add ("csISOLatinHebrew", "iso_8859_8");
+ aliases.Add ("hebrew", "iso_8859_8");
+ aliases.Add ("ISO_8859_8:1988", "iso_8859_8");
+ aliases.Add ("iso_ir_138", "iso_8859_8");
+
+ aliases.Add ("csShiftJIS", "shift_jis");
+ aliases.Add ("csWindows31J", "shift_jis");
+ aliases.Add ("ms_Kanji", "shift_jis");
+ aliases.Add ("shift-jis", "shift_jis");
+ aliases.Add ("x-ms-cp932", "shift_jis");
+ aliases.Add ("x-sjis", "shift_jis");
+
+ aliases.Add ("csISOLatin3", "iso_8859_3");
+ aliases.Add ("ISO_8859_3:1988", "iso_8859_3");
+ aliases.Add ("iso_ir_109", "iso_8859_3");
+ aliases.Add ("l3", "iso_8859_3");
+ aliases.Add ("latin3", "iso_8859_3");
+
+ aliases.Add ("csISOLatin9", "iso_8859_15");
+ aliases.Add ("l9", "iso_8859_15");
+ aliases.Add ("latin9", "iso_8859_15");
+
+ aliases.Add ("cp437", "ibm437");
+ aliases.Add ("csPC8", "ibm437");
+ aliases.Add ("CodePage437", "ibm437");
+
+ aliases.Add ("DOS_874", "windows_874");
+ aliases.Add ("iso_8859_11", "windows_874");
+ aliases.Add ("TIS_620", "windows_874");
+ }
+
+
}; // class Handlers
}; // namespace I18N.Common
diff --git a/mcs/class/I18N/Common/Manager.cs b/mcs/class/I18N/Common/Manager.cs
index 6cf4fde14d8..e4e3aec5dbe 100644
--- a/mcs/class/I18N/Common/Manager.cs
+++ b/mcs/class/I18N/Common/Manager.cs
@@ -110,9 +110,19 @@ public class Manager
if (e == null)
e = Instantiate (name) as Encoding;
+ if (e == null) {
+ // Try windows aliases
+ string alias = Handlers.GetAlias (name);
+ if (alias != null) {
+ e = Instantiate ("ENC" + alias) as Encoding;
+ if (e == null)
+ e = Instantiate (alias) as Encoding;
+ }
+ }
+
return e;
}
-
+
// List of hex digits for use by "GetCulture".
private const String hex = "0123456789abcdef";
diff --git a/mcs/class/Makefile b/mcs/class/Makefile
index 5fc9597d694..ad33ae1ac47 100644
--- a/mcs/class/Makefile
+++ b/mcs/class/Makefile
@@ -1,4 +1,7 @@
thisdir = class
+include ../build/rules.make
+
+MONO_POSIX = Mono.Posix
ifeq ($(PLATFORM),linux)
MONO_CSHARP_DEBUGGER = Mono.CSharp.Debugger
else
@@ -31,7 +34,7 @@ SUBDIRS = \
Mono.Data.TdsClient \
System.Data.OracleClient \
Mono.PEToolkit \
- Mono.Posix \
+ $(MONO_POSIX) \
Accessibility \
Microsoft.VisualBasic \
Microsoft.VisualC \
@@ -73,8 +76,6 @@ DIST_ONLY_SUBDIRS = \
# No new makefiles for: System.Messaging, System.Web.Mobile,
# System.ServiceProcess
-include ../build/rules.make
-
DISTFILES = \
LICENSE \
README \
diff --git a/mcs/class/Microsoft.JScript/ChangeLog b/mcs/class/Microsoft.JScript/ChangeLog
index 02660fe1853..bb6ff915fc3 100644
--- a/mcs/class/Microsoft.JScript/ChangeLog
+++ b/mcs/class/Microsoft.JScript/ChangeLog
@@ -1,3 +1,7 @@
+2004-01-16 Cesar Lopez Nataren <cesar@ciencias.unam.mx>
+
+ * Microsoft.JScript.dll.sources: added VsaScriptScope to the build.
+
2003-11-10 <cesar@ciencias.unam.mx>
* Microsoft.JScript.dll.sources: don't build Visitor.cs.
diff --git a/mcs/class/Microsoft.JScript/Microsoft.JScript.Vsa/ChangeLog b/mcs/class/Microsoft.JScript/Microsoft.JScript.Vsa/ChangeLog
index 0b64627641b..1cf6966de73 100644
--- a/mcs/class/Microsoft.JScript/Microsoft.JScript.Vsa/ChangeLog
+++ b/mcs/class/Microsoft.JScript/Microsoft.JScript.Vsa/ChangeLog
@@ -1,3 +1,10 @@
+2004-01-16 Cesar Lopez Nataren <cesar@ciencias.unam.mx>
+
+ * VsaEngine.cs: added an Stack, a VsaScriptScope, do not throw exceptions for:
+ CreateEngineAndgetGlobalScope, GetGlobalScope, InitVsaEngine,
+ PopScriptObject, PushScriptObject, the reason is for being able to
+ run the tests at jtests. Be aware that this must get implemented yet.
+
2003-09-29 <cesar@ciencias.unam.mx>
* VsaEngine.cs: uncommented inheritance from BaseVsaEngine (thanks
diff --git a/mcs/class/Microsoft.JScript/Microsoft.JScript.Vsa/VsaEngine.cs b/mcs/class/Microsoft.JScript/Microsoft.JScript.Vsa/VsaEngine.cs
index a43350c885e..e17bd4d7cc6 100755
--- a/mcs/class/Microsoft.JScript/Microsoft.JScript.Vsa/VsaEngine.cs
+++ b/mcs/class/Microsoft.JScript/Microsoft.JScript.Vsa/VsaEngine.cs
@@ -16,16 +16,19 @@ namespace Microsoft.JScript.Vsa {
public class VsaEngine : BaseVsaEngine, IRedirectOutput {
static private Hashtable options;
+ internal VsaScriptScope global_scope;
+ internal Stack globals;
public VsaEngine ()
- : base ("", "", false)
+ : this (true)
{
InitOptions ();
}
public VsaEngine (bool b)
+ : base ("JScript", "0.0.1", true)
{
- throw new NotImplementedException ();
+ globals = new Stack (4);
}
public virtual IVsaEngine Clone (AppDomain appDom)
@@ -43,9 +46,25 @@ namespace Microsoft.JScript.Vsa {
throw new NotImplementedException ();
}
- public static GlobalScope CreateEngineAndGetGlobalScope (bool b, string [] assemblyName)
+ public static GlobalScope CreateEngineAndGetGlobalScope (bool fast, string [] assembly_names)
{
- throw new NotImplementedException ();
+ int i, n;
+ GlobalScope scope;
+
+ VsaEngine engine = new VsaEngine (fast);
+ engine.InitVsaEngine ("JScript.Vsa.VsaEngine://Microsoft.JScript.VsaEngine.Vsa",
+ new DefaultVsaSite ());
+ n = assembly_names.Length;
+
+ for (i = 0; i < n; i++) {
+ string assembly_name = assembly_names [i];
+ VsaReferenceItem r = (VsaReferenceItem) engine.Items.CreateItem (assembly_name,
+ VsaItemType.Reference,
+ VsaItemFlag.None);
+ r.AssemblyName = assembly_name;
+ }
+ scope = (GlobalScope) engine.GetGlobalScope ().GetObject ();
+ return scope;
}
public static GlobalScope CreateEngineAndGetGlobalScopeWithType (bool b, string [] assemblyNames,
@@ -76,7 +95,11 @@ namespace Microsoft.JScript.Vsa {
public virtual IVsaScriptScope GetGlobalScope ()
{
- throw new NotImplementedException ();
+ if (global_scope == null) {
+ global_scope = new VsaScriptScope (this, "Global", null);
+ }
+
+ return global_scope;
}
public virtual GlobalScope GetMainScope ()
@@ -106,7 +129,12 @@ namespace Microsoft.JScript.Vsa {
public void InitVsaEngine (string moniker, IVsaSite site)
{
- throw new NotImplementedException ();
+ RootMoniker = moniker;
+ Site = site;
+ InitNewCalled = true;
+ RootNamespace = "JScript.DefaultNamespace";
+ IsDirty = true;
+ compiled = false;
}
public virtual void Interrupt ()
@@ -127,12 +155,21 @@ namespace Microsoft.JScript.Vsa {
public ScriptObject PopScriptObject ()
{
- throw new NotImplementedException ();
+ ScriptObject script_obj = null;
+
+ try {
+ script_obj = (ScriptObject) globals.Pop ();
+ } catch (NullReferenceException e) {
+ }
+ return script_obj;
}
public void PushScriptObject (ScriptObject obj)
{
- throw new NotImplementedException ();
+ try {
+ globals.Push (obj);
+ } catch (NullReferenceException e) {
+ }
}
public virtual void RegisterEventSource (string name)
@@ -140,13 +177,10 @@ namespace Microsoft.JScript.Vsa {
throw new NotImplementedException ();
}
- /*
public override void Reset ()
{
throw new NotImplementedException ();
}
- */
-
public virtual void Restart ()
{
@@ -212,4 +246,7 @@ namespace Microsoft.JScript.Vsa {
}
}
}
-} \ No newline at end of file
+
+ class DefaultVsaSite : BaseVsaSite {
+ }
+}
diff --git a/mcs/class/Microsoft.JScript/Microsoft.JScript.dll.sources b/mcs/class/Microsoft.JScript/Microsoft.JScript.dll.sources
index 22f609fb95f..48e978bdc80 100644
--- a/mcs/class/Microsoft.JScript/Microsoft.JScript.dll.sources
+++ b/mcs/class/Microsoft.JScript/Microsoft.JScript.dll.sources
@@ -251,9 +251,10 @@ Antlr.Runtime/antlr.collections/AST.cs
Antlr.Runtime/antlr.debug.misc/ASTFrame.cs
Antlr.Runtime/antlr.debug.misc/JTreeASTPanel.cs
Antlr.Runtime/antlr.debug.misc/SupportClass.cs
+Microsoft.JScript/VsaCodeItem.cs
Microsoft.JScript/VsaItem.cs
Microsoft.JScript/VsaItems.cs
Microsoft.JScript/VsaGlobalItem.cs
Microsoft.JScript/VsaReferenceItem.cs
-Microsoft.JScript/VsaCodeItem.cs
+Microsoft.JScript/VsaScriptScope.cs
Microsoft.JScript/expression.cs
diff --git a/mcs/class/Microsoft.JScript/Microsoft.JScript/BinaryOp.cs b/mcs/class/Microsoft.JScript/Microsoft.JScript/BinaryOp.cs
index e4131b4a0be..84716500657 100644
--- a/mcs/class/Microsoft.JScript/Microsoft.JScript/BinaryOp.cs
+++ b/mcs/class/Microsoft.JScript/Microsoft.JScript/BinaryOp.cs
@@ -8,7 +8,7 @@
namespace Microsoft.JScript {
- public abstract class BinaryOp : AST {
+ public abstract class BinaryOp : Exp {
internal AST left, right;
@@ -32,4 +32,3 @@ namespace Microsoft.JScript {
internal JSToken current_op;
}
}
- \ No newline at end of file
diff --git a/mcs/class/Microsoft.JScript/Microsoft.JScript/BitwiseBinary.cs b/mcs/class/Microsoft.JScript/Microsoft.JScript/BitwiseBinary.cs
index 3a5b246e2ac..4c0c59180d7 100644
--- a/mcs/class/Microsoft.JScript/Microsoft.JScript/BitwiseBinary.cs
+++ b/mcs/class/Microsoft.JScript/Microsoft.JScript/BitwiseBinary.cs
@@ -30,6 +30,11 @@ namespace Microsoft.JScript {
throw new NotImplementedException ();
}
+ internal override bool Resolve (IdentificationTable context, bool no_effect)
+ {
+ throw new NotImplementedException ();
+ }
+
internal override void Emit (EmitContext ec)
{
throw new NotImplementedException ();
diff --git a/mcs/class/Microsoft.JScript/Microsoft.JScript/Block.cs b/mcs/class/Microsoft.JScript/Microsoft.JScript/Block.cs
index 69525e8167f..1b09766bf89 100644
--- a/mcs/class/Microsoft.JScript/Microsoft.JScript/Block.cs
+++ b/mcs/class/Microsoft.JScript/Microsoft.JScript/Block.cs
@@ -14,26 +14,24 @@ namespace Microsoft.JScript {
public class Block : AST {
- internal ArrayList Elements;
+ internal ArrayList elems;
internal Block (AST parent)
{
this.parent = parent;
- Elements = new ArrayList ();
+ elems = new ArrayList ();
}
internal void Add (AST e)
{
- Elements.Add (e);
+ elems.Add (e);
}
public override string ToString ()
{
- System.Console.WriteLine (Elements.Count);
-
StringBuilder sb = new StringBuilder ();
- foreach (AST a in Elements)
+ foreach (AST a in elems)
if (a != null)
sb.Append (a.ToString () + " ");
@@ -42,23 +40,33 @@ namespace Microsoft.JScript {
internal override void Emit (EmitContext ec)
{
- int i, size = Elements.Count;
-
- for (i = 0; i < size; i++)
- ((AST) Elements [i]).Emit (ec);
+ int i, n = elems.Count;
+ object e;
+
+ for (i = 0; i < n; i++) {
+ e = elems [i];
+ if (e is FunctionDeclaration)
+ ((FunctionDeclaration) e).Emit (ec);
+ }
+
+ for (i = 0; i < n; i++) {
+ e = elems [i];
+ if (!(e is FunctionDeclaration))
+ ((AST) e).Emit (ec);
+ }
}
internal override bool Resolve (IdentificationTable context)
{
+ AST e;
bool r = true;
- int i, size = Elements.Count;
-
- System.Console.WriteLine ("Block::Resolve");
-
- for (i = 0; i < size; i++)
- r &= ((AST) Elements [i]).Resolve (context);
+ int i, n = elems.Count;
- return r;
+ for (i = 0; i < n; i++) {
+ e = (AST) elems [i];
+ r &= e.Resolve (context);
+ }
+ return r;
}
}
}
diff --git a/mcs/class/Microsoft.JScript/Microsoft.JScript/ChangeLog b/mcs/class/Microsoft.JScript/Microsoft.JScript/ChangeLog
index f9bbaa60385..ebf7fa24b01 100644
--- a/mcs/class/Microsoft.JScript/Microsoft.JScript/ChangeLog
+++ b/mcs/class/Microsoft.JScript/Microsoft.JScript/ChangeLog
@@ -1,3 +1,102 @@
+2004-01-25 Cesar Lopez Nataren <cesar@ciencias.unam.mx>
+
+ * Relational.cs: Initial generation of CIL for relational operators.
+
+2004-01-23 Cesar Lopez Nataren <cesar@ciencias.unam.mx>
+
+ * jscript-lexer-parser.g: formal_param_list receives a parent too.
+
+ * SymbolTable.cs: added size and current_symbols properties.
+
+ * JSLocalField.cs: don't throw not ImplementedException from
+ constructor (same reason, testing purposes, must get implemented
+ for real).
+
+ * IdentificationTable.cs: added num_of_locals and current_locals properties.
+
+ * FunctionDeclaration.cs: added a LocalBuilder and DictionaryEntry
+ as fields. Not throw NotImplementedException for
+ JScriptFunctionDeclaration (testing purposes, must get implemeted
+ for real). Let's build our function closures! Added functions:
+ build_closure and build_closure_nested, build_local_fields. Keep
+ track of current parameters and locals defs.
+
+ * FormalParameterList.cs: made FormalParam inherit from
+ AST. Implement the Emit for parameters, yeah!
+
+ * CodeGenerator.cs: added a ModuleBuilder reference. New constructor.
+
+ * Closure.cs: do not throw the exception (this allow me to run the
+ tests at mcs/jtests and check that at least i'm not generating
+ invalid CIL). Be aware that this must be really implemented.
+
+ * Block.cs: renamed field, and implement the double pass for
+ nested function declarations code emittion, yeah!.
+
+2004-01-16 Cesar Lopez Nataren <cesar@ciencias.unam.mx>
+
+ * Microsoft.JScript/VsaReferenceItem.cs: renamed field, reuse parent's ctr.
+ * Microsoft.JScript/VsaItem.cs: renamed some fields, added ctr,
+ * Microsoft.JScript/VsaGlobalItem.cs: reuse parent ctr.
+ * Microsoft.JScript/VsaCodeItem.cs: reuse parent ctr.
+ * Microsoft.JScript/GlobalScope.cs: reuse constructors from parent.
+
+ * UnaryOp.cs: inherit from Exp now.
+ * Plus.cs: Don't throw the exception when calling constructor, let
+ it build the default handler. Return a new object when calling
+ EvaluatePlus until properly implemented.
+
+ * NumericUnary.cs: added new Resolve.
+ * NumericBinary.cs: assign operator val at ctr. Return a new
+ object when calling EvaluateNumericBinary until properly
+ implemented. Added Resolve.
+ * Equality.cs: added ctr and return false for EvaluateEquality
+ until properly implemented. Added Resolve's functions.
+
+ * Block.cs (Resolve): That check was not necessary.
+
+ * InstanceOf.cs, PostOrPrefixOperator.cs, Relational.cs,
+ StrictEquality.cs, TypeOf.cs: added Resolve inherited from
+ BinaryOp and UnaryOp, and this from Exp.
+ * IdentificationTable.cs, ScriptBlock.cs: deleted debugging messages.
+ * jscript-lexer-parser.g: deleted debugging messages. Create a
+ Assign object instance of a simple Binary obj. Same case for Equality.
+
+ * expression.cs: added Exp abstract class. Classes that are ast of
+ language constructions that can appear as global expressions that
+ get evaluated and then the result is discarded inherit from this
+ new class. This let meee keep track of things that must get Popped
+ or can even avoid the evaluation of it. Wrote real Resolve method
+ for classes: Unary, Binary.
+ Implemted Emit method for some binary operations (+, -, / and *),
+ for other operators some more code is still missing.
+ Identifier: handle assignment cases and global exp cases.
+ Added class Assign (compisite assignment still missing tough :-(
+
+ * driver.cs: deleted debug messages, added "Compilation Succeeded"
+ message ;-).
+ * VariableStatement.cs, VariableDeclaration.cs: wrote real Resolve method.
+ * Literal.cs (BooleanLiteral, NumericLiteral): now inherits from
+ Exp and handle the case for global expressions that must be popped
+ after evaluation. no more invalid IL being generated! yeah!
+ * Block.cs: wrote real Resolve method, erased debug messages.
+ * BitwiseBinary.cs, InstanceOf.cs, UnaryOp.cs: : add new Resolve inherited from Exp.
+ * BinaryOp.cs, Conditional: now inherits from Exp.
+
+2004-01-15 Cesar Lopez Nataren <cesar@ciencias.unam.mx>
+
+ * ReferenceAttribute.cs: moved it back to namespace Microsoft.JScript.
+
+ * CodeGenerator.cs: small fixes to generate same things that ms.
+
+2004-01-13 Cesar Lopez Nataren <cesar@ciencias.unam.mx>
+
+ * VariableDeclaration.cs: get the this.type which is a Type not a TypeBuilder.
+
+2004-01-12 Atsushi Enomoto <atsushi@ximian.com>
+
+ * JSMethodInfo.cs : tiny fix for NET_1_2 build.
+
2003-12-24 Cesar Lopez Nataren <cesar@ciencias.unam.mx>
* jscript-lexer-parser.g: keep track of parent reference for
diff --git a/mcs/class/Microsoft.JScript/Microsoft.JScript/Closure.cs b/mcs/class/Microsoft.JScript/Microsoft.JScript/Closure.cs
index e8aaeea93d5..87dd8851ccc 100644
--- a/mcs/class/Microsoft.JScript/Microsoft.JScript/Closure.cs
+++ b/mcs/class/Microsoft.JScript/Microsoft.JScript/Closure.cs
@@ -17,7 +17,6 @@ namespace Microsoft.JScript {
public Closure (FunctionObject func)
{
- throw new NotImplementedException ();
}
public override string ToString ()
@@ -25,4 +24,4 @@ namespace Microsoft.JScript {
throw new NotImplementedException ();
}
}
-} \ No newline at end of file
+}
diff --git a/mcs/class/Microsoft.JScript/Microsoft.JScript/CodeGenerator.cs b/mcs/class/Microsoft.JScript/Microsoft.JScript/CodeGenerator.cs
index 95e46625651..d323c41eb9c 100644
--- a/mcs/class/Microsoft.JScript/Microsoft.JScript/CodeGenerator.cs
+++ b/mcs/class/Microsoft.JScript/Microsoft.JScript/CodeGenerator.cs
@@ -21,6 +21,7 @@ namespace Microsoft.JScript {
internal TypeBuilder type_builder;
internal ILGenerator ig;
internal ILGenerator gc_ig;
+ internal ModuleBuilder mod_builder;
internal EmitContext (TypeBuilder type)
{
@@ -35,6 +36,14 @@ namespace Microsoft.JScript {
gc_ig = global_code.GetILGenerator ();
}
}
+
+ internal EmitContext (TypeBuilder type_builder, ModuleBuilder mod_builder, ILGenerator gc_ig, ILGenerator loc_ig)
+ {
+ this.type_builder = type_builder;
+ this.mod_builder = mod_builder;
+ this.gc_ig = gc_ig;
+ this.ig = loc_ig;
+ }
}
public class CodeGenerator {
@@ -60,6 +69,11 @@ namespace Microsoft.JScript {
assembly_name,
AssemblyBuilderAccess.RunAndSave);
+ ConstructorInfo ctr_info = typeof (Microsoft.JScript.ReferenceAttribute).GetConstructor (new Type [] { typeof (string) });
+ // FIXME: find out which is the blob.
+ byte [] blob = new byte [] {};
+ assembly_builder.SetCustomAttribute (ctr_info, blob);
+
module_builder = assembly_builder.DefineDynamicModule (
mod_name,
assembly_name.Name + ".exe",
@@ -87,13 +101,14 @@ namespace Microsoft.JScript {
return;
TypeBuilder type_builder;
- type_builder = module_builder.DefineType ("JScript 0");
+ type_builder = module_builder.DefineType ("JScript 0", TypeAttributes.Public);
type_builder.SetParent (typeof (GlobalScope));
type_builder.SetCustomAttribute (new CustomAttributeBuilder
(typeof (CompilerGlobalScopeAttribute).GetConstructor (new Type [] {}), new object [] {}));
EmitContext ec = new EmitContext (type_builder);
+ ec.mod_builder = module_builder;
ILGenerator global_code = ec.gc_ig;
emit_default_script_constructor (ec);
diff --git a/mcs/class/Microsoft.JScript/Microsoft.JScript/Equality.cs b/mcs/class/Microsoft.JScript/Microsoft.JScript/Equality.cs
index ab68669b248..4917dd15571 100644
--- a/mcs/class/Microsoft.JScript/Microsoft.JScript/Equality.cs
+++ b/mcs/class/Microsoft.JScript/Microsoft.JScript/Equality.cs
@@ -9,6 +9,7 @@
using System;
using System.Text;
+using System.Reflection.Emit;
namespace Microsoft.JScript {
@@ -26,10 +27,14 @@ namespace Microsoft.JScript {
throw new NotImplementedException ();
}
+ public Equality (int i)
+ {
+ current_op = (JSToken) i;
+ }
public bool EvaluateEquality (object v1, object v2)
{
- throw new NotImplementedException ();
+ return false;
}
@@ -55,9 +60,14 @@ namespace Microsoft.JScript {
internal override bool Resolve (IdentificationTable context)
{
- throw new NotImplementedException ();
+ return true;
}
+ internal override bool Resolve (IdentificationTable context, bool no_effect)
+ {
+ throw new NotImplementedException ();
+ }
+
internal override void Emit (EmitContext ec)
{
throw new NotImplementedException ();
diff --git a/mcs/class/Microsoft.JScript/Microsoft.JScript/FormalParameterList.cs b/mcs/class/Microsoft.JScript/Microsoft.JScript/FormalParameterList.cs
index a5da530ced1..8fe66e7d9e7 100644
--- a/mcs/class/Microsoft.JScript/Microsoft.JScript/FormalParameterList.cs
+++ b/mcs/class/Microsoft.JScript/Microsoft.JScript/FormalParameterList.cs
@@ -7,13 +7,14 @@
// (C) 2003, Cesar Lopez Nataren, <cesar@ciencias.unam.mx>
//
+using System.Reflection.Emit;
using System.Collections;
using System.Text;
using System;
namespace Microsoft.JScript {
- internal class FormalParam {
+ internal class FormalParam : AST {
internal string id;
internal string type_annot;
@@ -34,13 +35,23 @@ namespace Microsoft.JScript {
{
return id + " " + type_annot;
}
+
+ internal override void Emit (EmitContext ec)
+ {
+ }
+
+ internal override bool Resolve (IdentificationTable context)
+ {
+ context.Enter (id, this);
+ return true;
+ }
}
public class FormalParameterList : AST {
internal ArrayList ids;
- public FormalParameterList ()
+ internal FormalParameterList ()
{
ids = new ArrayList ();
}
@@ -64,19 +75,33 @@ namespace Microsoft.JScript {
internal override bool Resolve (IdentificationTable context)
{
FormalParam f;
- int i, size = ids.Count;
+ int i, n = ids.Count;
- for (i = 0; i < size; i++) {
+ for (i = 0; i < n; i++) {
f = (FormalParam) ids [i];
- context.Enter (f.id, f);
+ f.Resolve (context);
}
-
return true;
}
internal override void Emit (EmitContext ec)
{
- throw new NotImplementedException ();
+ int n = ids.Count;
+ ILGenerator ig = ec.gc_ig;
+
+ ig.Emit (OpCodes.Ldc_I4, n);
+ ig.Emit (OpCodes.Newarr, typeof (string));
+
+ for (int i = 0; i < n; i++) {
+ ig.Emit (OpCodes.Dup);
+ ig.Emit (OpCodes.Ldc_I4, i);
+ ig.Emit (OpCodes.Ldstr, ((FormalParam) ids [i]).id);
+ ig.Emit (OpCodes.Stelem_Ref);
+ }
+ }
+
+ internal int size {
+ get { return ids.Count; }
}
}
}
diff --git a/mcs/class/Microsoft.JScript/Microsoft.JScript/FunctionDeclaration.cs b/mcs/class/Microsoft.JScript/Microsoft.JScript/FunctionDeclaration.cs
index 9e7c4da0322..57c5825e278 100644
--- a/mcs/class/Microsoft.JScript/Microsoft.JScript/FunctionDeclaration.cs
+++ b/mcs/class/Microsoft.JScript/Microsoft.JScript/FunctionDeclaration.cs
@@ -12,12 +12,15 @@ using System.Text;
using System.Reflection;
using System.Reflection.Emit;
using Microsoft.JScript.Vsa;
+using System.Collections;
namespace Microsoft.JScript {
public class FunctionDeclaration : AST {
internal FunctionObject Function;
+ internal DictionaryEntry [] locals;
+ internal LocalBuilder local_func;
internal FunctionDeclaration (AST parent, string name,
FormalParameterList p,
@@ -34,9 +37,9 @@ namespace Microsoft.JScript {
bool hasArgumentsObjects, string text,
Object declaringObject, VsaEngine engine)
{
- throw new NotImplementedException ();
+ FunctionObject f = null;
+ return new Closure (f);
}
-
internal FunctionDeclaration ()
{
@@ -68,43 +71,133 @@ namespace Microsoft.JScript {
TypeBuilder type = ec.type_builder;
MethodBuilder method;
string name;
-
+
if (parent == null) {
name = Function.name;
type.DefineField (name,
typeof (Microsoft.JScript.ScriptFunction),
FieldAttributes.Public |
- FieldAttributes.Static);
+ FieldAttributes.Static);
+ build_closure (ec);
+ method = type.DefineMethod (name, Function.attr,
+ Function.return_type,
+ Function.params_types ());
+ ec.ig = method.GetILGenerator ();
+ Function.body.Emit (ec);
+ ec.ig.Emit (OpCodes.Ret);
+ return;
} else {
name = get_composite_name ();
- ec.ig.DeclareLocal (typeof (Microsoft.JScript.ScriptFunction));
+ local_func = ec.ig.DeclareLocal (typeof (Microsoft.JScript.ScriptFunction));
+
+ method = type.DefineMethod (name, Function.attr,
+ Function.return_type,
+ Function.params_types ());
+ EmitContext new_ec = new EmitContext (ec.type_builder, ec.mod_builder, ec.ig, method.GetILGenerator ());
+ build_closure_nested (new_ec);
+ Function.body.Emit (new_ec);
+ new_ec.ig.Emit (OpCodes.Ret);
+ }
+ }
+
+ internal void build_closure (EmitContext ec)
+ {
+ ILGenerator ig = ec.gc_ig;
+ string name = Function.name;
+ Type t = ec.mod_builder.GetType ("JScript 0");
+ ig.Emit (OpCodes.Ldtoken, t);
+ ig.Emit (OpCodes.Ldstr, name);
+ ig.Emit (OpCodes.Ldstr, name);
+ Function.parameters.Emit (ec);
+ build_local_fields (ig);
+
+ ig.Emit (OpCodes.Ldc_I4_0); // FIXME: this hard coded for now.
+ ig.Emit (OpCodes.Ldc_I4_0); // FIXME: this hard coded for now.
+ ig.Emit (OpCodes.Ldstr, "STRING_REPRESENTATION_OF_THE_FUNCTION"); // FIXME
+ ig.Emit (OpCodes.Ldnull); // FIXME: this hard coded for now.
+
+ ig.Emit (OpCodes.Ldarg_0);
+ ig.Emit (OpCodes.Ldfld, typeof (ScriptObject).GetField ("engine"));
+ ig.Emit (OpCodes.Call, typeof (FunctionDeclaration).GetMethod ("JScriptFunctionDeclaration"));
+ ig.Emit (OpCodes.Stsfld, ec.mod_builder.GetType ("JScript 0").GetField (name));
+ }
+
+ internal void build_closure_nested (EmitContext ec)
+ {
+ ILGenerator ig = ec.gc_ig;
+ string name = get_composite_name ();
+ Type t = ec.mod_builder.GetType ("JScript 0");
+ ig.Emit (OpCodes.Ldtoken, t);
+ ig.Emit (OpCodes.Ldstr, Function.name);
+ ig.Emit (OpCodes.Ldstr, name);
+ Function.parameters.Emit (ec);
+ build_local_fields (ig);
+
+ ig.Emit (OpCodes.Ldc_I4_0); // FIXME: this hard coded for now.
+ ig.Emit (OpCodes.Ldc_I4_0); // FIXME: this hard coded for now.
+ ig.Emit (OpCodes.Ldstr, "STRING_REPRESENTATION_OF_THE_FUNCTION"); // FIXME
+ ig.Emit (OpCodes.Ldnull); // FIXME: this hard coded for now.
+
+ ig.Emit (OpCodes.Ldarg_0);
+ ig.Emit (OpCodes.Ldfld, typeof (ScriptObject).GetField ("engine"));
+ ig.Emit (OpCodes.Call, typeof (FunctionDeclaration).GetMethod ("JScriptFunctionDeclaration"));
+ ig.Emit (OpCodes.Stloc, local_func);
+ }
+
+ internal void build_local_fields (ILGenerator ig)
+ {
+ DictionaryEntry e;
+ object v;
+ int n;
+
+ if (locals == null)
+ n = 0;
+ else
+ n = locals.Length;
+
+ Type t = typeof (JSLocalField);
+
+ ig.Emit (OpCodes.Ldc_I4, n);
+ ig.Emit (OpCodes.Newarr, t);
+
+ for (int i = 0; i < n; i++) {
+ ig.Emit (OpCodes.Dup);
+ ig.Emit (OpCodes.Ldc_I4, i);
+ e = locals [i];
+ ig.Emit (OpCodes.Ldstr, (string) e.Key);
+ v = e.Value;
+
+ if (v is VariableDeclaration)
+ ig.Emit (OpCodes.Ldtoken, ((VariableDeclaration) v).type);
+ else if (v is FormalParam)
+ ig.Emit (OpCodes.Ldtoken, ((FormalParam) v).type);
+ else if (v is FunctionDeclaration)
+ ig.Emit (OpCodes.Ldtoken, typeof (ScriptFunction));
+
+ ig.Emit (OpCodes.Ldc_I4, i);
+ ig.Emit (OpCodes.Newobj, t.GetConstructor (new Type [] {
+ typeof (string),
+ typeof (RuntimeTypeHandle),
+ typeof (Int32) }));
+ ig.Emit (OpCodes.Stelem_Ref);
}
- method = type.DefineMethod (name, Function.attr,
- Function.return_type,
- Function.params_types ());
-
- ec.ig = method.GetILGenerator ();
- Function.body.Emit (ec);
- ec.ig.Emit (OpCodes.Ret);
}
internal override bool Resolve (IdentificationTable context)
{
context.Enter (Function.name, this);
context.OpenBlock ();
-
FormalParameterList p = Function.parameters;
if (p != null)
p.Resolve (context);
Block body = Function.body;
-
if (body != null)
body.Resolve (context);
- context.CloseBlock ();
-
+ locals = context.current_locals;
+ context.CloseBlock ();
return true;
}
}
diff --git a/mcs/class/Microsoft.JScript/Microsoft.JScript/GlobalScope.cs b/mcs/class/Microsoft.JScript/Microsoft.JScript/GlobalScope.cs
index b636d04202b..0729d126a20 100644
--- a/mcs/class/Microsoft.JScript/Microsoft.JScript/GlobalScope.cs
+++ b/mcs/class/Microsoft.JScript/Microsoft.JScript/GlobalScope.cs
@@ -16,8 +16,12 @@ namespace Microsoft.JScript {
public class GlobalScope : ActivationObject, IExpando {
public GlobalScope (GlobalScope parent, VsaEngine engine)
+ : this (parent, engine, engine != null)
{
- throw new NotImplementedException ();
+ }
+
+ internal GlobalScope (GlobalScope parent, VsaEngine engine, bool is_comp_scope)
+ {
}
public FieldInfo AddField (string name)
@@ -85,4 +89,4 @@ namespace Microsoft.JScript {
throw new NotImplementedException ();
}
}
-} \ No newline at end of file
+}
diff --git a/mcs/class/Microsoft.JScript/Microsoft.JScript/IdentificationTable.cs b/mcs/class/Microsoft.JScript/Microsoft.JScript/IdentificationTable.cs
index 3c817485784..702e70b2acc 100644
--- a/mcs/class/Microsoft.JScript/Microsoft.JScript/IdentificationTable.cs
+++ b/mcs/class/Microsoft.JScript/Microsoft.JScript/IdentificationTable.cs
@@ -24,22 +24,18 @@ namespace Microsoft.JScript {
internal void OpenBlock ()
{
- System.Console.WriteLine ("IdTable::OpenBlock");
-
SymbolTable parent = (SymbolTable) stack.Peek ();
stack.Push (new SymbolTable (parent));
}
internal void CloseBlock ()
{
- System.Console.WriteLine ("IdTable::CloseBlock");
stack.Pop ();
}
internal void Enter (string id, object decl)
{
((SymbolTable) stack.Peek ()).Add (id , decl);
- System.Console.WriteLine ("IdentificationTable::Enter::{0}", id);
}
//
@@ -70,5 +66,13 @@ namespace Microsoft.JScript {
return sb.ToString ();
}
+
+ internal int num_of_locals {
+ get { return ((SymbolTable) stack.Peek ()).size; }
+ }
+
+ internal DictionaryEntry [] current_locals {
+ get { return ((SymbolTable) stack.Peek ()).current_symbols; }
+ }
}
}
diff --git a/mcs/class/Microsoft.JScript/Microsoft.JScript/InstanceOf.cs b/mcs/class/Microsoft.JScript/Microsoft.JScript/InstanceOf.cs
index 5955bb82266..7ac9285384a 100644
--- a/mcs/class/Microsoft.JScript/Microsoft.JScript/InstanceOf.cs
+++ b/mcs/class/Microsoft.JScript/Microsoft.JScript/InstanceOf.cs
@@ -23,6 +23,11 @@ namespace Microsoft.JScript.Tmp {
throw new NotImplementedException ();
}
+ internal override bool Resolve (IdentificationTable context, bool no_effect)
+ {
+ throw new NotImplementedException ();
+ }
+
internal override void Emit (EmitContext ec)
{
throw new NotImplementedException ();
diff --git a/mcs/class/Microsoft.JScript/Microsoft.JScript/JSLocalField.cs b/mcs/class/Microsoft.JScript/Microsoft.JScript/JSLocalField.cs
index 09cfacccbdd..4f2c4fd0512 100644
--- a/mcs/class/Microsoft.JScript/Microsoft.JScript/JSLocalField.cs
+++ b/mcs/class/Microsoft.JScript/Microsoft.JScript/JSLocalField.cs
@@ -16,7 +16,6 @@ namespace Microsoft.JScript {
public JSLocalField (string name, RuntimeTypeHandle handle, int number)
{
- throw new NotImplementedException ();
}
public override Type FieldType {
@@ -35,4 +34,4 @@ namespace Microsoft.JScript {
}
}
}
- \ No newline at end of file
+
diff --git a/mcs/class/Microsoft.JScript/Microsoft.JScript/JSMethodInfo.cs b/mcs/class/Microsoft.JScript/Microsoft.JScript/JSMethodInfo.cs
index dde555d0e6c..28f083ba20e 100644
--- a/mcs/class/Microsoft.JScript/Microsoft.JScript/JSMethodInfo.cs
+++ b/mcs/class/Microsoft.JScript/Microsoft.JScript/JSMethodInfo.cs
@@ -44,6 +44,14 @@ namespace Microsoft.JScript.Tmp
}
+#if NET_1_2
+ public sealed override Type [] GetGenericArguments ()
+ {
+ throw new NotImplementedException ();
+ }
+#endif
+
+
public override MethodImplAttributes GetMethodImplementationFlags ()
{
throw new NotImplementedException ();
diff --git a/mcs/class/Microsoft.JScript/Microsoft.JScript/JScriptParser.cs b/mcs/class/Microsoft.JScript/Microsoft.JScript/JScriptParser.cs
index c80d4ba0ea9..38659ad431e 100644
--- a/mcs/class/Microsoft.JScript/Microsoft.JScript/JScriptParser.cs
+++ b/mcs/class/Microsoft.JScript/Microsoft.JScript/JScriptParser.cs
@@ -225,11 +225,8 @@ _loop4_breakloop: ;
if (0==inputState.guessing)
{
- if (stm != null) {
+ if (stm != null)
elems.Add (stm);
- Console.WriteLine ("DEBUG::src_elem::Add::{0}",
- stm.ToString ());
- }
}
break;
@@ -242,7 +239,6 @@ _loop4_breakloop: ;
if (stm != null)
elems.Add (stm);
- Console.WriteLine ("DEBUG:src_elem::Add (function)");
}
break;
@@ -366,7 +362,7 @@ _loop4_breakloop: ;
func = null;
bool is_func_exp = false;
- FormalParameterList p = null;
+ FormalParameterList p = new FormalParameterList ();
Block body = null;
@@ -400,7 +396,7 @@ _loop4_breakloop: ;
{
case IDENTIFIER:
{
- p=formal_param_list();
+ p=formal_param_list(parent);
break;
}
case CLOSE_PARENS:
@@ -461,7 +457,9 @@ _loop4_breakloop: ;
return func;
}
- public FormalParameterList formal_param_list() //throws RecognitionException, TokenStreamException
+ public FormalParameterList formal_param_list(
+ AST parent
+ ) //throws RecognitionException, TokenStreamException
{
FormalParameterList p;
@@ -471,6 +469,7 @@ _loop4_breakloop: ;
Token t2 = null;
p = new FormalParameterList ();
+ p.parent = parent;
i = LT(1);
@@ -1669,8 +1668,11 @@ _loop58_breakloop: ;
if (0==inputState.guessing)
{
- Binary a = new Binary (parent, left, right, op);
- Console.WriteLine ("\nDEBUG::jscript.g::assign_expr::ToString::" + a.ToString () + "\n");
+ Assign a;
+ if (right is Assign)
+ a = new Assign (parent, left, right, op, true);
+ else
+ a = new Assign (parent, left, right, op, false);
assign_expr = a;
}
@@ -3146,7 +3148,7 @@ _loop86_breakloop: ;
eq_expr = null;
AST left = null;
- Equality right = null;
+ AST right = null;
left=relational_expr(parent);
@@ -3157,23 +3159,23 @@ _loop86_breakloop: ;
if (right == null)
eq_expr = left;
else {
- eq_expr = new Equality (parent, left, right, right.old_op);
+ eq_expr = new Binary (parent, left, right, ((Binary) right).old_op);
}
}
return eq_expr;
}
- public Equality equality_aux(
+ public AST equality_aux(
AST parent
) //throws RecognitionException, TokenStreamException
{
- Equality eq_aux;
+ AST eq_aux;
eq_aux = null;
AST left = null;
- Equality right = null;
+ AST right = null;
JSToken op = JSToken.None;
@@ -3192,11 +3194,10 @@ _loop86_breakloop: ;
{
if (right == null)
- eq_aux = new Equality (parent, left, null, JSToken.None);
+ eq_aux = new Binary (parent, left, null, JSToken.None);
else
- eq_aux = new Equality (parent, left, right, right.old_op);
-
- eq_aux.old_op = op;
+ eq_aux = new Binary (parent, left, right, ((Binary) right).old_op);
+ ((Binary) eq_aux).old_op = op;
}
break;
diff --git a/mcs/class/Microsoft.JScript/Microsoft.JScript/Literal.cs b/mcs/class/Microsoft.JScript/Microsoft.JScript/Literal.cs
index 9375d33075e..2f9add3d5dd 100644
--- a/mcs/class/Microsoft.JScript/Microsoft.JScript/Literal.cs
+++ b/mcs/class/Microsoft.JScript/Microsoft.JScript/Literal.cs
@@ -25,7 +25,7 @@ namespace Microsoft.JScript {
}
}
- internal class BooleanLiteral : AST {
+ internal class BooleanLiteral : Exp {
internal bool val;
@@ -45,6 +45,12 @@ namespace Microsoft.JScript {
return true;
}
+ internal override bool Resolve (IdentificationTable context, bool no_effect)
+ {
+ this.no_effect = no_effect;
+ return true;
+ }
+
internal override void Emit (EmitContext ec)
{
ILGenerator ig;
@@ -60,10 +66,13 @@ namespace Microsoft.JScript {
ig.Emit (OpCodes.Ldc_I4_0);
ig.Emit (OpCodes.Box, typeof (System.Boolean));
+
+ if (no_effect)
+ ig.Emit (OpCodes.Pop);
}
}
- public class NumericLiteral : AST {
+ public class NumericLiteral : Exp {
double val;
@@ -83,17 +92,23 @@ namespace Microsoft.JScript {
return true;
}
+ internal override bool Resolve (IdentificationTable context, bool no_effect)
+ {
+ this.no_effect = no_effect;
+ return true;
+ }
+
internal override void Emit (EmitContext ec)
{
ILGenerator ig;
-
if (parent == null)
ig = ec.gc_ig;
else
ig = ec.ig;
-
ig.Emit (OpCodes.Ldc_I4, (int) val);
ig.Emit (OpCodes.Box, typeof (System.Int32));
+ if (no_effect)
+ ig.Emit (OpCodes.Pop);
}
}
}
diff --git a/mcs/class/Microsoft.JScript/Microsoft.JScript/NumericBinary.cs b/mcs/class/Microsoft.JScript/Microsoft.JScript/NumericBinary.cs
index 7fbac05eed7..48c59b265b5 100644
--- a/mcs/class/Microsoft.JScript/Microsoft.JScript/NumericBinary.cs
+++ b/mcs/class/Microsoft.JScript/Microsoft.JScript/NumericBinary.cs
@@ -14,14 +14,13 @@ namespace Microsoft.JScript {
public sealed class NumericBinary : BinaryOp {
public NumericBinary (int operatorTok)
- {
- throw new NotImplementedException ();
+ {
+ current_op = (JSToken) operatorTok;
}
-
public object EvaluateNumericBinary (object v1, object v2)
{
- throw new NotImplementedException ();
+ return new object ();
}
@@ -35,6 +34,12 @@ namespace Microsoft.JScript {
throw new NotImplementedException ();
}
+ internal override bool Resolve (IdentificationTable context, bool no_effect)
+ {
+ this.no_effect = no_effect;
+ return Resolve (context);
+ }
+
internal override void Emit (EmitContext ec)
{
throw new NotImplementedException ();
diff --git a/mcs/class/Microsoft.JScript/Microsoft.JScript/NumericUnary.cs b/mcs/class/Microsoft.JScript/Microsoft.JScript/NumericUnary.cs
index 4bbf721d41e..af7ce80f8c1 100644
--- a/mcs/class/Microsoft.JScript/Microsoft.JScript/NumericUnary.cs
+++ b/mcs/class/Microsoft.JScript/Microsoft.JScript/NumericUnary.cs
@@ -29,6 +29,11 @@ namespace Microsoft.JScript.Tmp {
throw new NotImplementedException ();
}
+ internal override bool Resolve (IdentificationTable context, bool no_effect)
+ {
+ throw new NotImplementedException ();
+ }
+
internal override void Emit (EmitContext ec)
{
throw new NotImplementedException ();
diff --git a/mcs/class/Microsoft.JScript/Microsoft.JScript/Plus.cs b/mcs/class/Microsoft.JScript/Microsoft.JScript/Plus.cs
index bce947c726e..b33c9f47b99 100644
--- a/mcs/class/Microsoft.JScript/Microsoft.JScript/Plus.cs
+++ b/mcs/class/Microsoft.JScript/Microsoft.JScript/Plus.cs
@@ -15,16 +15,13 @@ namespace Microsoft.JScript {
public Plus ()
{
- throw new NotImplementedException ();
}
-
public object EvaluatePlus (object v1, object v2)
{
- throw new NotImplementedException ();
+ return new object ();
}
-
public static object DoOp (object v1, object v2)
{
throw new NotImplementedException ();
@@ -35,6 +32,11 @@ namespace Microsoft.JScript {
throw new NotImplementedException ();
}
+ internal override bool Resolve (IdentificationTable context, bool no_effect)
+ {
+ throw new NotImplementedException ();
+ }
+
internal override void Emit (EmitContext ec)
{
throw new NotImplementedException ();
diff --git a/mcs/class/Microsoft.JScript/Microsoft.JScript/PostOrPrefixOperator.cs b/mcs/class/Microsoft.JScript/Microsoft.JScript/PostOrPrefixOperator.cs
index 23304e1f12f..0bd4b4846e8 100644
--- a/mcs/class/Microsoft.JScript/Microsoft.JScript/PostOrPrefixOperator.cs
+++ b/mcs/class/Microsoft.JScript/Microsoft.JScript/PostOrPrefixOperator.cs
@@ -29,6 +29,11 @@ namespace Microsoft.JScript.Tmp {
throw new NotImplementedException ();
}
+ internal override bool Resolve (IdentificationTable context, bool no_effect)
+ {
+ throw new NotImplementedException ();
+ }
+
internal override void Emit (EmitContext ec)
{
throw new NotImplementedException ();
diff --git a/mcs/class/Microsoft.JScript/Microsoft.JScript/ReferenceAttribute.cs b/mcs/class/Microsoft.JScript/Microsoft.JScript/ReferenceAttribute.cs
index 42800b82f7b..1ccf0994fb9 100644
--- a/mcs/class/Microsoft.JScript/Microsoft.JScript/ReferenceAttribute.cs
+++ b/mcs/class/Microsoft.JScript/Microsoft.JScript/ReferenceAttribute.cs
@@ -7,12 +7,12 @@
// (C) 2003, Cesar Lopez Nataren
//
-namespace Microsoft.JScript.Tmp
-{
- using System;
+using System;
+
+namespace Microsoft.JScript {
+
+ public class ReferenceAttribute : Attribute {
- public class ReferenceAttribute : Attribute
- {
public string reference;
public ReferenceAttribute (string reference)
@@ -20,4 +20,4 @@ namespace Microsoft.JScript.Tmp
throw new NotImplementedException ();
}
}
-} \ No newline at end of file
+}
diff --git a/mcs/class/Microsoft.JScript/Microsoft.JScript/Relational.cs b/mcs/class/Microsoft.JScript/Microsoft.JScript/Relational.cs
index 31f24adcd3f..1ec5aeaa1fa 100644
--- a/mcs/class/Microsoft.JScript/Microsoft.JScript/Relational.cs
+++ b/mcs/class/Microsoft.JScript/Microsoft.JScript/Relational.cs
@@ -9,6 +9,8 @@
using System;
using System.Text;
+using System.Reflection;
+using System.Reflection.Emit;
namespace Microsoft.JScript {
@@ -28,7 +30,7 @@ namespace Microsoft.JScript {
public double EvaluateRelational (object v1, object v2)
{
- throw new NotImplementedException ();
+ return -1;
}
@@ -63,9 +65,89 @@ namespace Microsoft.JScript {
return true;
}
+ internal override bool Resolve (IdentificationTable context, bool no_effect)
+ {
+ this.no_effect = no_effect;
+ return Resolve (context);
+ }
+
internal override void Emit (EmitContext ec)
{
- throw new NotImplementedException ();
+ if (current_op == JSToken.None && right == null) {
+ left.Emit (ec);
+ return;
+ }
+
+ ILGenerator ig;
+ LocalBuilder loc;
+ Type t = typeof (Relational);
+ ConstructorInfo ctr_info;
+
+ if (parent == null)
+ ig = ec.gc_ig;
+ else
+ ig = ec.ig;
+
+ loc = ig.DeclareLocal (t);
+
+ switch (current_op) {
+ case JSToken.GreaterThan:
+ ig.Emit (OpCodes.Ldc_I4_S, (byte) 57);
+ break;
+ case JSToken.LessThan:
+ ig.Emit (OpCodes.Ldc_I4_S, (byte) 58);
+ break;
+ case JSToken.LessThanEqual:
+ ig.Emit (OpCodes.Ldc_I4_S, (byte) 59);
+ break;
+ case JSToken.GreaterThanEqual:
+ ig.Emit (OpCodes.Ldc_I4_S, (byte) 60);
+ break;
+ }
+
+ ctr_info = typeof (Relational).GetConstructor (new Type [] { typeof (Int32) });
+ ig.Emit (OpCodes.Newobj, ctr_info);
+ ig.Emit (OpCodes.Stloc, loc);
+ ig.Emit (OpCodes.Ldloc, loc);
+
+ if (left != null)
+ left.Emit (ec);
+ if (right != null)
+ right.Emit (ec);
+
+ 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 (current_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 (Boolean));
}
}
}
diff --git a/mcs/class/Microsoft.JScript/Microsoft.JScript/ScriptBlock.cs b/mcs/class/Microsoft.JScript/Microsoft.JScript/ScriptBlock.cs
index 033f3fabdea..4d083387b83 100644
--- a/mcs/class/Microsoft.JScript/Microsoft.JScript/ScriptBlock.cs
+++ b/mcs/class/Microsoft.JScript/Microsoft.JScript/ScriptBlock.cs
@@ -34,7 +34,6 @@ namespace Microsoft.JScript {
internal override bool Resolve (IdentificationTable context)
{
- System.Console.WriteLine ("ScriptBlock::Resolve");
return src_elems.Resolve (context);
}
}
diff --git a/mcs/class/Microsoft.JScript/Microsoft.JScript/StrictEquality.cs b/mcs/class/Microsoft.JScript/Microsoft.JScript/StrictEquality.cs
index c7c01116cb7..b4b3b9d11c4 100644
--- a/mcs/class/Microsoft.JScript/Microsoft.JScript/StrictEquality.cs
+++ b/mcs/class/Microsoft.JScript/Microsoft.JScript/StrictEquality.cs
@@ -22,6 +22,12 @@ namespace Microsoft.JScript.Tmp {
{
throw new NotImplementedException ();
}
+
+ internal override bool Resolve (IdentificationTable context, bool no_effect)
+ {
+ this.no_effect = no_effect;
+ return Resolve (context);
+ }
internal override void Emit (EmitContext ec)
{
diff --git a/mcs/class/Microsoft.JScript/Microsoft.JScript/SymbolTable.cs b/mcs/class/Microsoft.JScript/Microsoft.JScript/SymbolTable.cs
index 37d09c102ef..8f5564d6da3 100644
--- a/mcs/class/Microsoft.JScript/Microsoft.JScript/SymbolTable.cs
+++ b/mcs/class/Microsoft.JScript/Microsoft.JScript/SymbolTable.cs
@@ -44,5 +44,22 @@ namespace Microsoft.JScript {
return sb.ToString ();
}
+
+ internal int size {
+ get { return symbols.Count; }
+ }
+
+ internal DictionaryEntry [] current_symbols {
+ get {
+ int n = symbols.Count;
+ if (n == 0)
+ return null;
+ else {
+ DictionaryEntry [] e = new DictionaryEntry [symbols.Count];
+ symbols.CopyTo (e, 0);
+ return e;
+ }
+ }
+ }
}
}
diff --git a/mcs/class/Microsoft.JScript/Microsoft.JScript/TODO b/mcs/class/Microsoft.JScript/Microsoft.JScript/TODO
index 1d3cf85dbb3..593474c9d18 100644
--- a/mcs/class/Microsoft.JScript/Microsoft.JScript/TODO
+++ b/mcs/class/Microsoft.JScript/Microsoft.JScript/TODO
@@ -18,6 +18,11 @@ a list of things where you can start helping with:
2) Runtime support.
+- URGENT: Implement the classes: Plus (focus on EvaluatePlus method),
+ Equality (focus on EvaluateEquality method), Relational (focus on
+ EvaluateRelational method), NumericBinary (focus on
+ EvaluateNumericBinary), NumericUnary (focus on EvaluateUnary).
+
- The building block for this is the VsaEngine, and of particular
interest are the classes:
diff --git a/mcs/class/Microsoft.JScript/Microsoft.JScript/TypeOf.cs b/mcs/class/Microsoft.JScript/Microsoft.JScript/TypeOf.cs
index e49c29c777a..8e7418c029b 100644
--- a/mcs/class/Microsoft.JScript/Microsoft.JScript/TypeOf.cs
+++ b/mcs/class/Microsoft.JScript/Microsoft.JScript/TypeOf.cs
@@ -23,6 +23,12 @@ namespace Microsoft.JScript.Tmp {
throw new NotImplementedException ();
}
+ internal override bool Resolve (IdentificationTable context, bool no_effect)
+ {
+ this.no_effect = no_effect;
+ return Resolve (context);
+ }
+
internal override void Emit (EmitContext ec)
{
throw new NotImplementedException ();
diff --git a/mcs/class/Microsoft.JScript/Microsoft.JScript/UnaryOp.cs b/mcs/class/Microsoft.JScript/Microsoft.JScript/UnaryOp.cs
index b29609ebcfb..6e55acad30c 100644
--- a/mcs/class/Microsoft.JScript/Microsoft.JScript/UnaryOp.cs
+++ b/mcs/class/Microsoft.JScript/Microsoft.JScript/UnaryOp.cs
@@ -9,9 +9,9 @@
namespace Microsoft.JScript {
- public abstract class UnaryOp : AST {
+ public abstract class UnaryOp : Exp {
internal AST operand;
internal JSToken oper;
}
-} \ No newline at end of file
+}
diff --git a/mcs/class/Microsoft.JScript/Microsoft.JScript/VariableDeclaration.cs b/mcs/class/Microsoft.JScript/Microsoft.JScript/VariableDeclaration.cs
index 457f00dee0e..bbe47380d93 100644
--- a/mcs/class/Microsoft.JScript/Microsoft.JScript/VariableDeclaration.cs
+++ b/mcs/class/Microsoft.JScript/Microsoft.JScript/VariableDeclaration.cs
@@ -61,7 +61,7 @@ namespace Microsoft.JScript {
FieldBuilder field;
TypeBuilder type = ec.type_builder;
- field = type.DefineField (id, type,
+ field = type.DefineField (id, this.type,
FieldAttributes.Public |
FieldAttributes.Static);
@@ -84,9 +84,14 @@ namespace Microsoft.JScript {
internal override bool Resolve (IdentificationTable context)
{
+ bool r = true;
+ if (val != null)
+ if (val is Exp)
+ r = ((Exp) val).Resolve (context, false);
+ else
+ r = val.Resolve (context);
context.Enter (id, this);
- Console.WriteLine ("VariableDeclaration::Resolve");
- return true;
+ return r;
}
}
}
diff --git a/mcs/class/Microsoft.JScript/Microsoft.JScript/VariableStatement.cs b/mcs/class/Microsoft.JScript/Microsoft.JScript/VariableStatement.cs
index 342fe53e3c7..dce6ebf8526 100644
--- a/mcs/class/Microsoft.JScript/Microsoft.JScript/VariableStatement.cs
+++ b/mcs/class/Microsoft.JScript/Microsoft.JScript/VariableStatement.cs
@@ -50,21 +50,14 @@ namespace Microsoft.JScript {
internal override bool Resolve (IdentificationTable context)
{
VariableDeclaration tmp_decl;
- int i, size = var_decls.Count;
- bool res = true;
- AST init_val;
+ int i, n = var_decls.Count;
+ bool r = true;
- for (i = 0; i < size; i++) {
+ for (i = 0; i < n; i++) {
tmp_decl = (VariableDeclaration) var_decls [i];
- init_val = tmp_decl.val;
-
- if (init_val != null)
- res = init_val.Resolve (context);
-
- if (res)
- context.Enter (tmp_decl.id, tmp_decl);
+ r &= tmp_decl.Resolve (context);
}
- return true;
+ return r;
}
}
}
diff --git a/mcs/class/Microsoft.JScript/Microsoft.JScript/VsaCodeItem.cs b/mcs/class/Microsoft.JScript/Microsoft.JScript/VsaCodeItem.cs
index c66dbb3b7a6..c654448621b 100755
--- a/mcs/class/Microsoft.JScript/Microsoft.JScript/VsaCodeItem.cs
+++ b/mcs/class/Microsoft.JScript/Microsoft.JScript/VsaCodeItem.cs
@@ -19,11 +19,8 @@ namespace Microsoft.JScript {
private string sourceText;
internal VsaCodeItem (VsaEngine engine, string name, VsaItemFlag flag)
+ : base (engine, name, VsaItemType.Code, flag)
{
- this.engine = engine;
- this.itemType = VsaItemType.Code;
- this.itemFlag = flag;
- this.name = name;
this.dirty = true;
}
diff --git a/mcs/class/Microsoft.JScript/Microsoft.JScript/VsaGlobalItem.cs b/mcs/class/Microsoft.JScript/Microsoft.JScript/VsaGlobalItem.cs
index 428d66cf4b5..0b690130ee0 100755
--- a/mcs/class/Microsoft.JScript/Microsoft.JScript/VsaGlobalItem.cs
+++ b/mcs/class/Microsoft.JScript/Microsoft.JScript/VsaGlobalItem.cs
@@ -16,15 +16,11 @@ namespace Microsoft.JScript {
internal class VsaGlobalItem : VsaItem, IVsaGlobalItem {
internal VsaGlobalItem (VsaEngine engine, string name, VsaItemFlag flag)
+ : base (engine, name, VsaItemType.AppGlobal, flag)
{
- this.engine = engine;
- this.name = name;
- this.itemType = VsaItemType.AppGlobal;
- this.itemFlag = flag;
this.dirty = true;
}
-
//
// Still not implemented on .Net 1.1
//
@@ -42,7 +38,7 @@ namespace Microsoft.JScript {
else if (engine.Busy)
throw new VsaException (VsaError.EngineBusy);
- return System.Enum.GetName (typeof (VsaItemType), itemType);
+ return System.Enum.GetName (typeof (VsaItemType), type);
}
set {
@@ -53,9 +49,8 @@ namespace Microsoft.JScript {
else if (engine.Busy)
throw new VsaException (VsaError.EngineBusy);
- itemType = (VsaItemType) System.Enum.Parse (typeof (VsaItemType),
- value);
+ type = (VsaItemType) System.Enum.Parse (typeof (VsaItemType), value);
}
}
}
-} \ No newline at end of file
+}
diff --git a/mcs/class/Microsoft.JScript/Microsoft.JScript/VsaItem.cs b/mcs/class/Microsoft.JScript/Microsoft.JScript/VsaItem.cs
index d70244b8d06..4e279b8ad9a 100755
--- a/mcs/class/Microsoft.JScript/Microsoft.JScript/VsaItem.cs
+++ b/mcs/class/Microsoft.JScript/Microsoft.JScript/VsaItem.cs
@@ -16,11 +16,19 @@ namespace Microsoft.JScript {
public abstract class VsaItem : IVsaItem {
protected bool dirty;
- protected VsaItemType itemType;
- protected VsaItemFlag itemFlag;
+ protected VsaItemType type;
+ protected VsaItemFlag flag;
protected string name;
protected VsaEngine engine;
-
+
+ internal VsaItem (VsaEngine engine, string name, VsaItemType type, VsaItemFlag flag)
+ {
+ this.engine = engine;
+ this.name = name;
+ this.type = type;
+ this.flag = flag;
+ }
+
public virtual bool IsDirty {
get {
if (engine.Closed)
@@ -60,7 +68,7 @@ namespace Microsoft.JScript {
get {
if (engine.Closed)
throw new VsaException (VsaError.EngineClosed);
- else return itemType;
+ else return type;
}
}
diff --git a/mcs/class/Microsoft.JScript/Microsoft.JScript/VsaReferenceItem.cs b/mcs/class/Microsoft.JScript/Microsoft.JScript/VsaReferenceItem.cs
index 67f1777d167..a6ab91ad9f1 100755
--- a/mcs/class/Microsoft.JScript/Microsoft.JScript/VsaReferenceItem.cs
+++ b/mcs/class/Microsoft.JScript/Microsoft.JScript/VsaReferenceItem.cs
@@ -15,14 +15,11 @@ namespace Microsoft.JScript {
internal class VsaReferenceItem : VsaItem, IVsaReferenceItem {
- private string assemblyName;
+ private string assembly_name;
internal VsaReferenceItem (VsaEngine engine, string name, VsaItemFlag flag)
+ : base (engine, name, VsaItemType.Reference, flag)
{
- this.engine = engine;
- this.name = name;
- this.itemType = VsaItemType.Reference;
- this.itemFlag = flag;
this.dirty = true;
}
@@ -35,10 +32,10 @@ namespace Microsoft.JScript {
else if (engine.Busy)
throw new VsaException (VsaError.EngineBusy);
- throw new NotImplementedException ();
+ return assembly_name;
}
- set { throw new NotImplementedException (); }
+ set { assembly_name = value; }
}
}
}
diff --git a/mcs/class/Microsoft.JScript/Microsoft.JScript/VsaScriptScope.cs b/mcs/class/Microsoft.JScript/Microsoft.JScript/VsaScriptScope.cs
new file mode 100644
index 00000000000..3c3dde7f9d1
--- /dev/null
+++ b/mcs/class/Microsoft.JScript/Microsoft.JScript/VsaScriptScope.cs
@@ -0,0 +1,86 @@
+//
+// VsaScriptScope.cs:
+//
+// Author:
+// Cesar Lopez Nataren (cesar@ciencias.unam.mx)
+//
+// (C) 2003, Cesar Lopez Nataren
+//
+
+using System;
+using System.Collections;
+using Microsoft.Vsa;
+using Microsoft.JScript.Vsa;
+
+namespace Microsoft.JScript {
+
+ internal class VsaScriptScope : VsaItem, IVsaScriptScope {
+
+ internal VsaScriptScope parent;
+ internal ArrayList items;
+ internal GlobalScope scope;
+
+ internal VsaScriptScope (VsaEngine engine, string item_name, VsaScriptScope parent)
+ : base (engine, item_name, (VsaItemType) 0, VsaItemFlag.None)
+ {
+ this.parent = parent;
+ items = new ArrayList (8);
+ }
+
+ public IVsaScriptScope Parent {
+ get { return (IVsaScriptScope) parent; }
+ }
+
+ public IVsaItem AddItem (string item_name, VsaItemType type)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public IVsaItem GetItem (string item_name)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public void RemoveItem (string item_name)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public void RemoveItem (IVsaItem item)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public int GetItemCount ()
+ {
+ return items.Count;
+ }
+
+ public IVsaItem GetItemAtIndex (int index)
+ {
+ return (IVsaItem) items [index];
+ }
+
+ public void RemoveItemAtIndex (int index)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public object GetObject ()
+ {
+ if (scope == null)
+ if (parent == null) {
+ scope = new GlobalScope (null, engine);
+ } else {
+ scope = new GlobalScope ((GlobalScope) parent.GetObject (),
+ engine, false);
+ }
+ return scope;
+ }
+
+ public IVsaItem CreateDynamicItem (string item_name, VsaItemType type)
+ {
+ throw new NotImplementedException ();
+ }
+ }
+}
diff --git a/mcs/class/Microsoft.JScript/Microsoft.JScript/driver.cs b/mcs/class/Microsoft.JScript/Microsoft.JScript/driver.cs
index 031263be2be..ad931a95ae4 100644
--- a/mcs/class/Microsoft.JScript/Microsoft.JScript/driver.cs
+++ b/mcs/class/Microsoft.JScript/Microsoft.JScript/driver.cs
@@ -23,13 +23,10 @@ namespace Microsoft.JScript {
string filename = args [0];
Context ctx = new Context (filename);
JSParser parser = new JSParser (ctx);
-
ScriptBlock prog_tree = parser.Parse ();
- Console.WriteLine (prog_tree.ToString ());
-
SemanticAnalyser.Run (prog_tree);
-
CodeGenerator.Run (args [0], prog_tree);
+ Console.WriteLine ("Compilation succeeded.");
}
}
}
diff --git a/mcs/class/Microsoft.JScript/Microsoft.JScript/expression.cs b/mcs/class/Microsoft.JScript/Microsoft.JScript/expression.cs
index 9be5fdc3c2d..77b8c32f9b9 100755
--- a/mcs/class/Microsoft.JScript/Microsoft.JScript/expression.cs
+++ b/mcs/class/Microsoft.JScript/Microsoft.JScript/expression.cs
@@ -14,6 +14,11 @@ using System.Reflection.Emit;
namespace Microsoft.JScript {
+ public abstract class Exp : AST {
+ internal bool no_effect;
+ internal abstract bool Resolve (IdentificationTable context, bool no_effect);
+ }
+
public class Unary : UnaryOp {
internal Unary (AST parent, AST operand, JSToken oper)
@@ -38,10 +43,18 @@ namespace Microsoft.JScript {
internal override bool Resolve (IdentificationTable context)
{
- if (operand != null)
- operand.Resolve (context);
+ bool r = false;
+ if (operand is Exp)
+ if (oper != JSToken.Increment && oper != JSToken.Decrement)
+ r = ((Exp) operand).Resolve (context, no_effect);
+ r = ((AST) operand).Resolve (context);
+ return r;
+ }
- return true;
+ internal override bool Resolve (IdentificationTable context, bool no_effect)
+ {
+ this.no_effect = no_effect;
+ return Resolve (context);
}
internal override void Emit (EmitContext ec)
@@ -55,7 +68,6 @@ namespace Microsoft.JScript {
internal Binary (AST parent, AST left, AST right, JSToken op)
{
- Console.WriteLine ("DEBUG::expression.cs::Binary constructor called");
this.parent = parent;
this.left = left;
this.right = right;
@@ -79,43 +91,117 @@ namespace Microsoft.JScript {
internal override bool Resolve (IdentificationTable context)
{
+ bool r = true;
if (left != null)
- left.Resolve (context);
-
+ r &= left.Resolve (context);
if (right != null)
- right.Resolve (context);
+ r &= right.Resolve (context);
+ return r;
+ }
- return true;
+ internal override bool Resolve (IdentificationTable context, bool no_effect)
+ {
+ this.no_effect = no_effect;
+ return Resolve (context);
}
internal override void Emit (EmitContext ec)
{
ILGenerator ig;
-
if (parent == null)
ig = ec.gc_ig;
else
ig = ec.ig;
+ if (current_op != JSToken.None)
+ emit_operator (ig);
+ if (left != null)
+ left.Emit (ec);
+ if (right != null)
+ right.Emit (ec);
+ emit_op_eval (ig);
+ if (no_effect)
+ ig.Emit (OpCodes.Pop);
+ }
- emit_operator (ig);
+ internal void emit_op_eval (ILGenerator ig)
+ {
+ switch (current_op) {
+ case JSToken.Plus:
+ ig.Emit (OpCodes.Callvirt, typeof (Plus).GetMethod ("EvaluatePlus"));
+ break;
+ case JSToken.Minus:
+ case JSToken.Divide:
+ case JSToken.Modulo:
+ case JSToken.Multiply:
+ ig.Emit (OpCodes.Call, typeof (NumericBinary).GetMethod ("EvaluateNumericBinary"));
+ break;
+ case JSToken.Equal:
+ ig.Emit (OpCodes.Call, typeof (Equality).GetMethod ("EvaluateEquality"));
+ Label t = ig.DefineLabel ();
+ Label f = ig.DefineLabel ();
+ ig.Emit (OpCodes.Brtrue_S, t);
+ ig.Emit (OpCodes.Ldc_I4_0);
+ ig.Emit (OpCodes.Br_S, f);
+ ig.MarkLabel (t);
+ ig.Emit (OpCodes.Ldc_I4_1);
+ ig.MarkLabel (f);
+ ig.Emit (OpCodes.Pop);
+ break;
+ }
}
internal void emit_operator (ILGenerator ig)
{
- if (current_op == JSToken.Plus)
- ig.DeclareLocal (typeof (Microsoft.JScript.Plus));
- else if (current_op == JSToken.Minus || current_op == JSToken.Divide ||
- current_op == JSToken.Modulo)
- ig.DeclareLocal (typeof (Microsoft.JScript.NumericBinary));
- else if (current_op == JSToken.BitwiseOr || current_op == JSToken.BitwiseXor ||
- current_op == JSToken.BitwiseAnd)
- ig.DeclareLocal (typeof (Microsoft.JScript.BitwiseBinary));
- else if (current_op == JSToken.Equal || current_op == JSToken.NotEqual)
- ig.DeclareLocal (typeof (Microsoft.JScript.Equality));
+ LocalBuilder local_builder = null;
+ Type t = null;
+
+ if (current_op == JSToken.Plus) {
+ t = typeof (Plus);
+ local_builder = ig.DeclareLocal (t);
+ ig.Emit (OpCodes.Newobj, t.GetConstructor (new Type [] {}));
+ ig.Emit (OpCodes.Stloc, local_builder);
+ ig.Emit (OpCodes.Ldloc, local_builder);
+ return;
+ } else if (current_op == JSToken.Minus) {
+ t = typeof (NumericBinary);
+ local_builder = ig.DeclareLocal (t);
+ ig.Emit (OpCodes.Ldc_I4_S, (byte) 47);
+ } else if (current_op == JSToken.Multiply) {
+ t = typeof (NumericBinary);
+ local_builder = ig.DeclareLocal (t);
+ ig.Emit (OpCodes.Ldc_I4_S, (byte) 64);
+ } else if (current_op == JSToken.Divide) {
+ t = typeof (NumericBinary);
+ local_builder = ig.DeclareLocal (t);
+ ig.Emit (OpCodes.Ldc_I4_S, (byte) 65);
+ } else if (current_op == JSToken.BitwiseOr) {
+ t = typeof (BitwiseBinary);
+ local_builder = ig.DeclareLocal (t);
+ ig.Emit (OpCodes.Ldc_I4_S, (byte) 50);
+ } else if (current_op == JSToken.BitwiseXor) {
+ t = typeof (BitwiseBinary);
+ local_builder = ig.DeclareLocal (t);
+ ig.Emit (OpCodes.Ldc_I4_S, (byte) 51);
+ } else if (current_op == JSToken.BitwiseAnd) {
+ t = typeof (BitwiseBinary);
+ local_builder = ig.DeclareLocal (t);
+ ig.Emit (OpCodes.Ldc_I4_S, (byte) 52);
+ } else if (current_op == JSToken.Equal) {
+ t = typeof (Equality);
+ local_builder = ig.DeclareLocal (t);
+ ig.Emit (OpCodes.Ldc_I4_S, (byte) 53);
+ } else if (current_op == JSToken.NotEqual) {
+ t = typeof (Equality);
+ local_builder = ig.DeclareLocal (t);
+ ig.Emit (OpCodes.Ldc_I4_S, (byte) 54);
+ }
+ ig.Emit (OpCodes.Newobj, t.GetConstructor (new Type [] {typeof (int)}));
+ ig.Emit (OpCodes.Stloc, local_builder);
+ ig.Emit (OpCodes.Ldloc, local_builder);
}
}
- public class Conditional : AST {
+ public class Conditional : Exp {
AST cond_expr, trueExpr, falseExpr;
@@ -144,6 +230,12 @@ namespace Microsoft.JScript {
{
throw new NotImplementedException ();
}
+
+ internal override bool Resolve (IdentificationTable context, bool no_effect)
+ {
+ this.no_effect = no_effect;
+ return true;
+ }
internal override void Emit (EmitContext ec)
{
@@ -199,10 +291,11 @@ namespace Microsoft.JScript {
}
}
- internal class Identifier : AST {
+ internal class Identifier : Exp, IAssignable {
internal string name;
internal Decl binding;
+ internal bool assign;
internal Identifier (AST parent, string id)
{
@@ -226,23 +319,49 @@ namespace Microsoft.JScript {
throw new Exception ("variable not found: " + name);
else
binding = bind;
+
+ return true;
+ }
+
+ internal override bool Resolve (IdentificationTable context, bool no_effect)
+ {
+ this.no_effect = no_effect;
+ return Resolve (context);
+ }
+
+ public bool ResolveAssign (IdentificationTable context)
+ {
+ this.assign = true;
+ this.no_effect = false;
+ if (name != String.Empty)
+ return Resolve (context);
return true;
}
internal override void Emit (EmitContext ec)
{
ILGenerator ig;
-
if (parent == null) {
ig = ec.gc_ig;
- ig.Emit (OpCodes.Ldsfld, binding.field_info);
+ if (assign)
+ ig.Emit (OpCodes.Stsfld, binding.field_info);
+ else {
+ ig.Emit (OpCodes.Ldsfld, binding.field_info);
+ if (no_effect)
+ ig.Emit (OpCodes.Pop);
+ }
} else {
- ig = ec.ig;
- ig.Emit (OpCodes.Ldloc, binding.local_builder);
+ ig = ec.ig;
+ if (assign)
+ ig.Emit (OpCodes.Stloc, binding.local_builder);
+ else {
+ ig.Emit (OpCodes.Ldloc, binding.local_builder);
+ if (no_effect)
+ ig.Emit (OpCodes.Pop);
+ }
}
- ig.Emit (OpCodes.Pop);
}
- }
+ }
public class Args : AST {
@@ -308,12 +427,21 @@ namespace Microsoft.JScript {
internal override bool Resolve (IdentificationTable context)
{
- int i, size = exprs.Count;
-
- for (i = 0; i < size; i++)
- ((AST) exprs [i]).Resolve (context);
+ int i, n = exprs.Count;
+ object e;
+ bool r = true;
- return true;
+ for (i = 0; i < n; i++) {
+ e = exprs [i];
+ if (e is Exp)
+ if (e is Assign)
+ r &= ((Assign) e).Resolve (context);
+ else
+ r &= ((Exp) e).Resolve (context, true);
+ else
+ r &= ((AST) e).Resolve (context);
+ }
+ return r;
}
internal override void Emit (EmitContext ec)
@@ -321,12 +449,68 @@ namespace Microsoft.JScript {
int i, n = exprs.Count;
AST exp;
- Console.WriteLine ("n = {0}", n);
-
for (i = 0; i < n; i++) {
exp = (AST) exprs [i];
exp.Emit (ec);
}
}
}
+
+ internal class Assign : BinaryOp {
+
+ internal bool is_embedded;
+
+ internal Assign (AST parent, AST left, AST right, JSToken op, bool is_embedded)
+ {
+ this.parent = parent;
+ this.left = left;
+ this.right = right;
+ this.is_embedded = is_embedded;
+ current_op = op;
+ }
+
+ internal override bool Resolve (IdentificationTable context)
+ {
+ bool r;
+ if (left is IAssignable)
+ r = ((IAssignable) left).ResolveAssign (context);
+ else
+ return false;
+ if (right is Exp)
+ r &=((Exp) right).Resolve (context, false);
+ return r;
+ }
+
+ internal override bool Resolve (IdentificationTable context, bool no_effect)
+ {
+ return true;
+ }
+
+ internal override void Emit (EmitContext ec)
+ {
+ ILGenerator ig;
+ if (parent == null)
+ ig = ec.gc_ig;
+ else
+ ig = ec.ig;
+ if (is_embedded) {
+ Console.WriteLine ("embedded assignments not supported yet");
+ Environment.Exit (-1);
+ } else {
+ right.Emit (ec);
+ left.Emit (ec);
+ }
+ }
+
+ public override string ToString ()
+ {
+ string l = left.ToString ();
+ string r = right.ToString ();
+ return l + " " + r;
+ }
+ }
+
+ internal interface IAssignable {
+ bool ResolveAssign (IdentificationTable context);
+ }
}
diff --git a/mcs/class/Microsoft.JScript/Microsoft.JScript/jscript-lexer-parser.g b/mcs/class/Microsoft.JScript/Microsoft.JScript/jscript-lexer-parser.g
index 8c93bd01a2e..fac4833d1ea 100644
--- a/mcs/class/Microsoft.JScript/Microsoft.JScript/jscript-lexer-parser.g
+++ b/mcs/class/Microsoft.JScript/Microsoft.JScript/jscript-lexer-parser.g
@@ -34,17 +34,13 @@ source_element [Block elems, AST parent]
{ AST stm = null; }
: stm = statement [parent]
{
- if (stm != null) {
+ if (stm != null)
elems.Add (stm);
- Console.WriteLine ("DEBUG::src_elem::Add::{0}",
- stm.ToString ());
- }
}
| stm = function_decl_or_expr [parent]
{
if (stm != null)
elems.Add (stm);
- Console.WriteLine ("DEBUG:src_elem::Add (function)");
}
;
@@ -52,11 +48,11 @@ function_decl_or_expr [AST parent] returns [AST func]
{
func = null;
bool is_func_exp = false;
- FormalParameterList p = null;
+ FormalParameterList p = new FormalParameterList ();
Block body = null;
}
: "function" (id:IDENTIFIER | { is_func_exp = true; } )
- OPEN_PARENS (p = formal_param_list | ) CLOSE_PARENS
+ OPEN_PARENS (p = formal_param_list [parent] | ) CLOSE_PARENS
(COLON type_annot:IDENTIFIER | )
{
if (is_func_exp)
@@ -85,9 +81,10 @@ function_body [AST parent] returns [Block elems]
: source_elements [elems]
;
-formal_param_list returns [FormalParameterList p]
+formal_param_list [AST parent] returns [FormalParameterList p]
{
p = new FormalParameterList ();
+ p.parent = parent;
}
: i:IDENTIFIER (COLON t1:IDENTIFIER { p.Add (i.getText (), t1.getText ()); }
| { p.Add (i.getText (), "Object"); }
@@ -312,11 +309,13 @@ assignment_expr [AST parent] returns [AST assign_expr]
: ((left_hand_side_expr [parent] assignment_op)=>
left = left_hand_side_expr [parent] op = assignment_op right = assignment_expr [parent]
{
- Binary a = new Binary (parent, left, right, op);
- Console.WriteLine ("\nDEBUG::jscript.g::assign_expr::ToString::" + a.ToString () + "\n");
+ Assign a;
+ if (right is Assign)
+ a = new Assign (parent, left, right, op, true);
+ else
+ a = new Assign (parent, left, right, op, false);
assign_expr = a;
- }
-
+ }
| assign_expr = cond_expr [parent]
)
;
@@ -597,33 +596,32 @@ equality_expr [AST parent] returns [AST eq_expr]
{
eq_expr = null;
AST left = null;
- Equality right = null;
+ AST right = null;
}
: left = relational_expr [parent] right = equality_aux [parent]
{
if (right == null)
eq_expr = left;
else {
- eq_expr = new Equality (parent, left, right, right.old_op);
+ eq_expr = new Binary (parent, left, right, ((Binary) right).old_op);
}
}
;
-equality_aux [AST parent] returns [Equality eq_aux]
+equality_aux [AST parent] returns [AST eq_aux]
{
eq_aux = null;
AST left = null;
- Equality right = null;
+ AST right = null;
JSToken op = JSToken.None;
}
: (op = equality_op left = relational_expr [parent] right = equality_aux [parent]
{
if (right == null)
- eq_aux = new Equality (parent, left, null, JSToken.None);
+ eq_aux = new Binary (parent, left, null, JSToken.None);
else
- eq_aux = new Equality (parent, left, right, right.old_op);
-
- eq_aux.old_op = op;
+ eq_aux = new Binary (parent, left, right, ((Binary) right).old_op);
+ ((Binary) eq_aux).old_op = op;
}
| )
;
diff --git a/mcs/class/Microsoft.JScript/Microsoft.Vsa/BaseVsaEngine.cs b/mcs/class/Microsoft.JScript/Microsoft.Vsa/BaseVsaEngine.cs
index 952d84239dd..0e5040ef9f5 100755
--- a/mcs/class/Microsoft.JScript/Microsoft.Vsa/BaseVsaEngine.cs
+++ b/mcs/class/Microsoft.JScript/Microsoft.Vsa/BaseVsaEngine.cs
@@ -31,7 +31,7 @@ namespace Microsoft.Vsa {
private bool namespaceNotSet;
private bool supportDebug;
private bool generateDebugInfo;
- private bool compiled;
+ protected bool compiled;
private bool dirty;
private bool initNewCalled;
@@ -576,6 +576,7 @@ namespace Microsoft.Vsa {
internal bool InitNewCalled {
get { return initNewCalled; }
+ set { initNewCalled = value; }
}
}
diff --git a/mcs/class/Microsoft.JScript/Microsoft.Vsa/ChangeLog b/mcs/class/Microsoft.JScript/Microsoft.Vsa/ChangeLog
index ddc5fdbf299..ad3a77f36dc 100755
--- a/mcs/class/Microsoft.JScript/Microsoft.Vsa/ChangeLog
+++ b/mcs/class/Microsoft.JScript/Microsoft.Vsa/ChangeLog
@@ -1,3 +1,7 @@
+2004-01-16 Cesar Lopez Nataren <cesar@ciencias.unam.mx>
+
+ * Microsoft.Vsa/BaseVsaEngine.cs: added setter for InitNewCalled.
+
2003-09-29 <cesar@ciencias.unam.mx>
* BaseVsaEngine.cs: added default constructor, added exceptions
diff --git a/mcs/class/Microsoft.VisualBasic/.cvsignore b/mcs/class/Microsoft.VisualBasic/.cvsignore
index 0c2ee6906fa..0e201cdb355 100644
--- a/mcs/class/Microsoft.VisualBasic/.cvsignore
+++ b/mcs/class/Microsoft.VisualBasic/.cvsignore
@@ -1,3 +1,5 @@
+Microsoft.VisualBasic_test.dll
+Microsoft.VisualBasic_test.pdb
list
.makefrag
.response
diff --git a/mcs/class/Microsoft.VisualBasic/Changelog b/mcs/class/Microsoft.VisualBasic/Changelog
index 8950e1b1348..634671201d3 100644
--- a/mcs/class/Microsoft.VisualBasic/Changelog
+++ b/mcs/class/Microsoft.VisualBasic/Changelog
@@ -1,11 +1,7 @@
-2003-12-02 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
- * Microsoft.VisualBasic: Strings.cs
- Simplified Asc(string) by using Asc(char)
- Simplified AscW(string) by using AscW(char)
- Simplified StrReverse
+2004-01-21 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
+ * Microsoft.VisualBasic_test.dll.sources: Added new test files
2003-11-13 Andreas Nahr <ClassDevelopment@A-SoftTech.com>
-
* Microsoft.VisualBasic.dll.sources: Added Assembly files
2003-03-12 Martin Willemoes Hansen <mwh@sysrq.dk>
@@ -17,13 +13,10 @@
Added files to allow build on linux.
2002-05-12 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
-
* Microsoft.VisualBasic: Strings.cs - Merged all method implementations provided
by Martin Adoue, with method signatures (specially attributes) provided
by Chris J. Breisch. Some tweaking for the Mid member (two overloads versus third optional parameter).
-
-
2002-05-18 Chris J Breisch <cjbreisch@altavista.net>
* Microsoft.VisualBasic: *.cs/Test/*.cs - Cleaned up code, added
diff --git a/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/.cvsignore b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/.cvsignore
new file mode 100644
index 00000000000..85959c190a6
--- /dev/null
+++ b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/.cvsignore
@@ -0,0 +1,3 @@
+pending
+*.diff
+*~
diff --git a/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/ChangeLog b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/ChangeLog
index 93871e7c0bc..eff6c674af7 100644
--- a/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/ChangeLog
+++ b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/ChangeLog
@@ -1,8 +1,30 @@
+2004-01-21 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
+ * FileSystem.cs:
+ Implemented Dir() now throws the right exception
+
+2004-01-21 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
+ * Information.cs:
+ Implemented IsNothing(object)
+
+2004-01-21 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
+ * FileSystem.cs:
+ Started implementing Dir function
+
+2004-01-06 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
+ * Information.cs:
+ Implemented IsNumeric(object)
+
2003-12-29 Jochen Wezel <jwezel@compumaster.de>
* Strings.cs:
Fixed bug in Len(Decimal)
+2003-12-02 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
+ * Microsoft.VisualBasic: Strings.cs
+ Simplified Asc(string) by using Asc(char)
+ Simplified AscW(string) by using AscW(char)
+ Simplified StrReverse
+
2002-08-15 Tim Coleman <tim@timcoleman.com>
* ChangeLog:
Added a ChangeLog
diff --git a/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/FileSystem.cs b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/FileSystem.cs
index 337f1b3ab7a..fca3edb9322 100644
--- a/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/FileSystem.cs
+++ b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/FileSystem.cs
@@ -1,14 +1,16 @@
//
// FileSystem.cs
//
-// Author:
+// Authors:
//
// Daniel Campos ( danielcampos@netcourrier.com )
+// Rafael Teixeira (rafaelteixeirabr@hotmail.com)
//
//
using System;
using System.IO;
+
namespace Microsoft.VisualBasic
{
[Microsoft.VisualBasic.CompilerServices.StandardModuleAttribute]
@@ -64,10 +66,43 @@ namespace Microsoft.VisualBasic
return (MyDrive.ToUpper() + Path.VolumeSeparatorChar + Path.DirectorySeparatorChar );
}
}
- [MonoTODO]
- public static System.String Dir () { throw new NotImplementedException (); }
- [MonoTODO]
- public static System.String Dir (System.String Pathname, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(0)] Microsoft.VisualBasic.FileAttribute Attributes) { throw new NotImplementedException (); }
+
+ private class FileFinder {
+ public string Pathname;
+ public FileAttribute Attributes;
+
+ public FileFinder(string pathname, FileAttribute attributes) {
+ Pathname = pathname;
+ Attributes = attributes;
+ }
+
+ public string Next() {
+ return "";
+ }
+ }
+
+ private static FileFinder CurrentFileFinder = null;
+
+ [MonoTODO]
+ public static System.String Dir (
+ System.String Pathname,
+ [System.Runtime.InteropServices.Optional]
+ [System.ComponentModel.DefaultValue(0)]
+ Microsoft.VisualBasic.FileAttribute Attributes) {
+ CurrentFileFinder = new FileFinder(Pathname, Attributes);
+ return Dir();
+ }
+
+ [MonoTODO]
+ public static System.String Dir () {
+ if (CurrentFileFinder == null)
+ throw new ArgumentException();
+ string filename = CurrentFileFinder.Next();
+ if (filename == "")
+ CurrentFileFinder = null; // to cause an error next time
+ return filename;
+ }
+
[MonoTODO("Needs testing")]
public static void MkDir (System.String Path)
diff --git a/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Information.cs b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Information.cs
index cb7e773d58d..fa638fa3f88 100644
--- a/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Information.cs
+++ b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Information.cs
@@ -3,10 +3,12 @@
//
// Author:
// Chris J Breisch (cjbreisch@altavista.net)
-// Francesco Delfino (pluto@tipic.com
+// Francesco Delfino (pluto@tipic.com)
+// Rafael Teixeira (rafaelteixeirabr@hotmail.com)
//
// (C) 2002 Chris J Breisch
// 2003 Tipic, Inc. (http://www.tipic.com)
+// 2004 Rafael Teixeira
//
using System;
@@ -32,14 +34,36 @@ namespace Microsoft.VisualBasic
public static System.Boolean IsDate (System.Object Expression) { throw new NotImplementedException (); }
[MonoTODO]
public static System.Boolean IsDBNull (System.Object Expression) { throw new NotImplementedException (); }
- [MonoTODO]
- public static System.Boolean IsNothing (System.Object Expression) { throw new NotImplementedException (); }
+
+ public static System.Boolean IsNothing (System.Object Expression) {
+ return (Expression == null);
+ }
+
[MonoTODO]
public static System.Boolean IsError (System.Object Expression) { throw new NotImplementedException (); }
[MonoTODO]
public static System.Boolean IsReference (System.Object Expression) { throw new NotImplementedException (); }
- [MonoTODO]
- public static System.Boolean IsNumeric (System.Object Expression) { throw new NotImplementedException (); }
+
+ public static System.Boolean IsNumeric (System.Object Expression)
+ {
+ if (Expression == null || Expression is DateTime)
+ return false;
+
+ if (Expression is Int16 || Expression is Int32 || Expression is Int64 || Expression is Decimal ||
+ Expression is Single || Expression is Double)
+ return true;
+
+ try {
+ if (Expression is string)
+ Double.Parse(Expression as string);
+ else
+ Double.Parse(Expression.ToString());
+ return true;
+ } catch {} // just dismiss errors but return false
+
+ return false;
+ }
+
[MonoTODO]
public static System.Int32 LBound (System.Array Array, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(1)] System.Int32 Rank) { throw new NotImplementedException (); }
[MonoTODO]
diff --git a/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/ChangeLog b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/ChangeLog
new file mode 100644
index 00000000000..8339847b225
--- /dev/null
+++ b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/ChangeLog
@@ -0,0 +1,3 @@
+2004-01-22 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
+ * Utils.cs:
+ First Try Implementation for CopyArray(): NET_1_1-aware
diff --git a/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/Utils.cs b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/Utils.cs
index 6d13fa195a2..3d5b9add22d 100644
--- a/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/Utils.cs
+++ b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/Utils.cs
@@ -3,8 +3,10 @@
//
// Author:
// Chris J Breisch (cjbreisch@altavista.net)
+// Rafael Teixeira (rafaelteixeirabr@hotmail.com)
//
// (C) 2002 Chris J Breisch
+// (C) 2004 Rafael Teixeira
//
using System;
@@ -14,18 +16,40 @@ namespace Microsoft.VisualBasic.CompilerServices
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
[Microsoft.VisualBasic.CompilerServices.StandardModuleAttribute]
sealed public class Utils {
- // Declarations
- // Constructors
- // Properties
- // Methods
+
+ static Utils() {
+ }
+
[MonoTODO]
- public static void ThrowException (System.Int32 hr) { throw new NotImplementedException (); }
+ public static void ThrowException (System.Int32 hr) {
+ throw new NotImplementedException ();
+ }
+
[MonoTODO]
- public static System.Object SetCultureInfo (System.Globalization.CultureInfo Culture) { throw new NotImplementedException (); }
+ public static System.Object SetCultureInfo (System.Globalization.CultureInfo Culture) {
+ throw new NotImplementedException ();
+ }
+
[MonoTODO]
- public static System.Array CopyArray (System.Array arySrc, System.Array aryDest) { throw new NotImplementedException (); }
+ public static System.Array CopyArray (System.Array SourceArray, System.Array DestinationArray) {
+#if NET_1_1
+ long SourceLength = SourceArray.LongLength;
+ long DestinationLength = DestinationArray.LongLength;
+ long LengthToCopy = (SourceLength < DestinationLength) ? SourceLength : DestinationLength;
+ Array.Copy(SourceArray, DestinationArray, LengthToCopy);
+#else
+ int SourceLength = SourceArray.Length;
+ int DestinationLength = DestinationArray.Length;
+ int LengthToCopy = (SourceLength < DestinationLength) ? SourceLength : DestinationLength;
+ Array.Copy(SourceArray, DestinationArray, LengthToCopy);
+#endif
+ return DestinationArray;
+ }
+
[MonoTODO]
- public static System.String MethodToString (System.Reflection.MethodBase Method) { throw new NotImplementedException (); }
+ public static System.String MethodToString (System.Reflection.MethodBase Method) {
+ throw new NotImplementedException ();
+ }
// Events
};
}
diff --git a/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic_test.dll.sources b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic_test.dll.sources
index a615bd07eee..56a52d7784e 100644
--- a/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic_test.dll.sources
+++ b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic_test.dll.sources
@@ -1,4 +1,6 @@
-CollectionTest.cs
-ConversionTest.cs
-DateAndTimeTest.cs
-StringsTest.cs
+Microsoft.VisualBasic/CollectionTest.cs
+Microsoft.VisualBasic/ConversionTest.cs
+Microsoft.VisualBasic/DateAndTimeTest.cs
+Microsoft.VisualBasic/StringsTest.cs
+Microsoft.VisualBasic/FileSystemTest.cs
+Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/UtilsTest.cs
diff --git a/mcs/class/Microsoft.VisualBasic/Test/ChangeLog b/mcs/class/Microsoft.VisualBasic/Test/Microsoft.VisualBasic/ChangeLog
index 16fb14ad277..357db129632 100644
--- a/mcs/class/Microsoft.VisualBasic/Test/ChangeLog
+++ b/mcs/class/Microsoft.VisualBasic/Test/Microsoft.VisualBasic/ChangeLog
@@ -1,41 +1,59 @@
-2003-12-29 Jochen Wezel <jwezel@compumaster.de>
-
- * Updated StringsTest.cs
-
-2003-12-10 Jochen Wezel <jwezel@compumaster.de>
-
- * Added StringsTest.cs (needs further work on)
-
-2003-05-13 Martin Willemoes Hansen <mwh@sysrq.dk>
- * CollectionTest.cs ConversionTest.cs DateAndTimeTest.cs
- Inherited from Assertion and removed
- Assertion. prefix from assertions
-
-2003-04-17 Nick Drochak <ndrochak@gol.com>
-
- * makefile.gnu: get the nunit dll from class/lib now.
- * DateAndTimeTest.cs: Ignore test that hangs mono.
-
-2003-04-15 Nick Drochak <ndrochak@gol.com>
-
- * Microsoft.VisualBasic_test.build: use nunit version 2
-
-2003-03-13 Martin Willemoes Hansen <mwh@sysrq.dk>
- * Credited myself in CollectionTest.cs,
- ConversionTest.cs and DateAndTimeTest.cs
-
-2003-03-12 Martin Willemoes Hansen <mwh@sysrq.dk>
- * Added makefile.gnu
- * Added microsoftvisualbasic_test.args
- * Removed AllTests.cs not need for NUnit 2.0
- * Updated CollectionTest.cs, ConversionTest.cs and
- DateAndTimeTest.cs to NUnit 2.0
-
-2002-10-28 Nick Drochak <ndrochak@gol.com>
-
- * DateAndTimeTest.cs: Make tests pass on Windows with .NET
-
-2002-10-23 Nick Drochak <ndrochak@gol.com>
-
- * DateAndTimeTest.cs: Try to set the culture for these tests and see
- if that helps. All but one works on my machine.
+2004-01-24 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
+ * FileSystemTest.cs:
+ Correcting expected exception type in TestDir to match MS' behaviour
+ * CollectionTest.cs
+ Correcting expected exception type in Exception #E19 to match MS' behaviour
+ * DateAndTimeTest.cs:
+ Correcting expected WeekDay values for many asserts to match MS' behaviour
+ Correcting expected exception type in DateValue "#DV03" to match MS' behaviour
+ WeekdayName Test assumed FirstDayOfWeek.System to always be the same, but it is user configurable,
+ test with FirstDayOfWeek.Monday instead
+ TimeValue Test wrongly wanted to receive the parsed time as happening today,
+ instead it comes in day 1/1/1 (timescale-zero)
+
+2004-01-21 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
+ * Added FileSystemTest.cs:
+ Initial tests for FileSystem.Dir function
+ * moved sources and this Changelog to correct namespace directory
+
+2003-12-29 Jochen Wezel <jwezel@compumaster.de>
+
+ * Updated StringsTest.cs
+
+2003-12-10 Jochen Wezel <jwezel@compumaster.de>
+
+ * Added StringsTest.cs (needs further work on)
+
+2003-05-13 Martin Willemoes Hansen <mwh@sysrq.dk>
+ * CollectionTest.cs ConversionTest.cs DateAndTimeTest.cs
+ Inherited from Assertion and removed
+ Assertion. prefix from assertions
+
+2003-04-17 Nick Drochak <ndrochak@gol.com>
+
+ * makefile.gnu: get the nunit dll from class/lib now.
+ * DateAndTimeTest.cs: Ignore test that hangs mono.
+
+2003-04-15 Nick Drochak <ndrochak@gol.com>
+
+ * Microsoft.VisualBasic_test.build: use nunit version 2
+
+2003-03-13 Martin Willemoes Hansen <mwh@sysrq.dk>
+ * Credited myself in CollectionTest.cs,
+ ConversionTest.cs and DateAndTimeTest.cs
+
+2003-03-12 Martin Willemoes Hansen <mwh@sysrq.dk>
+ * Added makefile.gnu
+ * Added microsoftvisualbasic_test.args
+ * Removed AllTests.cs not need for NUnit 2.0
+ * Updated CollectionTest.cs, ConversionTest.cs and
+ DateAndTimeTest.cs to NUnit 2.0
+
+2002-10-28 Nick Drochak <ndrochak@gol.com>
+
+ * DateAndTimeTest.cs: Make tests pass on Windows with .NET
+
+2002-10-23 Nick Drochak <ndrochak@gol.com>
+
+ * DateAndTimeTest.cs: Try to set the culture for these tests and see
+ if that helps. All but one works on my machine.
diff --git a/mcs/class/Microsoft.VisualBasic/Test/CollectionTest.cs b/mcs/class/Microsoft.VisualBasic/Test/Microsoft.VisualBasic/CollectionTest.cs
index fbd22eeaaf2..a1fef0e2b76 100644..100755
--- a/mcs/class/Microsoft.VisualBasic/Test/CollectionTest.cs
+++ b/mcs/class/Microsoft.VisualBasic/Test/Microsoft.VisualBasic/CollectionTest.cs
@@ -1,543 +1,543 @@
-// Collection.cs - NUnit Test Cases for Microsoft.VisualBasic.Collection
-//
-// Authors:
-// Chris J. Breisch (cjbreisch@altavista.net)
-// Martin Willemoes Hansen (mwh@sysrq.dk)
-//
-// (C) Chris J. Breisch
-// (C) Martin Willemoes Hansen
-//
-
-using NUnit.Framework;
-using System;
-using Microsoft.VisualBasic;
-using System.Collections;
-
-namespace MonoTests.Microsoft.VisualBasic
-{
- [TestFixture]
- public class CollectionTest : Assertion
- {
-
- [SetUp]
- public void GetReady() {}
-
- [TearDown]
- public void Clean() {}
-
- // Test Constructor
- [Test]
- public void New ()
- {
- Collection c;
-
- c = new Collection();
-
- AssertNotNull("#N01", c);
- AssertEquals("#N02", 0, c.Count);
- }
-
- // Test Add method with Key == null
- [Test]
- public void AddNoKey ()
- {
- Collection c;
-
- c = new Collection();
-
- c.Add(typeof(int), null, null, null);
- c.Add(typeof(double), null, null, null);
- c.Add(typeof(string), null, null, null);
-
- AssertEquals("#ANK01", 3, c.Count);
-
- // Collection class is 1-based
- AssertEquals("#ANK02", typeof(string), c[3]);
-
- }
-
- // Test Add method with Key specified
- [Test]
- public void AddKey ()
- {
- Collection c;
-
- c = new Collection();
-
- c.Add("Baseball", "Base", null, null);
- c.Add("Football", "Foot", null, null);
- c.Add("Basketball", "Basket", null, null);
- c.Add("Volleyball", "Volley", null, null);
-
- AssertEquals("#AK01", 4, c.Count);
-
- // Collection class is 1-based
- AssertEquals("#AK02", "Baseball", c[1]);
- AssertEquals("#AK03", "Volleyball", c["Volley"]);
-
- }
-
- // Test Add method with Before specified and Key == null
- [Test]
- public void AddBeforeNoKey ()
- {
- Collection c;
-
- c = new Collection();
-
- c.Add(typeof(int), null, null, null);
- c.Add(typeof(double), null, 1, null);
- c.Add(typeof(string), null, 2, null);
- c.Add(typeof(object), null, 2, null);
-
- AssertEquals("#ABNK01", 4, c.Count);
-
- // Collection class is 1-based
- AssertEquals("#ABNK02", typeof(int), c[4]);
- AssertEquals("#ABNK03", typeof(double), c[1]);
- AssertEquals("#ABNK04", typeof(object), c[2]);
-
- }
-
- // Test Add method with Before and Key
- [Test]
- public void AddBeforeKey ()
- {
- Collection c;
-
- c = new Collection();
-
- c.Add("Baseball", "Base", null, null);
- c.Add("Football", "Foot", 1, null);
- c.Add("Basketball", "Basket", 1, null);
- c.Add("Volleyball", "Volley", 3, null);
-
- AssertEquals("#ABK01", 4, c.Count);
- AssertEquals("#ABK02", "Basketball", c[1]);
- AssertEquals("#ABK03", "Baseball", c[4]);
- AssertEquals("#ABK04", "Volleyball", c["Volley"]);
- AssertEquals("#ABK05", "Football", c["Foot"]);
-
- }
-
- // Test Add method with After specified and Key == null
- [Test]
- public void AddAfterNoKey ()
- {
- Collection c;
-
- c = new Collection();
-
- c.Add(typeof(int), null, null, 0);
- c.Add(typeof(double), null, null, 1);
- c.Add(typeof(string), null, null, 1);
- c.Add(typeof(object), null, null, 3);
-
- AssertEquals("#AANK01", 4, c.Count);
-
- // Collection class is 1-based
- AssertEquals("#AANK02", typeof(object), c[4]);
- AssertEquals("#AANK03", typeof(int), c[1]);
- AssertEquals("#AANK04", typeof(string), c[2]);
-
- }
-
- // Test Add method with After and Key
- [Test]
- public void AddAfterKey ()
- {
- Collection c;
-
- c = new Collection();
-
- c.Add("Baseball", "Base", null, 0);
- c.Add("Football", "Foot", null, 1);
- c.Add("Basketball", "Basket", null, 1);
- c.Add("Volleyball", "Volley", null, 2);
-
- AssertEquals("#AAK01", 4, c.Count);
-
- // Collection class is 1-based
- AssertEquals("#AAK02", "Baseball", c[1]);
- AssertEquals("#AAK03", "Football", c[4]);
- AssertEquals("#AAK04", "Basketball", c["Basket"]);
- AssertEquals("#AAK05", "Volleyball", c["Volley"]);
- }
-
- // Test GetEnumerator method
- [Test]
- public void GetEnumerator ()
- {
- Collection c;
- IEnumerator e;
- object[] o = new object[4] {typeof(int),
- typeof(double), typeof(string), typeof(object)};
- int i = 0;
-
- c = new Collection();
-
- c.Add(typeof(int), null, null, null);
- c.Add(typeof(double), null, null, null);
- c.Add(typeof(string), null, null, null);
- c.Add(typeof(object), null, null, null);
-
- e = c.GetEnumerator();
-
- AssertNotNull("#GE01", e);
-
- while (e.MoveNext()) {
- AssertEquals("#GE02." + i.ToString(), o[i], e.Current);
- i++;
- }
-
- e.Reset();
- e.MoveNext();
-
- AssertEquals("#GE03", o[0], e.Current);
-
- }
-
- // Test GetEnumerator method again, this time using foreach
- [Test]
- public void Foreach ()
- {
- Collection c;
- object[] o = new object[4] {typeof(int),
- typeof(double), typeof(string), typeof(object)};
- int i = 0;
-
- c = new Collection();
-
- c.Add(typeof(int), null, null, null);
- c.Add(typeof(double), null, null, null);
- c.Add(typeof(string), null, null, null);
- c.Add(typeof(object), null, null, null);
-
-
- foreach (object item in c) {
- AssertEquals("#fe01." + i.ToString(), o[i], item);
- i++;
- }
-
- }
-
- // Test Remove method with Index
- [Test]
- public void RemoveNoKey ()
- {
- Collection c;
-
- c = new Collection();
-
- c.Add(typeof(int), null, null, null);
- c.Add(typeof(double), null, null, null);
- c.Add(typeof(string), null, null, null);
- c.Add(typeof(object), null, null, null);
-
- AssertEquals("#RNK01", 4, c.Count);
-
- c.Remove(3);
-
- AssertEquals("#RNK02", 3, c.Count);
-
- // Collection class is 1-based
- AssertEquals("#RNK03", typeof(object), c[3]);
-
- c.Remove(1);
-
- AssertEquals("#RNK04", 2, c.Count);
- AssertEquals("#RNK05", typeof(double), c[1]);
- AssertEquals("#RNK06", typeof(object), c[2]);
-
- c.Remove(2);
-
- AssertEquals("#RNK07", 1, c.Count);
- AssertEquals("#RNK08", typeof(double), c[1]);
-
- c.Remove(1);
-
- AssertEquals("#RNK09", 0, c.Count);
-
- }
-
- // Test Remove method with Key
- [Test]
- public void RemoveKey ()
- {
- Collection c;
-
- c = new Collection();
-
- c.Add("Baseball", "Base", null, null);
- c.Add("Football", "Foot", null, null);
- c.Add("Basketball", "Basket", null, null);
- c.Add("Volleyball", "Volley", null, null);
-
- AssertEquals("#RK01", 4, c.Count);
-
- c.Remove("Foot");
-
- AssertEquals("#RK02", 3, c.Count);
- AssertEquals("#RK03", "Basketball", c["Basket"]);
-
- // Collection class is 1-based
- AssertEquals("#RK04", "Volleyball", c[3]);
-
- c.Remove("Base");
-
- AssertEquals("#RK05", 2, c.Count);
- AssertEquals("#RK06", "Basketball", c[1]);
- AssertEquals("#RK07", "Volleyball", c["Volley"]);
-
- c.Remove(2);
-
- AssertEquals("#RK08", 1, c.Count);
- AssertEquals("#RK09", "Basketball", c[1]);
- AssertEquals("#RK10", "Basketball", c["Basket"]);
-
- c.Remove(1);
-
- AssertEquals("#RK11", 0, c.Count);
- }
-
- // Test all the Exceptions we're supposed to throw
- [Test]
- public void Exception ()
- {
- Collection c;
- bool caughtException = false;
-
- c = new Collection();
-
- try {
- // nothing in Collection yet
- object o = c[0];
- }
- catch (Exception e) {
- AssertEquals("#E01", typeof(IndexOutOfRangeException), e.GetType());
- caughtException = true;
- }
-
- AssertEquals("#E02", true, caughtException);
-
- c.Add("Baseball", "Base", null, null);
- c.Add("Football", "Foot", null, null);
- c.Add("Basketball", "Basket", null, null);
- c.Add("Volleyball", "Volley", null, null);
-
- caughtException = false;
-
- try {
- // only 4 elements
- object o = c[5];
- }
- catch (Exception e) {
- AssertEquals("#E03", typeof(IndexOutOfRangeException), e.GetType());
- caughtException = true;
- }
-
- AssertEquals("#E04", true, caughtException);
-
- caughtException = false;
-
- try {
- // Collection class is 1-based
- object o = c[0];
- }
- catch (Exception e) {
- AssertEquals("#E05", typeof(IndexOutOfRangeException), e.GetType());
- caughtException = true;
- }
-
- AssertEquals("#E06", true, caughtException);
-
- caughtException = false;
-
- try {
- // no member with Key == "Kick"
- object o = c["Kick"];
- }
- catch (Exception e) {
- // FIXME
- // VB Language Reference says IndexOutOfRangeException
- // here, but MS throws ArgumentException
- // AssertEquals("#E07", typeof(IndexOutOfRangeException), e.GetType());
- AssertEquals("#E07", typeof(ArgumentException), e.GetType());
- caughtException = true;
- }
-
- AssertEquals("#E08", true, caughtException);
-
- caughtException = false;
-
- try {
- // Even though Indexer is an object, really it's a string
- object o = c[typeof(int)];
- }
- catch (Exception e) {
- AssertEquals("#E09", typeof(ArgumentException), e.GetType());
- caughtException = true;
- }
-
- AssertEquals("#E10", true, caughtException);
-
- caughtException = false;
-
- try {
- // can't specify both Before and After
- c.Add("Kickball", "Kick", "Volley", "Foot");
- }
- catch (Exception e) {
- AssertEquals("#E11", typeof(ArgumentException), e.GetType());
- caughtException = true;
- }
-
- AssertEquals("#E12", true, caughtException);
-
- caughtException = false;
-
- try {
- // Key "Foot" already exists
- c.Add("Kickball", "Foot", null, null);
- }
- catch (Exception e) {
- AssertEquals("#E13", typeof(ArgumentException), e.GetType());
- caughtException = true;
- }
-
- AssertEquals("#E14", true, caughtException);
-
- caughtException = false;
-
- try {
- // Even though Before is object, it's really a string
- c.Add("Dodgeball", "Dodge", typeof(int), null);
- }
- catch (Exception e) {
- AssertEquals("#E15", typeof(InvalidCastException), e.GetType());
- caughtException = true;
- }
-
- AssertEquals("#E16", true, caughtException);
-
- caughtException = false;
-
- try {
- // Even though After is object, it's really a string
- c.Add("Wallyball", "Wally", null, typeof(int));
- }
- catch (Exception e) {
- AssertEquals("#E17", typeof(InvalidCastException), e.GetType());
- caughtException = true;
- }
-
- AssertEquals("#E18", true, caughtException);
-
- caughtException = false;
-
- try {
- // have to pass a legitimate value to remove
- c.Remove(null);
- }
- catch (Exception e) {
- AssertEquals("#E19", typeof(ArgumentException), e.GetType());
- caughtException = true;
- }
-
- AssertEquals("#E20", true, caughtException);
-
- caughtException = false;
-
- try {
- // no Key "Golf" exists
- c.Remove("Golf");
- }
- catch (Exception e) {
- AssertEquals("#E21", typeof(ArgumentException), e.GetType());
- caughtException = true;
- }
-
- AssertEquals("#E22", true, caughtException);
-
- caughtException = false;
-
- try {
- // no Index 10 exists
- c.Remove(10);
- }
- catch (Exception e) {
- AssertEquals("#E23", typeof(IndexOutOfRangeException), e.GetType());
- caughtException = true;
- }
-
- AssertEquals("#E24", true, caughtException);
-
- caughtException = false;
-
- try {
- IEnumerator e = c.GetEnumerator();
-
- // Must MoveNext before Current
- object item = e.Current;
- }
- catch (Exception e) {
- // FIXME
- // On-line help says InvalidOperationException here,
- // but MS throws IndexOutOfRangeException
- // AssertEquals("#E25", typeof(InvalidOperationException), e.GetType());
- AssertEquals("#E25", typeof(IndexOutOfRangeException), e.GetType());
- caughtException = true;
- }
-
- AssertEquals("#E26", true, caughtException);
-
- caughtException = false;
-
- try {
- IEnumerator e = c.GetEnumerator();
- e.MoveNext();
-
- c.Add("Paintball", "Paint", null, null);
-
- // Can't MoveNext if Collection has been modified
- e.MoveNext();
- }
- catch (Exception e) {
- // FIXME
- // On-line help says this should throw an error. MS doesn't.
- AssertEquals("#E27", typeof(InvalidOperationException), e.GetType());
- caughtException = true;
- }
-
- // FIXME
- // What to do about this? MS doesn't throw an error
- // AssertEquals("#E28", true, caughtException);
- AssertEquals("#E28", false, caughtException);
-
- caughtException = false;
-
- try {
- IEnumerator e = c.GetEnumerator();
- e.MoveNext();
-
- c.Add("Racketball", "Racket", null, null);
-
- // Can't Reset if Collection has been modified
- e.Reset();
- }
- catch (Exception e) {
- // FIXME
- // On-line help says this should throw an error. MS doesn't.
- AssertEquals("#E29", typeof(InvalidOperationException), e.GetType());
- caughtException = true;
- }
-
- // FIXME
- // What to do about this? MS doesn't throw an error
- // AssertEquals("#E30", true, caughtException);
- AssertEquals("#E30", false, caughtException);
-
- caughtException = false;
- }
- }
-}
+// Collection.cs - NUnit Test Cases for Microsoft.VisualBasic.Collection
+//
+// Authors:
+// Chris J. Breisch (cjbreisch@altavista.net)
+// Martin Willemoes Hansen (mwh@sysrq.dk)
+//
+// (C) Chris J. Breisch
+// (C) Martin Willemoes Hansen
+//
+
+using NUnit.Framework;
+using System;
+using Microsoft.VisualBasic;
+using System.Collections;
+
+namespace MonoTests.Microsoft.VisualBasic
+{
+ [TestFixture]
+ public class CollectionTest : Assertion
+ {
+
+ [SetUp]
+ public void GetReady() {}
+
+ [TearDown]
+ public void Clean() {}
+
+ // Test Constructor
+ [Test]
+ public void New ()
+ {
+ Collection c;
+
+ c = new Collection();
+
+ AssertNotNull("#N01", c);
+ AssertEquals("#N02", 0, c.Count);
+ }
+
+ // Test Add method with Key == null
+ [Test]
+ public void AddNoKey ()
+ {
+ Collection c;
+
+ c = new Collection();
+
+ c.Add(typeof(int), null, null, null);
+ c.Add(typeof(double), null, null, null);
+ c.Add(typeof(string), null, null, null);
+
+ AssertEquals("#ANK01", 3, c.Count);
+
+ // Collection class is 1-based
+ AssertEquals("#ANK02", typeof(string), c[3]);
+
+ }
+
+ // Test Add method with Key specified
+ [Test]
+ public void AddKey ()
+ {
+ Collection c;
+
+ c = new Collection();
+
+ c.Add("Baseball", "Base", null, null);
+ c.Add("Football", "Foot", null, null);
+ c.Add("Basketball", "Basket", null, null);
+ c.Add("Volleyball", "Volley", null, null);
+
+ AssertEquals("#AK01", 4, c.Count);
+
+ // Collection class is 1-based
+ AssertEquals("#AK02", "Baseball", c[1]);
+ AssertEquals("#AK03", "Volleyball", c["Volley"]);
+
+ }
+
+ // Test Add method with Before specified and Key == null
+ [Test]
+ public void AddBeforeNoKey ()
+ {
+ Collection c;
+
+ c = new Collection();
+
+ c.Add(typeof(int), null, null, null);
+ c.Add(typeof(double), null, 1, null);
+ c.Add(typeof(string), null, 2, null);
+ c.Add(typeof(object), null, 2, null);
+
+ AssertEquals("#ABNK01", 4, c.Count);
+
+ // Collection class is 1-based
+ AssertEquals("#ABNK02", typeof(int), c[4]);
+ AssertEquals("#ABNK03", typeof(double), c[1]);
+ AssertEquals("#ABNK04", typeof(object), c[2]);
+
+ }
+
+ // Test Add method with Before and Key
+ [Test]
+ public void AddBeforeKey ()
+ {
+ Collection c;
+
+ c = new Collection();
+
+ c.Add("Baseball", "Base", null, null);
+ c.Add("Football", "Foot", 1, null);
+ c.Add("Basketball", "Basket", 1, null);
+ c.Add("Volleyball", "Volley", 3, null);
+
+ AssertEquals("#ABK01", 4, c.Count);
+ AssertEquals("#ABK02", "Basketball", c[1]);
+ AssertEquals("#ABK03", "Baseball", c[4]);
+ AssertEquals("#ABK04", "Volleyball", c["Volley"]);
+ AssertEquals("#ABK05", "Football", c["Foot"]);
+
+ }
+
+ // Test Add method with After specified and Key == null
+ [Test]
+ public void AddAfterNoKey ()
+ {
+ Collection c;
+
+ c = new Collection();
+
+ c.Add(typeof(int), null, null, 0);
+ c.Add(typeof(double), null, null, 1);
+ c.Add(typeof(string), null, null, 1);
+ c.Add(typeof(object), null, null, 3);
+
+ AssertEquals("#AANK01", 4, c.Count);
+
+ // Collection class is 1-based
+ AssertEquals("#AANK02", typeof(object), c[4]);
+ AssertEquals("#AANK03", typeof(int), c[1]);
+ AssertEquals("#AANK04", typeof(string), c[2]);
+
+ }
+
+ // Test Add method with After and Key
+ [Test]
+ public void AddAfterKey ()
+ {
+ Collection c;
+
+ c = new Collection();
+
+ c.Add("Baseball", "Base", null, 0);
+ c.Add("Football", "Foot", null, 1);
+ c.Add("Basketball", "Basket", null, 1);
+ c.Add("Volleyball", "Volley", null, 2);
+
+ AssertEquals("#AAK01", 4, c.Count);
+
+ // Collection class is 1-based
+ AssertEquals("#AAK02", "Baseball", c[1]);
+ AssertEquals("#AAK03", "Football", c[4]);
+ AssertEquals("#AAK04", "Basketball", c["Basket"]);
+ AssertEquals("#AAK05", "Volleyball", c["Volley"]);
+ }
+
+ // Test GetEnumerator method
+ [Test]
+ public void GetEnumerator ()
+ {
+ Collection c;
+ IEnumerator e;
+ object[] o = new object[4] {typeof(int),
+ typeof(double), typeof(string), typeof(object)};
+ int i = 0;
+
+ c = new Collection();
+
+ c.Add(typeof(int), null, null, null);
+ c.Add(typeof(double), null, null, null);
+ c.Add(typeof(string), null, null, null);
+ c.Add(typeof(object), null, null, null);
+
+ e = c.GetEnumerator();
+
+ AssertNotNull("#GE01", e);
+
+ while (e.MoveNext()) {
+ AssertEquals("#GE02." + i.ToString(), o[i], e.Current);
+ i++;
+ }
+
+ e.Reset();
+ e.MoveNext();
+
+ AssertEquals("#GE03", o[0], e.Current);
+
+ }
+
+ // Test GetEnumerator method again, this time using foreach
+ [Test]
+ public void Foreach ()
+ {
+ Collection c;
+ object[] o = new object[4] {typeof(int),
+ typeof(double), typeof(string), typeof(object)};
+ int i = 0;
+
+ c = new Collection();
+
+ c.Add(typeof(int), null, null, null);
+ c.Add(typeof(double), null, null, null);
+ c.Add(typeof(string), null, null, null);
+ c.Add(typeof(object), null, null, null);
+
+
+ foreach (object item in c) {
+ AssertEquals("#fe01." + i.ToString(), o[i], item);
+ i++;
+ }
+
+ }
+
+ // Test Remove method with Index
+ [Test]
+ public void RemoveNoKey ()
+ {
+ Collection c;
+
+ c = new Collection();
+
+ c.Add(typeof(int), null, null, null);
+ c.Add(typeof(double), null, null, null);
+ c.Add(typeof(string), null, null, null);
+ c.Add(typeof(object), null, null, null);
+
+ AssertEquals("#RNK01", 4, c.Count);
+
+ c.Remove(3);
+
+ AssertEquals("#RNK02", 3, c.Count);
+
+ // Collection class is 1-based
+ AssertEquals("#RNK03", typeof(object), c[3]);
+
+ c.Remove(1);
+
+ AssertEquals("#RNK04", 2, c.Count);
+ AssertEquals("#RNK05", typeof(double), c[1]);
+ AssertEquals("#RNK06", typeof(object), c[2]);
+
+ c.Remove(2);
+
+ AssertEquals("#RNK07", 1, c.Count);
+ AssertEquals("#RNK08", typeof(double), c[1]);
+
+ c.Remove(1);
+
+ AssertEquals("#RNK09", 0, c.Count);
+
+ }
+
+ // Test Remove method with Key
+ [Test]
+ public void RemoveKey ()
+ {
+ Collection c;
+
+ c = new Collection();
+
+ c.Add("Baseball", "Base", null, null);
+ c.Add("Football", "Foot", null, null);
+ c.Add("Basketball", "Basket", null, null);
+ c.Add("Volleyball", "Volley", null, null);
+
+ AssertEquals("#RK01", 4, c.Count);
+
+ c.Remove("Foot");
+
+ AssertEquals("#RK02", 3, c.Count);
+ AssertEquals("#RK03", "Basketball", c["Basket"]);
+
+ // Collection class is 1-based
+ AssertEquals("#RK04", "Volleyball", c[3]);
+
+ c.Remove("Base");
+
+ AssertEquals("#RK05", 2, c.Count);
+ AssertEquals("#RK06", "Basketball", c[1]);
+ AssertEquals("#RK07", "Volleyball", c["Volley"]);
+
+ c.Remove(2);
+
+ AssertEquals("#RK08", 1, c.Count);
+ AssertEquals("#RK09", "Basketball", c[1]);
+ AssertEquals("#RK10", "Basketball", c["Basket"]);
+
+ c.Remove(1);
+
+ AssertEquals("#RK11", 0, c.Count);
+ }
+
+ // Test all the Exceptions we're supposed to throw
+ [Test]
+ public void Exception ()
+ {
+ Collection c;
+ bool caughtException = false;
+
+ c = new Collection();
+
+ try {
+ // nothing in Collection yet
+ object o = c[0];
+ }
+ catch (Exception e) {
+ AssertEquals("#E01", typeof(IndexOutOfRangeException), e.GetType());
+ caughtException = true;
+ }
+
+ AssertEquals("#E02", true, caughtException);
+
+ c.Add("Baseball", "Base", null, null);
+ c.Add("Football", "Foot", null, null);
+ c.Add("Basketball", "Basket", null, null);
+ c.Add("Volleyball", "Volley", null, null);
+
+ caughtException = false;
+
+ try {
+ // only 4 elements
+ object o = c[5];
+ }
+ catch (Exception e) {
+ AssertEquals("#E03", typeof(IndexOutOfRangeException), e.GetType());
+ caughtException = true;
+ }
+
+ AssertEquals("#E04", true, caughtException);
+
+ caughtException = false;
+
+ try {
+ // Collection class is 1-based
+ object o = c[0];
+ }
+ catch (Exception e) {
+ AssertEquals("#E05", typeof(IndexOutOfRangeException), e.GetType());
+ caughtException = true;
+ }
+
+ AssertEquals("#E06", true, caughtException);
+
+ caughtException = false;
+
+ try {
+ // no member with Key == "Kick"
+ object o = c["Kick"];
+ }
+ catch (Exception e) {
+ // FIXME
+ // VB Language Reference says IndexOutOfRangeException
+ // here, but MS throws ArgumentException
+ // AssertEquals("#E07", typeof(IndexOutOfRangeException), e.GetType());
+ AssertEquals("#E07", typeof(ArgumentException), e.GetType());
+ caughtException = true;
+ }
+
+ AssertEquals("#E08", true, caughtException);
+
+ caughtException = false;
+
+ try {
+ // Even though Indexer is an object, really it's a string
+ object o = c[typeof(int)];
+ }
+ catch (Exception e) {
+ AssertEquals("#E09", typeof(ArgumentException), e.GetType());
+ caughtException = true;
+ }
+
+ AssertEquals("#E10", true, caughtException);
+
+ caughtException = false;
+
+ try {
+ // can't specify both Before and After
+ c.Add("Kickball", "Kick", "Volley", "Foot");
+ }
+ catch (Exception e) {
+ AssertEquals("#E11", typeof(ArgumentException), e.GetType());
+ caughtException = true;
+ }
+
+ AssertEquals("#E12", true, caughtException);
+
+ caughtException = false;
+
+ try {
+ // Key "Foot" already exists
+ c.Add("Kickball", "Foot", null, null);
+ }
+ catch (Exception e) {
+ AssertEquals("#E13", typeof(ArgumentException), e.GetType());
+ caughtException = true;
+ }
+
+ AssertEquals("#E14", true, caughtException);
+
+ caughtException = false;
+
+ try {
+ // Even though Before is object, it's really a string
+ c.Add("Dodgeball", "Dodge", typeof(int), null);
+ }
+ catch (Exception e) {
+ AssertEquals("#E15", typeof(InvalidCastException), e.GetType());
+ caughtException = true;
+ }
+
+ AssertEquals("#E16", true, caughtException);
+
+ caughtException = false;
+
+ try {
+ // Even though After is object, it's really a string
+ c.Add("Wallyball", "Wally", null, typeof(int));
+ }
+ catch (Exception e) {
+ AssertEquals("#E17", typeof(InvalidCastException), e.GetType());
+ caughtException = true;
+ }
+
+ AssertEquals("#E18", true, caughtException);
+
+ caughtException = false;
+
+ try {
+ // have to pass a legitimate value to remove
+ c.Remove(null);
+ }
+ catch (Exception e) {
+ AssertEquals("#E19", typeof(ArgumentNullException), e.GetType());
+ caughtException = true;
+ }
+
+ AssertEquals("#E20", true, caughtException);
+
+ caughtException = false;
+
+ try {
+ // no Key "Golf" exists
+ c.Remove("Golf");
+ }
+ catch (Exception e) {
+ AssertEquals("#E21", typeof(ArgumentException), e.GetType());
+ caughtException = true;
+ }
+
+ AssertEquals("#E22", true, caughtException);
+
+ caughtException = false;
+
+ try {
+ // no Index 10 exists
+ c.Remove(10);
+ }
+ catch (Exception e) {
+ AssertEquals("#E23", typeof(IndexOutOfRangeException), e.GetType());
+ caughtException = true;
+ }
+
+ AssertEquals("#E24", true, caughtException);
+
+ caughtException = false;
+
+ try {
+ IEnumerator e = c.GetEnumerator();
+
+ // Must MoveNext before Current
+ object item = e.Current;
+ }
+ catch (Exception e) {
+ // FIXME
+ // On-line help says InvalidOperationException here,
+ // but MS throws IndexOutOfRangeException
+ // AssertEquals("#E25", typeof(InvalidOperationException), e.GetType());
+ AssertEquals("#E25", typeof(IndexOutOfRangeException), e.GetType());
+ caughtException = true;
+ }
+
+ AssertEquals("#E26", true, caughtException);
+
+ caughtException = false;
+
+ try {
+ IEnumerator e = c.GetEnumerator();
+ e.MoveNext();
+
+ c.Add("Paintball", "Paint", null, null);
+
+ // Can't MoveNext if Collection has been modified
+ e.MoveNext();
+ }
+ catch (Exception e) {
+ // FIXME
+ // On-line help says this should throw an error. MS doesn't.
+ AssertEquals("#E27", typeof(InvalidOperationException), e.GetType());
+ caughtException = true;
+ }
+
+ // FIXME
+ // What to do about this? MS doesn't throw an error
+ // AssertEquals("#E28", true, caughtException);
+ AssertEquals("#E28", false, caughtException);
+
+ caughtException = false;
+
+ try {
+ IEnumerator e = c.GetEnumerator();
+ e.MoveNext();
+
+ c.Add("Racketball", "Racket", null, null);
+
+ // Can't Reset if Collection has been modified
+ e.Reset();
+ }
+ catch (Exception e) {
+ // FIXME
+ // On-line help says this should throw an error. MS doesn't.
+ AssertEquals("#E29", typeof(InvalidOperationException), e.GetType());
+ caughtException = true;
+ }
+
+ // FIXME
+ // What to do about this? MS doesn't throw an error
+ // AssertEquals("#E30", true, caughtException);
+ AssertEquals("#E30", false, caughtException);
+
+ caughtException = false;
+ }
+ }
+}
diff --git a/mcs/class/Microsoft.VisualBasic/Test/ConversionTest.cs b/mcs/class/Microsoft.VisualBasic/Test/Microsoft.VisualBasic/ConversionTest.cs
index 0a0021b6ac9..0a0021b6ac9 100644..100755
--- a/mcs/class/Microsoft.VisualBasic/Test/ConversionTest.cs
+++ b/mcs/class/Microsoft.VisualBasic/Test/Microsoft.VisualBasic/ConversionTest.cs
diff --git a/mcs/class/Microsoft.VisualBasic/Test/DateAndTimeTest.cs b/mcs/class/Microsoft.VisualBasic/Test/Microsoft.VisualBasic/DateAndTimeTest.cs
index 9856ac5518b..dee1e9dcd3e 100644..100755
--- a/mcs/class/Microsoft.VisualBasic/Test/DateAndTimeTest.cs
+++ b/mcs/class/Microsoft.VisualBasic/Test/Microsoft.VisualBasic/DateAndTimeTest.cs
@@ -1,423 +1,422 @@
-// Collection.cs - NUnit Test Cases for Microsoft.VisualBasic.Collection
-//
-// Authors:
-// Chris J. Breisch (cjbreisch@altavista.net)
-// Martin Willemoes Hansen (mwh@sysrq.dk)
-//
-// (C) Chris J. Breisch
-// (C) Martin Willemoes Hansen
-//
-
-using NUnit.Framework;
-using System;
-using System.Threading;
-using System.Globalization;
-using Microsoft.VisualBasic;
-
-namespace MonoTests.Microsoft.VisualBasic
-{
- [TestFixture]
- public class DateAndTimeTest : Assertion {
-
- private CultureInfo oldcult;
-
- [SetUp]
- public void GetReady()
- {
- // the current culture determines the result of formatting
- oldcult = Thread.CurrentThread.CurrentCulture;
- Thread.CurrentThread.CurrentCulture = new CultureInfo ("");
- }
-
- [TearDown]
- public void Clear()
- {
- Thread.CurrentThread.CurrentCulture = oldcult;
- }
-
- [Test]
- public void DateString()
- {
- string s = DateAndTime.DateString;
- DateTime dtNow = DateTime.Today;
- AssertEquals("#DS01", dtNow.ToShortDateString(), DateTime.Parse(s).ToShortDateString());
-
- // TODO: Add a test for setting the date string too
- }
-
- [Test]
- public void Today()
- {
- AssertEquals("#TO01", DateTime.Today, DateAndTime.Today);
-
- // TODO: Add a test for setting Today
- }
-
- [Test]
- public void Timer()
- {
- double secTimer = DateAndTime.Timer;
- DateTime dtNow = DateTime.Now;
- double secNow = dtNow.Hour * 3600 + dtNow.Minute * 60 + dtNow.Second + (dtNow.Millisecond + 1) / 1000D;
- double secTimer2 = DateAndTime.Timer + .001;
-
- // waste a little time
- for (int i = 0; i < int.MaxValue; i++);
-
- // get another timer
- double secTimer3 = DateAndTime.Timer;
-
- // should be same time within a reasonable tolerance
- Assert("#TI01", secNow >= secTimer);
- Assert("#TI02: SecTimer2=" + secTimer2 + " secNow=" + secNow, secTimer2 >= secNow);
-
- // third timer should be greater than the first
- Assert("#TI03", secTimer3 > secTimer);
- }
-
- [Test]
- public void Now()
- {
- DateTime dtNow = DateTime.Now;
- DateTime dtTest = DateAndTime.Now;
- DateTime dtNow2 = DateTime.Now;
-
- Assert("#N01", dtTest >= dtNow);
- Assert("#N02", dtNow2 >= dtTest);
- }
-
- [Test]
- public void TimeOfDay()
- {
- DateTime dtNow = DateTime.Now;
- TimeSpan tsNow = new TimeSpan(dtNow.Hour, dtNow.Minute, dtNow.Second);
- DateTime dtTest = DateAndTime.TimeOfDay;
- TimeSpan tsTest = new TimeSpan(dtTest.Hour, dtTest.Minute, dtTest.Second);
- DateTime dtNow2 = DateTime.Now;
- TimeSpan tsNow2 = new TimeSpan(dtNow2.Hour, dtNow2.Minute, dtNow2.Second);
-
- Assert("#TOD01", tsTest.Ticks >= tsNow.Ticks);
- Assert("#TOD02", tsNow2.Ticks >= tsTest.Ticks);
-
- // TODO: add a test case for setting time of day
- }
-
- [Test]
- public void TimeString()
- {
- DateTime dtNow = DateTime.Now;
- TimeSpan tsNow = new TimeSpan(dtNow.Hour, dtNow.Minute, dtNow.Second);
- string s = DateAndTime.TimeString;
- DateTime dtTest = DateTime.Parse(s);
- TimeSpan tsTest = new TimeSpan(dtTest.Hour, dtTest.Minute, dtTest.Second);
- DateTime dtNow2 = DateTime.Now;
- TimeSpan tsNow2 = new TimeSpan(dtNow2.Hour, dtNow2.Minute, dtNow2.Second);
-
- Assert("#TS01", tsTest.Ticks >= tsNow.Ticks);
- Assert("#TS02", tsNow2.Ticks >= tsTest.Ticks);
-
- // TODO: add a test case for setting TimeString
- }
-
- [Test]
- public void DateAdd()
- {
- DateTime dtNow = DateTime.Now;
-
- AssertEquals("#DA01", dtNow.AddYears(1), DateAndTime.DateAdd(DateInterval.Year, 1, dtNow));
- AssertEquals("#DA02", dtNow.AddYears(-1), DateAndTime.DateAdd("yyyy", -1, dtNow));
-
-
- bool caughtException = false;
-
- try {
- DateAndTime.DateAdd("foo", 1, dtNow);
- }
- catch (Exception e) {
- AssertEquals("#DA03", e.GetType(), typeof(ArgumentException));
- caughtException = true;
- }
-
- AssertEquals("#DA04", caughtException, true);
-
- AssertEquals("#DA05", dtNow.AddMonths(6), DateAndTime.DateAdd(DateInterval.Quarter, 2, dtNow));
- AssertEquals("#DA06", dtNow.AddMonths(-6), DateAndTime.DateAdd("q", -2, dtNow));
-
- AssertEquals("#DA07", dtNow.AddMonths(3), DateAndTime.DateAdd(DateInterval.Month, 3, dtNow));
- AssertEquals("#DA08", dtNow.AddMonths(-3), DateAndTime.DateAdd("m", -3, dtNow));
-
- AssertEquals("#DA09", dtNow.AddDays(28), DateAndTime.DateAdd(DateInterval.WeekOfYear, 4, dtNow));
- AssertEquals("#DA10", dtNow.AddDays(-28), DateAndTime.DateAdd("ww", -4, dtNow));
-
- AssertEquals("#DA11", dtNow.AddDays(5), DateAndTime.DateAdd(DateInterval.Weekday, 5, dtNow));
- AssertEquals("#DA12", dtNow.AddDays(-5), DateAndTime.DateAdd("w", -5, dtNow));
-
- AssertEquals("#DA13", dtNow.AddDays(6), DateAndTime.DateAdd(DateInterval.DayOfYear, 6, dtNow));
- AssertEquals("#DA14", dtNow.AddDays(-6), DateAndTime.DateAdd("y", -6, dtNow));
-
- AssertEquals("#DA15", dtNow.AddDays(7), DateAndTime.DateAdd(DateInterval.Day, 7, dtNow));
- AssertEquals("#DA16", dtNow.AddDays(-7), DateAndTime.DateAdd("d", -7, dtNow));
-
- AssertEquals("#DA17", dtNow.AddHours(8), DateAndTime.DateAdd(DateInterval.Hour, 8, dtNow));
- AssertEquals("#DA18", dtNow.AddHours(-8), DateAndTime.DateAdd(DateInterval.Hour, -8, dtNow));
-
- AssertEquals("#DA19", dtNow.AddMinutes(9), DateAndTime.DateAdd(DateInterval.Minute, 9, dtNow));
- AssertEquals("#DA20", dtNow.AddMinutes(-9), DateAndTime.DateAdd("n", -9, dtNow));
-
- AssertEquals("#DA21", dtNow.AddSeconds(10), DateAndTime.DateAdd(DateInterval.Second, 10, dtNow));
- AssertEquals("#DA22", dtNow.AddSeconds(-10), DateAndTime.DateAdd("s", -10, dtNow));
-
- caughtException = false;
-
- try {
- DateAndTime.DateAdd(DateInterval.Year, int.MinValue, dtNow);
- }
- catch (Exception e) {
- caughtException = true;
- AssertEquals("#DA23", e.GetType(), typeof(Exception));
- }
-
- // AssertEquals("#DA24", caughtException, true);
- }
-
- [Test]
- public void DateDiff ()
- {
- DateTime dtNow = DateTime.Now;
- DateTime dtOld = dtNow.AddYears(-1);
-
- // TODO: Test this better
- long diff = DateAndTime.DateDiff(DateInterval.Year, dtOld, dtNow, FirstDayOfWeek.System, FirstWeekOfYear.System);
-
- AssertEquals("#DD01", dtNow, dtOld.AddYears((int)diff));
-
- DateTime dtJan1 = new DateTime(2002, 1, 1);
- DateTime dtDec31 = new DateTime(2001, 12, 31);
-
- diff = DateAndTime.DateDiff(DateInterval.Year, dtDec31, dtJan1, FirstDayOfWeek.System, FirstWeekOfYear.System);
-
- AssertEquals("#DD02", 1L, diff);
-
- diff = DateAndTime.DateDiff(DateInterval.Quarter, dtDec31, dtJan1, FirstDayOfWeek.System, FirstWeekOfYear.System);
-
- AssertEquals("#DD03", 1L, diff);
-
- diff = DateAndTime.DateDiff(DateInterval.Month, dtDec31, dtJan1, FirstDayOfWeek.System, FirstWeekOfYear.System);
-
- AssertEquals("#DD04", 1L, diff);
-
- DateTime dtJan4 = new DateTime(2001, 1, 4); // This is a Thursday
- DateTime dtJan9 = new DateTime(2001, 1, 9); // This is the next Tuesday
-
-
- long WD = DateAndTime.DateDiff(DateInterval.Weekday, dtJan4, dtJan9, FirstDayOfWeek.System, FirstWeekOfYear.System);
-
- AssertEquals ("#DD05", 0L, WD);
-
- long WY = DateAndTime.DateDiff(DateInterval.WeekOfYear, dtJan4, dtJan9, FirstDayOfWeek.System, FirstWeekOfYear.System);
-
- AssertEquals ("#DD06", 1L, WY);
- }
-
- [Test]
- public void DatePart ()
- {
- DateTime dtJan4 = new DateTime(2001, 1, 4);
-
- // TODO: Test this better
-
- AssertEquals("#DP01", 2001, DateAndTime.DatePart(DateInterval.Year, dtJan4, FirstDayOfWeek.System, FirstWeekOfYear.System));
- AssertEquals("#DP02", 1, DateAndTime.DatePart(DateInterval.Quarter, dtJan4, FirstDayOfWeek.System, FirstWeekOfYear.System));
- AssertEquals("#DP03", 1, DateAndTime.DatePart(DateInterval.Month, dtJan4, FirstDayOfWeek.System, FirstWeekOfYear.System));
- AssertEquals("#DP04", 1, DateAndTime.DatePart(DateInterval.WeekOfYear, dtJan4, FirstDayOfWeek.System, FirstWeekOfYear.FirstFourDays));
- AssertEquals("#DP05", 53, DateAndTime.DatePart(DateInterval.WeekOfYear, dtJan4, FirstDayOfWeek.System, FirstWeekOfYear.FirstFullWeek));
- AssertEquals("#DP06", 1, DateAndTime.DatePart(DateInterval.WeekOfYear, dtJan4, FirstDayOfWeek.System, FirstWeekOfYear.Jan1));
- AssertEquals("#DP07", 1, DateAndTime.DatePart(DateInterval.WeekOfYear, dtJan4, FirstDayOfWeek.System, FirstWeekOfYear.System));
- AssertEquals("#DP08", 5, DateAndTime.DatePart(DateInterval.Weekday, dtJan4, FirstDayOfWeek.Friday, FirstWeekOfYear.FirstFourDays));
- AssertEquals("#DP09", 5, DateAndTime.DatePart(DateInterval.Weekday, dtJan4, FirstDayOfWeek.Saturday, FirstWeekOfYear.FirstFourDays));
- AssertEquals("#DP10", 5, DateAndTime.DatePart(DateInterval.Weekday, dtJan4, FirstDayOfWeek.Sunday, FirstWeekOfYear.FirstFourDays));
- AssertEquals("#DP11", 5, DateAndTime.DatePart(DateInterval.Weekday, dtJan4, FirstDayOfWeek.Monday, FirstWeekOfYear.FirstFourDays));
- AssertEquals("#DP12", 5, DateAndTime.DatePart(DateInterval.Weekday, dtJan4, FirstDayOfWeek.Tuesday, FirstWeekOfYear.FirstFourDays));
- AssertEquals("#DP13", 5, DateAndTime.DatePart(DateInterval.Weekday, dtJan4, FirstDayOfWeek.Wednesday, FirstWeekOfYear.FirstFourDays));
- AssertEquals("#DP14", 5, DateAndTime.DatePart(DateInterval.Weekday, dtJan4, FirstDayOfWeek.Thursday, FirstWeekOfYear.FirstFourDays));
- AssertEquals("#DP15", 5, DateAndTime.DatePart(DateInterval.Weekday, dtJan4, FirstDayOfWeek.System, FirstWeekOfYear.FirstFourDays));
-
-
- }
-
- [Test]
- public void DateSerial ()
- {
- DateTime dtJan4 = new DateTime(2001, 1, 4);
- DateTime dtSerial = DateAndTime.DateSerial(2001, 1, 4);
-
- AssertEquals("#DS01", dtJan4, dtSerial);
- }
-
- [Test]
- public void TimeSerial ()
- {
- bool caughtException = false;
-
- try {
- DateAndTime.TimeSerial(0, -1440, -1);
- }
- catch (Exception e) {
- AssertEquals("#TS01", e.GetType(), typeof(ArgumentOutOfRangeException));
- caughtException = true;
- }
- AssertEquals("#TS02", true, caughtException);
-
- AssertEquals("#TS03", new DateTime(1, 1, 1, 1, 1, 1), DateAndTime.TimeSerial(1, 1, 1));
-
- }
-
- [Test]
- [Ignore ("Hangs Mono")]
- public void DateValue ()
- {
- try {
- DateAndTime.DateValue("This is not a date.");
- }
- catch (FormatException) {
- /* do nothing. this is what we expect */
- }
- catch (Exception e) {
- Fail ("Unexpected exception:" + e);
- }
- AssertEquals("#DV03", new DateTime(1969, 2, 12), DateAndTime.DateValue("February 12, 1969"));
- }
-
- [Test]
- public void TimeValue ()
- {
- try {
- DateAndTime.TimeValue("This is not a time.");
- }
- catch (FormatException) {
- /* do nothing. this is what we expect */
- }
- catch (Exception e) {
- Fail ("Unexpected exception:" + e);
- }
- AssertEquals("#TV03", new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 16, 35, 17), DateAndTime.TimeValue("4:35:17 PM"));
- }
-
- [Test]
- public void Year ()
- {
- DateTime jan1 = new DateTime(2001, 1, 1, 1, 1, 1);
- AssertEquals("#Y01", jan1.Year, DateAndTime.Year(jan1));
- }
-
- [Test]
- public void Month ()
- {
- DateTime jan1 = new DateTime(2001, 1, 1, 1, 1, 1);
- AssertEquals("#MO01", jan1.Month, DateAndTime.Month(jan1));
- }
-
- [Test]
- public void Day ()
- {
- DateTime jan1 = new DateTime(2001, 1, 1, 1, 1, 1);
- AssertEquals("#D01", jan1.Day, DateAndTime.Day(jan1));
- }
-
- [Test]
- public void Hour ()
- {
- DateTime jan1 = new DateTime(2001, 1, 1, 1, 1, 1);
- AssertEquals("#H01", jan1.Hour, DateAndTime.Hour(jan1));
- }
-
- [Test]
- public void Minute ()
- {
- DateTime jan1 = new DateTime(2001, 1, 1, 1, 1, 1);
- AssertEquals("#MI01", jan1.Minute, DateAndTime.Minute(jan1));
- }
-
- [Test]
- public void Second ()
- {
- DateTime jan1 = new DateTime(2001, 1, 1, 1, 1, 1);
- AssertEquals("#S01", jan1.Second, DateAndTime.Second(jan1));
- }
-
- [Test]
- public void Weekday ()
- {
- DateTime jan1 = new DateTime(2001, 1, 1, 1, 1, 1);
- AssertEquals("#W01", (int)jan1.DayOfWeek + 1, DateAndTime.Weekday(jan1, FirstDayOfWeek.System));
- }
-
- [Test]
- public void MonthName ()
- {
- DateTime jan1 = new DateTime(2001, 1, 1, 1, 1, 1);
- AssertEquals("#MN01", CultureInfo.CurrentCulture.DateTimeFormat.GetAbbreviatedMonthName(jan1.Month),
- DateAndTime.MonthName(jan1.Month, true));
- AssertEquals("#MN02", CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(jan1.Month),
- DateAndTime.MonthName(jan1.Month, false));
-
- bool caughtException = false;
-
- try {
- DateAndTime.MonthName(0, false);
- }
- catch (Exception e) {
- AssertEquals("#MN03", typeof(ArgumentException), e.GetType());
- caughtException = true;
- }
- AssertEquals("#MN04", true, caughtException);
-
- caughtException = false;
-
- try {
- DateAndTime.MonthName(14, false);
- }
- catch (Exception e) {
- AssertEquals("#MN05", typeof(ArgumentException), e.GetType());
- caughtException = true;
- }
- AssertEquals("#MN06", true, caughtException);
-
- //AssertEquals("#MN07", "", DateAndTime.MonthName(13, false));
- }
-
- [Test]
- public void WeekdayName ()
- {
- DateTime jan1 = new DateTime(2001, 1, 1, 1, 1, 1);
- AssertEquals("#WN01", "Tue",
- DateAndTime.WeekdayName((int)jan1.DayOfWeek + 1, true, FirstDayOfWeek.System));
- AssertEquals("#WN02", "Tuesday",
- DateAndTime.WeekdayName((int)jan1.DayOfWeek + 1, false, FirstDayOfWeek.System));
-
- bool caughtException = false;
-
- try {
- DateAndTime.WeekdayName(0, false, FirstDayOfWeek.System);
- }
- catch (Exception e) {
- AssertEquals("#WN03", typeof(ArgumentException), e.GetType());
- caughtException = true;
- }
- AssertEquals("#WN04", true, caughtException);
-
- caughtException = false;
-
- try {
- DateAndTime.WeekdayName(8, false, FirstDayOfWeek.System);
- }
- catch (Exception e) {
- AssertEquals("#WN05", typeof(ArgumentException), e.GetType());
- caughtException = true;
- }
- AssertEquals("#WN06", true, caughtException);
-
- AssertEquals("#WN07", "Tuesday", DateAndTime.WeekdayName((int)jan1.DayOfWeek + 1, false, FirstDayOfWeek.System));
- }
- }
-}
+// DateAndTimeTest.cs - NUnit Test Cases for Microsoft.VisualBasic.DateAndTime
+//
+// Authors:
+// Chris J. Breisch (cjbreisch@altavista.net)
+// Martin Willemoes Hansen (mwh@sysrq.dk)
+//
+// (C) Chris J. Breisch
+// (C) Martin Willemoes Hansen
+//
+
+using NUnit.Framework;
+using System;
+using System.Threading;
+using System.Globalization;
+using Microsoft.VisualBasic;
+
+namespace MonoTests.Microsoft.VisualBasic
+{
+ [TestFixture]
+ public class DateAndTimeTest : Assertion {
+
+ private CultureInfo oldcult;
+
+ [SetUp]
+ public void GetReady()
+ {
+ // the current culture determines the result of formatting
+ oldcult = Thread.CurrentThread.CurrentCulture;
+ Thread.CurrentThread.CurrentCulture = new CultureInfo ("");
+ }
+
+ [TearDown]
+ public void Clear()
+ {
+ Thread.CurrentThread.CurrentCulture = oldcult;
+ }
+
+ [Test]
+ public void DateString()
+ {
+ string s = DateAndTime.DateString;
+ DateTime dtNow = DateTime.Today;
+ AssertEquals("#DS01", dtNow.ToShortDateString(), DateTime.Parse(s).ToShortDateString());
+
+ // TODO: Add a test for setting the date string too
+ }
+
+ [Test]
+ public void Today()
+ {
+ AssertEquals("#TO01", DateTime.Today, DateAndTime.Today);
+
+ // TODO: Add a test for setting Today
+ }
+
+ [Test]
+ public void Timer()
+ {
+ double secTimer = DateAndTime.Timer;
+ DateTime dtNow = DateTime.Now;
+ double secNow = dtNow.Hour * 3600 + dtNow.Minute * 60 + dtNow.Second + (dtNow.Millisecond + 1) / 1000D;
+ double secTimer2 = DateAndTime.Timer + .001;
+
+ // waste a little time
+ for (int i = 0; i < int.MaxValue; i++);
+
+ // get another timer
+ double secTimer3 = DateAndTime.Timer;
+
+ // should be same time within a reasonable tolerance
+ Assert("#TI01", secNow >= secTimer);
+ Assert("#TI02: SecTimer2=" + secTimer2 + " secNow=" + secNow, secTimer2 >= secNow);
+
+ // third timer should be greater than the first
+ Assert("#TI03", secTimer3 > secTimer);
+ }
+
+ [Test]
+ public void Now()
+ {
+ DateTime dtNow = DateTime.Now;
+ DateTime dtTest = DateAndTime.Now;
+ DateTime dtNow2 = DateTime.Now;
+
+ Assert("#N01", dtTest >= dtNow);
+ Assert("#N02", dtNow2 >= dtTest);
+ }
+
+ [Test]
+ public void TimeOfDay()
+ {
+ DateTime dtNow = DateTime.Now;
+ TimeSpan tsNow = new TimeSpan(dtNow.Hour, dtNow.Minute, dtNow.Second);
+ DateTime dtTest = DateAndTime.TimeOfDay;
+ TimeSpan tsTest = new TimeSpan(dtTest.Hour, dtTest.Minute, dtTest.Second);
+ DateTime dtNow2 = DateTime.Now;
+ TimeSpan tsNow2 = new TimeSpan(dtNow2.Hour, dtNow2.Minute, dtNow2.Second);
+
+ Assert("#TOD01", tsTest.Ticks >= tsNow.Ticks);
+ Assert("#TOD02", tsNow2.Ticks >= tsTest.Ticks);
+
+ // TODO: add a test case for setting time of day
+ }
+
+ [Test]
+ public void TimeString()
+ {
+ DateTime dtNow = DateTime.Now;
+ TimeSpan tsNow = new TimeSpan(dtNow.Hour, dtNow.Minute, dtNow.Second);
+ string s = DateAndTime.TimeString;
+ DateTime dtTest = DateTime.Parse(s);
+ TimeSpan tsTest = new TimeSpan(dtTest.Hour, dtTest.Minute, dtTest.Second);
+ DateTime dtNow2 = DateTime.Now;
+ TimeSpan tsNow2 = new TimeSpan(dtNow2.Hour, dtNow2.Minute, dtNow2.Second);
+
+ Assert("#TS01", tsTest.Ticks >= tsNow.Ticks);
+ Assert("#TS02", tsNow2.Ticks >= tsTest.Ticks);
+
+ // TODO: add a test case for setting TimeString
+ }
+
+ [Test]
+ public void DateAdd()
+ {
+ DateTime dtNow = DateTime.Now;
+
+ AssertEquals("#DA01", dtNow.AddYears(1), DateAndTime.DateAdd(DateInterval.Year, 1, dtNow));
+ AssertEquals("#DA02", dtNow.AddYears(-1), DateAndTime.DateAdd("yyyy", -1, dtNow));
+
+
+ bool caughtException = false;
+
+ try {
+ DateAndTime.DateAdd("foo", 1, dtNow);
+ }
+ catch (Exception e) {
+ AssertEquals("#DA03", e.GetType(), typeof(ArgumentException));
+ caughtException = true;
+ }
+
+ AssertEquals("#DA04", caughtException, true);
+
+ AssertEquals("#DA05", dtNow.AddMonths(6), DateAndTime.DateAdd(DateInterval.Quarter, 2, dtNow));
+ AssertEquals("#DA06", dtNow.AddMonths(-6), DateAndTime.DateAdd("q", -2, dtNow));
+
+ AssertEquals("#DA07", dtNow.AddMonths(3), DateAndTime.DateAdd(DateInterval.Month, 3, dtNow));
+ AssertEquals("#DA08", dtNow.AddMonths(-3), DateAndTime.DateAdd("m", -3, dtNow));
+
+ AssertEquals("#DA09", dtNow.AddDays(28), DateAndTime.DateAdd(DateInterval.WeekOfYear, 4, dtNow));
+ AssertEquals("#DA10", dtNow.AddDays(-28), DateAndTime.DateAdd("ww", -4, dtNow));
+
+ AssertEquals("#DA11", dtNow.AddDays(5), DateAndTime.DateAdd(DateInterval.Weekday, 5, dtNow));
+ AssertEquals("#DA12", dtNow.AddDays(-5), DateAndTime.DateAdd("w", -5, dtNow));
+
+ AssertEquals("#DA13", dtNow.AddDays(6), DateAndTime.DateAdd(DateInterval.DayOfYear, 6, dtNow));
+ AssertEquals("#DA14", dtNow.AddDays(-6), DateAndTime.DateAdd("y", -6, dtNow));
+
+ AssertEquals("#DA15", dtNow.AddDays(7), DateAndTime.DateAdd(DateInterval.Day, 7, dtNow));
+ AssertEquals("#DA16", dtNow.AddDays(-7), DateAndTime.DateAdd("d", -7, dtNow));
+
+ AssertEquals("#DA17", dtNow.AddHours(8), DateAndTime.DateAdd(DateInterval.Hour, 8, dtNow));
+ AssertEquals("#DA18", dtNow.AddHours(-8), DateAndTime.DateAdd(DateInterval.Hour, -8, dtNow));
+
+ AssertEquals("#DA19", dtNow.AddMinutes(9), DateAndTime.DateAdd(DateInterval.Minute, 9, dtNow));
+ AssertEquals("#DA20", dtNow.AddMinutes(-9), DateAndTime.DateAdd("n", -9, dtNow));
+
+ AssertEquals("#DA21", dtNow.AddSeconds(10), DateAndTime.DateAdd(DateInterval.Second, 10, dtNow));
+ AssertEquals("#DA22", dtNow.AddSeconds(-10), DateAndTime.DateAdd("s", -10, dtNow));
+
+ caughtException = false;
+
+ try {
+ DateAndTime.DateAdd(DateInterval.Year, int.MinValue, dtNow);
+ }
+ catch (Exception e) {
+ caughtException = true;
+ AssertEquals("#DA23", e.GetType(), typeof(Exception));
+ }
+
+ // AssertEquals("#DA24", caughtException, true);
+ }
+
+ [Test]
+ public void DateDiff ()
+ {
+ DateTime dtNow = DateTime.Now;
+ DateTime dtOld = dtNow.AddYears(-1);
+
+ // TODO: Test this better
+ long diff = DateAndTime.DateDiff(DateInterval.Year, dtOld, dtNow, FirstDayOfWeek.System, FirstWeekOfYear.System);
+
+ AssertEquals("#DD01", dtNow, dtOld.AddYears((int)diff));
+
+ DateTime dtJan1 = new DateTime(2002, 1, 1);
+ DateTime dtDec31 = new DateTime(2001, 12, 31);
+
+ diff = DateAndTime.DateDiff(DateInterval.Year, dtDec31, dtJan1, FirstDayOfWeek.System, FirstWeekOfYear.System);
+
+ AssertEquals("#DD02", 1L, diff);
+
+ diff = DateAndTime.DateDiff(DateInterval.Quarter, dtDec31, dtJan1, FirstDayOfWeek.System, FirstWeekOfYear.System);
+
+ AssertEquals("#DD03", 1L, diff);
+
+ diff = DateAndTime.DateDiff(DateInterval.Month, dtDec31, dtJan1, FirstDayOfWeek.System, FirstWeekOfYear.System);
+
+ AssertEquals("#DD04", 1L, diff);
+
+ DateTime dtJan4 = new DateTime(2001, 1, 4); // This is a Thursday
+ DateTime dtJan9 = new DateTime(2001, 1, 9); // This is the next Tuesday
+
+
+ long WD = DateAndTime.DateDiff(DateInterval.Weekday, dtJan4, dtJan9, FirstDayOfWeek.System, FirstWeekOfYear.System);
+
+ AssertEquals ("#DD05", 0L, WD);
+
+ long WY = DateAndTime.DateDiff(DateInterval.WeekOfYear, dtJan4, dtJan9, FirstDayOfWeek.System, FirstWeekOfYear.System);
+
+ AssertEquals ("#DD06", 1L, WY);
+ }
+
+ [Test]
+ public void DatePart ()
+ {
+ DateTime dtJan4 = new DateTime(2001, 1, 4);
+
+ // TODO: Test this better
+
+ AssertEquals("#DP01", 2001, DateAndTime.DatePart(DateInterval.Year, dtJan4, FirstDayOfWeek.System, FirstWeekOfYear.System));
+ AssertEquals("#DP02", 1, DateAndTime.DatePart(DateInterval.Quarter, dtJan4, FirstDayOfWeek.System, FirstWeekOfYear.System));
+ AssertEquals("#DP03", 1, DateAndTime.DatePart(DateInterval.Month, dtJan4, FirstDayOfWeek.System, FirstWeekOfYear.System));
+ AssertEquals("#DP04", 1, DateAndTime.DatePart(DateInterval.WeekOfYear, dtJan4, FirstDayOfWeek.System, FirstWeekOfYear.FirstFourDays));
+ AssertEquals("#DP05", 53, DateAndTime.DatePart(DateInterval.WeekOfYear, dtJan4, FirstDayOfWeek.System, FirstWeekOfYear.FirstFullWeek));
+ AssertEquals("#DP06", 1, DateAndTime.DatePart(DateInterval.WeekOfYear, dtJan4, FirstDayOfWeek.System, FirstWeekOfYear.Jan1));
+ AssertEquals("#DP07", 1, DateAndTime.DatePart(DateInterval.WeekOfYear, dtJan4, FirstDayOfWeek.System, FirstWeekOfYear.System));
+ AssertEquals("#DP08", 7, DateAndTime.DatePart(DateInterval.Weekday, dtJan4, FirstDayOfWeek.Friday, FirstWeekOfYear.FirstFourDays));
+ AssertEquals("#DP09", 6, DateAndTime.DatePart(DateInterval.Weekday, dtJan4, FirstDayOfWeek.Saturday, FirstWeekOfYear.FirstFourDays));
+ AssertEquals("#DP10", 5, DateAndTime.DatePart(DateInterval.Weekday, dtJan4, FirstDayOfWeek.Sunday, FirstWeekOfYear.FirstFourDays));
+ AssertEquals("#DP11", 4, DateAndTime.DatePart(DateInterval.Weekday, dtJan4, FirstDayOfWeek.Monday, FirstWeekOfYear.FirstFourDays));
+ AssertEquals("#DP12", 3, DateAndTime.DatePart(DateInterval.Weekday, dtJan4, FirstDayOfWeek.Tuesday, FirstWeekOfYear.FirstFourDays));
+ AssertEquals("#DP13", 2, DateAndTime.DatePart(DateInterval.Weekday, dtJan4, FirstDayOfWeek.Wednesday, FirstWeekOfYear.FirstFourDays));
+ AssertEquals("#DP14", 1, DateAndTime.DatePart(DateInterval.Weekday, dtJan4, FirstDayOfWeek.Thursday, FirstWeekOfYear.FirstFourDays));
+ AssertEquals("#DP15", 5, DateAndTime.DatePart(DateInterval.Weekday, dtJan4, FirstDayOfWeek.System, FirstWeekOfYear.FirstFourDays));
+
+
+ }
+
+ [Test]
+ public void DateSerial ()
+ {
+ DateTime dtJan4 = new DateTime(2001, 1, 4);
+ DateTime dtSerial = DateAndTime.DateSerial(2001, 1, 4);
+
+ AssertEquals("#DS01", dtJan4, dtSerial);
+ }
+
+ [Test]
+ public void TimeSerial ()
+ {
+ bool caughtException = false;
+
+ try {
+ DateAndTime.TimeSerial(0, -1440, -1);
+ }
+ catch (Exception e) {
+ AssertEquals("#TS01", e.GetType(), typeof(ArgumentOutOfRangeException));
+ caughtException = true;
+ }
+ AssertEquals("#TS02", true, caughtException);
+
+ AssertEquals("#TS03", new DateTime(1, 1, 1, 1, 1, 1), DateAndTime.TimeSerial(1, 1, 1));
+
+ }
+
+ [Test]
+ public void DateValue ()
+ {
+ try {
+ DateAndTime.DateValue("This is not a date.");
+ }
+ catch (InvalidCastException) {
+ /* do nothing. this is what we expect */
+ }
+ catch (Exception e) {
+ Fail ("Unexpected exception:" + e);
+ }
+ AssertEquals("#DV03", new DateTime(1969, 2, 12), DateAndTime.DateValue("February 12, 1969"));
+ }
+
+ [Test]
+ public void TimeValue ()
+ {
+ try {
+ DateAndTime.TimeValue("This is not a time.");
+ }
+ catch (InvalidCastException) {
+ /* do nothing. this is what we expect */
+ }
+ catch (Exception e) {
+ Fail ("Unexpected exception:" + e);
+ }
+ AssertEquals("#TV03", new DateTime(1, 1, 1, 16, 35, 17), DateAndTime.TimeValue("4:35:17 PM"));
+ }
+
+ [Test]
+ public void Year ()
+ {
+ DateTime jan1 = new DateTime(2001, 1, 1, 1, 1, 1);
+ AssertEquals("#Y01", jan1.Year, DateAndTime.Year(jan1));
+ }
+
+ [Test]
+ public void Month ()
+ {
+ DateTime jan1 = new DateTime(2001, 1, 1, 1, 1, 1);
+ AssertEquals("#MO01", jan1.Month, DateAndTime.Month(jan1));
+ }
+
+ [Test]
+ public void Day ()
+ {
+ DateTime jan1 = new DateTime(2001, 1, 1, 1, 1, 1);
+ AssertEquals("#D01", jan1.Day, DateAndTime.Day(jan1));
+ }
+
+ [Test]
+ public void Hour ()
+ {
+ DateTime jan1 = new DateTime(2001, 1, 1, 1, 1, 1);
+ AssertEquals("#H01", jan1.Hour, DateAndTime.Hour(jan1));
+ }
+
+ [Test]
+ public void Minute ()
+ {
+ DateTime jan1 = new DateTime(2001, 1, 1, 1, 1, 1);
+ AssertEquals("#MI01", jan1.Minute, DateAndTime.Minute(jan1));
+ }
+
+ [Test]
+ public void Second ()
+ {
+ DateTime jan1 = new DateTime(2001, 1, 1, 1, 1, 1);
+ AssertEquals("#S01", jan1.Second, DateAndTime.Second(jan1));
+ }
+
+ [Test]
+ public void Weekday ()
+ {
+ DateTime jan1 = new DateTime(2001, 1, 1, 1, 1, 1);
+ AssertEquals("#W01", (int)jan1.DayOfWeek + 1, DateAndTime.Weekday(jan1, FirstDayOfWeek.System));
+ }
+
+ [Test]
+ public void MonthName ()
+ {
+ DateTime jan1 = new DateTime(2001, 1, 1, 1, 1, 1);
+ AssertEquals("#MN01", CultureInfo.CurrentCulture.DateTimeFormat.GetAbbreviatedMonthName(jan1.Month),
+ DateAndTime.MonthName(jan1.Month, true));
+ AssertEquals("#MN02", CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(jan1.Month),
+ DateAndTime.MonthName(jan1.Month, false));
+
+ bool caughtException = false;
+
+ try {
+ DateAndTime.MonthName(0, false);
+ }
+ catch (Exception e) {
+ AssertEquals("#MN03", typeof(ArgumentException), e.GetType());
+ caughtException = true;
+ }
+ AssertEquals("#MN04", true, caughtException);
+
+ caughtException = false;
+
+ try {
+ DateAndTime.MonthName(14, false);
+ }
+ catch (Exception e) {
+ AssertEquals("#MN05", typeof(ArgumentException), e.GetType());
+ caughtException = true;
+ }
+ AssertEquals("#MN06", true, caughtException);
+
+ //AssertEquals("#MN07", "", DateAndTime.MonthName(13, false));
+ }
+
+ [Test]
+ public void WeekdayName ()
+ {
+ DateTime jan1 = new DateTime(2001, 1, 1, 1, 1, 1);
+ AssertEquals("#WN01", "Tue",
+ DateAndTime.WeekdayName((int)jan1.DayOfWeek + 1, true, FirstDayOfWeek.Monday));
+ AssertEquals("#WN02", "Tuesday",
+ DateAndTime.WeekdayName((int)jan1.DayOfWeek + 1, false, FirstDayOfWeek.Monday));
+
+ bool caughtException = false;
+
+ try {
+ DateAndTime.WeekdayName(0, false, FirstDayOfWeek.Monday);
+ }
+ catch (Exception e) {
+ AssertEquals("#WN03", typeof(ArgumentException), e.GetType());
+ caughtException = true;
+ }
+ AssertEquals("#WN04", true, caughtException);
+
+ caughtException = false;
+
+ try {
+ DateAndTime.WeekdayName(8, false, FirstDayOfWeek.Monday);
+ }
+ catch (Exception e) {
+ AssertEquals("#WN05", typeof(ArgumentException), e.GetType());
+ caughtException = true;
+ }
+ AssertEquals("#WN06", true, caughtException);
+
+ AssertEquals("#WN07", "Tuesday", DateAndTime.WeekdayName((int)jan1.DayOfWeek + 1, false, FirstDayOfWeek.Monday));
+ }
+ }
+}
diff --git a/mcs/class/Microsoft.VisualBasic/Test/Microsoft.VisualBasic/FileSystemTest.cs b/mcs/class/Microsoft.VisualBasic/Test/Microsoft.VisualBasic/FileSystemTest.cs
new file mode 100755
index 00000000000..58af5dbe57e
--- /dev/null
+++ b/mcs/class/Microsoft.VisualBasic/Test/Microsoft.VisualBasic/FileSystemTest.cs
@@ -0,0 +1,40 @@
+// FileSystemTest.cs - NUnit Test Cases for vb module FileSystem
+// (class Microsoft.VisualBasic.FileSystem)
+//
+// Rafael Teixeira (rafaelteixeirabr@hotmail.com)
+//
+// (C) Rafael Teixeira
+//
+
+using NUnit.Framework;
+using System;
+using Microsoft.VisualBasic;
+
+namespace MonoTests.Microsoft.VisualBasic
+{
+
+ [TestFixture]
+ public class FileSystemTest : Assertion {
+
+ [SetUp]
+ public void GetReady() {}
+
+ [TearDown]
+ public void Clean() {}
+
+ [Test]
+ [ExpectedException(typeof(ArgumentException))]
+ public void TestDir() {
+ FileSystem.Dir();
+ Fail ("Calling as the first thing the parameterless overload of Dir didn't throw an exception");
+ }
+
+ [Test]
+ public void TestDirWithSourceFile() {
+ AssertEquals("Didn't found the source file with pattern './Microsoft.VisualBasic/FileSystem.cs'",
+ "FileSystem.cs",
+ FileSystem.Dir("./Microsoft.VisualBasic/FileSystem.cs", FileAttribute.Normal)) ;
+ }
+
+ }
+}
diff --git a/mcs/class/Microsoft.VisualBasic/Test/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/ChangeLog b/mcs/class/Microsoft.VisualBasic/Test/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/ChangeLog
new file mode 100644
index 00000000000..e7579b0b94f
--- /dev/null
+++ b/mcs/class/Microsoft.VisualBasic/Test/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/ChangeLog
@@ -0,0 +1,8 @@
+2004-01-21 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
+ * Added UtilsTest.cs:
+ More tests (with bidimensional arrays) for Utils.CopyArray undocumented runtime function,
+ they are still failing tests
+
+2004-01-21 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
+ * Added UtilsTest.cs:
+ Initial tests for Utils.CopyArray undocumented runtime function
diff --git a/mcs/class/Microsoft.VisualBasic/Test/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/UtilsTest.cs b/mcs/class/Microsoft.VisualBasic/Test/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/UtilsTest.cs
new file mode 100755
index 00000000000..24c6794c0fc
--- /dev/null
+++ b/mcs/class/Microsoft.VisualBasic/Test/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/UtilsTest.cs
@@ -0,0 +1,93 @@
+// UtilsTest.cs - NUnit Test Cases for class Microsoft.VisualBasic.CompilerServices.Utils
+//
+// Rafael Teixeira (rafaelteixeirabr@hotmail.com)
+//
+// (C) 2004 Rafael Teixeira
+//
+
+using NUnit.Framework;
+using System;
+using Microsoft.VisualBasic.CompilerServices;
+
+namespace MonoTests.Microsoft.VisualBasic.CompilerServices
+{
+
+ [TestFixture]
+ public class UtilsTest : Assertion {
+
+ [SetUp]
+ public void GetReady() {}
+
+ [TearDown]
+ public void Clean() {}
+
+ [Test]
+ public void TestCopyArrayOneDimensionalShrinking() {
+ string[] source = new string[] { "First", "Second", "Third" };
+ string[] destination = new string[2];
+ string[] result = (string[])Utils.CopyArray(source, destination);
+ AssertEquals ("ResultIsDestination", destination, result);
+ AssertEquals ("First", source[0], destination[0]);
+ AssertEquals ("Second", source[1], destination[1]);
+ }
+
+ [Test]
+ public void TestCopyArrayOneDimensionalExpanding() {
+ string[] source = new string[] { "First", "Second" };
+ string[] destination = new string[3];
+ string[] result = (string[])Utils.CopyArray(source, destination);
+ AssertEquals ("ResultIsDestination", destination, result);
+ AssertEquals ("First", source[0], destination[0]);
+ AssertEquals ("Second", source[1], destination[1]);
+ AssertEquals ("EmptyThird", null, destination[2]);
+ }
+
+ [Test]
+ public void TestCopyArrayBiDimensionalShrinking() {
+ string[,] source = new string[2,2];
+ source[0,0] = "First";
+ source[0,1] = "Second";
+ source[1,0] = "Third";
+ source[1,1] = "Fourth";
+ string[,] destination = new string[2,1];
+ string[,] result = (string[,])Utils.CopyArray(source, destination);
+ AssertEquals ("ResultIsDestination", destination, result);
+ AssertEquals ("First", source[0,0], destination[0,0]);
+ AssertEquals ("Third", source[1,0], destination[1,0]);
+ }
+
+ [Test]
+ public void TestCopyArrayBiDimensionalExpanding() {
+ string[,] source = new string[2,2];
+ source[0,0] = "First";
+ source[0,1] = "Second";
+ source[1,0] = "Third";
+ source[1,1] = "Fourth";
+ string[,] destination = new string[2,3];
+ string[,] result = (string[,])Utils.CopyArray(source, destination);
+ AssertEquals ("ResultIsDestination", destination, result);
+ AssertEquals ("First", source[0,0], destination[0,0]);
+ AssertEquals ("Second", source[0,1], destination[0,1]);
+ AssertEquals ("Third", source[1,0], destination[1,0]);
+ AssertEquals ("Fourth", source[1,1], destination[1,1]);
+ AssertEquals ("EmptyFifth", null, destination[0,2]);
+ AssertEquals ("EmptySixth", null, destination[1,2]);
+ }
+
+ // An nice way to test for exceptions the class under test should
+ // throw is:
+ /*
+ [Test]
+ [ExpectedException(typeof(ArgumentNullException))]
+ public void OnValid() {
+ ConcreteCollection myCollection;
+ myCollection = new ConcreteCollection();
+ ....
+ AssertEquals ("#UniqueID", expected, actual);
+ ....
+ Fail ("Message");
+ }
+ */
+
+ }
+}
diff --git a/mcs/class/Microsoft.VisualBasic/Test/StringsTest.cs b/mcs/class/Microsoft.VisualBasic/Test/Microsoft.VisualBasic/StringsTest.cs
index 1d4765614a6..0e6b77a53db 100644
--- a/mcs/class/Microsoft.VisualBasic/Test/StringsTest.cs
+++ b/mcs/class/Microsoft.VisualBasic/Test/Microsoft.VisualBasic/StringsTest.cs
@@ -1,1735 +1,1735 @@
-//
-// StringsTest.cs
-//
-// Authors:
-// Jochen Wezel (jwezel@compumaster.de)
-//
-// (C) 2003 Jochen Wezel, CompuMaster GmbH (http://www.compumaster.de/)
-//
-
-using Microsoft.VisualBasic;
-using System;
-using System.Text;
-using System.Globalization;
-using NUnit.Framework;
-
-namespace MonoTests.Microsoft.VisualBasic
-{
- [TestFixture]
- public class StringsTest : Assertion
- {
- private string TextStringOfMultipleLanguages;
- private string TextStringUninitialized;
- const string TextStringEmpty = "";
-
- //Disclaimer: I herewith distance me and the whole Mono project of text written in this test strings - they are really only for testing purposes and are copy and pasted of randomly found test parts of several suriously looking websites
- const string MSWebSiteContent_English = "Choose the location for which you want contact information:";
- const string MSWebSiteContent_Japanese = "é›»å­ãƒ¡ãƒ¼ãƒ«ã‚’ã¯ã˜ã‚ã€äºˆå®šè¡¨ã‚„アドレス帳ãªã©ã®å€‹äººæƒ…å ±ã€ã•ã‚‰ã«ã¯ Office v. X ã®å„アプリケーションã§ä½œæˆã—ãŸæ›¸é¡žã‚„ãã®ä»–ã®ãƒ•ã‚¡ã‚¤ãƒ«ã‚’リンクã•ã›ã¦çµ±åˆçš„ã«ç®¡ç†ã™ã‚‹ã“ã¨ãŒã§ãるコミュニケーションï¼å€‹äººæƒ…報管ç†ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã§ã™ã€‚インターフェースãŒä¸€æ–°ã•ã‚Œã€é«˜åº¦ã§å¤šå½©ãª Entourage X ã®æ©Ÿèƒ½ãŒã‚ˆã‚Šç›´æ„Ÿçš„ã«åˆ©ç”¨ã§ãるよã†ã«ãªã‚Šã¾ã—ãŸã€‚以å‰ãŠä½¿ã„ã«ãªã£ã¦ã„ãŸé›»å­ãƒ¡ãƒ¼ãƒ« アプリケーションã‹ã‚‰ã®æƒ…å ±ã®ã‚¤ãƒ³ãƒãƒ¼ãƒˆã‚‚容易ã«ã§ãã¾ã™ã€‚";
- const string MSWebSiteContent_Russian = "будете автоматичеÑки перенаправлены";
- const string MSWebSiteContent_Slovakian = "Äníci nároÄných používateľovNové portfólio Microsoft Hardware. Å¡piÄkové optické bezdrôtové myÅ¡ky s novou technológiou - nakláňacím kolieskom. Nezáleží na tom, aký stôl máte, pokiaľ je na ňom elegantná";
- const string MSWebSiteContent_Korean = "보안 ìº íŽ˜ì¸ - 스스로 지킨 ë‹¹ì‹ ì˜ PC! ë”ìš± 안전해집니다!";
- const string ArabynetComWebSiteContent_Arabic = "كل الحقوق محÙوظة ليديعوت إنترنت";
- const string GermanUmlauts_German = "äöüÄÖÜß";
-
- private char Letter_Empty;
- private char Letter_English;
- private char Letter_Japanese;
- private char Letter_Russian;
- private char Letter_Slovakian;
- private char Letter_Korean;
- private char Letter_Arabic;
- private char Letter_German;
-
- [SetUp]
- public void Setup()
- {
- TextStringOfMultipleLanguages =
- MSWebSiteContent_Japanese +
- MSWebSiteContent_Russian +
- MSWebSiteContent_Slovakian +
- MSWebSiteContent_Korean +
- ArabynetComWebSiteContent_Arabic +
- GermanUmlauts_German;
- Letter_English = MSWebSiteContent_English[0];
- Letter_Japanese = MSWebSiteContent_Japanese[0];
- Letter_Russian = MSWebSiteContent_Russian[0];
- Letter_Slovakian = MSWebSiteContent_Slovakian[0];
- Letter_Korean = MSWebSiteContent_Korean[0];
- Letter_Arabic = ArabynetComWebSiteContent_Arabic[0];
- Letter_German = GermanUmlauts_German[0];
- }
-
-
- //TODO: additional tests with other system/languages (especially other Asian ones)
- // pay attention to
- // 1. Byte count
- // 2. Little or big endian
- [Test]
- public void Asc()
- {
- Asc_Char();
- Asc_String();
- }
-
- public void Asc_Char()
- {
- // buffer current culture
- System.Globalization.CultureInfo CurCulture = System.Threading.Thread.CurrentThread.CurrentCulture;
-
- Encoding defencoding;
- defencoding = Encoding.Default;
-
- System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
- NUnit.Framework.Assertion.AssertEquals ("JW*Asc#US29", 1252, System.Globalization.CultureInfo.CurrentCulture.TextInfo.ANSICodePage);
- NUnit.Framework.Assertion.AssertEquals ("JW*Asc#US26", 0, Strings.Asc(Letter_Empty));
- NUnit.Framework.Assertion.AssertEquals ("JW*Asc#US27 - Quotation mark test", 34, Strings.Asc("\""[0]));
- if (defencoding.GetMaxByteCount(1) == 1)
- {
- NUnit.Framework.Assertion.AssertEquals ("JW*Asc#US28 - JapaneseCharacter", 63, Strings.Asc(MSWebSiteContent_Japanese[0]));
- NUnit.Framework.Assertion.AssertEquals ("JW*Asc#US28a - GermanCharacter", 228, Strings.Asc(Letter_German));
- }
- else
- {
- NUnit.Framework.Assertion.AssertEquals ("JW*Asc#US28W - JapaneseCharacter", -27804, Strings.Asc(MSWebSiteContent_Japanese[0]));
- NUnit.Framework.Assertion.AssertEquals ("JW*Asc#US28aW - GermanCharacter", 97, Strings.Asc(Letter_German));
- }
-
- System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo("de-DE");
- NUnit.Framework.Assertion.AssertEquals ("JW*Asc#DE29", 1252, System.Globalization.CultureInfo.CurrentCulture.TextInfo.ANSICodePage);
- NUnit.Framework.Assertion.AssertEquals ("JW*Asc#DE26", 0, Strings.Asc(Letter_Empty));
- NUnit.Framework.Assertion.AssertEquals ("JW*Asc#DE27 - Quotation mark test", 34, Strings.Asc("\""[0]));
- if (defencoding.GetMaxByteCount(1) == 1)
- {
- NUnit.Framework.Assertion.AssertEquals ("JW*Asc#US28 - JapaneseCharacter", 63, Strings.Asc(MSWebSiteContent_Japanese[0]));
- NUnit.Framework.Assertion.AssertEquals ("JW*Asc#DE28a - GermanCharacter", 228, Strings.Asc(Letter_German));
- }
- else
- {
- NUnit.Framework.Assertion.AssertEquals ("JW*Asc#DE28W - JapaneseCharacter", -27804, Strings.Asc(MSWebSiteContent_Japanese[0]));
- NUnit.Framework.Assertion.AssertEquals ("JW*Asc#DE28aW - GermanCharacter", 97, Strings.Asc(Letter_German));
- }
-
- System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo("ja-JP");
- NUnit.Framework.Assertion.AssertEquals ("JW*Asc#JA29", 932, System.Globalization.CultureInfo.CurrentCulture.TextInfo.ANSICodePage);
- NUnit.Framework.Assertion.AssertEquals ("JW*Asc#JA26", 0, Strings.Asc(Letter_Empty));
- NUnit.Framework.Assertion.AssertEquals ("JW*Asc#JA27 - Quotation mark test", 34, Strings.Asc("\""[0]));
- if (defencoding.GetMaxByteCount(1) == 1)
- {
- NUnit.Framework.Assertion.AssertEquals ("JW*Asc#JA28 - JapaneseCharacter", 63, Strings.Asc(MSWebSiteContent_Japanese[0]));
- NUnit.Framework.Assertion.AssertEquals ("JW*Asc#JA28a - GermanCharacter", 228, Strings.Asc(Letter_German));
- }
- else
- {
- NUnit.Framework.Assertion.AssertEquals ("JW*Asc#JA28W - JapaneseCharacter", -27804, Strings.Asc(MSWebSiteContent_Japanese[0]));
- NUnit.Framework.Assertion.AssertEquals ("JW*Asc#JA28aW - GermanCharacter", 97, Strings.Asc(Letter_German));
- }
-
- // restore buffered culture
- System.Threading.Thread.CurrentThread.CurrentCulture = CurCulture;
- }
-
-
- public void Asc_String()
- {
- Encoding defencoding;
- defencoding = Encoding.Default;
-
- if (defencoding.GetMaxByteCount(1) == 1)
- {
- //single byte systems
- NUnit.Framework.Assertion.AssertEquals ("JW*Asc#01", 63, Strings.Asc(this.TextStringOfMultipleLanguages));
- NUnit.Framework.Assertion.AssertEquals ("JW*Asc#02", 99, Strings.Asc(MSWebSiteContent_Slovakian));
- NUnit.Framework.Assertion.AssertEquals ("JW*Asc#03", 63, Strings.Asc(MSWebSiteContent_Japanese));
- NUnit.Framework.Assertion.AssertEquals ("JW*Asc#04", 63, Strings.Asc(ArabynetComWebSiteContent_Arabic));
- NUnit.Framework.Assertion.AssertEquals ("JW*Asc#05", 63, Strings.Asc(MSWebSiteContent_Korean));
- NUnit.Framework.Assertion.AssertEquals ("JW*Asc#06", 63, Strings.Asc(MSWebSiteContent_Russian));
- NUnit.Framework.Assertion.AssertEquals ("JW*Asc#07", 67, Strings.Asc(MSWebSiteContent_English));
- }
- else
- {
- //double byte charsets (wide)
- NUnit.Framework.Assertion.AssertEquals ("JW*Asc#01W", -27804, Strings.Asc(this.TextStringOfMultipleLanguages));
- NUnit.Framework.Assertion.AssertEquals ("JW*Asc#02W", 63, Strings.Asc(MSWebSiteContent_Slovakian));
- NUnit.Framework.Assertion.AssertEquals ("JW*Asc#03W", -27804, Strings.Asc(MSWebSiteContent_Japanese));
- NUnit.Framework.Assertion.AssertEquals ("JW*Asc#04W", 63, Strings.Asc(ArabynetComWebSiteContent_Arabic));
- NUnit.Framework.Assertion.AssertEquals ("JW*Asc#05W", 63, Strings.Asc(MSWebSiteContent_Korean));
- NUnit.Framework.Assertion.AssertEquals ("JW*Asc#06W", -31631, Strings.Asc(MSWebSiteContent_Russian));
- NUnit.Framework.Assertion.AssertEquals ("JW*Asc#07W", 67, Strings.Asc(MSWebSiteContent_English));
- }
- try
- {
- object buffer = Strings.Asc(TextStringEmpty);
- NUnit.Framework.Assertion.Fail ("JW*Asc#08 hasn't thrown an error");
- }
- catch
- {
- NUnit.Framework.Assertion.Assert ("JW*Asc#08", true);
- }
- try
- {
- object buffer = Strings.Asc(null);
- NUnit.Framework.Assertion.Fail ("JW*Asc#09 hasn't thrown an error");
- }
- catch
- {
- NUnit.Framework.Assertion.Assert ("JW*Asc#09", true);
- }
- try
- {
- object buffer = Strings.Asc(TextStringUninitialized);
- NUnit.Framework.Assertion.Fail ("JW*Asc#10 hasn't thrown an error");
- }
- catch
- {
- NUnit.Framework.Assertion.Assert ("JW*Asc#10", true);
- }
- NUnit.Framework.Assertion.AssertEquals ("JW*Asc#11 - Quotation mark test", 34, Strings.Asc("\""));
- }
-
-
- [Test]
- public void AscW()
- {
- AscW_Char();
- AscW_String();
- }
-
- public void AscW_Char()
- {
- NUnit.Framework.Assertion.AssertEquals ("JW#12", 0, Strings.AscW(Letter_Empty));
- NUnit.Framework.Assertion.AssertEquals ("JW#13 - Quotation mark test", 34, Strings.AscW("\""[0]));
- NUnit.Framework.Assertion.AssertEquals ("JW#14 - JapaneseCharacter", 38651, Strings.AscW(Letter_Japanese));
- NUnit.Framework.Assertion.AssertEquals ("JW#14a - ArabicCharacter", 1603, Strings.AscW(Letter_Arabic));
- NUnit.Framework.Assertion.AssertEquals ("JW#14b - GermanCharacter", 228, Strings.AscW(Letter_German));
- }
-
- public void AscW_String()
- {
- NUnit.Framework.Assertion.AssertEquals ("JW#15", 38651, Strings.AscW(this.TextStringOfMultipleLanguages));
- NUnit.Framework.Assertion.AssertEquals ("JW#16", 269, Strings.AscW(MSWebSiteContent_Slovakian));
- NUnit.Framework.Assertion.AssertEquals ("JW#17", 38651, Strings.AscW(MSWebSiteContent_Japanese));
- NUnit.Framework.Assertion.AssertEquals ("JW#18", 1603, Strings.AscW(ArabynetComWebSiteContent_Arabic));
- NUnit.Framework.Assertion.AssertEquals ("JW#19", 48372, Strings.AscW(MSWebSiteContent_Korean));
- NUnit.Framework.Assertion.AssertEquals ("JW#20", 1073, Strings.AscW(MSWebSiteContent_Russian));
- NUnit.Framework.Assertion.AssertEquals ("JW#21", 67, Strings.AscW(MSWebSiteContent_English));
- try
- {
- object buffer = Strings.AscW(TextStringEmpty);
- NUnit.Framework.Assertion.Fail ("JW#22 hasn't thrown an error");
- }
- catch
- {
- NUnit.Framework.Assertion.Assert ("JW#22", true);
- }
- try
- {
- object buffer = Strings.AscW(null);
- NUnit.Framework.Assertion.Fail ("JW#23 hasn't thrown an error");
- }
- catch
- {
- NUnit.Framework.Assertion.Assert ("JW#23", true);
- }
- try
- {
- object buffer = Strings.AscW(TextStringUninitialized);
- NUnit.Framework.Assertion.Fail ("JW#24 hasn't thrown an error");
- }
- catch
- {
- NUnit.Framework.Assertion.Assert ("JW#24", true);
- }
- NUnit.Framework.Assertion.AssertEquals ("JW#25 - Quotation mark test", 34, Strings.AscW("\""));
- }
-
- [Test]
- public void Chr()
- {
- NUnit.Framework.Assertion.AssertEquals ("JW#29", "@"[0], Strings.Chr(64));
- try
- {
- object buffer = Strings.Chr(38651);
- NUnit.Framework.Assertion.Fail ("JW#30 hasn't thrown an error");
- }
- catch
- {
- NUnit.Framework.Assertion.Assert ("JW#30", true);
- }
- NUnit.Framework.Assertion.AssertEquals ("JW#31 - Quotation mark test", "\""[0], Strings.Chr(34));
- }
-
- [Test]
- public void ChrW()
- {
- NUnit.Framework.Assertion.AssertEquals ("JW#32", "@"[0], Strings.ChrW(64));
- NUnit.Framework.Assertion.AssertEquals ("JW#33", "é›»"[0], Strings.ChrW(38651));
- NUnit.Framework.Assertion.AssertEquals ("JW#34 - Quotation mark test", "\""[0], Strings.ChrW(34));
- }
-
-
- //TODO: [Test]
- public void Filter()
- {
- Filter_Objects();
- Filter_Strings();
- }
-
- public void Filter_Objects()
- {
- /*
- if (Source +AD0APQ- null)
- throw new ArgumentException("Argument 'Source' can not be null.", "Source");
- if (Source.Rank +AD4- 1)
- throw new ArgumentException("Argument 'Source' can have only one dimension.", "Source");
-
- string+AFsAXQ- strings;
- strings = new string[Source.Length+AF0AOw-
-
- Source.CopyTo(strings, 0);
- return Filter(strings, Match, Include, Compare);
- */
- }
-
- public void Filter_Strings()
- {
- /*
- if (Source +AD0APQ- null)
- throw new ArgumentException("Argument 'Source' can not be null.", "Source");
- if (Source.Rank +AD4- 1)
- throw new ArgumentException("Argument 'Source' can have only one dimension.", "Source");
-
- //* Well, I don't like it either. But I figured that two iterations
- //* on the array would be better than many aloocations. Besides, this
- //* way I can isolate the special cases.
- //* I'd love to hear from a different approach.
-
- int count = Source.Length;
- bool+AFsAXQ- matches = new bool[count+AF0AOw-
- int matchesCount = 0;
-
- for (int i = 0; i +ADw- count; i++)
- {
- if (InStr(1, Match, Source[i], Compare) +ACEAPQ- 0)
- {
- //found one more
- matches[i] = true;
- matchesCount ++;
- }
- else
- {
- matches[i] = false;
- }
- }
-
- if (matchesCount +AD0APQ- 0)
- {
- if (Include)
- return new string[0+AF0AOw-
- else
- return Source;
- }
- else
- {
- if (matchesCount +AD0APQ- count)
- {
- if (Include)
- return Source;
- else
- return new string[0+AF0AOw-
- }
- else
- {
- string+AFsAXQ- ret;
- int j = 0;
- if (Include)
- ret = new string [matchesCount+AF0AOw-
- else
- ret = new string [count - matchesCount+AF0AOw-
-
- for (int i=0; i +ADw- count; i++)
- {
- if ((matches[i] +ACYAJg- Include) +AHwAfA- +ACE-(matches[i] +AHwAfA- Include))
- {
- ret[j] = Source[i+AF0AOw-
- j++;
- }
- }
- return ret;
- }
- }
- */
- }
-
- //[Test]
- public void Format()
- {
- FormatCurrency();
- FormatDateTime();
- FormatNumber();
- FormatPercent();
- }
-
- // [MonoToDo("Not implemented")]
- //TODO: [Test]
- public void Format_Original()
- {
- /*
- string returnstr=null;
- string expstring=expression.GetType().ToString()+ADsAOw-
- switch(expstring)
- {
- case "System.Char":
- if ( style+ACEAPQAiACI-)
- throw new System.ArgumentException("'expression' argument has a not valid value");
- returnstr=Convert.ToChar(expression).ToString();
- break;
- case "System.String":
- if (style +AD0APQ- +ACIAIg-)
- returnstr=expression.ToString();
- else
- {
- switch ( style.ToLower ())
- {
- case "yes/no":
- case "on/off":
- switch (expression.ToString().ToLower())
- {
- case "true":
- case "On":
- if (style.ToLower ()+AD0APQAi-yes/no")
- returnstr+AD0AIg-Yes+ACIAOw- // TODO : must be translated
- else
- returnstr+AD0AIg-On+ACIAOw- // TODO : must be translated
- break;
- case "false":
- case "off":
- if (style.ToLower ()+AD0APQAi-yes/no")
- returnstr+AD0AIg-No+ACIAOw- // TODO : must be translated
- else
- returnstr+AD0AIg-Off+ACIAOw- // TODO : must be translated
- break;
- default:
- throw new System.ArgumentException();
-
- }
- break;
- default:
- returnstr=style.ToString();
- break;
- }
- }
- break;
- case "System.Boolean":
- if ( style+AD0APQAiACI-)
- {
- if ( Convert.ToBoolean(expression)+AD0APQ-true)
- returnstr+AD0AIg-True+ACIAOw- // must not be translated
- else
- returnstr+AD0AIg-False+ACIAOw- // must not be translated
- }
- else
- returnstr=style;
- break;
- case "System.DateTime":
- returnstr=Convert.ToDateTime(expression).ToString (style) ;
- break;
- case "System.Decimal": case "System.Byte": case "System.SByte":
- case "System.Int16": case "System.Int32": case "System.Int64":
- case "System.Double": case "System.Single": case "System.UInt16":
- case "System.UInt32": case "System.UInt64":
- switch (style.ToLower ())
- {
- case "yes/no": case "true": case "false": case "on/off":
- style=style.ToLower();
- double dblbuffer=Convert.ToDouble(expression);
- if (dblbuffer +AD0APQ- 0)
- {
- switch (style)
- {
- case "on/off":
- returnstr= "Off+ACIAOw-break; // TODO : must be translated
- case "yes/no":
- returnstr= "No+ACIAOw-break; // TODO : must be translated
- case "true":
- case "false":
- returnstr= "False+ACIAOw-break; // must not be translated
- }
- }
- else
- {
- switch (style)
- {
- case "on/off":
- returnstr+AD0AIg-On+ACIAOw-break; // TODO : must be translated
- case "yes/no":
- returnstr+AD0AIg-Yes+ACIAOw-break; // TODO : must be translated
- case "true":
- case "false":
- returnstr+AD0AIg-True+ACIAOw-break; // must not be translated
- }
- }
- break;
- default:
- switch (expstring)
- {
- case "System.Byte": returnstr=Convert.ToByte(expression).ToString (style);break;
- case "System.SByte": returnstr=Convert.ToSByte(expression).ToString (style);break;
- case "System.Int16": returnstr=Convert.ToInt16(expression).ToString (style);break;
- case "System.UInt16": returnstr=Convert.ToUInt16(expression).ToString (style);break;
- case "System.Int32": returnstr=Convert.ToInt32(expression).ToString (style);break;
- case "System.UInt32": returnstr=Convert.ToUInt32(expression).ToString (style);break;
- case "System.Int64": returnstr=Convert.ToUInt64(expression).ToString (style);break;
- case "System.UInt64":returnstr=Convert.ToUInt64(expression).ToString (style);break;
- case "System.Single": returnstr=Convert.ToSingle(expression).ToString (style);break;
- case "System.Double": returnstr=Convert.ToDouble(expression).ToString (style);break;
- case "System.Decimal": returnstr=Convert.ToDecimal(expression).ToString (style);break;
-
- }
- break;
- }
- break;
- }
- if (returnstr+AD0APQ-null)
- throw new System.ArgumentException();
- return returnstr;
- */
- }
-
- // [MonoToDo("Not implemented")]
- //TODO: [Test]
- public void FormatCurrency()
- {
- /*
- //FIXME
- throw new NotImplementedException();
- //throws InvalidCastException
- //throws ArgumentException
- */
- }
-
- // [MonoToDo("Not implemented")]
- //TODO: [Test]
- public void FormatDateTime()
- {
- /*
- switch(NamedFormat)
- {
- case DateFormat.GeneralDate:
- //FIXME: WTF should I do with it?
- throw new NotImplementedException();
- case DateFormat.LongDate:
- return Expression.ToLongDateString();
- case DateFormat.ShortDate:
- return Expression.ToShortDateString();
- case DateFormat.LongTime:
- return Expression.ToLongTimeString();
- case DateFormat.ShortTime:
- return Expression.ToShortTimeString();
- default:
- throw new ArgumentException("Argument 'NamedFormat' must be a member of DateFormat", "NamedFormat");
- }
- */
- }
-
- [Test]
- public void FormatNumber()
- {
- // buffer current culture
- System.Globalization.CultureInfo CurCulture = System.Threading.Thread.CurrentThread.CurrentCulture;
-
- // do testings
- System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo("de-DE");
- NUnit.Framework.Assertion.AssertEquals ("JW#60", "1.000", Strings.FormatNumber(1000,0,TriState.False,TriState.False,TriState.True));
- NUnit.Framework.Assertion.AssertEquals ("JW#61", "1000", Strings.FormatNumber(1000,0,TriState.False,TriState.False,TriState.False));
- NUnit.Framework.Assertion.AssertEquals ("JW#62", "1.000", Strings.FormatNumber(1000,0,TriState.True,TriState.False,TriState.True));
- NUnit.Framework.Assertion.AssertEquals ("JW#63", "1.000", Strings.FormatNumber(1000,0,TriState.False,TriState.True,TriState.True));
- NUnit.Framework.Assertion.AssertEquals ("JW#64", "1.000", Strings.FormatNumber(1000,0,TriState.True,TriState.True,TriState.True));
- NUnit.Framework.Assertion.AssertEquals ("JW#65", "1000", Strings.FormatNumber(1000,0,TriState.False,TriState.False,TriState.False));
- NUnit.Framework.Assertion.AssertEquals ("JW#66", "1.000", Strings.FormatNumber(1000,0,TriState.False,TriState.False,TriState.True));
- NUnit.Framework.Assertion.AssertEquals ("JW#67", "-1000", Strings.FormatNumber(-1000,0,TriState.False,TriState.False,TriState.False));
- NUnit.Framework.Assertion.AssertEquals ("JW#68", "-1.000", Strings.FormatNumber(-1000,0,TriState.True,TriState.False,TriState.True));
- NUnit.Framework.Assertion.AssertEquals ("JW#69", "(1.000)", Strings.FormatNumber(-1000,0,TriState.False,TriState.True,TriState.True));
- NUnit.Framework.Assertion.AssertEquals ("JW#70", "(1.000)", Strings.FormatNumber(-1000,0,TriState.True,TriState.True,TriState.True));
- NUnit.Framework.Assertion.AssertEquals ("JW#71", "-1000", Strings.FormatNumber(-1000,0,TriState.False,TriState.False,TriState.False));
- NUnit.Framework.Assertion.AssertEquals ("JW#72", "(1.000,0000)", Strings.FormatNumber(-1000,4,TriState.True,TriState.True,TriState.True));
-
- System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
- NUnit.Framework.Assertion.AssertEquals ("JW#80", "1,000", Strings.FormatNumber(1000,0,TriState.False,TriState.False,TriState.True));
- NUnit.Framework.Assertion.AssertEquals ("JW#81", "1000", Strings.FormatNumber(1000,0,TriState.False,TriState.False,TriState.False));
- NUnit.Framework.Assertion.AssertEquals ("JW#82", "1,000", Strings.FormatNumber(1000,0,TriState.True,TriState.False,TriState.True));
- NUnit.Framework.Assertion.AssertEquals ("JW#83", "1,000", Strings.FormatNumber(1000,0,TriState.False,TriState.True,TriState.True));
- NUnit.Framework.Assertion.AssertEquals ("JW#84", "1,000", Strings.FormatNumber(1000,0,TriState.True,TriState.True,TriState.True));
- NUnit.Framework.Assertion.AssertEquals ("JW#85", "1000", Strings.FormatNumber(1000,0,TriState.False,TriState.False,TriState.False));
- NUnit.Framework.Assertion.AssertEquals ("JW#86", "1,000", Strings.FormatNumber(1000,0,TriState.False,TriState.False,TriState.True));
- NUnit.Framework.Assertion.AssertEquals ("JW#87", "-1000", Strings.FormatNumber(-1000,0,TriState.False,TriState.False,TriState.False));
- NUnit.Framework.Assertion.AssertEquals ("JW#88", "-1,000", Strings.FormatNumber(-1000,0,TriState.True,TriState.False,TriState.True));
- NUnit.Framework.Assertion.AssertEquals ("JW#89", "(1,000)", Strings.FormatNumber(-1000,0,TriState.False,TriState.True,TriState.True));
- NUnit.Framework.Assertion.AssertEquals ("JW#90", "(1,000)", Strings.FormatNumber(-1000,0,TriState.True,TriState.True,TriState.True));
- NUnit.Framework.Assertion.AssertEquals ("JW#91", "-1000", Strings.FormatNumber(-1000,0,TriState.False,TriState.False,TriState.False));
- NUnit.Framework.Assertion.AssertEquals ("JW#92", "(1,000.0000)", Strings.FormatNumber(-1000,4,TriState.True,TriState.True,TriState.True));
-
- // restore buffered culture
- System.Threading.Thread.CurrentThread.CurrentCulture = CurCulture;
-
- /*
- //FIXME
- throw new NotImplementedException();
- //throws InvalidCastException
- */
- }
-
- // [MonoToDo("Not implemented")]
- //TODO: [Test]
- public void FormatPercent()
- {
- /*
- //FIXME
- throw new NotImplementedException();
- //throws InvalidCastException
- */
- }
-
- // [MonoToDo("Not implemented")]
- //TODO: [Test]
- public void GetChar()
- {
- /*
- if ((Str +AD0APQ- null) +AHwAfA- (Str.Length +AD0APQ- 0))
- throw new ArgumentException("Length of argument 'Str' must be greater than zero.", "Sre");
- if (Index +ADw- 1)
- throw new ArgumentException("Argument 'Index' must be greater than or equal to 1.", "Index");
- if (Index +AD4- Str.Length)
- throw new ArgumentException("Argument 'Index' must be less than or equal to the length of argument 'String'.", "Index");
-
- return Str.ToCharArray(Index -1, 1)[0+AF0AOw-
- */
- }
-
- //[Test]
- public void InStr()
- {
- InStr_WithOutStartParameter();
- InStr_WithStartParameter();
- }
-
- // [MonoToDo("Not implemented")]
- //TODO: [Test]
- public void InStr_WithOutStartParameter()
- {
- /*
- return InStr(1, String1, String2, Compare);
- */
- }
-
- // [MonoToDo("Not implemented")]
- //TODO: [Test]
- public void InStr_WithStartParameter()
- {
- /*
- if (Start +ADw- 1)
- throw new ArgumentException("Argument 'Start' must be non-negative.", "Start");
-
- //* FIXME: ms-help://MS.VSCC/MS.MSDNVS/vblr7/html/vafctinstr.htm
- //* If Compare is omitted, the Option Compare setting determines the type of comparison. Specify
- //* a valid LCID (LocaleID) to use locale-specific rules in the comparison.
- //* How do I do this?
-
- //* If InStr returns
- //*
- //* String1 is zero length or Nothing 0
- //* String2 is zero length or Nothing start
- //* String2 is not found 0
- //* String2 is found within String1 Position where match begins
- //* Start +AD4- String2 0
-
-
- //FIXME: someone with a non US setup should test this.
- switch (Compare)
- {
- case CompareMethod.Text:
- return System.Globalization.CultureInfo.CurrentCulture.CompareInfo.IndexOf(String2, String1, Start - 1) + 1;
-
- case CompareMethod.Binary:
- return String1.IndexOf(String2, Start - 1) + 1;
- default:
- throw new System.ArgumentException("Argument 'Compare' must be CompareMethod.Binary or CompareMethod.Text.", "Compare");
- }
- */
- }
-
- //[Test]
- public void InStrRev()
- {
- InStrRev_4Parameters();
- InStrRev_5Parameters();
- }
-
- // [MonoToDo("Not implemented")]
- //TODO: [Test]
- public void InStrRev_4Parameters()
- {
-
- // 2 InStrRev functions exists+ACEAIQ- Create tests for both versions+ACE-
-
- /*
- if ((Start +AD0APQ- 0) +AHwAfA- (Start +ADw- -1))
- throw new ArgumentException("Argument 'Start' must be greater than 0 or equal to -1", "Start");
-
- //FIXME: Use LastIndexOf()
- throw new NotImplementedException();
- */
- }
-
- // [MonoToDo("Not implemented")]
- //TODO: [Test]
- public void InStrRev_5Parameters()
- {
- }
-
- // [MonoToDo("Not implemented")]
- //TODO: [Test]
- public void Join_Strings()
- {
- /*
- if (SourceArray +AD0APQ- null)
- throw new ArgumentException("Argument 'SourceArray' can not be null.", "SourceArray");
- if (SourceArray.Rank +AD4- 1)
- throw new ArgumentException("Argument 'SourceArray' can have only one dimension.", "SourceArray");
-
- return string.Join(Delimiter, SourceArray);
- */
- }
-
- // [MonoToDo("Not implemented")]
- //TODO: [Test]
- public void Join_Objects()
- {
- /*
- if (SourceArray +AD0APQ- null)
- throw new ArgumentException("Argument 'SourceArray' can not be null.", "SourceArray");
- if (SourceArray.Rank +AD4- 1)
- throw new ArgumentException("Argument 'SourceArray' can have only one dimension.", "SourceArray");
-
- string+AFsAXQ- dest;
- dest = new string[SourceArray.Length+AF0AOw-
-
- SourceArray.CopyTo(dest, 0);
- return string.Join(Delimiter, dest);
- */
- }
-
- public void LCase_Char()
- {
- // buffer current culture
- System.Globalization.CultureInfo CurCulture = System.Threading.Thread.CurrentThread.CurrentCulture;
-
- // do testings
- NUnit.Framework.Assertion.AssertEquals ("JW#LCase/10c", 0, Strings.LCase(Letter_Empty));
-
- System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
- NUnit.Framework.Assertion.AssertEquals ("JW#LCase/10", Strings.AscW("c"), Strings.LCase(Letter_English));
- NUnit.Framework.Assertion.AssertEquals ("JW#LCase/11", Strings.AscW("é›»"), Strings.LCase(Letter_Japanese));
- NUnit.Framework.Assertion.AssertEquals ("JW#LCase/12", 1073, Strings.LCase(Letter_Russian));
- NUnit.Framework.Assertion.AssertEquals ("JW#LCase/13", 269, Strings.LCase(Letter_Slovakian));
- NUnit.Framework.Assertion.AssertEquals ("JW#LCase/14", Strings.AscW("ë³´"), Strings.LCase(Letter_Korean));
- NUnit.Framework.Assertion.AssertEquals ("JW#LCase/15", 1603, Strings.LCase(Letter_Arabic));
- NUnit.Framework.Assertion.AssertEquals ("JW#LCase/16", Strings.AscW("ä"), Strings.LCase(Letter_German));
-
- System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo("de-DE");
- NUnit.Framework.Assertion.AssertEquals ("JW#LCase/20", Strings.AscW("c"), Strings.LCase(Letter_English));
- NUnit.Framework.Assertion.AssertEquals ("JW#LCase/21", Strings.AscW("é›»"), Strings.LCase(Letter_Japanese));
- NUnit.Framework.Assertion.AssertEquals ("JW#LCase/22", 1073, Strings.LCase(Letter_Russian));
- NUnit.Framework.Assertion.AssertEquals ("JW#LCase/23", 269, Strings.LCase(Letter_Slovakian));
- NUnit.Framework.Assertion.AssertEquals ("JW#LCase/24", Strings.AscW("ë³´"), Strings.LCase(Letter_Korean));
- NUnit.Framework.Assertion.AssertEquals ("JW#LCase/25", 1603, Strings.LCase(Letter_Arabic));
- NUnit.Framework.Assertion.AssertEquals ("JW#LCase/26", Strings.AscW("ä"), Strings.LCase(Letter_German));
-
- System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo("ja-JP");
- NUnit.Framework.Assertion.AssertEquals ("JW#LCase/30", Strings.AscW("c"), Strings.LCase(Letter_English));
- NUnit.Framework.Assertion.AssertEquals ("JW#LCase/31", Strings.AscW("é›»"), Strings.LCase(Letter_Japanese));
- NUnit.Framework.Assertion.AssertEquals ("JW#LCase/32", 1073, Strings.LCase(Letter_Russian));
- NUnit.Framework.Assertion.AssertEquals ("JW#LCase/33", 269, Strings.LCase(Letter_Slovakian));
- NUnit.Framework.Assertion.AssertEquals ("JW#LCase/34", Strings.AscW("ë³´"), Strings.LCase(Letter_Korean));
- NUnit.Framework.Assertion.AssertEquals ("JW#LCase/35", 1603, Strings.LCase(Letter_Arabic));
- NUnit.Framework.Assertion.AssertEquals ("JW#LCase/36", Strings.AscW("ä"), Strings.LCase(Letter_German));
-
- // restore buffered culture
- System.Threading.Thread.CurrentThread.CurrentCulture = CurCulture;
- }
-
- [Test]
- public void LCase()
- {
- LCase_Char();
- LCase_String();
- }
-
- public void LCase_String()
- {
- // buffer current culture
- System.Globalization.CultureInfo CurCulture = System.Threading.Thread.CurrentThread.CurrentCulture;
-
- // do testings
- NUnit.Framework.Assertion.AssertEquals ("JW#LCase/64", null, Strings.LCase(TextStringUninitialized));
- NUnit.Framework.Assertion.AssertEquals ("JW#LCase/65", null, Strings.LCase(TextStringUninitialized));
- NUnit.Framework.Assertion.AssertEquals ("JW#LCase/67", String.Empty, Strings.LCase(TextStringEmpty));
- NUnit.Framework.Assertion.AssertEquals ("JW#LCase/68", "", Strings.LCase(TextStringEmpty));
-
- System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo("de-DE");
- NUnit.Framework.Assertion.AssertEquals ("JW#LCase/70", "choose the location for which you want contact information:", Strings.LCase(MSWebSiteContent_English));
- NUnit.Framework.Assertion.AssertEquals ("JW#LCase/71", "é›»å­ãƒ¡ãƒ¼ãƒ«ã‚’ã¯ã˜ã‚ã€äºˆå®šè¡¨ã‚„アドレス帳ãªã©ã®å€‹äººæƒ…å ±ã€ã•ã‚‰ã«ã¯ office v. x ã®å„アプリケーションã§ä½œæˆã—ãŸæ›¸é¡žã‚„ãã®ä»–ã®ãƒ•ã‚¡ã‚¤ãƒ«ã‚’リンクã•ã›ã¦çµ±åˆçš„ã«ç®¡ç†ã™ã‚‹ã“ã¨ãŒã§ãるコミュニケーションï¼å€‹äººæƒ…報管ç†ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã§ã™ã€‚インターフェースãŒä¸€æ–°ã•ã‚Œã€é«˜åº¦ã§å¤šå½©ãª entourage x ã®æ©Ÿèƒ½ãŒã‚ˆã‚Šç›´æ„Ÿçš„ã«åˆ©ç”¨ã§ãるよã†ã«ãªã‚Šã¾ã—ãŸã€‚以å‰ãŠä½¿ã„ã«ãªã£ã¦ã„ãŸé›»å­ãƒ¡ãƒ¼ãƒ« アプリケーションã‹ã‚‰ã®æƒ…å ±ã®ã‚¤ãƒ³ãƒãƒ¼ãƒˆã‚‚容易ã«ã§ãã¾ã™ã€‚", Strings.LCase(MSWebSiteContent_Japanese));
- NUnit.Framework.Assertion.AssertEquals ("JW#LCase/72", "будете автоматичеÑки перенаправлены", Strings.LCase(MSWebSiteContent_Russian));
- NUnit.Framework.Assertion.AssertEquals ("JW#LCase/73", "Äníci nároÄných používateľovnové portfólio microsoft hardware. Å¡piÄkové optické bezdrôtové myÅ¡ky s novou technológiou - nakláňacím kolieskom. nezáleží na tom, aký stôl máte, pokiaľ je na ňom elegantná", Strings.LCase(MSWebSiteContent_Slovakian));
- NUnit.Framework.Assertion.AssertEquals ("JW#LCase/74", "보안 ìº íŽ˜ì¸ - 스스로 지킨 ë‹¹ì‹ ì˜ pc! ë”ìš± 안전해집니다!", Strings.LCase(MSWebSiteContent_Korean));
- NUnit.Framework.Assertion.AssertEquals ("JW#LCase/75", "كل الحقوق محÙوظة ليديعوت إنترنت", Strings.LCase(ArabynetComWebSiteContent_Arabic));
- NUnit.Framework.Assertion.AssertEquals ("JW#LCase/76", "äöüäöüß", Strings.LCase(GermanUmlauts_German));
- NUnit.Framework.Assertion.AssertEquals ("JW#LCase/77", "é›»å­ãƒ¡ãƒ¼ãƒ«ã‚’ã¯ã˜ã‚ã€äºˆå®šè¡¨ã‚„アドレス帳ãªã©ã®å€‹äººæƒ…å ±ã€ã•ã‚‰ã«ã¯ office v. x ã®å„アプリケーションã§ä½œæˆã—ãŸæ›¸é¡žã‚„ãã®ä»–ã®ãƒ•ã‚¡ã‚¤ãƒ«ã‚’リンクã•ã›ã¦çµ±åˆçš„ã«ç®¡ç†ã™ã‚‹ã“ã¨ãŒã§ãるコミュニケーションï¼å€‹äººæƒ…報管ç†ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã§ã™ã€‚インターフェースãŒä¸€æ–°ã•ã‚Œã€é«˜åº¦ã§å¤šå½©ãª entourage x ã®æ©Ÿèƒ½ãŒã‚ˆã‚Šç›´æ„Ÿçš„ã«åˆ©ç”¨ã§ãるよã†ã«ãªã‚Šã¾ã—ãŸã€‚以å‰ãŠä½¿ã„ã«ãªã£ã¦ã„ãŸé›»å­ãƒ¡ãƒ¼ãƒ« アプリケーションã‹ã‚‰ã®æƒ…å ±ã®ã‚¤ãƒ³ãƒãƒ¼ãƒˆã‚‚容易ã«ã§ãã¾ã™ã€‚будете автоматичеÑки перенаправленыÄníci nároÄných používateľovnové portfólio microsoft hardware. Å¡piÄkové optické bezdrôtové myÅ¡ky s novou technológiou - nakláňacím kolieskom. nezáleží na tom, aký stôl máte, pokiaľ je na ňom elegantná보안 ìº íŽ˜ì¸ - 스스로 지킨 ë‹¹ì‹ ì˜ pc! ë”ìš± 안전해집니다!كل الحقوق محÙوظة ليديعوت إنترنتäöüäöüß", Strings.LCase(TextStringOfMultipleLanguages));
-
- System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
- NUnit.Framework.Assertion.AssertEquals ("JW#LCase/80", "choose the location for which you want contact information:", Strings.LCase(MSWebSiteContent_English));
- NUnit.Framework.Assertion.AssertEquals ("JW#LCase/81", "é›»å­ãƒ¡ãƒ¼ãƒ«ã‚’ã¯ã˜ã‚ã€äºˆå®šè¡¨ã‚„アドレス帳ãªã©ã®å€‹äººæƒ…å ±ã€ã•ã‚‰ã«ã¯ office v. x ã®å„アプリケーションã§ä½œæˆã—ãŸæ›¸é¡žã‚„ãã®ä»–ã®ãƒ•ã‚¡ã‚¤ãƒ«ã‚’リンクã•ã›ã¦çµ±åˆçš„ã«ç®¡ç†ã™ã‚‹ã“ã¨ãŒã§ãるコミュニケーションï¼å€‹äººæƒ…報管ç†ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã§ã™ã€‚インターフェースãŒä¸€æ–°ã•ã‚Œã€é«˜åº¦ã§å¤šå½©ãª entourage x ã®æ©Ÿèƒ½ãŒã‚ˆã‚Šç›´æ„Ÿçš„ã«åˆ©ç”¨ã§ãるよã†ã«ãªã‚Šã¾ã—ãŸã€‚以å‰ãŠä½¿ã„ã«ãªã£ã¦ã„ãŸé›»å­ãƒ¡ãƒ¼ãƒ« アプリケーションã‹ã‚‰ã®æƒ…å ±ã®ã‚¤ãƒ³ãƒãƒ¼ãƒˆã‚‚容易ã«ã§ãã¾ã™ã€‚", Strings.LCase(MSWebSiteContent_Japanese));
- NUnit.Framework.Assertion.AssertEquals ("JW#LCase/82", "будете автоматичеÑки перенаправлены", Strings.LCase(MSWebSiteContent_Russian));
- NUnit.Framework.Assertion.AssertEquals ("JW#LCase/83", "Äníci nároÄných používateľovnové portfólio microsoft hardware. Å¡piÄkové optické bezdrôtové myÅ¡ky s novou technológiou - nakláňacím kolieskom. nezáleží na tom, aký stôl máte, pokiaľ je na ňom elegantná", Strings.LCase(MSWebSiteContent_Slovakian));
- NUnit.Framework.Assertion.AssertEquals ("JW#LCase/84", "보안 ìº íŽ˜ì¸ - 스스로 지킨 ë‹¹ì‹ ì˜ pc! ë”ìš± 안전해집니다!", Strings.LCase(MSWebSiteContent_Korean));
- NUnit.Framework.Assertion.AssertEquals ("JW#LCase/85", "كل الحقوق محÙوظة ليديعوت إنترنت", Strings.LCase(ArabynetComWebSiteContent_Arabic));
- NUnit.Framework.Assertion.AssertEquals ("JW#LCase/86", "äöüäöüß", Strings.LCase(GermanUmlauts_German));
- NUnit.Framework.Assertion.AssertEquals ("JW#LCase/87", "é›»å­ãƒ¡ãƒ¼ãƒ«ã‚’ã¯ã˜ã‚ã€äºˆå®šè¡¨ã‚„アドレス帳ãªã©ã®å€‹äººæƒ…å ±ã€ã•ã‚‰ã«ã¯ office v. x ã®å„アプリケーションã§ä½œæˆã—ãŸæ›¸é¡žã‚„ãã®ä»–ã®ãƒ•ã‚¡ã‚¤ãƒ«ã‚’リンクã•ã›ã¦çµ±åˆçš„ã«ç®¡ç†ã™ã‚‹ã“ã¨ãŒã§ãるコミュニケーションï¼å€‹äººæƒ…報管ç†ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã§ã™ã€‚インターフェースãŒä¸€æ–°ã•ã‚Œã€é«˜åº¦ã§å¤šå½©ãª entourage x ã®æ©Ÿèƒ½ãŒã‚ˆã‚Šç›´æ„Ÿçš„ã«åˆ©ç”¨ã§ãるよã†ã«ãªã‚Šã¾ã—ãŸã€‚以å‰ãŠä½¿ã„ã«ãªã£ã¦ã„ãŸé›»å­ãƒ¡ãƒ¼ãƒ« アプリケーションã‹ã‚‰ã®æƒ…å ±ã®ã‚¤ãƒ³ãƒãƒ¼ãƒˆã‚‚容易ã«ã§ãã¾ã™ã€‚будете автоматичеÑки перенаправленыÄníci nároÄných používateľovnové portfólio microsoft hardware. Å¡piÄkové optické bezdrôtové myÅ¡ky s novou technológiou - nakláňacím kolieskom. nezáleží na tom, aký stôl máte, pokiaľ je na ňom elegantná보안 ìº íŽ˜ì¸ - 스스로 지킨 ë‹¹ì‹ ì˜ pc! ë”ìš± 안전해집니다!كل الحقوق محÙوظة ليديعوت إنترنتäöüäöüß", Strings.LCase(TextStringOfMultipleLanguages));
-
- System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo("ja-JP");
- NUnit.Framework.Assertion.AssertEquals ("JW#LCase/90", "choose the location for which you want contact information:", Strings.LCase(MSWebSiteContent_English));
- NUnit.Framework.Assertion.AssertEquals ("JW#LCase/91", "é›»å­ãƒ¡ãƒ¼ãƒ«ã‚’ã¯ã˜ã‚ã€äºˆå®šè¡¨ã‚„アドレス帳ãªã©ã®å€‹äººæƒ…å ±ã€ã•ã‚‰ã«ã¯ office v. x ã®å„アプリケーションã§ä½œæˆã—ãŸæ›¸é¡žã‚„ãã®ä»–ã®ãƒ•ã‚¡ã‚¤ãƒ«ã‚’リンクã•ã›ã¦çµ±åˆçš„ã«ç®¡ç†ã™ã‚‹ã“ã¨ãŒã§ãるコミュニケーションï¼å€‹äººæƒ…報管ç†ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã§ã™ã€‚インターフェースãŒä¸€æ–°ã•ã‚Œã€é«˜åº¦ã§å¤šå½©ãª entourage x ã®æ©Ÿèƒ½ãŒã‚ˆã‚Šç›´æ„Ÿçš„ã«åˆ©ç”¨ã§ãるよã†ã«ãªã‚Šã¾ã—ãŸã€‚以å‰ãŠä½¿ã„ã«ãªã£ã¦ã„ãŸé›»å­ãƒ¡ãƒ¼ãƒ« アプリケーションã‹ã‚‰ã®æƒ…å ±ã®ã‚¤ãƒ³ãƒãƒ¼ãƒˆã‚‚容易ã«ã§ãã¾ã™ã€‚", Strings.LCase(MSWebSiteContent_Japanese));
- NUnit.Framework.Assertion.AssertEquals ("JW#LCase/92", "будете автоматичеÑки перенаправлены", Strings.LCase(MSWebSiteContent_Russian));
- NUnit.Framework.Assertion.AssertEquals ("JW#LCase/93", "Äníci nároÄných používateľovnové portfólio microsoft hardware. Å¡piÄkové optické bezdrôtové myÅ¡ky s novou technológiou - nakláňacím kolieskom. nezáleží na tom, aký stôl máte, pokiaľ je na ňom elegantná", Strings.LCase(MSWebSiteContent_Slovakian));
- NUnit.Framework.Assertion.AssertEquals ("JW#LCase/94", "보안 ìº íŽ˜ì¸ - 스스로 지킨 ë‹¹ì‹ ì˜ pc! ë”ìš± 안전해집니다!", Strings.LCase(MSWebSiteContent_Korean));
- NUnit.Framework.Assertion.AssertEquals ("JW#LCase/95", "كل الحقوق محÙوظة ليديعوت إنترنت", Strings.LCase(ArabynetComWebSiteContent_Arabic));
- NUnit.Framework.Assertion.AssertEquals ("JW#LCase/96", "äöüäöüß", Strings.LCase(GermanUmlauts_German));
- NUnit.Framework.Assertion.AssertEquals ("JW#LCase/97", "é›»å­ãƒ¡ãƒ¼ãƒ«ã‚’ã¯ã˜ã‚ã€äºˆå®šè¡¨ã‚„アドレス帳ãªã©ã®å€‹äººæƒ…å ±ã€ã•ã‚‰ã«ã¯ office v. x ã®å„アプリケーションã§ä½œæˆã—ãŸæ›¸é¡žã‚„ãã®ä»–ã®ãƒ•ã‚¡ã‚¤ãƒ«ã‚’リンクã•ã›ã¦çµ±åˆçš„ã«ç®¡ç†ã™ã‚‹ã“ã¨ãŒã§ãるコミュニケーションï¼å€‹äººæƒ…報管ç†ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã§ã™ã€‚インターフェースãŒä¸€æ–°ã•ã‚Œã€é«˜åº¦ã§å¤šå½©ãª entourage x ã®æ©Ÿèƒ½ãŒã‚ˆã‚Šç›´æ„Ÿçš„ã«åˆ©ç”¨ã§ãるよã†ã«ãªã‚Šã¾ã—ãŸã€‚以å‰ãŠä½¿ã„ã«ãªã£ã¦ã„ãŸé›»å­ãƒ¡ãƒ¼ãƒ« アプリケーションã‹ã‚‰ã®æƒ…å ±ã®ã‚¤ãƒ³ãƒãƒ¼ãƒˆã‚‚容易ã«ã§ãã¾ã™ã€‚будете автоматичеÑки перенаправленыÄníci nároÄných používateľovnové portfólio microsoft hardware. Å¡piÄkové optické bezdrôtové myÅ¡ky s novou technológiou - nakláňacím kolieskom. nezáleží na tom, aký stôl máte, pokiaľ je na ňom elegantná보안 ìº íŽ˜ì¸ - 스스로 지킨 ë‹¹ì‹ ì˜ pc! ë”ìš± 안전해집니다!كل الحقوق محÙوظة ليديعوت إنترنتäöüäöüß", Strings.LCase(TextStringOfMultipleLanguages));
-
- // restore buffered culture
- System.Threading.Thread.CurrentThread.CurrentCulture = CurCulture;
- }
-
-
- [Test]
- public void Left()
- {
- NUnit.Framework.Assertion.AssertEquals ("JW#40", "ä電電", Strings.Left("ä電電jklmeh",3));
- NUnit.Framework.Assertion.AssertEquals ("JW#41", "jk", Strings.Left("jklmeh",2));
- NUnit.Framework.Assertion.AssertEquals ("JW#42", "", Strings.Left("jklmeh",0));
- try
- {
- object buffer = Strings.Left("jklmeh",-1);
- NUnit.Framework.Assertion.Fail ("JW#43 hasn't thrown an error");
- }
- catch
- {
- NUnit.Framework.Assertion.Assert ("JW#43", true);
- }
- NUnit.Framework.Assertion.AssertEquals ("JW#44", "j", Strings.Left("j",2));
- }
-
- [Test]
- public void Len()
- {
- Len_Object();
- Len_Bool();
- Len_Byte();
- Len_Char();
- Len_Double();
- Len_Int();
- Len_Long();
- Len_Short();
- Len_Float();
- Len_String();
- Len_DateTime();
- Len_Decimal();
- }
-
- public void Len_Bool()
- {
- try
- {
- object buffer = Strings.Len(null);
- NUnit.Framework.Assertion.Fail ("JW#Len/50 hasn't thrown an error");
- }
- catch
- {
- NUnit.Framework.Assertion.Assert ("JW#Len/50", true);
- }
- NUnit.Framework.Assertion.AssertEquals ("JW#Len/51", 2, Strings.Len(true));
- NUnit.Framework.Assertion.AssertEquals ("JW#Len/52", 2, Strings.Len(false));
- /*
- return 2; //sizeof(bool)
- */
- }
-
- public void Len_Byte()
- {
- byte MyByte1a = 3;
- const byte MyByte1 = 3;
- const byte MyByte2 = 13;
- const byte MyByte3 = 123;
- NUnit.Framework.Assertion.AssertEquals ("JW#Len/60", 1, Strings.Len(MyByte1a));
- NUnit.Framework.Assertion.AssertEquals ("JW#Len/61", 1, Strings.Len(MyByte1));
- NUnit.Framework.Assertion.AssertEquals ("JW#Len/62", 1, Strings.Len(MyByte2));
- NUnit.Framework.Assertion.AssertEquals ("JW#Len/63", 1, Strings.Len(MyByte3));
- }
-
- public void Len_Char()
- {
- char MyChar0 = (char)0;
- char MyChar1 = (char)73;
- char MyChar1a = (char)1024;
- char MyChar2 = (char)65000;
- NUnit.Framework.Assertion.AssertEquals ("JW#Len/71", 2, Strings.Len(MyChar0));
- NUnit.Framework.Assertion.AssertEquals ("JW#Len/72", 2, Strings.Len(MyChar1));
- NUnit.Framework.Assertion.AssertEquals ("JW#Len/73", 2, Strings.Len(MyChar1a));
- NUnit.Framework.Assertion.AssertEquals ("JW#Len/74", 2, Strings.Len(MyChar2));
- NUnit.Framework.Assertion.AssertEquals ("JW#Len/74", 2, Strings.Len(Letter_Empty));
- NUnit.Framework.Assertion.AssertEquals ("JW#Len/74", 2, Strings.Len(Letter_German));
- /*
- return 2; //sizeof(char)
- */
- }
-
- public void Len_Double()
- {
- double MyChar0 = (double)0;
- double MyChar1 = (double)73;
- double MyChar1a = (double)-1024;
- double MyChar2 = (double)65000.398721733;
- NUnit.Framework.Assertion.AssertEquals ("JW#Len/81", 8, Strings.Len(MyChar0));
- NUnit.Framework.Assertion.AssertEquals ("JW#Len/82", 8, Strings.Len(MyChar1));
- NUnit.Framework.Assertion.AssertEquals ("JW#Len/83", 8, Strings.Len(MyChar1a));
- NUnit.Framework.Assertion.AssertEquals ("JW#Len/84", 8, Strings.Len(MyChar2));
- /*
- return 8; //sizeof(double)
- */
- }
-
- public void Len_Int()
- {
- int MyChar0 = (int)0;
- int MyChar1 = (int)73;
- int MyChar1a = (int)-1024;
- int MyChar2 = (int)65000;
- NUnit.Framework.Assertion.AssertEquals ("JW#Len/91", 4, Strings.Len(MyChar0));
- NUnit.Framework.Assertion.AssertEquals ("JW#Len/92", 4, Strings.Len(MyChar1));
- NUnit.Framework.Assertion.AssertEquals ("JW#Len/93", 4, Strings.Len(MyChar1a));
- NUnit.Framework.Assertion.AssertEquals ("JW#Len/94", 4, Strings.Len(MyChar2));
- /*
- return 4; //sizeof(int)
- */
- }
-
- public void Len_Long()
- {
- long MyChar0 = (long)0;
- long MyChar1 = (long)73;
- long MyChar1a = (long)-1024;
- long MyChar2 = (long)65000.398721733;
- NUnit.Framework.Assertion.AssertEquals ("JW#Len/101", 8, Strings.Len(MyChar0));
- NUnit.Framework.Assertion.AssertEquals ("JW#Len/102", 8, Strings.Len(MyChar1));
- NUnit.Framework.Assertion.AssertEquals ("JW#Len/103", 8, Strings.Len(MyChar1a));
- NUnit.Framework.Assertion.AssertEquals ("JW#Len/104", 8, Strings.Len(MyChar2));
- /*
- return 8; //sizeof(long)
- */
- }
-
- class TMyLenTestClass
- {
- public void esss()
- {
- }
-
- int dummy = 16;
- const int me34 = 23;
- }
-
- class TMyLenTestClass2
- {
- public void esss()
- {
- string dddd = "kjdfhdjfh";
- }
-
- public void esss2()
- {
- string dddd = "kjdfhdjfh";
- }
-
- int dummy = 16;
- const int me34 = 23;
- }
-
- struct TMyLenTestStruct
- {
- public int dummy1;
- public double dummy2;
- double dummy3;
- }
-
- struct TMyLenTestStruct2
- {
- public int dummy1;
- double dummy3;
- }
-
- public void Len_Object()
- {
- object ObjectOfTextStringEmpty = TextStringEmpty;
- object ObjectOfTextStringUninitialized = TextStringUninitialized;
- object ObjectOfTextStringOfMultipleLanguages = TextStringOfMultipleLanguages;
- object ObjectOfInt = (int)0;
- object ObjectOfEmptyObject = null;
- TMyLenTestStruct MyLenTestStruct;
- MyLenTestStruct = new TMyLenTestStruct();
- MyLenTestStruct.dummy1 = 34;
- MyLenTestStruct.dummy2 = 34.343;
- object ObjectOfTMyLenTestStruct = MyLenTestStruct;
- TMyLenTestClass MyLenTestClass = new TMyLenTestClass();
- object ObjectOfTMyLenTestClass = MyLenTestClass;
- TMyLenTestStruct2 MyLenTestStruct2;
- MyLenTestStruct2 = new TMyLenTestStruct2();
- MyLenTestStruct2.dummy1 = 34;
- object ObjectOfTMyLenTestStruct2 = MyLenTestStruct2;
- TMyLenTestClass2 MyLenTestClass2 = new TMyLenTestClass2();
- object ObjectOfTMyLenTestClass2 = MyLenTestClass2;
- NUnit.Framework.Assertion.AssertEquals ("JW#Len/111", 0, Strings.Len(ObjectOfTextStringEmpty));
- NUnit.Framework.Assertion.AssertEquals ("JW#Len/112", 0, Strings.Len(ObjectOfTextStringUninitialized));
- NUnit.Framework.Assertion.AssertEquals ("JW#Len/113", 525, Strings.Len(ObjectOfTextStringOfMultipleLanguages));
- NUnit.Framework.Assertion.AssertEquals ("JW#Len/114", 4, Strings.Len(ObjectOfInt));
- NUnit.Framework.Assertion.AssertEquals ("JW#Len/115", 0, Strings.Len(ObjectOfEmptyObject));
- NUnit.Framework.Assertion.AssertEquals ("JW#Len/116", 12, Strings.Len(ObjectOfTMyLenTestStruct));
- NUnit.Framework.Assertion.AssertEquals ("JW#Len/118", 4, Strings.Len(ObjectOfTMyLenTestStruct2));
- try
- {
- int buffer = Strings.Len(ObjectOfTMyLenTestClass);
- NUnit.Framework.Assertion.Fail ("JW#Len/117 hasn't thrown an error");
- }
- catch
- {
- NUnit.Framework.Assertion.Assert ("JW#Len/117", true);
- }
- try
- {
- int buffer = Strings.Len(ObjectOfTMyLenTestClass2);
- NUnit.Framework.Assertion.Fail ("JW#Len/119 hasn't thrown an error");
- }
- catch
- {
- NUnit.Framework.Assertion.Assert ("JW#Len/119", true);
- }
- /*
- // FIXME:
- // With user-defined types and Object variables, the Len function returns the size as it will
- // be written to the file. If an Object contains a String, it will return the length of the string.
- // If an Object contains any other type, it will return the size of the object as it will be written
- // to the file.
- throw new NotImplementedException();
- */
- }
-
- public void Len_Short()
- {
- short MyChar0 = (short)0;
- short MyChar1 = (short)73;
- short MyChar1a = (short)-1024;
- short MyChar2 = short.MaxValue;
- NUnit.Framework.Assertion.AssertEquals ("JW#Len/121", 2, Strings.Len(MyChar0));
- NUnit.Framework.Assertion.AssertEquals ("JW#Len/122", 2, Strings.Len(MyChar1));
- NUnit.Framework.Assertion.AssertEquals ("JW#Len/123", 2, Strings.Len(MyChar1a));
- NUnit.Framework.Assertion.AssertEquals ("JW#Len/124", 2, Strings.Len(MyChar2));
- /*
- return 2; //sizeof(short)
- */
- }
-
- public void Len_Float()
- {
- float MyChar0 = (float)0;
- float MyChar1 = (float)73;
- float MyChar1a = (float)-1024;
- float MyChar2 = (float)-465000.398721733;
- NUnit.Framework.Assertion.AssertEquals ("JW#Len/131", 4, Strings.Len(MyChar0));
- NUnit.Framework.Assertion.AssertEquals ("JW#Len/132", 4, Strings.Len(MyChar1));
- NUnit.Framework.Assertion.AssertEquals ("JW#Len/133", 4, Strings.Len(MyChar1a));
- NUnit.Framework.Assertion.AssertEquals ("JW#Len/134", 4, Strings.Len(MyChar2));
- /*
- return 4; //sizeof(Single)
- */
- }
-
- public void Len_String()
- {
- NUnit.Framework.Assertion.AssertEquals ("JW#Len/161", 0, Strings.Len(TextStringEmpty));
- NUnit.Framework.Assertion.AssertEquals ("JW#Len/162", 0, Strings.Len(TextStringUninitialized));
- NUnit.Framework.Assertion.AssertEquals ("JW#Len/163", 525, Strings.Len(TextStringOfMultipleLanguages));
- /*
- return Expression.Length; //length of the string
- */
- }
-
- public void Len_DateTime()
- {
- System.DateTime MyChar0 = new System.DateTime(1000,1,1);
- System.DateTime MyChar1 = new System.DateTime(2003,12,29);
- System.DateTime MyChar1a = System.DateTime.Now;
- System.DateTime MyChar2 = new System.DateTime(9999,12,31,23,59,59,999);
- NUnit.Framework.Assertion.AssertEquals ("JW#Len/141", 8, Strings.Len(MyChar0));
- NUnit.Framework.Assertion.AssertEquals ("JW#Len/142", 8, Strings.Len(MyChar1));
- NUnit.Framework.Assertion.AssertEquals ("JW#Len/143", 8, Strings.Len(MyChar1a));
- NUnit.Framework.Assertion.AssertEquals ("JW#Len/144", 8, Strings.Len(MyChar2));
- /*
- return 8; //sizeof(DateTime)
- */
- }
-
- public void Len_Decimal()
- {
- decimal MyChar0 = (decimal)0;
- decimal MyChar1 = (decimal)-3840;
- decimal MyChar1a = (decimal)-29843433.23984723894333333;
- decimal MyChar2 = (decimal)2934838384323432333;
- NUnit.Framework.Assertion.AssertEquals ("JW#Len/151", 8, Strings.Len(MyChar0));
- NUnit.Framework.Assertion.AssertEquals ("JW#Len/152", 8, Strings.Len(MyChar1));
- NUnit.Framework.Assertion.AssertEquals ("JW#Len/153", 8, Strings.Len(MyChar1a));
- NUnit.Framework.Assertion.AssertEquals ("JW#Len/154", 8, Strings.Len(MyChar2));
- /*
- return 16; //sizeof(decimal)
- */
- }
-
- [Test]
- public void LSet()
- {
- NUnit.Framework.Assertion.AssertEquals ("JW#LSet/10", " lf", Strings.LSet(" lfkdfkd ", 4));
- NUnit.Framework.Assertion.AssertEquals ("JW#LSet/11", "", Strings.LSet(" lfkdfkd ", 0));
- try
- {
- string buffer = Strings.LSet(" lfkdfkd ", -1);
- NUnit.Framework.Assertion.Fail ("JW#LSet/12 hasn't thrown an error");
- }
- catch
- {
- NUnit.Framework.Assertion.Assert ("JW#LSet/12", true);
- }
- NUnit.Framework.Assertion.AssertEquals ("JW#LSet/11", " lfkdfkd ", Strings.LSet(" lfkdfkd ", 20));
- }
-
- [Test]
- public void LTrim()
- {
- NUnit.Framework.Assertion.AssertEquals ("JW#LTrim/10", "dkfÄ ", Strings.LTrim(" dkfÄ "));
- NUnit.Framework.Assertion.AssertEquals ("JW#LTrim/11", "", Strings.LTrim(" "));
- NUnit.Framework.Assertion.AssertEquals ("JW#LTrim/12", "", Strings.LTrim(null));
- NUnit.Framework.Assertion.AssertEquals ("JW#LTrim/13", "", Strings.LTrim(String.Empty));
- }
-
- [Test]
- public void RTrim()
- {
- NUnit.Framework.Assertion.AssertEquals ("JW#RTrim/10", " dkfÄ", Strings.RTrim(" dkfÄ "));
- NUnit.Framework.Assertion.AssertEquals ("JW#RTrim/11", "", Strings.RTrim(" "));
- NUnit.Framework.Assertion.AssertEquals ("JW#RTrim/12", "", Strings.RTrim(null));
- NUnit.Framework.Assertion.AssertEquals ("JW#RTrim/13", "", Strings.RTrim(String.Empty));
- }
-
- [Test]
- public void Trim()
- {
- NUnit.Framework.Assertion.AssertEquals ("JW#Trim/10", "dkfÄ", Strings.Trim(" dkfÄ "));
- NUnit.Framework.Assertion.AssertEquals ("JW#Trim/11", "", Strings.Trim(" "));
- NUnit.Framework.Assertion.AssertEquals ("JW#Trim/12", "", Strings.Trim(null));
- NUnit.Framework.Assertion.AssertEquals ("JW#Trim/13", "", Strings.Trim(String.Empty));
- }
-
- [Test]
- public void Mid()
- {
- Mid_WithLengthParameter();
- Mid_WithOutLengthParameter();
- }
-
- public void Mid_WithLengthParameter()
- {
- try
- {
- string buffer = Strings.Mid(String.Empty,0,0);
- NUnit.Framework.Assertion.Fail ("JW#Mid/10 hasn't thrown an error");
- }
- catch
- {
- NUnit.Framework.Assertion.Assert ("JW#Mid/10", true);
- }
- try
- {
- string buffer = Strings.Mid(String.Empty,0,1);
- NUnit.Framework.Assertion.Fail ("JW#Mid/11 hasn't thrown an error");
- }
- catch
- {
- NUnit.Framework.Assertion.Assert ("JW#Mid/11", true);
- }
- NUnit.Framework.Assertion.AssertEquals ("JW#Mid/12", "", Strings.Mid(String.Empty,1,0));
- NUnit.Framework.Assertion.AssertEquals ("JW#Mid/13", "", Strings.Mid(String.Empty,1,1));
- try
- {
- string buffer = Strings.Mid(String.Empty,-1,0);
- NUnit.Framework.Assertion.Fail ("JW#Mid/14 hasn't thrown an error");
- }
- catch
- {
- NUnit.Framework.Assertion.Assert ("JW#Mid/14", true);
- }
- try
- {
- string buffer = Strings.Mid(String.Empty,1,-1);
- NUnit.Framework.Assertion.Fail ("JW#Mid/15 hasn't thrown an error");
- }
- catch
- {
- NUnit.Framework.Assertion.Assert ("JW#Mid/15", true);
- }
-
- NUnit.Framework.Assertion.AssertEquals ("JW#Mid/22", "", Strings.Mid(GermanUmlauts_German,1,0));
- NUnit.Framework.Assertion.AssertEquals ("JW#Mid/23", "ä", Strings.Mid(GermanUmlauts_German,1,1));
- NUnit.Framework.Assertion.AssertEquals ("JW#Mid/27", "öüÄÖ", Strings.Mid(GermanUmlauts_German,2,4));
- NUnit.Framework.Assertion.AssertEquals ("JW#Mid/28", "öüÄÖÜß", Strings.Mid(GermanUmlauts_German,2,400));
-
- NUnit.Framework.Assertion.AssertEquals ("JW#Mid/32", "", Strings.Mid(ArabynetComWebSiteContent_Arabic,1,0));
- NUnit.Framework.Assertion.AssertEquals ("JW#Mid/33", "Ùƒ", Strings.Mid(ArabynetComWebSiteContent_Arabic,1,1));
- NUnit.Framework.Assertion.AssertEquals ("JW#Mid/37", "ل ال", Strings.Mid(ArabynetComWebSiteContent_Arabic,2,4));
- NUnit.Framework.Assertion.AssertEquals ("JW#Mid/38", "Ù„ الحقوق محÙوظة ليديعوت إنترنت", Strings.Mid(ArabynetComWebSiteContent_Arabic,2,400));
- }
-
- public void Mid_WithOutLengthParameter ()
- {
- try
- {
- string buffer = Strings.Mid(String.Empty,0);
- NUnit.Framework.Assertion.Fail ("JW#Mid/60 hasn't thrown an error");
- }
- catch
- {
- NUnit.Framework.Assertion.Assert ("JW#Mid/60", true);
- }
- NUnit.Framework.Assertion.AssertEquals ("JW#Mid/62", "", Strings.Mid(String.Empty,1));
- try
- {
- string buffer = Strings.Mid(String.Empty,-1);
- NUnit.Framework.Assertion.Fail ("JW#Mid/64 hasn't thrown an error");
- }
- catch
- {
- NUnit.Framework.Assertion.Assert ("JW#Mid/64", true);
- }
-
- NUnit.Framework.Assertion.AssertEquals ("JW#Mid/73", "äöüÄÖÜß", Strings.Mid(GermanUmlauts_German,1));
- NUnit.Framework.Assertion.AssertEquals ("JW#Mid/78", "öüÄÖÜß", Strings.Mid(GermanUmlauts_German,2));
-
- NUnit.Framework.Assertion.AssertEquals ("JW#Mid/82", "كل الحقوق محÙوظة ليديعوت إنترنت", Strings.Mid(ArabynetComWebSiteContent_Arabic,1));
- NUnit.Framework.Assertion.AssertEquals ("JW#Mid/88", "Ù„ الحقوق محÙوظة ليديعوت إنترنت", Strings.Mid(ArabynetComWebSiteContent_Arabic,2));
- }
-
-/* TODO: reenable when Mono supports compilation of these lines
- [Test]
- public void Replace()
- {
- string buffer;
-
- buffer = GermanUmlauts_German + GermanUmlauts_German + GermanUmlauts_German + GermanUmlauts_German;
-
- NUnit.Framework.Assertion.AssertEquals ("JW#Replace/10", null, Strings.Replace(String.Empty, "ÄÖ", "deee",1,-1,CompareMethod.Binary));
- NUnit.Framework.Assertion.AssertEquals ("JW#Replace/11", null, Strings.Replace(String.Empty, "ÄÖ", "deee",1,-1,CompareMethod.Text));
- NUnit.Framework.Assertion.AssertEquals ("JW#Replace/12", null, Strings.Replace(null, "ÄÖ", "deee",1,-1,CompareMethod.Binary));
- NUnit.Framework.Assertion.AssertEquals ("JW#Replace/13", null, Strings.Replace(null, "ÄÖ", "deee",1,-1,CompareMethod.Text));
-
- try
- {
- string buffer2 = Strings.Replace(buffer, "ÄÖ", "ÄÖ",0,0,CompareMethod.Binary);
- NUnit.Framework.Assertion.Fail ("JW#Replace/20 hasn't thrown an error");
- }
- catch
- {
- NUnit.Framework.Assertion.Assert ("JW#Replace/20", true);
- }
- NUnit.Framework.Assertion.AssertEquals ("JW#Replace/21", "ßäöüÄÖÜßäöüÄÖÜßäöüÄÖÜß", Strings.Replace(buffer, "ÄÖ", "ÄÖ",7,-1,CompareMethod.Binary));
- try
- {
- string buffer2 = Strings.Replace(buffer, "ÄÖ", "ÄÖ",7,-2,CompareMethod.Binary);
- NUnit.Framework.Assertion.Fail ("JW#Replace/22 hasn't thrown an error");
- }
- catch
- {
- NUnit.Framework.Assertion.Assert ("JW#Replace/22", true);
- }
- try
- {
- string buffer2 = Strings.Replace(buffer, "ÄÖ", "ÄÖ",-1,0,CompareMethod.Binary);
- NUnit.Framework.Assertion.Fail ("JW#Replace/23 hasn't thrown an error");
- }
- catch
- {
- NUnit.Framework.Assertion.Assert ("JW#Replace/23", true);
- }
- try
- {
- string buffer2 = Strings.Replace(buffer, "ÄÖ", "ÄÖ",-2,0,CompareMethod.Binary);
- NUnit.Framework.Assertion.Fail ("JW#Replace/24 hasn't thrown an error");
- }
- catch
- {
- NUnit.Framework.Assertion.Assert ("JW#Replace/24", true);
- }
- NUnit.Framework.Assertion.AssertEquals ("JW#Replace/25", "äöüÄÖÜßäöüÄÖÜßäöüÄÖÜßäöüÄÖÜß", Strings.Replace(buffer, "ÄÖ", "ÄÖ",1,0,CompareMethod.Binary));
- try
- {
- string buffer2 = Strings.Replace(buffer, "ÄÖ", "ÄÖ",0,1,CompareMethod.Binary);
- NUnit.Framework.Assertion.Fail ("JW#Replace/26 hasn't thrown an error");
- }
- catch
- {
- NUnit.Framework.Assertion.Assert ("JW#Replace/26", true);
- }
- NUnit.Framework.Assertion.AssertEquals ("JW#Replace/27", "äöüÄÖÜßäöüÄÖÜßäöüÄÖÜßäöüÄÖÜß", Strings.Replace(buffer, "ÄÖ", "ÄÖ",1,1,CompareMethod.Binary));
- NUnit.Framework.Assertion.AssertEquals ("JW#Replace/28", "ßäöüÄÖÜßäöüÄÖÜßäöüÄÖÜß", Strings.Replace(buffer, "ÄÖ", "ÄÖ",7,1,CompareMethod.Binary));
- NUnit.Framework.Assertion.AssertEquals ("JW#Replace/29", "ßäöüÄÖÜßäöüÄÖÜßäöüÄÖÜß", Strings.Replace(buffer, "ÄÖ", "ÄÖ",7,2,CompareMethod.Binary));
-
- NUnit.Framework.Assertion.AssertEquals ("JW#Replace/31", "ßäöüudddÜßäöüudddÜßäöüudddÜß", Strings.Replace(buffer, "ÄÖ", "uddd",7,-1,CompareMethod.Binary));
- NUnit.Framework.Assertion.AssertEquals ("JW#Replace/35", "äöüÄÖÜßäöüÄÖÜßäöüÄÖÜßäöüÄÖÜß", Strings.Replace(buffer, "ÄÖ", "uddd",1,0,CompareMethod.Binary));
- NUnit.Framework.Assertion.AssertEquals ("JW#Replace/37", "äöüudddÜßäöüÄÖÜßäöüÄÖÜßäöüÄÖÜß", Strings.Replace(buffer, "ÄÖ", "uddd",1,1,CompareMethod.Binary));
- NUnit.Framework.Assertion.AssertEquals ("JW#Replace/38", "ßäöüudddÜßäöüÄÖÜßäöüÄÖÜß", Strings.Replace(buffer, "ÄÖ", "uddd",7,1,CompareMethod.Binary));
- NUnit.Framework.Assertion.AssertEquals ("JW#Replace/39", "ßäöüudddÜßäöüudddÜßäöüÄÖÜß", Strings.Replace(buffer, "ÄÖ", "uddd",7,2,CompareMethod.Binary));
- NUnit.Framework.Assertion.AssertEquals ("JW#Replace/39a", "", Strings.Replace(buffer, "äöüÄÖÜß", "",1,-1,CompareMethod.Binary));
- NUnit.Framework.Assertion.AssertEquals ("JW#Replace/39b", String.Empty, Strings.Replace(buffer, "äöüÄÖÜß", "",1,-1,CompareMethod.Binary));
- NUnit.Framework.Assertion.AssertEquals ("JW#Replace/39c", null, Strings.Replace(buffer, "äöüÄÖÜß", "",400,-1,CompareMethod.Binary));
-
- buffer = ArabynetComWebSiteContent_Arabic + ArabynetComWebSiteContent_Arabic;
- //ArabynetComWebSiteContent_Arabic = "كل الحقوق محÙوظة ليديعوت إنترنت";
- NUnit.Framework.Assertion.AssertEquals ("JW#Replace/41", "وق محÙوظة ليديعوت إنترنتكل الحقوق محÙوظة ليديعوت إنترنت", Strings.Replace(buffer, "ÄÖ", "uddd",8,-1,CompareMethod.Binary));
- NUnit.Framework.Assertion.AssertEquals ("JW#Replace/45", "كل الحقوق محÙوظة ليديعوت إنترنتكل الحقوق محÙوظة ليديعوت إنترنت", Strings.Replace(buffer, "ÄÖ", "uddd",1,0,CompareMethod.Binary));
- NUnit.Framework.Assertion.AssertEquals ("JW#Replace/47", "كل الحقوق محÙوظة ليديعوت إنترنتكل الحقوق محÙوظة ليديعوت إنترنت", Strings.Replace(buffer, "ÄÖ", "uddd",1,1,CompareMethod.Binary));
- NUnit.Framework.Assertion.AssertEquals ("JW#Replace/48", "وق محÙوظة ليديعوت إنترنتكل الحقوق محÙوظة ليديعوت إنترنت", Strings.Replace(buffer, "ÄÖ", "uddd",8,1,CompareMethod.Binary));
- NUnit.Framework.Assertion.AssertEquals ("JW#Replace/49", "وق محÙوظة ليديعوت إنترنتكل الحقوق محÙوظة ليديعوت إنترنت", Strings.Replace(buffer, "ÄÖ", "uddd",8,2,CompareMethod.Binary));
- NUnit.Framework.Assertion.AssertEquals ("JW#Replace/49a", "", Strings.Replace(buffer, "كل الحقوق محÙوظة ليديعوت إنترنت", "",1,-1,CompareMethod.Binary));
- NUnit.Framework.Assertion.AssertEquals ("JW#Replace/49b", String.Empty, Strings.Replace(buffer, "كل الحقوق محÙوظة ليديعوت إنترنت", "",1,-1,CompareMethod.Binary));
-
- buffer = MSWebSiteContent_Korean + MSWebSiteContent_Korean;
- //MSWebSiteContent_Korean = "보안 ìº íŽ˜ì¸ - 스스로 지킨 ë‹¹ì‹ ì˜ PC! ë”ìš± 안전해집니다!";
- NUnit.Framework.Assertion.AssertEquals ("JW#Replace/51", " - 스스로 지킨 ë‹¹ì‹ ì˜ PC! ë”ìš± 안전해집니다!보안 ìº íŽ˜ì¸ - 스스로 지킨 ë‹¹ì‹ ì˜ PC! ë”ìš± 안전해집니다!", Strings.Replace(buffer, "ÄÖ", "uddd",7,-1,CompareMethod.Binary));
- NUnit.Framework.Assertion.AssertEquals ("JW#Replace/55", "보안 ìº íŽ˜ì¸ - 스스로 지킨 ë‹¹ì‹ ì˜ PC! ë”ìš± 안전해집니다!보안 ìº íŽ˜ì¸ - 스스로 지킨 ë‹¹ì‹ ì˜ PC! ë”ìš± 안전해집니다!", Strings.Replace(buffer, "ÄÖ", "uddd",1,0,CompareMethod.Binary));
- NUnit.Framework.Assertion.AssertEquals ("JW#Replace/57", "보안 ìº íŽ˜ì¸ - 스스로 지킨 ë‹¹ì‹ ì˜ PC! ë”ìš± 안전해집니다!보안 ìº íŽ˜ì¸ - 스스로 지킨 ë‹¹ì‹ ì˜ PC! ë”ìš± 안전해집니다!", Strings.Replace(buffer, "ÄÖ", "uddd",1,1,CompareMethod.Binary));
- NUnit.Framework.Assertion.AssertEquals ("JW#Replace/58", " - 스스로 지킨 ë‹¹ì‹ ì˜ PC! ë”ìš± 안전해집니다!보안 ìº íŽ˜ì¸ - 스스로 지킨 ë‹¹ì‹ ì˜ PC! ë”ìš± 안전해집니다!", Strings.Replace(buffer, "ÄÖ", "uddd",7,1,CompareMethod.Binary));
- NUnit.Framework.Assertion.AssertEquals ("JW#Replace/59", " - 스스로 지킨 ë‹¹ì‹ ì˜ PC! ë”ìš± 안전해집니다!보안 ìº íŽ˜ì¸ - 스스로 지킨 ë‹¹ì‹ ì˜ PC! ë”ìš± 안전해집니다!", Strings.Replace(buffer, "ÄÖ", "uddd",7,2,CompareMethod.Binary));
- NUnit.Framework.Assertion.AssertEquals ("JW#Replace/59a", "", Strings.Replace(buffer, "보안 ìº íŽ˜ì¸ - 스스로 지킨 ë‹¹ì‹ ì˜ PC! ë”ìš± 안전해집니다!", "",1,-1,CompareMethod.Binary));
- NUnit.Framework.Assertion.AssertEquals ("JW#Replace/59b", String.Empty, Strings.Replace(buffer, "보안 ìº íŽ˜ì¸ - 스스로 지킨 ë‹¹ì‹ ì˜ PC! ë”ìš± 안전해집니다!", "",1,-1,CompareMethod.Binary));
-
- buffer = GermanUmlauts_German + GermanUmlauts_German + GermanUmlauts_German + GermanUmlauts_German;
- NUnit.Framework.Assertion.AssertEquals ("JW#Replace/61", "ßudddüudddÜßudddüudddÜßudddüudddÜß", Strings.Replace(buffer, "ÄÖ", "uddd",7,-1,CompareMethod.Text));
- NUnit.Framework.Assertion.AssertEquals ("JW#Replace/65", "äöüÄÖÜßäöüÄÖÜßäöüÄÖÜßäöüÄÖÜß", Strings.Replace(buffer, "ÄÖ", "uddd",1,0,CompareMethod.Text));
- NUnit.Framework.Assertion.AssertEquals ("JW#Replace/67", "udddüÄÖÜßäöüÄÖÜßäöüÄÖÜßäöüÄÖÜß", Strings.Replace(buffer, "ÄÖ", "uddd",1,1,CompareMethod.Text));
- NUnit.Framework.Assertion.AssertEquals ("JW#Replace/68", "ßudddüÄÖÜßäöüÄÖÜßäöüÄÖÜß", Strings.Replace(buffer, "ÄÖ", "uddd",7,1,CompareMethod.Text));
- NUnit.Framework.Assertion.AssertEquals ("JW#Replace/69", "ßudddüudddÜßäöüÄÖÜßäöüÄÖÜß", Strings.Replace(buffer, "ÄÖ", "uddd",7,2,CompareMethod.Text));
- NUnit.Framework.Assertion.AssertEquals ("JW#Replace/69a", "ßßßß", Strings.Replace(buffer, "äöü", "",1,-1,CompareMethod.Text));
- NUnit.Framework.Assertion.AssertEquals ("JW#Replace/69b", String.Empty, Strings.Replace(buffer, "äöüÄÖÜß", "",1,-1,CompareMethod.Text));
- NUnit.Framework.Assertion.AssertEquals ("JW#Replace/69c", null, Strings.Replace(buffer, "äöüÄÖÜß", "",400,-1,CompareMethod.Text));
-
- buffer = ArabynetComWebSiteContent_Arabic + ArabynetComWebSiteContent_Arabic;
- //ArabynetComWebSiteContent_Arabic = "كل الحقوق محÙوظة ليديعوت إنترنت";
- NUnit.Framework.Assertion.AssertEquals ("JW#Replace/71", "وق محÙوظة ليديعوت إنترنتكل الحقوق محÙوظة ليديعوت إنترنت", Strings.Replace(buffer, "ÄÖ", "uddd",8,-1,CompareMethod.Text));
- NUnit.Framework.Assertion.AssertEquals ("JW#Replace/75", "كل الحقوق محÙوظة ليديعوت إنترنتكل الحقوق محÙوظة ليديعوت إنترنت", Strings.Replace(buffer, "ÄÖ", "uddd",1,0,CompareMethod.Text));
- NUnit.Framework.Assertion.AssertEquals ("JW#Replace/77", "كل الحقوق محÙوظة ليديعوت إنترنتكل الحقوق محÙوظة ليديعوت إنترنت", Strings.Replace(buffer, "ÄÖ", "uddd",1,1,CompareMethod.Text));
- NUnit.Framework.Assertion.AssertEquals ("JW#Replace/78", "وق محÙوظة ليديعوت إنترنتكل الحقوق محÙوظة ليديعوت إنترنت", Strings.Replace(buffer, "ÄÖ", "uddd",8,1,CompareMethod.Text));
- NUnit.Framework.Assertion.AssertEquals ("JW#Replace/79", "وق محÙوظة ليديعوت إنترنتكل الحقوق محÙوظة ليديعوت إنترنت", Strings.Replace(buffer, "ÄÖ", "uddd",8,2,CompareMethod.Text));
- NUnit.Framework.Assertion.AssertEquals ("JW#Replace/79a", "", Strings.Replace(buffer, "كل الحقوق محÙوظة ليديعوت إنترنت", "",1,-1,CompareMethod.Text));
- NUnit.Framework.Assertion.AssertEquals ("JW#Replace/79b", String.Empty, Strings.Replace(buffer, "كل الحقوق محÙوظة ليديعوت إنترنت", "",1,-1,CompareMethod.Text));
- NUnit.Framework.Assertion.AssertEquals ("JW#Replace/79c", "uddd", Strings.Replace(buffer, Strings.UCase("وق محÙوظة ليديعوت إنترنتكل الحقوق محÙوظة ليديعوت إنترنت"), "uddd",8,2,CompareMethod.Text));
-
- buffer = MSWebSiteContent_Korean + MSWebSiteContent_Korean;
- //MSWebSiteContent_Korean = "보안 ìº íŽ˜ì¸ - 스스로 지킨 ë‹¹ì‹ ì˜ PC! ë”ìš± 안전해집니다!";
- NUnit.Framework.Assertion.AssertEquals ("JW#Replace/81", " - 스스로 지킨 ë‹¹ì‹ ì˜ PC! ë”ìš± 안전해집니다!보안 ìº íŽ˜ì¸ - 스스로 지킨 ë‹¹ì‹ ì˜ PC! ë”ìš± 안전해집니다!", Strings.Replace(buffer, "ÄÖ", "uddd",7,-1,CompareMethod.Text));
- NUnit.Framework.Assertion.AssertEquals ("JW#Replace/85", "보안 ìº íŽ˜ì¸ - 스스로 지킨 ë‹¹ì‹ ì˜ PC! ë”ìš± 안전해집니다!보안 ìº íŽ˜ì¸ - 스스로 지킨 ë‹¹ì‹ ì˜ PC! ë”ìš± 안전해집니다!", Strings.Replace(buffer, "ÄÖ", "uddd",1,0,CompareMethod.Text));
- NUnit.Framework.Assertion.AssertEquals ("JW#Replace/87", "보안 ìº íŽ˜ì¸ - 스스로 지킨 ë‹¹ì‹ ì˜ PC! ë”ìš± 안전해집니다!보안 ìº íŽ˜ì¸ - 스스로 지킨 ë‹¹ì‹ ì˜ PC! ë”ìš± 안전해집니다!", Strings.Replace(buffer, "ÄÖ", "uddd",1,1,CompareMethod.Text));
- NUnit.Framework.Assertion.AssertEquals ("JW#Replace/88", " - 스스로 지킨 ë‹¹ì‹ ì˜ PC! ë”ìš± 안전해집니다!보안 ìº íŽ˜ì¸ - 스스로 지킨 ë‹¹ì‹ ì˜ PC! ë”ìš± 안전해집니다!", Strings.Replace(buffer, "ÄÖ", "uddd",7,1,CompareMethod.Text));
- NUnit.Framework.Assertion.AssertEquals ("JW#Replace/89", " - 스스로 지킨 ë‹¹ì‹ ì˜ PC! ë”ìš± 안전해집니다!보안 ìº íŽ˜ì¸ - 스스로 지킨 ë‹¹ì‹ ì˜ PC! ë”ìš± 안전해집니다!", Strings.Replace(buffer, "ÄÖ", "uddd",7,2,CompareMethod.Text));
- NUnit.Framework.Assertion.AssertEquals ("JW#Replace/89a", "", Strings.Replace(buffer, "보안 ìº íŽ˜ì¸ - 스스로 지킨 ë‹¹ì‹ ì˜ PC! ë”ìš± 안전해집니다!", "",1,-1,CompareMethod.Text));
- NUnit.Framework.Assertion.AssertEquals ("JW#Replace/89b", String.Empty, Strings.Replace(buffer, "보안 ìº íŽ˜ì¸ - 스스로 지킨 ë‹¹ì‹ ì˜ PC! ë”ìš± 안전해집니다!", "",1,-1,CompareMethod.Text));
- }
-*/
-
- [Test]
- public void Right()
- {
- try
- {
- string buffer2 = Strings.Right(TextStringOfMultipleLanguages, 0);
- NUnit.Framework.Assertion.Fail ("JW#Right/20 hasn't thrown an error");
- }
- catch
- {
- NUnit.Framework.Assertion.Assert ("JW#Right/20", true);
- }
-
- NUnit.Framework.Assertion.AssertEquals ("JW#Right/21", "يديعوت إنترنتäöüÄÖÜß", Strings.Right(TextStringOfMultipleLanguages, 20));
- NUnit.Framework.Assertion.AssertEquals ("JW#Right/22", TextStringOfMultipleLanguages, Strings.Right(TextStringOfMultipleLanguages, 20000));
-
- }
-
- [Test]
- public void RSet()
- {
- NUnit.Framework.Assertion.AssertEquals ("JW#RSet/10", " lf", Strings.RSet(" lfkdfkd ", 4));
- NUnit.Framework.Assertion.AssertEquals ("JW#RSet/11", "", Strings.RSet(" lfkdfkd ", 0));
- try
- {
- string buffer = Strings.RSet(" lfkdfkd ", -1);
- NUnit.Framework.Assertion.Fail ("JW#RSet/12 hasn't thrown an error");
- }
- catch
- {
- NUnit.Framework.Assertion.Assert ("JW#RSet/12", true);
- }
- NUnit.Framework.Assertion.AssertEquals ("JW#RSet/11", " lfkdfkd ", Strings.RSet(" lfkdfkd ", 20));
- }
-
- [Test]
- public void Space()
- {
- NUnit.Framework.Assertion.AssertEquals ("JW*Space#01", "", Strings.Space(0));
- NUnit.Framework.Assertion.AssertEquals ("JW*Space#02", " ", Strings.Space(2));
- NUnit.Framework.Assertion.AssertEquals ("JW*Space#03", Strings.Chr(32).ToString() + Strings.Chr(32).ToString(), Strings.Space(2));
- NUnit.Framework.Assertion.AssertEquals ("JW*Space#03a", String.Concat(Strings.Chr(32).ToString(), Strings.Chr(32).ToString()), Strings.Space(2));
- NUnit.Framework.Assertion.AssertEquals ("JW*Space#04", " ", Strings.Space(8));
- try
- {
- string buf = Strings.Space(-1);
- NUnit.Framework.Assert.Fail ("JW*Space#10");
- }
- catch
- {
- }
- }
-
-/* TODO: reenable when Mono supports compilation of these lines
- [Test]
- public void Split()
- {
- string buffer = GermanUmlauts_German + GermanUmlauts_German + GermanUmlauts_German + GermanUmlauts_German;
- NUnit.Framework.Assertion.AssertEquals ("JW*Split#01", 1, Strings.Split("äö","ü", 0, CompareMethod.Binary).Length);
- NUnit.Framework.Assertion.AssertEquals ("JW*Split#01a", "", Strings.Split(String.Empty," ", -1, CompareMethod.Binary)[0]);
- NUnit.Framework.Assertion.AssertEquals ("JW*Split#01a", 1, Strings.Split(String.Empty," ", -1, CompareMethod.Binary).Length);
- NUnit.Framework.Assertion.AssertEquals ("JW*Split#01b", 1, Strings.Split(String.Empty,"", -1, CompareMethod.Binary).Length);
- NUnit.Framework.Assertion.AssertEquals ("JW*Split#01b", "", Strings.Split(String.Empty,"", -1, CompareMethod.Binary)[0]);
- try
- {
- string buffer2 = Strings.Split(buffer,"ü", 0, CompareMethod.Binary).Length.ToString();
- NUnit.Framework.Assertion.Fail ("JW#Split#01c hasn't thrown an error");
- }
- catch
- {
- }
- try
- {
- string buffer2 = Strings.Split(buffer,"ü", -2, CompareMethod.Binary).Length.ToString();
- NUnit.Framework.Assertion.Fail ("JW#Split#02 hasn't thrown an error");
- }
- catch
- {
- }
- NUnit.Framework.Assertion.AssertEquals ("JW*Split#10", 5, Strings.Split(buffer,"ü", -1, CompareMethod.Binary).Length);
- NUnit.Framework.Assertion.AssertEquals ("JW*Split#11", 2, Strings.Split(buffer,"ü", 2, CompareMethod.Binary).Length);
- NUnit.Framework.Assertion.AssertEquals ("JW*Split#12", 9, Strings.Split(buffer,"ü", -1, CompareMethod.Text).Length);
- NUnit.Framework.Assertion.AssertEquals ("JW*Split#13", 1, Strings.Split(buffer,"ü", 1, CompareMethod.Text).Length);
- NUnit.Framework.Assertion.AssertEquals ("JW*Split#14", 1, Strings.Split(buffer,"", -1, CompareMethod.Binary).Length);
- NUnit.Framework.Assertion.AssertEquals ("JW*Split#15", 1, Strings.Split(buffer,"", 2, CompareMethod.Binary).Length);
- NUnit.Framework.Assertion.AssertEquals ("JW*Split#16", 1, Strings.Split(buffer,"", -1, CompareMethod.Text).Length);
- NUnit.Framework.Assertion.AssertEquals ("JW*Split#17", 1, Strings.Split(buffer,"", 1, CompareMethod.Text).Length);
- NUnit.Framework.Assertion.AssertEquals ("JW*Split#14a", 5, Strings.Split(buffer,"äö", -1, CompareMethod.Binary).Length);
- NUnit.Framework.Assertion.AssertEquals ("JW*Split#15a", 2, Strings.Split(buffer,"äö", 2, CompareMethod.Binary).Length);
- NUnit.Framework.Assertion.AssertEquals ("JW*Split#16a", 9, Strings.Split(buffer,"äö", -1, CompareMethod.Text).Length);
- NUnit.Framework.Assertion.AssertEquals ("JW*Split#17a", 1, Strings.Split(buffer,"äö", 1, CompareMethod.Text).Length);
- NUnit.Framework.Assertion.AssertEquals ("JW*Split#14b", "üÄÖÜß", Strings.Split(buffer,"äö", -1, CompareMethod.Binary)[4]);
- NUnit.Framework.Assertion.AssertEquals ("JW*Split#15b", "üÄÖÜßäöüÄÖÜßäöüÄÖÜßäöüÄÖÜß", Strings.Split(buffer,"äö", 2, CompareMethod.Binary)[1]);
- NUnit.Framework.Assertion.AssertEquals ("JW*Split#16b", "Üß", Strings.Split(buffer,"äö", -1, CompareMethod.Text)[8]);
- NUnit.Framework.Assertion.AssertEquals ("JW*Split#17b", "äöüÄÖÜßäöüÄÖÜßäöüÄÖÜßäöüÄÖÜß", Strings.Split(buffer,"äö", 1, CompareMethod.Text)[0]);
- NUnit.Framework.Assertion.AssertEquals ("JW*Split#17c", "", Strings.Split(buffer,"äö", 2, CompareMethod.Text)[0]);
-
- string myString = "Look at these!";
- string[] myReturn = {"Look", "at", "these!"};
- NUnit.Framework.Assertion.AssertEquals ("JW*Split#18", 3, Strings.Split(myString, " ", -1, CompareMethod.Binary).Length);
- NUnit.Framework.Assertion.AssertEquals ("JW*Split#18a", myReturn[0], Strings.Split(myString, " ", -1, CompareMethod.Binary)[0]);
- NUnit.Framework.Assertion.AssertEquals ("JW*Split#18b", myReturn[1], Strings.Split(myString, " ", -1, CompareMethod.Binary)[1]);
- NUnit.Framework.Assertion.AssertEquals ("JW*Split#18c", myReturn[2], Strings.Split(myString, " ", -1, CompareMethod.Binary)[2]);
-
- NUnit.Framework.Assertion.AssertEquals ("JW*Split#20", "äöüÄÖ", Strings.Split(buffer,"Ü", -1, CompareMethod.Binary)[0]);
- NUnit.Framework.Assertion.AssertEquals ("JW*Split#21", "äöüÄÖ", Strings.Split(buffer,"Ü", 2, CompareMethod.Binary)[0]);
- NUnit.Framework.Assertion.AssertEquals ("JW*Split#22", "äö", Strings.Split(buffer,"Ü", -1, CompareMethod.Text)[0]);
- NUnit.Framework.Assertion.AssertEquals ("JW*Split#23", "äöüÄÖÜßäöüÄÖÜßäöüÄÖÜßäöüÄÖÜß", Strings.Split(buffer,"Ü", 1, CompareMethod.Text)[0]);
- NUnit.Framework.Assertion.AssertEquals ("JW*Split#24", "äö", Strings.Split(buffer,"Ü", 2, CompareMethod.Text)[0]);
-
- }
-
- [Test]
- public void StrComp()
- {
- NUnit.Framework.Assertion.AssertEquals ("JW*StrComp#01", -1, Strings.StrComp(Strings.UCase(TextStringOfMultipleLanguages),TextStringOfMultipleLanguages, CompareMethod.Binary));
- NUnit.Framework.Assertion.AssertEquals ("JW*StrComp#02", 1, Strings.StrComp(Strings.LCase(TextStringOfMultipleLanguages),TextStringOfMultipleLanguages, CompareMethod.Binary));
- NUnit.Framework.Assertion.AssertEquals ("JW*StrComp#03", 0, Strings.StrComp(TextStringOfMultipleLanguages,TextStringOfMultipleLanguages, CompareMethod.Binary));
- NUnit.Framework.Assertion.AssertEquals ("JW*StrComp#04", -1, Strings.StrComp(String.Empty,TextStringOfMultipleLanguages, CompareMethod.Binary));
- NUnit.Framework.Assertion.AssertEquals ("JW*StrComp#05", -1, Strings.StrComp(null,TextStringOfMultipleLanguages, CompareMethod.Binary));
- NUnit.Framework.Assertion.AssertEquals ("JW*StrComp#06", -1, Strings.StrComp(" " + TextStringOfMultipleLanguages,TextStringOfMultipleLanguages, CompareMethod.Binary));
- NUnit.Framework.Assertion.AssertEquals ("JW*StrComp#06a", -1, Strings.StrComp(Strings.ChrW(6444) + TextStringOfMultipleLanguages,TextStringOfMultipleLanguages, CompareMethod.Binary));
- NUnit.Framework.Assertion.AssertEquals ("JW*StrComp#07", 1, Strings.StrComp(TextStringOfMultipleLanguages + " ",TextStringOfMultipleLanguages, CompareMethod.Binary));
-
- NUnit.Framework.Assertion.AssertEquals ("JW*StrComp#11", 0, Strings.StrComp(Strings.UCase(TextStringOfMultipleLanguages),TextStringOfMultipleLanguages, CompareMethod.Text));
- NUnit.Framework.Assertion.AssertEquals ("JW*StrComp#12", 0, Strings.StrComp(Strings.LCase(TextStringOfMultipleLanguages),TextStringOfMultipleLanguages, CompareMethod.Text));
- NUnit.Framework.Assertion.AssertEquals ("JW*StrComp#13", 0, Strings.StrComp(TextStringOfMultipleLanguages,TextStringOfMultipleLanguages, CompareMethod.Binary));
- NUnit.Framework.Assertion.AssertEquals ("JW*StrComp#14", -1, Strings.StrComp(String.Empty,TextStringOfMultipleLanguages, CompareMethod.Binary));
- NUnit.Framework.Assertion.AssertEquals ("JW*StrComp#15", -1, Strings.StrComp(null,TextStringOfMultipleLanguages, CompareMethod.Binary));
- NUnit.Framework.Assertion.AssertEquals ("JW*StrComp#06", -1, Strings.StrComp(" " + TextStringOfMultipleLanguages,TextStringOfMultipleLanguages, CompareMethod.Text));
- NUnit.Framework.Assertion.AssertEquals ("JW*StrComp#06a", 0, Strings.StrComp(Strings.ChrW(10654) + TextStringOfMultipleLanguages,TextStringOfMultipleLanguages, CompareMethod.Text)); //seems to be a MS bug?
- NUnit.Framework.Assertion.AssertEquals ("JW*StrComp#06b", -1, Strings.StrComp(Strings.ChrW(88) + TextStringOfMultipleLanguages,TextStringOfMultipleLanguages, CompareMethod.Text));
- NUnit.Framework.Assertion.AssertEquals ("JW*StrComp#07", 1, Strings.StrComp(TextStringOfMultipleLanguages + " ",TextStringOfMultipleLanguages, CompareMethod.Text));
- }
-*/
-
- // TODO: Chinese testings
- [Test]
- public void StrConv ()
- {
- // buffer current culture
- System.Globalization.CultureInfo CurCulture = System.Threading.Thread.CurrentThread.CurrentCulture;
-
- // do testings
-
- // ***********
- // ** EN-US **
- // ***********
-
- System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
-
- //requires japanese systems
- //NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#02", 1, Strings.StrConv(TextStringOfMultipleLanguages, VbStrConv.Hiragana, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
- //NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#03", 1, Strings.StrConv(TextStringOfMultipleLanguages, VbStrConv.Katakana, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
-
- //TODO: how to write VbStrConv.LinguisticCasing + VbStrConv.UpperCase correctly?
- //NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#04", 1, Strings.StrConv(TextStringOfMultipleLanguages, (VbStrConv.LinguisticCasing + VbStrConv.UpperCase), System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
- //NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#04a", 1, Strings.StrConv(TextStringOfMultipleLanguages, VbStrConv.LinguisticCasing || VbStrConv.LowerCase, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
-
- //not supported
- //NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#05", 1, Strings.StrConv(TextStringOfMultipleLanguages, VbStrConv.Narrow, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
- //NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#11", 1, Strings.StrConv(TextStringOfMultipleLanguages, VbStrConv.Wide, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
-
- NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#06", TextStringOfMultipleLanguages, Strings.StrConv(TextStringOfMultipleLanguages, VbStrConv.None, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
- NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#01", "é›»å­ãƒ¡ãƒ¼ãƒ«ã‚’ã¯ã˜ã‚ã€äºˆå®šè¡¨ã‚„アドレス帳ãªã©ã®å€‹äººæƒ…å ±ã€ã•ã‚‰ã«ã¯ office v. x ã®å„アプリケーションã§ä½œæˆã—ãŸæ›¸é¡žã‚„ãã®ä»–ã®ãƒ•ã‚¡ã‚¤ãƒ«ã‚’リンクã•ã›ã¦çµ±åˆçš„ã«ç®¡ç†ã™ã‚‹ã“ã¨ãŒã§ãるコミュニケーションï¼å€‹äººæƒ…報管ç†ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã§ã™ã€‚インターフェースãŒä¸€æ–°ã•ã‚Œã€é«˜åº¦ã§å¤šå½©ãª entourage x ã®æ©Ÿèƒ½ãŒã‚ˆã‚Šç›´æ„Ÿçš„ã«åˆ©ç”¨ã§ãるよã†ã«ãªã‚Šã¾ã—ãŸã€‚以å‰ãŠä½¿ã„ã«ãªã£ã¦ã„ãŸé›»å­ãƒ¡ãƒ¼ãƒ« アプリケーションã‹ã‚‰ã®æƒ…å ±ã®ã‚¤ãƒ³ãƒãƒ¼ãƒˆã‚‚容易ã«ã§ãã¾ã™ã€‚будете автоматичеÑки перенаправленыÄníci nároÄných používateľovnové portfólio microsoft hardware. Å¡piÄkové optické bezdrôtové myÅ¡ky s novou technológiou - nakláňacím kolieskom. nezáleží na tom, aký stôl máte, pokiaľ je na ňom elegantná보안 ìº íŽ˜ì¸ - 스스로 지킨 ë‹¹ì‹ ì˜ pc! ë”ìš± 안전해집니다!كل الحقوق محÙوظة ليديعوت إنترنتäöüäöüß", Strings.StrConv(TextStringOfMultipleLanguages, VbStrConv.LowerCase, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
- NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#07", "é›»å­ãƒ¡ãƒ¼ãƒ«ã‚’ã¯ã˜ã‚ã€äºˆå®šè¡¨ã‚„アドレス帳ãªã©ã®å€‹äººæƒ…å ±ã€ã•ã‚‰ã«ã¯ Office V. X ã®å„アプリケーションã§ä½œæˆã—ãŸæ›¸é¡žã‚„ãã®ä»–ã®ãƒ•ã‚¡ã‚¤ãƒ«ã‚’リンクã•ã›ã¦çµ±åˆçš„ã«ç®¡ç†ã™ã‚‹ã“ã¨ãŒã§ãるコミュニケーションï¼å€‹äººæƒ…報管ç†ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã§ã™ã€‚インターフェースãŒä¸€æ–°ã•ã‚Œã€é«˜åº¦ã§å¤šå½©ãª Entourage X ã®æ©Ÿèƒ½ãŒã‚ˆã‚Šç›´æ„Ÿçš„ã«åˆ©ç”¨ã§ãるよã†ã«ãªã‚Šã¾ã—ãŸã€‚以å‰ãŠä½¿ã„ã«ãªã£ã¦ã„ãŸé›»å­ãƒ¡ãƒ¼ãƒ« アプリケーションã‹ã‚‰ã®æƒ…å ±ã®ã‚¤ãƒ³ãƒãƒ¼ãƒˆã‚‚容易ã«ã§ãã¾ã™ã€‚Будете ÐвтоматичеÑки ПеренаправленыÄníci NároÄných Používateľovnové Portfólio Microsoft Hardware. Å piÄkové Optické Bezdrôtové MyÅ¡ky S Novou Technológiou - Nakláňacím Kolieskom. Nezáleží Na Tom, Aký Stôl Máte, Pokiaľ Je Na Ňom Elegantná보안 ìº íŽ˜ì¸ - 스스로 지킨 ë‹¹ì‹ ì˜ Pc! ë”ìš± 안전해집니다!كل الحقوق محÙوظة ليديعوت إنترنتäöüäöüß", Strings.StrConv(TextStringOfMultipleLanguages, VbStrConv.ProperCase, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
- NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#10", "é›»å­ãƒ¡ãƒ¼ãƒ«ã‚’ã¯ã˜ã‚ã€äºˆå®šè¡¨ã‚„アドレス帳ãªã©ã®å€‹äººæƒ…å ±ã€ã•ã‚‰ã«ã¯ OFFICE V. X ã®å„アプリケーションã§ä½œæˆã—ãŸæ›¸é¡žã‚„ãã®ä»–ã®ãƒ•ã‚¡ã‚¤ãƒ«ã‚’リンクã•ã›ã¦çµ±åˆçš„ã«ç®¡ç†ã™ã‚‹ã“ã¨ãŒã§ãるコミュニケーションï¼å€‹äººæƒ…報管ç†ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã§ã™ã€‚インターフェースãŒä¸€æ–°ã•ã‚Œã€é«˜åº¦ã§å¤šå½©ãª ENTOURAGE X ã®æ©Ÿèƒ½ãŒã‚ˆã‚Šç›´æ„Ÿçš„ã«åˆ©ç”¨ã§ãるよã†ã«ãªã‚Šã¾ã—ãŸã€‚以å‰ãŠä½¿ã„ã«ãªã£ã¦ã„ãŸé›»å­ãƒ¡ãƒ¼ãƒ« アプリケーションã‹ã‚‰ã®æƒ…å ±ã®ã‚¤ãƒ³ãƒãƒ¼ãƒˆã‚‚容易ã«ã§ãã¾ã™ã€‚БУДЕТЕ ÐВТОМÐТИЧЕСКИ ПЕРЕÐÐПРÐВЛЕÐЫČNÃCI NÃROÄŒNÃCH POUŽÃVATEĽOVNOVÉ PORTFÓLIO MICROSOFT HARDWARE. Å PIÄŒKOVÉ OPTICKÉ BEZDRÔTOVÉ MYÅ KY S NOVOU TECHNOLÓGIOU - NAKLÃŇACÃM KOLIESKOM. NEZÃLEŽà NA TOM, AKà STÔL MÃTE, POKIAĽ JE NA ŇOM ELEGANTNÃ보안 ìº íŽ˜ì¸ - 스스로 지킨 ë‹¹ì‹ ì˜ PC! ë”ìš± 안전해집니다!كل الحقوق محÙوظة ليديعوت إنترنتÄÖÜÄÖÜß", Strings.StrConv(TextStringOfMultipleLanguages, VbStrConv.UpperCase, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
-
- //TODO: implementation for Chinese characters
- //NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#08", 1, Strings.StrConv(TextStringOfMultipleLanguages, VbStrConv.SimplifiedChinese, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
- //NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#09", 1, Strings.StrConv(TextStringOfMultipleLanguages, VbStrConv.TraditionalChinese, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
-
- //ProperCase word delimiters
- NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#13", "Lksdjfda Älkjdf Ükjlhj" + Strings.Chr(0) + "Ldkfjd", Strings.StrConv("lksdjfda älkjdf ükjlhj" + Strings.Chr(0) + "ldkfjd", VbStrConv.ProperCase, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
- NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#14", "Lksdjfda Älkjdf Ükjlhj" + Strings.Chr(9) + "Ldkfjd", Strings.StrConv("lksdjfda älkjdf ükjlhj" + Strings.Chr(9) + "ldkfjd", VbStrConv.ProperCase, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
- NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#15", "Lksdjfda Älkjdf Ükjlhj" + Strings.Chr(10) + "Ldkfjd", Strings.StrConv("lksdjfda älkjdf ükjlhj" + Strings.Chr(10) + "ldkfjd", VbStrConv.ProperCase, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
- NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#16", "Lksdjfda Älkjdf Ükjlhj" + Strings.Chr(11) + "Ldkfjd", Strings.StrConv("lksdjfda älkjdf ükjlhj" + Strings.Chr(11) + "ldkfjd", VbStrConv.ProperCase, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
- NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#17", "Lksdjfda Älkjdf Ükjlhj" + Strings.Chr(12) + "Ldkfjd", Strings.StrConv("lksdjfda älkjdf ükjlhj" + Strings.Chr(12) + "ldkfjd", VbStrConv.ProperCase, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
- NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#18", "Lksdjfda Älkjdf Ükjlhj" + Strings.Chr(13) + "Ldkfjd", Strings.StrConv("lksdjfda älkjdf ükjlhj" + Strings.Chr(13) + "ldkfjd", VbStrConv.ProperCase, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
- NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#19", "Lksdjfda Älkjdf Ükjlhj" + Strings.Chr(32) + "Ldkfjd", Strings.StrConv("lksdjfda älkjdf ükjlhj" + Strings.Chr(32) + "ldkfjd", VbStrConv.ProperCase, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
-
- // ***********
- // ** DE-DE **
- // ***********
-
- System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo("de-DE");
-
- //requires japanese systems
- //NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#22", 1, Strings.StrConv(TextStringOfMultipleLanguages, VbStrConv.Hiragana, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
- //NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#23", 1, Strings.StrConv(TextStringOfMultipleLanguages, VbStrConv.Katakana, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
-
- //TODO: how to write VbStrConv.LinguisticCasing + VbStrConv.UpperCase correctly?
- //NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#24", 1, Strings.StrConv(TextStringOfMultipleLanguages, VbStrConv.LinguisticCasing, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
-
- //not supported
- //NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#25", 1, Strings.StrConv(TextStringOfMultipleLanguages, VbStrConv.Narrow, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
- //NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#31", 1, Strings.StrConv(TextStringOfMultipleLanguages, VbStrConv.Wide, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
-
- NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#26", TextStringOfMultipleLanguages, Strings.StrConv(TextStringOfMultipleLanguages, VbStrConv.None, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
- NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#21", "é›»å­ãƒ¡ãƒ¼ãƒ«ã‚’ã¯ã˜ã‚ã€äºˆå®šè¡¨ã‚„アドレス帳ãªã©ã®å€‹äººæƒ…å ±ã€ã•ã‚‰ã«ã¯ office v. x ã®å„アプリケーションã§ä½œæˆã—ãŸæ›¸é¡žã‚„ãã®ä»–ã®ãƒ•ã‚¡ã‚¤ãƒ«ã‚’リンクã•ã›ã¦çµ±åˆçš„ã«ç®¡ç†ã™ã‚‹ã“ã¨ãŒã§ãるコミュニケーションï¼å€‹äººæƒ…報管ç†ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã§ã™ã€‚インターフェースãŒä¸€æ–°ã•ã‚Œã€é«˜åº¦ã§å¤šå½©ãª entourage x ã®æ©Ÿèƒ½ãŒã‚ˆã‚Šç›´æ„Ÿçš„ã«åˆ©ç”¨ã§ãるよã†ã«ãªã‚Šã¾ã—ãŸã€‚以å‰ãŠä½¿ã„ã«ãªã£ã¦ã„ãŸé›»å­ãƒ¡ãƒ¼ãƒ« アプリケーションã‹ã‚‰ã®æƒ…å ±ã®ã‚¤ãƒ³ãƒãƒ¼ãƒˆã‚‚容易ã«ã§ãã¾ã™ã€‚будете автоматичеÑки перенаправленыÄníci nároÄných používateľovnové portfólio microsoft hardware. Å¡piÄkové optické bezdrôtové myÅ¡ky s novou technológiou - nakláňacím kolieskom. nezáleží na tom, aký stôl máte, pokiaľ je na ňom elegantná보안 ìº íŽ˜ì¸ - 스스로 지킨 ë‹¹ì‹ ì˜ pc! ë”ìš± 안전해집니다!كل الحقوق محÙوظة ليديعوت إنترنتäöüäöüß", Strings.StrConv(TextStringOfMultipleLanguages, VbStrConv.LowerCase, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
- NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#27", "é›»å­ãƒ¡ãƒ¼ãƒ«ã‚’ã¯ã˜ã‚ã€äºˆå®šè¡¨ã‚„アドレス帳ãªã©ã®å€‹äººæƒ…å ±ã€ã•ã‚‰ã«ã¯ Office V. X ã®å„アプリケーションã§ä½œæˆã—ãŸæ›¸é¡žã‚„ãã®ä»–ã®ãƒ•ã‚¡ã‚¤ãƒ«ã‚’リンクã•ã›ã¦çµ±åˆçš„ã«ç®¡ç†ã™ã‚‹ã“ã¨ãŒã§ãるコミュニケーションï¼å€‹äººæƒ…報管ç†ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã§ã™ã€‚インターフェースãŒä¸€æ–°ã•ã‚Œã€é«˜åº¦ã§å¤šå½©ãª Entourage X ã®æ©Ÿèƒ½ãŒã‚ˆã‚Šç›´æ„Ÿçš„ã«åˆ©ç”¨ã§ãるよã†ã«ãªã‚Šã¾ã—ãŸã€‚以å‰ãŠä½¿ã„ã«ãªã£ã¦ã„ãŸé›»å­ãƒ¡ãƒ¼ãƒ« アプリケーションã‹ã‚‰ã®æƒ…å ±ã®ã‚¤ãƒ³ãƒãƒ¼ãƒˆã‚‚容易ã«ã§ãã¾ã™ã€‚Будете ÐвтоматичеÑки ПеренаправленыÄníci NároÄných Používateľovnové Portfólio Microsoft Hardware. Å piÄkové Optické Bezdrôtové MyÅ¡ky S Novou Technológiou - Nakláňacím Kolieskom. Nezáleží Na Tom, Aký Stôl Máte, Pokiaľ Je Na Ňom Elegantná보안 ìº íŽ˜ì¸ - 스스로 지킨 ë‹¹ì‹ ì˜ Pc! ë”ìš± 안전해집니다!كل الحقوق محÙوظة ليديعوت إنترنتäöüäöüß", Strings.StrConv(TextStringOfMultipleLanguages, VbStrConv.ProperCase, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
- NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#30", "é›»å­ãƒ¡ãƒ¼ãƒ«ã‚’ã¯ã˜ã‚ã€äºˆå®šè¡¨ã‚„アドレス帳ãªã©ã®å€‹äººæƒ…å ±ã€ã•ã‚‰ã«ã¯ OFFICE V. X ã®å„アプリケーションã§ä½œæˆã—ãŸæ›¸é¡žã‚„ãã®ä»–ã®ãƒ•ã‚¡ã‚¤ãƒ«ã‚’リンクã•ã›ã¦çµ±åˆçš„ã«ç®¡ç†ã™ã‚‹ã“ã¨ãŒã§ãるコミュニケーションï¼å€‹äººæƒ…報管ç†ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã§ã™ã€‚インターフェースãŒä¸€æ–°ã•ã‚Œã€é«˜åº¦ã§å¤šå½©ãª ENTOURAGE X ã®æ©Ÿèƒ½ãŒã‚ˆã‚Šç›´æ„Ÿçš„ã«åˆ©ç”¨ã§ãるよã†ã«ãªã‚Šã¾ã—ãŸã€‚以å‰ãŠä½¿ã„ã«ãªã£ã¦ã„ãŸé›»å­ãƒ¡ãƒ¼ãƒ« アプリケーションã‹ã‚‰ã®æƒ…å ±ã®ã‚¤ãƒ³ãƒãƒ¼ãƒˆã‚‚容易ã«ã§ãã¾ã™ã€‚БУДЕТЕ ÐВТОМÐТИЧЕСКИ ПЕРЕÐÐПРÐВЛЕÐЫČNÃCI NÃROÄŒNÃCH POUŽÃVATEĽOVNOVÉ PORTFÓLIO MICROSOFT HARDWARE. Å PIÄŒKOVÉ OPTICKÉ BEZDRÔTOVÉ MYÅ KY S NOVOU TECHNOLÓGIOU - NAKLÃŇACÃM KOLIESKOM. NEZÃLEŽà NA TOM, AKà STÔL MÃTE, POKIAĽ JE NA ŇOM ELEGANTNÃ보안 ìº íŽ˜ì¸ - 스스로 지킨 ë‹¹ì‹ ì˜ PC! ë”ìš± 안전해집니다!كل الحقوق محÙوظة ليديعوت إنترنتÄÖÜÄÖÜß", Strings.StrConv(TextStringOfMultipleLanguages, VbStrConv.UpperCase, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
-
- //TODO: implementation for Chinese characters
- //NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#28", 1, Strings.StrConv(TextStringOfMultipleLanguages, VbStrConv.SimplifiedChinese, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
- //NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#29", 1, Strings.StrConv(TextStringOfMultipleLanguages, VbStrConv.TraditionalChinese, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
-
- //ProperCase word delimiters
- NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#33", "Lksdjfda Älkjdf Ükjlhj" + Strings.Chr(0) + "Ldkfjd", Strings.StrConv("lksdjfda älkjdf ükjlhj" + Strings.Chr(0) + "ldkfjd", VbStrConv.ProperCase, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
- NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#34", "Lksdjfda Älkjdf Ükjlhj" + Strings.Chr(9) + "Ldkfjd", Strings.StrConv("lksdjfda älkjdf ükjlhj" + Strings.Chr(9) + "ldkfjd", VbStrConv.ProperCase, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
- NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#35", "Lksdjfda Älkjdf Ükjlhj" + Strings.Chr(10) + "Ldkfjd", Strings.StrConv("lksdjfda älkjdf ükjlhj" + Strings.Chr(10) + "ldkfjd", VbStrConv.ProperCase, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
- NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#36", "Lksdjfda Älkjdf Ükjlhj" + Strings.Chr(11) + "Ldkfjd", Strings.StrConv("lksdjfda älkjdf ükjlhj" + Strings.Chr(11) + "ldkfjd", VbStrConv.ProperCase, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
- NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#37", "Lksdjfda Älkjdf Ükjlhj" + Strings.Chr(12) + "Ldkfjd", Strings.StrConv("lksdjfda älkjdf ükjlhj" + Strings.Chr(12) + "ldkfjd", VbStrConv.ProperCase, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
- NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#38", "Lksdjfda Älkjdf Ükjlhj" + Strings.Chr(13) + "Ldkfjd", Strings.StrConv("lksdjfda älkjdf ükjlhj" + Strings.Chr(13) + "ldkfjd", VbStrConv.ProperCase, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
- NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#39", "Lksdjfda Älkjdf Ükjlhj" + Strings.Chr(32) + "Ldkfjd", Strings.StrConv("lksdjfda älkjdf ükjlhj" + Strings.Chr(32) + "ldkfjd", VbStrConv.ProperCase, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
-
- // ***********
- // ** JA-JP **
- // ***********
-
- System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo("ja-JP");
- NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#42", "é›»å­ã‚ーるをã¯ã˜ã‚ã€äºˆå®šè¡¨ã‚„ã‚ã©ã‚Œã™å¸³ãªã©ã®å€‹äººæƒ…å ±ã€ã•ã‚‰ã«ã¯ Office v. X ã®å„ã‚ã·ã‚Šã‘ーã—ょんã§ä½œæˆã—ãŸæ›¸é¡žã‚„ãã®ä»–ã®ãµãã„ã‚‹ã‚’ã‚Šã‚“ãã•ã›ã¦çµ±åˆçš„ã«ç®¡ç†ã™ã‚‹ã“ã¨ãŒã§ãã‚‹ã“ã¿ã‚…ã«ã‘ーã—ょんï¼å€‹äººæƒ…報管ç†ããµã¨ã†ã‡ã‚ã§ã™ã€‚ã„ã‚“ãŸãƒ¼ãµã‡ãƒ¼ã™ãŒä¸€æ–°ã•ã‚Œã€é«˜åº¦ã§å¤šå½©ãª Entourage X ã®æ©Ÿèƒ½ãŒã‚ˆã‚Šç›´æ„Ÿçš„ã«åˆ©ç”¨ã§ãるよã†ã«ãªã‚Šã¾ã—ãŸã€‚以å‰ãŠä½¿ã„ã«ãªã£ã¦ã„ãŸé›»å­ã‚ーる ã‚ã·ã‚Šã‘ーã—ょんã‹ã‚‰ã®æƒ…å ±ã®ã„ã‚“ã½ãƒ¼ã¨ã‚‚容易ã«ã§ãã¾ã™ã€‚будете автоматичеÑки перенаправлены?nici naro?nych pou?ivate?ovNove portfolio Microsoft Hardware. ?pi?kove opticke bezdrotove my?ky s novou technologiou - nakla?acim kolieskom. Nezale?i na tom, aky stol mate, pokia? je na ?om elegantna?? ??? - ??? ?? ??? PC! ?? ??????!?? ?????? ?????? ??????? ??????aouAOUs", Strings.StrConv(TextStringOfMultipleLanguages, VbStrConv.Hiragana, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
- NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#43", "é›»å­ãƒ¡ãƒ¼ãƒ«ãƒ²ãƒã‚¸ãƒ¡ã€äºˆå®šè¡¨ãƒ¤ã‚¢ãƒ‰ãƒ¬ã‚¹å¸³ãƒŠãƒ‰ãƒŽå€‹äººæƒ…å ±ã€ã‚µãƒ©ãƒ‹ãƒ Office v. X ノå„アプリケーションデ作æˆã‚·ã‚¿æ›¸é¡žãƒ¤ã‚½ãƒŽä»–ノファイルヲリンクサセテ統åˆçš„ニ管ç†ã‚¹ãƒ«ã‚³ãƒˆã‚¬ãƒ‡ã‚­ãƒ«ã‚³ãƒŸãƒ¥ãƒ‹ã‚±ãƒ¼ã‚·ãƒ§ãƒ³ï¼å€‹äººæƒ…報管ç†ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ãƒ‡ã‚¹ã€‚インターフェースガ一新サレã€é«˜åº¦ãƒ‡å¤šå½©ãƒŠ Entourage X ノ機能ガヨリ直感的ニ利用デキルヨウニナリマシタ。以å‰ã‚ªä½¿ã‚¤ãƒ‹ãƒŠãƒƒãƒ†ã‚¤ã‚¿é›»å­ãƒ¡ãƒ¼ãƒ« アプリケーションカラノ情報ノインãƒãƒ¼ãƒˆãƒ¢å®¹æ˜“ニデキマス。будете автоматичеÑки перенаправлены?nici naro?nych pou?ivate?ovNove portfolio Microsoft Hardware. ?pi?kove opticke bezdrotove my?ky s novou technologiou - nakla?acim kolieskom. Nezale?i na tom, aky stol mate, pokia? je na ?om elegantna?? ??? - ??? ?? ??? PC! ?? ??????!?? ?????? ?????? ??????? ??????aouAOUs", Strings.StrConv(TextStringOfMultipleLanguages, VbStrConv.Katakana, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
-
- //TODO: how to write VbStrConv.LinguisticCasing + VbStrConv.UpperCase correctly?
- //NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#44", 1, Strings.StrConv(TextStringOfMultipleLanguages, VbStrConv.LinguisticCasing, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
-
- //not supported
- //NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#45", 1, Strings.StrConv(TextStringOfMultipleLanguages, VbStrConv.Narrow, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
- //NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#51", 1, Strings.StrConv(TextStringOfMultipleLanguages, VbStrConv.Wide, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
-
- NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#46", TextStringOfMultipleLanguages, Strings.StrConv(TextStringOfMultipleLanguages, VbStrConv.None, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
- NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#41", "é›»å­ãƒ¡ãƒ¼ãƒ«ã‚’ã¯ã˜ã‚ã€äºˆå®šè¡¨ã‚„アドレス帳ãªã©ã®å€‹äººæƒ…å ±ã€ã•ã‚‰ã«ã¯ office v. x ã®å„アプリケーションã§ä½œæˆã—ãŸæ›¸é¡žã‚„ãã®ä»–ã®ãƒ•ã‚¡ã‚¤ãƒ«ã‚’リンクã•ã›ã¦çµ±åˆçš„ã«ç®¡ç†ã™ã‚‹ã“ã¨ãŒã§ãるコミュニケーションï¼å€‹äººæƒ…報管ç†ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã§ã™ã€‚インターフェースãŒä¸€æ–°ã•ã‚Œã€é«˜åº¦ã§å¤šå½©ãª entourage x ã®æ©Ÿèƒ½ãŒã‚ˆã‚Šç›´æ„Ÿçš„ã«åˆ©ç”¨ã§ãるよã†ã«ãªã‚Šã¾ã—ãŸã€‚以å‰ãŠä½¿ã„ã«ãªã£ã¦ã„ãŸé›»å­ãƒ¡ãƒ¼ãƒ« アプリケーションã‹ã‚‰ã®æƒ…å ±ã®ã‚¤ãƒ³ãƒãƒ¼ãƒˆã‚‚容易ã«ã§ãã¾ã™ã€‚будете автоматичеÑки перенаправленыÄníci nároÄných používateľovnové portfólio microsoft hardware. Å¡piÄkové optické bezdrôtové myÅ¡ky s novou technológiou - nakláňacím kolieskom. nezáleží na tom, aký stôl máte, pokiaľ je na ňom elegantná보안 ìº íŽ˜ì¸ - 스스로 지킨 ë‹¹ì‹ ì˜ pc! ë”ìš± 안전해집니다!كل الحقوق محÙوظة ليديعوت إنترنتäöüäöüß", Strings.StrConv(TextStringOfMultipleLanguages, VbStrConv.LowerCase, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
- NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#47", "é›»å­ãƒ¡ãƒ¼ãƒ«ã‚’ã¯ã˜ã‚ã€äºˆå®šè¡¨ã‚„アドレス帳ãªã©ã®å€‹äººæƒ…å ±ã€ã•ã‚‰ã«ã¯ Office V. X ã®å„アプリケーションã§ä½œæˆã—ãŸæ›¸é¡žã‚„ãã®ä»–ã®ãƒ•ã‚¡ã‚¤ãƒ«ã‚’リンクã•ã›ã¦çµ±åˆçš„ã«ç®¡ç†ã™ã‚‹ã“ã¨ãŒã§ãるコミュニケーションï¼å€‹äººæƒ…報管ç†ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã§ã™ã€‚インターフェースãŒä¸€æ–°ã•ã‚Œã€é«˜åº¦ã§å¤šå½©ãª Entourage X ã®æ©Ÿèƒ½ãŒã‚ˆã‚Šç›´æ„Ÿçš„ã«åˆ©ç”¨ã§ãるよã†ã«ãªã‚Šã¾ã—ãŸã€‚以å‰ãŠä½¿ã„ã«ãªã£ã¦ã„ãŸé›»å­ãƒ¡ãƒ¼ãƒ« アプリケーションã‹ã‚‰ã®æƒ…å ±ã®ã‚¤ãƒ³ãƒãƒ¼ãƒˆã‚‚容易ã«ã§ãã¾ã™ã€‚Будете ÐвтоматичеÑки Перенаправлены?Nici Naro?Nych Pou?Ivate?Ovnove Portfolio Microsoft Hardware. ?Pi?Kove Opticke Bezdrotove My?Ky S Novou Technologiou - Nakla?Acim Kolieskom. Nezale?I Na Tom, Aky Stol Mate, Pokia? Je Na ?Om Elegantna?? ??? - ??? ?? ??? Pc! ?? ??????!?? ?????? ?????? ??????? ??????Aouaous", Strings.StrConv(TextStringOfMultipleLanguages, VbStrConv.ProperCase, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
- NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#50", "é›»å­ãƒ¡ãƒ¼ãƒ«ã‚’ã¯ã˜ã‚ã€äºˆå®šè¡¨ã‚„アドレス帳ãªã©ã®å€‹äººæƒ…å ±ã€ã•ã‚‰ã«ã¯ OFFICE V. X ã®å„アプリケーションã§ä½œæˆã—ãŸæ›¸é¡žã‚„ãã®ä»–ã®ãƒ•ã‚¡ã‚¤ãƒ«ã‚’リンクã•ã›ã¦çµ±åˆçš„ã«ç®¡ç†ã™ã‚‹ã“ã¨ãŒã§ãるコミュニケーションï¼å€‹äººæƒ…報管ç†ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã§ã™ã€‚インターフェースãŒä¸€æ–°ã•ã‚Œã€é«˜åº¦ã§å¤šå½©ãª ENTOURAGE X ã®æ©Ÿèƒ½ãŒã‚ˆã‚Šç›´æ„Ÿçš„ã«åˆ©ç”¨ã§ãるよã†ã«ãªã‚Šã¾ã—ãŸã€‚以å‰ãŠä½¿ã„ã«ãªã£ã¦ã„ãŸé›»å­ãƒ¡ãƒ¼ãƒ« アプリケーションã‹ã‚‰ã®æƒ…å ±ã®ã‚¤ãƒ³ãƒãƒ¼ãƒˆã‚‚容易ã«ã§ãã¾ã™ã€‚БУДЕТЕ ÐВТОМÐТИЧЕСКИ ПЕРЕÐÐПРÐВЛЕÐЫČNÃCI NÃROÄŒNÃCH POUŽÃVATEĽOVNOVÉ PORTFÓLIO MICROSOFT HARDWARE. Å PIÄŒKOVÉ OPTICKÉ BEZDRÔTOVÉ MYÅ KY S NOVOU TECHNOLÓGIOU - NAKLÃŇACÃM KOLIESKOM. NEZÃLEŽà NA TOM, AKà STÔL MÃTE, POKIAĽ JE NA ŇOM ELEGANTNÃ보안 ìº íŽ˜ì¸ - 스스로 지킨 ë‹¹ì‹ ì˜ PC! ë”ìš± 안전해집니다!كل الحقوق محÙوظة ليديعوت إنترنتÄÖÜÄÖÜß", Strings.StrConv(TextStringOfMultipleLanguages, VbStrConv.UpperCase, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
-
- //TODO: implementation for Chinese characters
- //NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#48", 1, Strings.StrConv(TextStringOfMultipleLanguages, VbStrConv.SimplifiedChinese, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
- //NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#49", 1, Strings.StrConv(TextStringOfMultipleLanguages, VbStrConv.TraditionalChinese, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
-
- //ProperCase word delimiters
- NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#53", "Lksdjfda Alkjdf Ukjlhj" + Strings.Chr(0) + "Ldkfjd", Strings.StrConv("lksdjfda älkjdf ükjlhj" + Strings.Chr(0) + "ldkfjd", VbStrConv.ProperCase, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
- NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#54", "Lksdjfda Alkjdf Ukjlhj" + Strings.Chr(9) + "Ldkfjd", Strings.StrConv("lksdjfda älkjdf ükjlhj" + Strings.Chr(9) + "ldkfjd", VbStrConv.ProperCase, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
- NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#55", "Lksdjfda Alkjdf Ukjlhj" + Strings.Chr(10) + "Ldkfjd", Strings.StrConv("lksdjfda älkjdf ükjlhj" + Strings.Chr(10) + "ldkfjd", VbStrConv.ProperCase, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
- NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#56", "Lksdjfda Alkjdf Ukjlhj" + Strings.Chr(11) + "Ldkfjd", Strings.StrConv("lksdjfda älkjdf ükjlhj" + Strings.Chr(11) + "ldkfjd", VbStrConv.ProperCase, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
- NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#57", "Lksdjfda Alkjdf Ukjlhj" + Strings.Chr(12) + "Ldkfjd", Strings.StrConv("lksdjfda älkjdf ükjlhj" + Strings.Chr(12) + "ldkfjd", VbStrConv.ProperCase, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
- NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#58", "Lksdjfda Alkjdf Ukjlhj" + Strings.Chr(13) + "Ldkfjd", Strings.StrConv("lksdjfda älkjdf ükjlhj" + Strings.Chr(13) + "ldkfjd", VbStrConv.ProperCase, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
- NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#59", "Lksdjfda Alkjdf Ukjlhj" + Strings.Chr(32) + "Ldkfjd", Strings.StrConv("lksdjfda älkjdf ükjlhj" + Strings.Chr(32) + "ldkfjd", VbStrConv.ProperCase, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
-
- // ***********
- // ** Chinese **
- // ***********
-
- //TODO: implementation for Chinese locales
- //System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo("ja-JP");
- // .......
-
- // restore buffered culture
- System.Threading.Thread.CurrentThread.CurrentCulture = CurCulture;
-
- }
-
- [Test]
- public void StrDup()
- {
- string aString = "Wow! What a string!";
- object aObject = new object();
- string myString ;
- aObject = "This is a String contained within an Object";
- NUnit.Framework.Assertion.AssertEquals ("JW*StrDup#01", "PPPPP", Strings.StrDup(5, (char)Strings.Asc("P")));
- NUnit.Framework.Assertion.AssertEquals ("JW*StrDup#01", "WWWWWWWWWW", Strings.StrDup(10, aString));
- NUnit.Framework.Assertion.AssertEquals ("JW*StrDup#01", "TTTTTT", Strings.StrDup(6, aObject));
- }
-
- [Test]
- public void StrReverse()
- {
- NUnit.Framework.Assertion.AssertEquals ("JW*StrReverse#01", "", Strings.StrReverse(String.Empty));
- NUnit.Framework.Assertion.AssertEquals ("JW*StrReverse#02", "ßÜÖÄüöä", Strings.StrReverse(GermanUmlauts_German));
- NUnit.Framework.Assertion.AssertEquals ("JW*StrReverse#03", "", Strings.StrReverse(null));
- }
-
- public void UCase_Char()
- {
- // buffer current culture
- System.Globalization.CultureInfo CurCulture = System.Threading.Thread.CurrentThread.CurrentCulture;
-
- // do testings
- NUnit.Framework.Assertion.AssertEquals ("JW#UCase/10c", 0, Strings.UCase(Letter_Empty));
-
- System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
- NUnit.Framework.Assertion.AssertEquals ("JW#UCase/10", Strings.AscW("C"), Strings.UCase(Letter_English));
- NUnit.Framework.Assertion.AssertEquals ("JW#UCase/11", Strings.AscW("é›»"), Strings.UCase(Letter_Japanese));
- NUnit.Framework.Assertion.AssertEquals ("JW#UCase/12", 1041, Strings.UCase(Letter_Russian));
- NUnit.Framework.Assertion.AssertEquals ("JW#UCase/13", 268, Strings.UCase(Letter_Slovakian));
- NUnit.Framework.Assertion.AssertEquals ("JW#UCase/14", Strings.AscW("ë³´"), Strings.UCase(Letter_Korean));
- NUnit.Framework.Assertion.AssertEquals ("JW#UCase/15", 1603, Strings.UCase(Letter_Arabic));
- NUnit.Framework.Assertion.AssertEquals ("JW#UCase/16", Strings.AscW("Ä"), Strings.UCase(Letter_German));
-
- System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo("de-DE");
- NUnit.Framework.Assertion.AssertEquals ("JW#UCase/20", Strings.AscW("C"), Strings.UCase(Letter_English));
- NUnit.Framework.Assertion.AssertEquals ("JW#UCase/21", Strings.AscW("é›»"), Strings.UCase(Letter_Japanese));
- NUnit.Framework.Assertion.AssertEquals ("JW#UCase/22", 1041, Strings.UCase(Letter_Russian));
- NUnit.Framework.Assertion.AssertEquals ("JW#UCase/23", 268, Strings.UCase(Letter_Slovakian));
- NUnit.Framework.Assertion.AssertEquals ("JW#UCase/24", Strings.AscW("ë³´"), Strings.UCase(Letter_Korean));
- NUnit.Framework.Assertion.AssertEquals ("JW#UCase/25", 1603, Strings.UCase(Letter_Arabic));
- NUnit.Framework.Assertion.AssertEquals ("JW#UCase/26", Strings.AscW("Ä"), Strings.UCase(Letter_German));
-
- System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo("ja-JP");
- NUnit.Framework.Assertion.AssertEquals ("JW#UCase/30", Strings.AscW("C"), Strings.UCase(Letter_English));
- NUnit.Framework.Assertion.AssertEquals ("JW#UCase/31", Strings.AscW("é›»"), Strings.UCase(Letter_Japanese));
- NUnit.Framework.Assertion.AssertEquals ("JW#UCase/32", 1041, Strings.UCase(Letter_Russian));
- NUnit.Framework.Assertion.AssertEquals ("JW#UCase/33", 268, Strings.UCase(Letter_Slovakian));
- NUnit.Framework.Assertion.AssertEquals ("JW#UCase/34", Strings.AscW("ë³´"), Strings.UCase(Letter_Korean));
- NUnit.Framework.Assertion.AssertEquals ("JW#UCase/35", 1603, Strings.UCase(Letter_Arabic));
- NUnit.Framework.Assertion.AssertEquals ("JW#UCase/36", Strings.AscW("Ä"), Strings.UCase(Letter_German));
-
- // restore buffered culture
- System.Threading.Thread.CurrentThread.CurrentCulture = CurCulture;
- }
-
- [Test]
- public void UCase()
- {
- UCase_Char();
- UCase_String();
- }
-
- public void UCase_String()
- {
- // buffer current culture
- System.Globalization.CultureInfo CurCulture = System.Threading.Thread.CurrentThread.CurrentCulture;
-
- // do testings
- NUnit.Framework.Assertion.AssertEquals ("JW#UCase/64", String.Empty, Strings.UCase(TextStringUninitialized));
- NUnit.Framework.Assertion.AssertEquals ("JW#UCase/65", "", Strings.UCase(TextStringUninitialized));
- NUnit.Framework.Assertion.AssertEquals ("JW#UCase/67", String.Empty, Strings.UCase(TextStringEmpty));
- NUnit.Framework.Assertion.AssertEquals ("JW#UCase/68", "", Strings.UCase(TextStringEmpty));
-
- System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo("de-DE");
- NUnit.Framework.Assertion.AssertEquals ("JW#UCase/70", "CHOOSE THE LOCATION FOR WHICH YOU WANT CONTACT INFORMATION:", Strings.UCase(MSWebSiteContent_English));
- NUnit.Framework.Assertion.AssertEquals ("JW#UCase/71", "é›»å­ãƒ¡ãƒ¼ãƒ«ã‚’ã¯ã˜ã‚ã€äºˆå®šè¡¨ã‚„アドレス帳ãªã©ã®å€‹äººæƒ…å ±ã€ã•ã‚‰ã«ã¯ OFFICE V. X ã®å„アプリケーションã§ä½œæˆã—ãŸæ›¸é¡žã‚„ãã®ä»–ã®ãƒ•ã‚¡ã‚¤ãƒ«ã‚’リンクã•ã›ã¦çµ±åˆçš„ã«ç®¡ç†ã™ã‚‹ã“ã¨ãŒã§ãるコミュニケーションï¼å€‹äººæƒ…報管ç†ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã§ã™ã€‚インターフェースãŒä¸€æ–°ã•ã‚Œã€é«˜åº¦ã§å¤šå½©ãª ENTOURAGE X ã®æ©Ÿèƒ½ãŒã‚ˆã‚Šç›´æ„Ÿçš„ã«åˆ©ç”¨ã§ãるよã†ã«ãªã‚Šã¾ã—ãŸã€‚以å‰ãŠä½¿ã„ã«ãªã£ã¦ã„ãŸé›»å­ãƒ¡ãƒ¼ãƒ« アプリケーションã‹ã‚‰ã®æƒ…å ±ã®ã‚¤ãƒ³ãƒãƒ¼ãƒˆã‚‚容易ã«ã§ãã¾ã™ã€‚", Strings.UCase(MSWebSiteContent_Japanese));
- NUnit.Framework.Assertion.AssertEquals ("JW#UCase/72", "БУДЕТЕ ÐВТОМÐТИЧЕСКИ ПЕРЕÐÐПРÐВЛЕÐЫ", Strings.UCase(MSWebSiteContent_Russian));
- NUnit.Framework.Assertion.AssertEquals ("JW#UCase/73", "ÄŒNÃCI NÃROÄŒNÃCH POUŽÃVATEĽOVNOVÉ PORTFÓLIO MICROSOFT HARDWARE. Å PIÄŒKOVÉ OPTICKÉ BEZDRÔTOVÉ MYÅ KY S NOVOU TECHNOLÓGIOU - NAKLÃŇACÃM KOLIESKOM. NEZÃLEŽà NA TOM, AKà STÔL MÃTE, POKIAĽ JE NA ŇOM ELEGANTNÃ", Strings.UCase(MSWebSiteContent_Slovakian));
- NUnit.Framework.Assertion.AssertEquals ("JW#UCase/74", "보안 ìº íŽ˜ì¸ - 스스로 지킨 ë‹¹ì‹ ì˜ PC! ë”ìš± 안전해집니다!", Strings.UCase(MSWebSiteContent_Korean));
- NUnit.Framework.Assertion.AssertEquals ("JW#UCase/75", "كل الحقوق محÙوظة ليديعوت إنترنت", Strings.UCase(ArabynetComWebSiteContent_Arabic));
- NUnit.Framework.Assertion.AssertEquals ("JW#UCase/76", "ÄÖÜÄÖÜß", Strings.UCase(GermanUmlauts_German));
- NUnit.Framework.Assertion.AssertEquals ("JW#UCase/77", "é›»å­ãƒ¡ãƒ¼ãƒ«ã‚’ã¯ã˜ã‚ã€äºˆå®šè¡¨ã‚„アドレス帳ãªã©ã®å€‹äººæƒ…å ±ã€ã•ã‚‰ã«ã¯ OFFICE V. X ã®å„アプリケーションã§ä½œæˆã—ãŸæ›¸é¡žã‚„ãã®ä»–ã®ãƒ•ã‚¡ã‚¤ãƒ«ã‚’リンクã•ã›ã¦çµ±åˆçš„ã«ç®¡ç†ã™ã‚‹ã“ã¨ãŒã§ãるコミュニケーションï¼å€‹äººæƒ…報管ç†ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã§ã™ã€‚インターフェースãŒä¸€æ–°ã•ã‚Œã€é«˜åº¦ã§å¤šå½©ãª ENTOURAGE X ã®æ©Ÿèƒ½ãŒã‚ˆã‚Šç›´æ„Ÿçš„ã«åˆ©ç”¨ã§ãるよã†ã«ãªã‚Šã¾ã—ãŸã€‚以å‰ãŠä½¿ã„ã«ãªã£ã¦ã„ãŸé›»å­ãƒ¡ãƒ¼ãƒ« アプリケーションã‹ã‚‰ã®æƒ…å ±ã®ã‚¤ãƒ³ãƒãƒ¼ãƒˆã‚‚容易ã«ã§ãã¾ã™ã€‚БУДЕТЕ ÐВТОМÐТИЧЕСКИ ПЕРЕÐÐПРÐВЛЕÐЫČNÃCI NÃROÄŒNÃCH POUŽÃVATEĽOVNOVÉ PORTFÓLIO MICROSOFT HARDWARE. Å PIÄŒKOVÉ OPTICKÉ BEZDRÔTOVÉ MYÅ KY S NOVOU TECHNOLÓGIOU - NAKLÃŇACÃM KOLIESKOM. NEZÃLEŽà NA TOM, AKà STÔL MÃTE, POKIAĽ JE NA ŇOM ELEGANTNÃ보안 ìº íŽ˜ì¸ - 스스로 지킨 ë‹¹ì‹ ì˜ PC! ë”ìš± 안전해집니다!كل الحقوق محÙوظة ليديعوت إنترنتÄÖÜÄÖÜß", Strings.UCase(TextStringOfMultipleLanguages));
-
- System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
- NUnit.Framework.Assertion.AssertEquals ("JW#UCase/80", "CHOOSE THE LOCATION FOR WHICH YOU WANT CONTACT INFORMATION:", Strings.UCase(MSWebSiteContent_English));
- NUnit.Framework.Assertion.AssertEquals ("JW#UCase/81", "é›»å­ãƒ¡ãƒ¼ãƒ«ã‚’ã¯ã˜ã‚ã€äºˆå®šè¡¨ã‚„アドレス帳ãªã©ã®å€‹äººæƒ…å ±ã€ã•ã‚‰ã«ã¯ OFFICE V. X ã®å„アプリケーションã§ä½œæˆã—ãŸæ›¸é¡žã‚„ãã®ä»–ã®ãƒ•ã‚¡ã‚¤ãƒ«ã‚’リンクã•ã›ã¦çµ±åˆçš„ã«ç®¡ç†ã™ã‚‹ã“ã¨ãŒã§ãるコミュニケーションï¼å€‹äººæƒ…報管ç†ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã§ã™ã€‚インターフェースãŒä¸€æ–°ã•ã‚Œã€é«˜åº¦ã§å¤šå½©ãª ENTOURAGE X ã®æ©Ÿèƒ½ãŒã‚ˆã‚Šç›´æ„Ÿçš„ã«åˆ©ç”¨ã§ãるよã†ã«ãªã‚Šã¾ã—ãŸã€‚以å‰ãŠä½¿ã„ã«ãªã£ã¦ã„ãŸé›»å­ãƒ¡ãƒ¼ãƒ« アプリケーションã‹ã‚‰ã®æƒ…å ±ã®ã‚¤ãƒ³ãƒãƒ¼ãƒˆã‚‚容易ã«ã§ãã¾ã™ã€‚", Strings.UCase(MSWebSiteContent_Japanese));
- NUnit.Framework.Assertion.AssertEquals ("JW#UCase/82", "БУДЕТЕ ÐВТОМÐТИЧЕСКИ ПЕРЕÐÐПРÐВЛЕÐЫ", Strings.UCase(MSWebSiteContent_Russian));
- NUnit.Framework.Assertion.AssertEquals ("JW#UCase/83", "ÄŒNÃCI NÃROÄŒNÃCH POUŽÃVATEĽOVNOVÉ PORTFÓLIO MICROSOFT HARDWARE. Å PIÄŒKOVÉ OPTICKÉ BEZDRÔTOVÉ MYÅ KY S NOVOU TECHNOLÓGIOU - NAKLÃŇACÃM KOLIESKOM. NEZÃLEŽà NA TOM, AKà STÔL MÃTE, POKIAĽ JE NA ŇOM ELEGANTNÃ", Strings.UCase(MSWebSiteContent_Slovakian));
- NUnit.Framework.Assertion.AssertEquals ("JW#UCase/84", "보안 ìº íŽ˜ì¸ - 스스로 지킨 ë‹¹ì‹ ì˜ PC! ë”ìš± 안전해집니다!", Strings.UCase(MSWebSiteContent_Korean));
- NUnit.Framework.Assertion.AssertEquals ("JW#UCase/85", "كل الحقوق محÙوظة ليديعوت إنترنت", Strings.UCase(ArabynetComWebSiteContent_Arabic));
- NUnit.Framework.Assertion.AssertEquals ("JW#UCase/86", "ÄÖÜÄÖÜß", Strings.UCase(GermanUmlauts_German));
- NUnit.Framework.Assertion.AssertEquals ("JW#UCase/87", "é›»å­ãƒ¡ãƒ¼ãƒ«ã‚’ã¯ã˜ã‚ã€äºˆå®šè¡¨ã‚„アドレス帳ãªã©ã®å€‹äººæƒ…å ±ã€ã•ã‚‰ã«ã¯ OFFICE V. X ã®å„アプリケーションã§ä½œæˆã—ãŸæ›¸é¡žã‚„ãã®ä»–ã®ãƒ•ã‚¡ã‚¤ãƒ«ã‚’リンクã•ã›ã¦çµ±åˆçš„ã«ç®¡ç†ã™ã‚‹ã“ã¨ãŒã§ãるコミュニケーションï¼å€‹äººæƒ…報管ç†ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã§ã™ã€‚インターフェースãŒä¸€æ–°ã•ã‚Œã€é«˜åº¦ã§å¤šå½©ãª ENTOURAGE X ã®æ©Ÿèƒ½ãŒã‚ˆã‚Šç›´æ„Ÿçš„ã«åˆ©ç”¨ã§ãるよã†ã«ãªã‚Šã¾ã—ãŸã€‚以å‰ãŠä½¿ã„ã«ãªã£ã¦ã„ãŸé›»å­ãƒ¡ãƒ¼ãƒ« アプリケーションã‹ã‚‰ã®æƒ…å ±ã®ã‚¤ãƒ³ãƒãƒ¼ãƒˆã‚‚容易ã«ã§ãã¾ã™ã€‚БУДЕТЕ ÐВТОМÐТИЧЕСКИ ПЕРЕÐÐПРÐВЛЕÐЫČNÃCI NÃROÄŒNÃCH POUŽÃVATEĽOVNOVÉ PORTFÓLIO MICROSOFT HARDWARE. Å PIÄŒKOVÉ OPTICKÉ BEZDRÔTOVÉ MYÅ KY S NOVOU TECHNOLÓGIOU - NAKLÃŇACÃM KOLIESKOM. NEZÃLEŽà NA TOM, AKà STÔL MÃTE, POKIAĽ JE NA ŇOM ELEGANTNÃ보안 ìº íŽ˜ì¸ - 스스로 지킨 ë‹¹ì‹ ì˜ PC! ë”ìš± 안전해집니다!كل الحقوق محÙوظة ليديعوت إنترنتÄÖÜÄÖÜß", Strings.UCase(TextStringOfMultipleLanguages));
-
- System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo("ja-JP");
- NUnit.Framework.Assertion.AssertEquals ("JW#UCase/90", "CHOOSE THE LOCATION FOR WHICH YOU WANT CONTACT INFORMATION:", Strings.UCase(MSWebSiteContent_English));
- NUnit.Framework.Assertion.AssertEquals ("JW#UCase/91", "é›»å­ãƒ¡ãƒ¼ãƒ«ã‚’ã¯ã˜ã‚ã€äºˆå®šè¡¨ã‚„アドレス帳ãªã©ã®å€‹äººæƒ…å ±ã€ã•ã‚‰ã«ã¯ OFFICE V. X ã®å„アプリケーションã§ä½œæˆã—ãŸæ›¸é¡žã‚„ãã®ä»–ã®ãƒ•ã‚¡ã‚¤ãƒ«ã‚’リンクã•ã›ã¦çµ±åˆçš„ã«ç®¡ç†ã™ã‚‹ã“ã¨ãŒã§ãるコミュニケーションï¼å€‹äººæƒ…報管ç†ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã§ã™ã€‚インターフェースãŒä¸€æ–°ã•ã‚Œã€é«˜åº¦ã§å¤šå½©ãª ENTOURAGE X ã®æ©Ÿèƒ½ãŒã‚ˆã‚Šç›´æ„Ÿçš„ã«åˆ©ç”¨ã§ãるよã†ã«ãªã‚Šã¾ã—ãŸã€‚以å‰ãŠä½¿ã„ã«ãªã£ã¦ã„ãŸé›»å­ãƒ¡ãƒ¼ãƒ« アプリケーションã‹ã‚‰ã®æƒ…å ±ã®ã‚¤ãƒ³ãƒãƒ¼ãƒˆã‚‚容易ã«ã§ãã¾ã™ã€‚", Strings.UCase(MSWebSiteContent_Japanese));
- NUnit.Framework.Assertion.AssertEquals ("JW#UCase/92", "БУДЕТЕ ÐВТОМÐТИЧЕСКИ ПЕРЕÐÐПРÐВЛЕÐЫ", Strings.UCase(MSWebSiteContent_Russian));
- NUnit.Framework.Assertion.AssertEquals ("JW#UCase/93", "ÄŒNÃCI NÃROÄŒNÃCH POUŽÃVATEĽOVNOVÉ PORTFÓLIO MICROSOFT HARDWARE. Å PIÄŒKOVÉ OPTICKÉ BEZDRÔTOVÉ MYÅ KY S NOVOU TECHNOLÓGIOU - NAKLÃŇACÃM KOLIESKOM. NEZÃLEŽà NA TOM, AKà STÔL MÃTE, POKIAĽ JE NA ŇOM ELEGANTNÃ", Strings.UCase(MSWebSiteContent_Slovakian));
- NUnit.Framework.Assertion.AssertEquals ("JW#UCase/94", "보안 ìº íŽ˜ì¸ - 스스로 지킨 ë‹¹ì‹ ì˜ PC! ë”ìš± 안전해집니다!", Strings.UCase(MSWebSiteContent_Korean));
- NUnit.Framework.Assertion.AssertEquals ("JW#UCase/95", "كل الحقوق محÙوظة ليديعوت إنترنت", Strings.UCase(ArabynetComWebSiteContent_Arabic));
- NUnit.Framework.Assertion.AssertEquals ("JW#UCase/96", "ÄÖÜÄÖÜß", Strings.UCase(GermanUmlauts_German));
- NUnit.Framework.Assertion.AssertEquals ("JW#UCase/97", "é›»å­ãƒ¡ãƒ¼ãƒ«ã‚’ã¯ã˜ã‚ã€äºˆå®šè¡¨ã‚„アドレス帳ãªã©ã®å€‹äººæƒ…å ±ã€ã•ã‚‰ã«ã¯ OFFICE V. X ã®å„アプリケーションã§ä½œæˆã—ãŸæ›¸é¡žã‚„ãã®ä»–ã®ãƒ•ã‚¡ã‚¤ãƒ«ã‚’リンクã•ã›ã¦çµ±åˆçš„ã«ç®¡ç†ã™ã‚‹ã“ã¨ãŒã§ãるコミュニケーションï¼å€‹äººæƒ…報管ç†ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã§ã™ã€‚インターフェースãŒä¸€æ–°ã•ã‚Œã€é«˜åº¦ã§å¤šå½©ãª ENTOURAGE X ã®æ©Ÿèƒ½ãŒã‚ˆã‚Šç›´æ„Ÿçš„ã«åˆ©ç”¨ã§ãるよã†ã«ãªã‚Šã¾ã—ãŸã€‚以å‰ãŠä½¿ã„ã«ãªã£ã¦ã„ãŸé›»å­ãƒ¡ãƒ¼ãƒ« アプリケーションã‹ã‚‰ã®æƒ…å ±ã®ã‚¤ãƒ³ãƒãƒ¼ãƒˆã‚‚容易ã«ã§ãã¾ã™ã€‚БУДЕТЕ ÐВТОМÐТИЧЕСКИ ПЕРЕÐÐПРÐВЛЕÐЫČNÃCI NÃROÄŒNÃCH POUŽÃVATEĽOVNOVÉ PORTFÓLIO MICROSOFT HARDWARE. Å PIÄŒKOVÉ OPTICKÉ BEZDRÔTOVÉ MYÅ KY S NOVOU TECHNOLÓGIOU - NAKLÃŇACÃM KOLIESKOM. NEZÃLEŽà NA TOM, AKà STÔL MÃTE, POKIAĽ JE NA ŇOM ELEGANTNÃ보안 ìº íŽ˜ì¸ - 스스로 지킨 ë‹¹ì‹ ì˜ PC! ë”ìš± 안전해집니다!كل الحقوق محÙوظة ليديعوت إنترنتÄÖÜÄÖÜß", Strings.UCase(TextStringOfMultipleLanguages));
-
- // restore buffered culture
- System.Threading.Thread.CurrentThread.CurrentCulture = CurCulture;
- }
- }
-}
+//
+// StringsTest.cs
+//
+// Authors:
+// Jochen Wezel (jwezel@compumaster.de)
+//
+// (C) 2003 Jochen Wezel, CompuMaster GmbH (http://www.compumaster.de/)
+//
+
+using Microsoft.VisualBasic;
+using System;
+using System.Text;
+using System.Globalization;
+using NUnit.Framework;
+
+namespace MonoTests.Microsoft.VisualBasic
+{
+ [TestFixture]
+ public class StringsTest : Assertion
+ {
+ private string TextStringOfMultipleLanguages;
+ private string TextStringUninitialized;
+ const string TextStringEmpty = "";
+
+ //Disclaimer: I herewith distance me and the whole Mono project of text written in this test strings - they are really only for testing purposes and are copy and pasted of randomly found test parts of several suriously looking websites
+ const string MSWebSiteContent_English = "Choose the location for which you want contact information:";
+ const string MSWebSiteContent_Japanese = "é›»å­ãƒ¡ãƒ¼ãƒ«ã‚’ã¯ã˜ã‚ã€äºˆå®šè¡¨ã‚„アドレス帳ãªã©ã®å€‹äººæƒ…å ±ã€ã•ã‚‰ã«ã¯ Office v. X ã®å„アプリケーションã§ä½œæˆã—ãŸæ›¸é¡žã‚„ãã®ä»–ã®ãƒ•ã‚¡ã‚¤ãƒ«ã‚’リンクã•ã›ã¦çµ±åˆçš„ã«ç®¡ç†ã™ã‚‹ã“ã¨ãŒã§ãるコミュニケーションï¼å€‹äººæƒ…報管ç†ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã§ã™ã€‚インターフェースãŒä¸€æ–°ã•ã‚Œã€é«˜åº¦ã§å¤šå½©ãª Entourage X ã®æ©Ÿèƒ½ãŒã‚ˆã‚Šç›´æ„Ÿçš„ã«åˆ©ç”¨ã§ãるよã†ã«ãªã‚Šã¾ã—ãŸã€‚以å‰ãŠä½¿ã„ã«ãªã£ã¦ã„ãŸé›»å­ãƒ¡ãƒ¼ãƒ« アプリケーションã‹ã‚‰ã®æƒ…å ±ã®ã‚¤ãƒ³ãƒãƒ¼ãƒˆã‚‚容易ã«ã§ãã¾ã™ã€‚";
+ const string MSWebSiteContent_Russian = "будете автоматичеÑки перенаправлены";
+ const string MSWebSiteContent_Slovakian = "Äníci nároÄných používateľovNové portfólio Microsoft Hardware. Å¡piÄkové optické bezdrôtové myÅ¡ky s novou technológiou - nakláňacím kolieskom. Nezáleží na tom, aký stôl máte, pokiaľ je na ňom elegantná";
+ const string MSWebSiteContent_Korean = "보안 ìº íŽ˜ì¸ - 스스로 지킨 ë‹¹ì‹ ì˜ PC! ë”ìš± 안전해집니다!";
+ const string ArabynetComWebSiteContent_Arabic = "كل الحقوق محÙوظة ليديعوت إنترنت";
+ const string GermanUmlauts_German = "äöüÄÖÜß";
+
+ private char Letter_Empty;
+ private char Letter_English;
+ private char Letter_Japanese;
+ private char Letter_Russian;
+ private char Letter_Slovakian;
+ private char Letter_Korean;
+ private char Letter_Arabic;
+ private char Letter_German;
+
+ [SetUp]
+ public void Setup()
+ {
+ TextStringOfMultipleLanguages =
+ MSWebSiteContent_Japanese +
+ MSWebSiteContent_Russian +
+ MSWebSiteContent_Slovakian +
+ MSWebSiteContent_Korean +
+ ArabynetComWebSiteContent_Arabic +
+ GermanUmlauts_German;
+ Letter_English = MSWebSiteContent_English[0];
+ Letter_Japanese = MSWebSiteContent_Japanese[0];
+ Letter_Russian = MSWebSiteContent_Russian[0];
+ Letter_Slovakian = MSWebSiteContent_Slovakian[0];
+ Letter_Korean = MSWebSiteContent_Korean[0];
+ Letter_Arabic = ArabynetComWebSiteContent_Arabic[0];
+ Letter_German = GermanUmlauts_German[0];
+ }
+
+
+ //TODO: additional tests with other system/languages (especially other Asian ones)
+ // pay attention to
+ // 1. Byte count
+ // 2. Little or big endian
+ [Test]
+ public void Asc()
+ {
+ Asc_Char();
+ Asc_String();
+ }
+
+ public void Asc_Char()
+ {
+ // buffer current culture
+ System.Globalization.CultureInfo CurCulture = System.Threading.Thread.CurrentThread.CurrentCulture;
+
+ Encoding defencoding;
+ defencoding = Encoding.Default;
+
+ System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
+ NUnit.Framework.Assertion.AssertEquals ("JW*Asc#US29", 1252, System.Globalization.CultureInfo.CurrentCulture.TextInfo.ANSICodePage);
+ NUnit.Framework.Assertion.AssertEquals ("JW*Asc#US26", 0, Strings.Asc(Letter_Empty));
+ NUnit.Framework.Assertion.AssertEquals ("JW*Asc#US27 - Quotation mark test", 34, Strings.Asc("\""[0]));
+ if (defencoding.GetMaxByteCount(1) == 1)
+ {
+ NUnit.Framework.Assertion.AssertEquals ("JW*Asc#US28 - JapaneseCharacter", 63, Strings.Asc(MSWebSiteContent_Japanese[0]));
+ NUnit.Framework.Assertion.AssertEquals ("JW*Asc#US28a - GermanCharacter", 228, Strings.Asc(Letter_German));
+ }
+ else
+ {
+ NUnit.Framework.Assertion.AssertEquals ("JW*Asc#US28W - JapaneseCharacter", -27804, Strings.Asc(MSWebSiteContent_Japanese[0]));
+ NUnit.Framework.Assertion.AssertEquals ("JW*Asc#US28aW - GermanCharacter", 97, Strings.Asc(Letter_German));
+ }
+
+ System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo("de-DE");
+ NUnit.Framework.Assertion.AssertEquals ("JW*Asc#DE29", 1252, System.Globalization.CultureInfo.CurrentCulture.TextInfo.ANSICodePage);
+ NUnit.Framework.Assertion.AssertEquals ("JW*Asc#DE26", 0, Strings.Asc(Letter_Empty));
+ NUnit.Framework.Assertion.AssertEquals ("JW*Asc#DE27 - Quotation mark test", 34, Strings.Asc("\""[0]));
+ if (defencoding.GetMaxByteCount(1) == 1)
+ {
+ NUnit.Framework.Assertion.AssertEquals ("JW*Asc#US28 - JapaneseCharacter", 63, Strings.Asc(MSWebSiteContent_Japanese[0]));
+ NUnit.Framework.Assertion.AssertEquals ("JW*Asc#DE28a - GermanCharacter", 228, Strings.Asc(Letter_German));
+ }
+ else
+ {
+ NUnit.Framework.Assertion.AssertEquals ("JW*Asc#DE28W - JapaneseCharacter", -27804, Strings.Asc(MSWebSiteContent_Japanese[0]));
+ NUnit.Framework.Assertion.AssertEquals ("JW*Asc#DE28aW - GermanCharacter", 97, Strings.Asc(Letter_German));
+ }
+
+ System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo("ja-JP");
+ NUnit.Framework.Assertion.AssertEquals ("JW*Asc#JA29", 932, System.Globalization.CultureInfo.CurrentCulture.TextInfo.ANSICodePage);
+ NUnit.Framework.Assertion.AssertEquals ("JW*Asc#JA26", 0, Strings.Asc(Letter_Empty));
+ NUnit.Framework.Assertion.AssertEquals ("JW*Asc#JA27 - Quotation mark test", 34, Strings.Asc("\""[0]));
+ if (defencoding.GetMaxByteCount(1) == 1)
+ {
+ NUnit.Framework.Assertion.AssertEquals ("JW*Asc#JA28 - JapaneseCharacter", 63, Strings.Asc(MSWebSiteContent_Japanese[0]));
+ NUnit.Framework.Assertion.AssertEquals ("JW*Asc#JA28a - GermanCharacter", 228, Strings.Asc(Letter_German));
+ }
+ else
+ {
+ NUnit.Framework.Assertion.AssertEquals ("JW*Asc#JA28W - JapaneseCharacter", -27804, Strings.Asc(MSWebSiteContent_Japanese[0]));
+ NUnit.Framework.Assertion.AssertEquals ("JW*Asc#JA28aW - GermanCharacter", 97, Strings.Asc(Letter_German));
+ }
+
+ // restore buffered culture
+ System.Threading.Thread.CurrentThread.CurrentCulture = CurCulture;
+ }
+
+
+ public void Asc_String()
+ {
+ Encoding defencoding;
+ defencoding = Encoding.Default;
+
+ if (defencoding.GetMaxByteCount(1) == 1)
+ {
+ //single byte systems
+ NUnit.Framework.Assertion.AssertEquals ("JW*Asc#01", 63, Strings.Asc(this.TextStringOfMultipleLanguages));
+ NUnit.Framework.Assertion.AssertEquals ("JW*Asc#02", 99, Strings.Asc(MSWebSiteContent_Slovakian));
+ NUnit.Framework.Assertion.AssertEquals ("JW*Asc#03", 63, Strings.Asc(MSWebSiteContent_Japanese));
+ NUnit.Framework.Assertion.AssertEquals ("JW*Asc#04", 63, Strings.Asc(ArabynetComWebSiteContent_Arabic));
+ NUnit.Framework.Assertion.AssertEquals ("JW*Asc#05", 63, Strings.Asc(MSWebSiteContent_Korean));
+ NUnit.Framework.Assertion.AssertEquals ("JW*Asc#06", 63, Strings.Asc(MSWebSiteContent_Russian));
+ NUnit.Framework.Assertion.AssertEquals ("JW*Asc#07", 67, Strings.Asc(MSWebSiteContent_English));
+ }
+ else
+ {
+ //double byte charsets (wide)
+ NUnit.Framework.Assertion.AssertEquals ("JW*Asc#01W", -27804, Strings.Asc(this.TextStringOfMultipleLanguages));
+ NUnit.Framework.Assertion.AssertEquals ("JW*Asc#02W", 63, Strings.Asc(MSWebSiteContent_Slovakian));
+ NUnit.Framework.Assertion.AssertEquals ("JW*Asc#03W", -27804, Strings.Asc(MSWebSiteContent_Japanese));
+ NUnit.Framework.Assertion.AssertEquals ("JW*Asc#04W", 63, Strings.Asc(ArabynetComWebSiteContent_Arabic));
+ NUnit.Framework.Assertion.AssertEquals ("JW*Asc#05W", 63, Strings.Asc(MSWebSiteContent_Korean));
+ NUnit.Framework.Assertion.AssertEquals ("JW*Asc#06W", -31631, Strings.Asc(MSWebSiteContent_Russian));
+ NUnit.Framework.Assertion.AssertEquals ("JW*Asc#07W", 67, Strings.Asc(MSWebSiteContent_English));
+ }
+ try
+ {
+ object buffer = Strings.Asc(TextStringEmpty);
+ NUnit.Framework.Assertion.Fail ("JW*Asc#08 hasn't thrown an error");
+ }
+ catch
+ {
+ NUnit.Framework.Assertion.Assert ("JW*Asc#08", true);
+ }
+ try
+ {
+ object buffer = Strings.Asc(null);
+ NUnit.Framework.Assertion.Fail ("JW*Asc#09 hasn't thrown an error");
+ }
+ catch
+ {
+ NUnit.Framework.Assertion.Assert ("JW*Asc#09", true);
+ }
+ try
+ {
+ object buffer = Strings.Asc(TextStringUninitialized);
+ NUnit.Framework.Assertion.Fail ("JW*Asc#10 hasn't thrown an error");
+ }
+ catch
+ {
+ NUnit.Framework.Assertion.Assert ("JW*Asc#10", true);
+ }
+ NUnit.Framework.Assertion.AssertEquals ("JW*Asc#11 - Quotation mark test", 34, Strings.Asc("\""));
+ }
+
+
+ [Test]
+ public void AscW()
+ {
+ AscW_Char();
+ AscW_String();
+ }
+
+ public void AscW_Char()
+ {
+ NUnit.Framework.Assertion.AssertEquals ("JW#12", 0, Strings.AscW(Letter_Empty));
+ NUnit.Framework.Assertion.AssertEquals ("JW#13 - Quotation mark test", 34, Strings.AscW("\""[0]));
+ NUnit.Framework.Assertion.AssertEquals ("JW#14 - JapaneseCharacter", 38651, Strings.AscW(Letter_Japanese));
+ NUnit.Framework.Assertion.AssertEquals ("JW#14a - ArabicCharacter", 1603, Strings.AscW(Letter_Arabic));
+ NUnit.Framework.Assertion.AssertEquals ("JW#14b - GermanCharacter", 228, Strings.AscW(Letter_German));
+ }
+
+ public void AscW_String()
+ {
+ NUnit.Framework.Assertion.AssertEquals ("JW#15", 38651, Strings.AscW(this.TextStringOfMultipleLanguages));
+ NUnit.Framework.Assertion.AssertEquals ("JW#16", 269, Strings.AscW(MSWebSiteContent_Slovakian));
+ NUnit.Framework.Assertion.AssertEquals ("JW#17", 38651, Strings.AscW(MSWebSiteContent_Japanese));
+ NUnit.Framework.Assertion.AssertEquals ("JW#18", 1603, Strings.AscW(ArabynetComWebSiteContent_Arabic));
+ NUnit.Framework.Assertion.AssertEquals ("JW#19", 48372, Strings.AscW(MSWebSiteContent_Korean));
+ NUnit.Framework.Assertion.AssertEquals ("JW#20", 1073, Strings.AscW(MSWebSiteContent_Russian));
+ NUnit.Framework.Assertion.AssertEquals ("JW#21", 67, Strings.AscW(MSWebSiteContent_English));
+ try
+ {
+ object buffer = Strings.AscW(TextStringEmpty);
+ NUnit.Framework.Assertion.Fail ("JW#22 hasn't thrown an error");
+ }
+ catch
+ {
+ NUnit.Framework.Assertion.Assert ("JW#22", true);
+ }
+ try
+ {
+ object buffer = Strings.AscW(null);
+ NUnit.Framework.Assertion.Fail ("JW#23 hasn't thrown an error");
+ }
+ catch
+ {
+ NUnit.Framework.Assertion.Assert ("JW#23", true);
+ }
+ try
+ {
+ object buffer = Strings.AscW(TextStringUninitialized);
+ NUnit.Framework.Assertion.Fail ("JW#24 hasn't thrown an error");
+ }
+ catch
+ {
+ NUnit.Framework.Assertion.Assert ("JW#24", true);
+ }
+ NUnit.Framework.Assertion.AssertEquals ("JW#25 - Quotation mark test", 34, Strings.AscW("\""));
+ }
+
+ [Test]
+ public void Chr()
+ {
+ NUnit.Framework.Assertion.AssertEquals ("JW#29", "@"[0], Strings.Chr(64));
+ try
+ {
+ object buffer = Strings.Chr(38651);
+ NUnit.Framework.Assertion.Fail ("JW#30 hasn't thrown an error");
+ }
+ catch
+ {
+ NUnit.Framework.Assertion.Assert ("JW#30", true);
+ }
+ NUnit.Framework.Assertion.AssertEquals ("JW#31 - Quotation mark test", "\""[0], Strings.Chr(34));
+ }
+
+ [Test]
+ public void ChrW()
+ {
+ NUnit.Framework.Assertion.AssertEquals ("JW#32", "@"[0], Strings.ChrW(64));
+ NUnit.Framework.Assertion.AssertEquals ("JW#33", "é›»"[0], Strings.ChrW(38651));
+ NUnit.Framework.Assertion.AssertEquals ("JW#34 - Quotation mark test", "\""[0], Strings.ChrW(34));
+ }
+
+
+ //TODO: [Test]
+ public void Filter()
+ {
+ Filter_Objects();
+ Filter_Strings();
+ }
+
+ public void Filter_Objects()
+ {
+ /*
+ if (Source +AD0APQ- null)
+ throw new ArgumentException("Argument 'Source' can not be null.", "Source");
+ if (Source.Rank +AD4- 1)
+ throw new ArgumentException("Argument 'Source' can have only one dimension.", "Source");
+
+ string+AFsAXQ- strings;
+ strings = new string[Source.Length+AF0AOw-
+
+ Source.CopyTo(strings, 0);
+ return Filter(strings, Match, Include, Compare);
+ */
+ }
+
+ public void Filter_Strings()
+ {
+ /*
+ if (Source +AD0APQ- null)
+ throw new ArgumentException("Argument 'Source' can not be null.", "Source");
+ if (Source.Rank +AD4- 1)
+ throw new ArgumentException("Argument 'Source' can have only one dimension.", "Source");
+
+ //* Well, I don't like it either. But I figured that two iterations
+ //* on the array would be better than many aloocations. Besides, this
+ //* way I can isolate the special cases.
+ //* I'd love to hear from a different approach.
+
+ int count = Source.Length;
+ bool+AFsAXQ- matches = new bool[count+AF0AOw-
+ int matchesCount = 0;
+
+ for (int i = 0; i +ADw- count; i++)
+ {
+ if (InStr(1, Match, Source[i], Compare) +ACEAPQ- 0)
+ {
+ //found one more
+ matches[i] = true;
+ matchesCount ++;
+ }
+ else
+ {
+ matches[i] = false;
+ }
+ }
+
+ if (matchesCount +AD0APQ- 0)
+ {
+ if (Include)
+ return new string[0+AF0AOw-
+ else
+ return Source;
+ }
+ else
+ {
+ if (matchesCount +AD0APQ- count)
+ {
+ if (Include)
+ return Source;
+ else
+ return new string[0+AF0AOw-
+ }
+ else
+ {
+ string+AFsAXQ- ret;
+ int j = 0;
+ if (Include)
+ ret = new string [matchesCount+AF0AOw-
+ else
+ ret = new string [count - matchesCount+AF0AOw-
+
+ for (int i=0; i +ADw- count; i++)
+ {
+ if ((matches[i] +ACYAJg- Include) +AHwAfA- +ACE-(matches[i] +AHwAfA- Include))
+ {
+ ret[j] = Source[i+AF0AOw-
+ j++;
+ }
+ }
+ return ret;
+ }
+ }
+ */
+ }
+
+ //[Test]
+ public void Format()
+ {
+ FormatCurrency();
+ FormatDateTime();
+ FormatNumber();
+ FormatPercent();
+ }
+
+ // [MonoToDo("Not implemented")]
+ //TODO: [Test]
+ public void Format_Original()
+ {
+ /*
+ string returnstr=null;
+ string expstring=expression.GetType().ToString()+ADsAOw-
+ switch(expstring)
+ {
+ case "System.Char":
+ if ( style+ACEAPQAiACI-)
+ throw new System.ArgumentException("'expression' argument has a not valid value");
+ returnstr=Convert.ToChar(expression).ToString();
+ break;
+ case "System.String":
+ if (style +AD0APQ- +ACIAIg-)
+ returnstr=expression.ToString();
+ else
+ {
+ switch ( style.ToLower ())
+ {
+ case "yes/no":
+ case "on/off":
+ switch (expression.ToString().ToLower())
+ {
+ case "true":
+ case "On":
+ if (style.ToLower ()+AD0APQAi-yes/no")
+ returnstr+AD0AIg-Yes+ACIAOw- // TODO : must be translated
+ else
+ returnstr+AD0AIg-On+ACIAOw- // TODO : must be translated
+ break;
+ case "false":
+ case "off":
+ if (style.ToLower ()+AD0APQAi-yes/no")
+ returnstr+AD0AIg-No+ACIAOw- // TODO : must be translated
+ else
+ returnstr+AD0AIg-Off+ACIAOw- // TODO : must be translated
+ break;
+ default:
+ throw new System.ArgumentException();
+
+ }
+ break;
+ default:
+ returnstr=style.ToString();
+ break;
+ }
+ }
+ break;
+ case "System.Boolean":
+ if ( style+AD0APQAiACI-)
+ {
+ if ( Convert.ToBoolean(expression)+AD0APQ-true)
+ returnstr+AD0AIg-True+ACIAOw- // must not be translated
+ else
+ returnstr+AD0AIg-False+ACIAOw- // must not be translated
+ }
+ else
+ returnstr=style;
+ break;
+ case "System.DateTime":
+ returnstr=Convert.ToDateTime(expression).ToString (style) ;
+ break;
+ case "System.Decimal": case "System.Byte": case "System.SByte":
+ case "System.Int16": case "System.Int32": case "System.Int64":
+ case "System.Double": case "System.Single": case "System.UInt16":
+ case "System.UInt32": case "System.UInt64":
+ switch (style.ToLower ())
+ {
+ case "yes/no": case "true": case "false": case "on/off":
+ style=style.ToLower();
+ double dblbuffer=Convert.ToDouble(expression);
+ if (dblbuffer +AD0APQ- 0)
+ {
+ switch (style)
+ {
+ case "on/off":
+ returnstr= "Off+ACIAOw-break; // TODO : must be translated
+ case "yes/no":
+ returnstr= "No+ACIAOw-break; // TODO : must be translated
+ case "true":
+ case "false":
+ returnstr= "False+ACIAOw-break; // must not be translated
+ }
+ }
+ else
+ {
+ switch (style)
+ {
+ case "on/off":
+ returnstr+AD0AIg-On+ACIAOw-break; // TODO : must be translated
+ case "yes/no":
+ returnstr+AD0AIg-Yes+ACIAOw-break; // TODO : must be translated
+ case "true":
+ case "false":
+ returnstr+AD0AIg-True+ACIAOw-break; // must not be translated
+ }
+ }
+ break;
+ default:
+ switch (expstring)
+ {
+ case "System.Byte": returnstr=Convert.ToByte(expression).ToString (style);break;
+ case "System.SByte": returnstr=Convert.ToSByte(expression).ToString (style);break;
+ case "System.Int16": returnstr=Convert.ToInt16(expression).ToString (style);break;
+ case "System.UInt16": returnstr=Convert.ToUInt16(expression).ToString (style);break;
+ case "System.Int32": returnstr=Convert.ToInt32(expression).ToString (style);break;
+ case "System.UInt32": returnstr=Convert.ToUInt32(expression).ToString (style);break;
+ case "System.Int64": returnstr=Convert.ToUInt64(expression).ToString (style);break;
+ case "System.UInt64":returnstr=Convert.ToUInt64(expression).ToString (style);break;
+ case "System.Single": returnstr=Convert.ToSingle(expression).ToString (style);break;
+ case "System.Double": returnstr=Convert.ToDouble(expression).ToString (style);break;
+ case "System.Decimal": returnstr=Convert.ToDecimal(expression).ToString (style);break;
+
+ }
+ break;
+ }
+ break;
+ }
+ if (returnstr+AD0APQ-null)
+ throw new System.ArgumentException();
+ return returnstr;
+ */
+ }
+
+ // [MonoToDo("Not implemented")]
+ //TODO: [Test]
+ public void FormatCurrency()
+ {
+ /*
+ //FIXME
+ throw new NotImplementedException();
+ //throws InvalidCastException
+ //throws ArgumentException
+ */
+ }
+
+ // [MonoToDo("Not implemented")]
+ //TODO: [Test]
+ public void FormatDateTime()
+ {
+ /*
+ switch(NamedFormat)
+ {
+ case DateFormat.GeneralDate:
+ //FIXME: WTF should I do with it?
+ throw new NotImplementedException();
+ case DateFormat.LongDate:
+ return Expression.ToLongDateString();
+ case DateFormat.ShortDate:
+ return Expression.ToShortDateString();
+ case DateFormat.LongTime:
+ return Expression.ToLongTimeString();
+ case DateFormat.ShortTime:
+ return Expression.ToShortTimeString();
+ default:
+ throw new ArgumentException("Argument 'NamedFormat' must be a member of DateFormat", "NamedFormat");
+ }
+ */
+ }
+
+ [Test]
+ public void FormatNumber()
+ {
+ // buffer current culture
+ System.Globalization.CultureInfo CurCulture = System.Threading.Thread.CurrentThread.CurrentCulture;
+
+ // do testings
+ System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo("de-DE");
+ NUnit.Framework.Assertion.AssertEquals ("JW#60", "1.000", Strings.FormatNumber(1000,0,TriState.False,TriState.False,TriState.True));
+ NUnit.Framework.Assertion.AssertEquals ("JW#61", "1000", Strings.FormatNumber(1000,0,TriState.False,TriState.False,TriState.False));
+ NUnit.Framework.Assertion.AssertEquals ("JW#62", "1.000", Strings.FormatNumber(1000,0,TriState.True,TriState.False,TriState.True));
+ NUnit.Framework.Assertion.AssertEquals ("JW#63", "1.000", Strings.FormatNumber(1000,0,TriState.False,TriState.True,TriState.True));
+ NUnit.Framework.Assertion.AssertEquals ("JW#64", "1.000", Strings.FormatNumber(1000,0,TriState.True,TriState.True,TriState.True));
+ NUnit.Framework.Assertion.AssertEquals ("JW#65", "1000", Strings.FormatNumber(1000,0,TriState.False,TriState.False,TriState.False));
+ NUnit.Framework.Assertion.AssertEquals ("JW#66", "1.000", Strings.FormatNumber(1000,0,TriState.False,TriState.False,TriState.True));
+ NUnit.Framework.Assertion.AssertEquals ("JW#67", "-1000", Strings.FormatNumber(-1000,0,TriState.False,TriState.False,TriState.False));
+ NUnit.Framework.Assertion.AssertEquals ("JW#68", "-1.000", Strings.FormatNumber(-1000,0,TriState.True,TriState.False,TriState.True));
+ NUnit.Framework.Assertion.AssertEquals ("JW#69", "(1.000)", Strings.FormatNumber(-1000,0,TriState.False,TriState.True,TriState.True));
+ NUnit.Framework.Assertion.AssertEquals ("JW#70", "(1.000)", Strings.FormatNumber(-1000,0,TriState.True,TriState.True,TriState.True));
+ NUnit.Framework.Assertion.AssertEquals ("JW#71", "-1000", Strings.FormatNumber(-1000,0,TriState.False,TriState.False,TriState.False));
+ NUnit.Framework.Assertion.AssertEquals ("JW#72", "(1.000,0000)", Strings.FormatNumber(-1000,4,TriState.True,TriState.True,TriState.True));
+
+ System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
+ NUnit.Framework.Assertion.AssertEquals ("JW#80", "1,000", Strings.FormatNumber(1000,0,TriState.False,TriState.False,TriState.True));
+ NUnit.Framework.Assertion.AssertEquals ("JW#81", "1000", Strings.FormatNumber(1000,0,TriState.False,TriState.False,TriState.False));
+ NUnit.Framework.Assertion.AssertEquals ("JW#82", "1,000", Strings.FormatNumber(1000,0,TriState.True,TriState.False,TriState.True));
+ NUnit.Framework.Assertion.AssertEquals ("JW#83", "1,000", Strings.FormatNumber(1000,0,TriState.False,TriState.True,TriState.True));
+ NUnit.Framework.Assertion.AssertEquals ("JW#84", "1,000", Strings.FormatNumber(1000,0,TriState.True,TriState.True,TriState.True));
+ NUnit.Framework.Assertion.AssertEquals ("JW#85", "1000", Strings.FormatNumber(1000,0,TriState.False,TriState.False,TriState.False));
+ NUnit.Framework.Assertion.AssertEquals ("JW#86", "1,000", Strings.FormatNumber(1000,0,TriState.False,TriState.False,TriState.True));
+ NUnit.Framework.Assertion.AssertEquals ("JW#87", "-1000", Strings.FormatNumber(-1000,0,TriState.False,TriState.False,TriState.False));
+ NUnit.Framework.Assertion.AssertEquals ("JW#88", "-1,000", Strings.FormatNumber(-1000,0,TriState.True,TriState.False,TriState.True));
+ NUnit.Framework.Assertion.AssertEquals ("JW#89", "(1,000)", Strings.FormatNumber(-1000,0,TriState.False,TriState.True,TriState.True));
+ NUnit.Framework.Assertion.AssertEquals ("JW#90", "(1,000)", Strings.FormatNumber(-1000,0,TriState.True,TriState.True,TriState.True));
+ NUnit.Framework.Assertion.AssertEquals ("JW#91", "-1000", Strings.FormatNumber(-1000,0,TriState.False,TriState.False,TriState.False));
+ NUnit.Framework.Assertion.AssertEquals ("JW#92", "(1,000.0000)", Strings.FormatNumber(-1000,4,TriState.True,TriState.True,TriState.True));
+
+ // restore buffered culture
+ System.Threading.Thread.CurrentThread.CurrentCulture = CurCulture;
+
+ /*
+ //FIXME
+ throw new NotImplementedException();
+ //throws InvalidCastException
+ */
+ }
+
+ // [MonoToDo("Not implemented")]
+ //TODO: [Test]
+ public void FormatPercent()
+ {
+ /*
+ //FIXME
+ throw new NotImplementedException();
+ //throws InvalidCastException
+ */
+ }
+
+ // [MonoToDo("Not implemented")]
+ //TODO: [Test]
+ public void GetChar()
+ {
+ /*
+ if ((Str +AD0APQ- null) +AHwAfA- (Str.Length +AD0APQ- 0))
+ throw new ArgumentException("Length of argument 'Str' must be greater than zero.", "Sre");
+ if (Index +ADw- 1)
+ throw new ArgumentException("Argument 'Index' must be greater than or equal to 1.", "Index");
+ if (Index +AD4- Str.Length)
+ throw new ArgumentException("Argument 'Index' must be less than or equal to the length of argument 'String'.", "Index");
+
+ return Str.ToCharArray(Index -1, 1)[0+AF0AOw-
+ */
+ }
+
+ //[Test]
+ public void InStr()
+ {
+ InStr_WithOutStartParameter();
+ InStr_WithStartParameter();
+ }
+
+ // [MonoToDo("Not implemented")]
+ //TODO: [Test]
+ public void InStr_WithOutStartParameter()
+ {
+ /*
+ return InStr(1, String1, String2, Compare);
+ */
+ }
+
+ // [MonoToDo("Not implemented")]
+ //TODO: [Test]
+ public void InStr_WithStartParameter()
+ {
+ /*
+ if (Start +ADw- 1)
+ throw new ArgumentException("Argument 'Start' must be non-negative.", "Start");
+
+ //* FIXME: ms-help://MS.VSCC/MS.MSDNVS/vblr7/html/vafctinstr.htm
+ //* If Compare is omitted, the Option Compare setting determines the type of comparison. Specify
+ //* a valid LCID (LocaleID) to use locale-specific rules in the comparison.
+ //* How do I do this?
+
+ //* If InStr returns
+ //*
+ //* String1 is zero length or Nothing 0
+ //* String2 is zero length or Nothing start
+ //* String2 is not found 0
+ //* String2 is found within String1 Position where match begins
+ //* Start +AD4- String2 0
+
+
+ //FIXME: someone with a non US setup should test this.
+ switch (Compare)
+ {
+ case CompareMethod.Text:
+ return System.Globalization.CultureInfo.CurrentCulture.CompareInfo.IndexOf(String2, String1, Start - 1) + 1;
+
+ case CompareMethod.Binary:
+ return String1.IndexOf(String2, Start - 1) + 1;
+ default:
+ throw new System.ArgumentException("Argument 'Compare' must be CompareMethod.Binary or CompareMethod.Text.", "Compare");
+ }
+ */
+ }
+
+ //[Test]
+ public void InStrRev()
+ {
+ InStrRev_4Parameters();
+ InStrRev_5Parameters();
+ }
+
+ // [MonoToDo("Not implemented")]
+ //TODO: [Test]
+ public void InStrRev_4Parameters()
+ {
+
+ // 2 InStrRev functions exists+ACEAIQ- Create tests for both versions+ACE-
+
+ /*
+ if ((Start +AD0APQ- 0) +AHwAfA- (Start +ADw- -1))
+ throw new ArgumentException("Argument 'Start' must be greater than 0 or equal to -1", "Start");
+
+ //FIXME: Use LastIndexOf()
+ throw new NotImplementedException();
+ */
+ }
+
+ // [MonoToDo("Not implemented")]
+ //TODO: [Test]
+ public void InStrRev_5Parameters()
+ {
+ }
+
+ // [MonoToDo("Not implemented")]
+ //TODO: [Test]
+ public void Join_Strings()
+ {
+ /*
+ if (SourceArray +AD0APQ- null)
+ throw new ArgumentException("Argument 'SourceArray' can not be null.", "SourceArray");
+ if (SourceArray.Rank +AD4- 1)
+ throw new ArgumentException("Argument 'SourceArray' can have only one dimension.", "SourceArray");
+
+ return string.Join(Delimiter, SourceArray);
+ */
+ }
+
+ // [MonoToDo("Not implemented")]
+ //TODO: [Test]
+ public void Join_Objects()
+ {
+ /*
+ if (SourceArray +AD0APQ- null)
+ throw new ArgumentException("Argument 'SourceArray' can not be null.", "SourceArray");
+ if (SourceArray.Rank +AD4- 1)
+ throw new ArgumentException("Argument 'SourceArray' can have only one dimension.", "SourceArray");
+
+ string+AFsAXQ- dest;
+ dest = new string[SourceArray.Length+AF0AOw-
+
+ SourceArray.CopyTo(dest, 0);
+ return string.Join(Delimiter, dest);
+ */
+ }
+
+ public void LCase_Char()
+ {
+ // buffer current culture
+ System.Globalization.CultureInfo CurCulture = System.Threading.Thread.CurrentThread.CurrentCulture;
+
+ // do testings
+ NUnit.Framework.Assertion.AssertEquals ("JW#LCase/10c", 0, Strings.LCase(Letter_Empty));
+
+ System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
+ NUnit.Framework.Assertion.AssertEquals ("JW#LCase/10", Strings.AscW("c"), Strings.LCase(Letter_English));
+ NUnit.Framework.Assertion.AssertEquals ("JW#LCase/11", Strings.AscW("é›»"), Strings.LCase(Letter_Japanese));
+ NUnit.Framework.Assertion.AssertEquals ("JW#LCase/12", 1073, Strings.LCase(Letter_Russian));
+ NUnit.Framework.Assertion.AssertEquals ("JW#LCase/13", 269, Strings.LCase(Letter_Slovakian));
+ NUnit.Framework.Assertion.AssertEquals ("JW#LCase/14", Strings.AscW("ë³´"), Strings.LCase(Letter_Korean));
+ NUnit.Framework.Assertion.AssertEquals ("JW#LCase/15", 1603, Strings.LCase(Letter_Arabic));
+ NUnit.Framework.Assertion.AssertEquals ("JW#LCase/16", Strings.AscW("ä"), Strings.LCase(Letter_German));
+
+ System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo("de-DE");
+ NUnit.Framework.Assertion.AssertEquals ("JW#LCase/20", Strings.AscW("c"), Strings.LCase(Letter_English));
+ NUnit.Framework.Assertion.AssertEquals ("JW#LCase/21", Strings.AscW("é›»"), Strings.LCase(Letter_Japanese));
+ NUnit.Framework.Assertion.AssertEquals ("JW#LCase/22", 1073, Strings.LCase(Letter_Russian));
+ NUnit.Framework.Assertion.AssertEquals ("JW#LCase/23", 269, Strings.LCase(Letter_Slovakian));
+ NUnit.Framework.Assertion.AssertEquals ("JW#LCase/24", Strings.AscW("ë³´"), Strings.LCase(Letter_Korean));
+ NUnit.Framework.Assertion.AssertEquals ("JW#LCase/25", 1603, Strings.LCase(Letter_Arabic));
+ NUnit.Framework.Assertion.AssertEquals ("JW#LCase/26", Strings.AscW("ä"), Strings.LCase(Letter_German));
+
+ System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo("ja-JP");
+ NUnit.Framework.Assertion.AssertEquals ("JW#LCase/30", Strings.AscW("c"), Strings.LCase(Letter_English));
+ NUnit.Framework.Assertion.AssertEquals ("JW#LCase/31", Strings.AscW("é›»"), Strings.LCase(Letter_Japanese));
+ NUnit.Framework.Assertion.AssertEquals ("JW#LCase/32", 1073, Strings.LCase(Letter_Russian));
+ NUnit.Framework.Assertion.AssertEquals ("JW#LCase/33", 269, Strings.LCase(Letter_Slovakian));
+ NUnit.Framework.Assertion.AssertEquals ("JW#LCase/34", Strings.AscW("ë³´"), Strings.LCase(Letter_Korean));
+ NUnit.Framework.Assertion.AssertEquals ("JW#LCase/35", 1603, Strings.LCase(Letter_Arabic));
+ NUnit.Framework.Assertion.AssertEquals ("JW#LCase/36", Strings.AscW("ä"), Strings.LCase(Letter_German));
+
+ // restore buffered culture
+ System.Threading.Thread.CurrentThread.CurrentCulture = CurCulture;
+ }
+
+ [Test]
+ public void LCase()
+ {
+ LCase_Char();
+ LCase_String();
+ }
+
+ public void LCase_String()
+ {
+ // buffer current culture
+ System.Globalization.CultureInfo CurCulture = System.Threading.Thread.CurrentThread.CurrentCulture;
+
+ // do testings
+ NUnit.Framework.Assertion.AssertEquals ("JW#LCase/64", null, Strings.LCase(TextStringUninitialized));
+ NUnit.Framework.Assertion.AssertEquals ("JW#LCase/65", null, Strings.LCase(TextStringUninitialized));
+ NUnit.Framework.Assertion.AssertEquals ("JW#LCase/67", String.Empty, Strings.LCase(TextStringEmpty));
+ NUnit.Framework.Assertion.AssertEquals ("JW#LCase/68", "", Strings.LCase(TextStringEmpty));
+
+ System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo("de-DE");
+ NUnit.Framework.Assertion.AssertEquals ("JW#LCase/70", "choose the location for which you want contact information:", Strings.LCase(MSWebSiteContent_English));
+ NUnit.Framework.Assertion.AssertEquals ("JW#LCase/71", "é›»å­ãƒ¡ãƒ¼ãƒ«ã‚’ã¯ã˜ã‚ã€äºˆå®šè¡¨ã‚„アドレス帳ãªã©ã®å€‹äººæƒ…å ±ã€ã•ã‚‰ã«ã¯ office v. x ã®å„アプリケーションã§ä½œæˆã—ãŸæ›¸é¡žã‚„ãã®ä»–ã®ãƒ•ã‚¡ã‚¤ãƒ«ã‚’リンクã•ã›ã¦çµ±åˆçš„ã«ç®¡ç†ã™ã‚‹ã“ã¨ãŒã§ãるコミュニケーションï¼å€‹äººæƒ…報管ç†ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã§ã™ã€‚インターフェースãŒä¸€æ–°ã•ã‚Œã€é«˜åº¦ã§å¤šå½©ãª entourage x ã®æ©Ÿèƒ½ãŒã‚ˆã‚Šç›´æ„Ÿçš„ã«åˆ©ç”¨ã§ãるよã†ã«ãªã‚Šã¾ã—ãŸã€‚以å‰ãŠä½¿ã„ã«ãªã£ã¦ã„ãŸé›»å­ãƒ¡ãƒ¼ãƒ« アプリケーションã‹ã‚‰ã®æƒ…å ±ã®ã‚¤ãƒ³ãƒãƒ¼ãƒˆã‚‚容易ã«ã§ãã¾ã™ã€‚", Strings.LCase(MSWebSiteContent_Japanese));
+ NUnit.Framework.Assertion.AssertEquals ("JW#LCase/72", "будете автоматичеÑки перенаправлены", Strings.LCase(MSWebSiteContent_Russian));
+ NUnit.Framework.Assertion.AssertEquals ("JW#LCase/73", "Äníci nároÄných používateľovnové portfólio microsoft hardware. Å¡piÄkové optické bezdrôtové myÅ¡ky s novou technológiou - nakláňacím kolieskom. nezáleží na tom, aký stôl máte, pokiaľ je na ňom elegantná", Strings.LCase(MSWebSiteContent_Slovakian));
+ NUnit.Framework.Assertion.AssertEquals ("JW#LCase/74", "보안 ìº íŽ˜ì¸ - 스스로 지킨 ë‹¹ì‹ ì˜ pc! ë”ìš± 안전해집니다!", Strings.LCase(MSWebSiteContent_Korean));
+ NUnit.Framework.Assertion.AssertEquals ("JW#LCase/75", "كل الحقوق محÙوظة ليديعوت إنترنت", Strings.LCase(ArabynetComWebSiteContent_Arabic));
+ NUnit.Framework.Assertion.AssertEquals ("JW#LCase/76", "äöüäöüß", Strings.LCase(GermanUmlauts_German));
+ NUnit.Framework.Assertion.AssertEquals ("JW#LCase/77", "é›»å­ãƒ¡ãƒ¼ãƒ«ã‚’ã¯ã˜ã‚ã€äºˆå®šè¡¨ã‚„アドレス帳ãªã©ã®å€‹äººæƒ…å ±ã€ã•ã‚‰ã«ã¯ office v. x ã®å„アプリケーションã§ä½œæˆã—ãŸæ›¸é¡žã‚„ãã®ä»–ã®ãƒ•ã‚¡ã‚¤ãƒ«ã‚’リンクã•ã›ã¦çµ±åˆçš„ã«ç®¡ç†ã™ã‚‹ã“ã¨ãŒã§ãるコミュニケーションï¼å€‹äººæƒ…報管ç†ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã§ã™ã€‚インターフェースãŒä¸€æ–°ã•ã‚Œã€é«˜åº¦ã§å¤šå½©ãª entourage x ã®æ©Ÿèƒ½ãŒã‚ˆã‚Šç›´æ„Ÿçš„ã«åˆ©ç”¨ã§ãるよã†ã«ãªã‚Šã¾ã—ãŸã€‚以å‰ãŠä½¿ã„ã«ãªã£ã¦ã„ãŸé›»å­ãƒ¡ãƒ¼ãƒ« アプリケーションã‹ã‚‰ã®æƒ…å ±ã®ã‚¤ãƒ³ãƒãƒ¼ãƒˆã‚‚容易ã«ã§ãã¾ã™ã€‚будете автоматичеÑки перенаправленыÄníci nároÄných používateľovnové portfólio microsoft hardware. Å¡piÄkové optické bezdrôtové myÅ¡ky s novou technológiou - nakláňacím kolieskom. nezáleží na tom, aký stôl máte, pokiaľ je na ňom elegantná보안 ìº íŽ˜ì¸ - 스스로 지킨 ë‹¹ì‹ ì˜ pc! ë”ìš± 안전해집니다!كل الحقوق محÙوظة ليديعوت إنترنتäöüäöüß", Strings.LCase(TextStringOfMultipleLanguages));
+
+ System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
+ NUnit.Framework.Assertion.AssertEquals ("JW#LCase/80", "choose the location for which you want contact information:", Strings.LCase(MSWebSiteContent_English));
+ NUnit.Framework.Assertion.AssertEquals ("JW#LCase/81", "é›»å­ãƒ¡ãƒ¼ãƒ«ã‚’ã¯ã˜ã‚ã€äºˆå®šè¡¨ã‚„アドレス帳ãªã©ã®å€‹äººæƒ…å ±ã€ã•ã‚‰ã«ã¯ office v. x ã®å„アプリケーションã§ä½œæˆã—ãŸæ›¸é¡žã‚„ãã®ä»–ã®ãƒ•ã‚¡ã‚¤ãƒ«ã‚’リンクã•ã›ã¦çµ±åˆçš„ã«ç®¡ç†ã™ã‚‹ã“ã¨ãŒã§ãるコミュニケーションï¼å€‹äººæƒ…報管ç†ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã§ã™ã€‚インターフェースãŒä¸€æ–°ã•ã‚Œã€é«˜åº¦ã§å¤šå½©ãª entourage x ã®æ©Ÿèƒ½ãŒã‚ˆã‚Šç›´æ„Ÿçš„ã«åˆ©ç”¨ã§ãるよã†ã«ãªã‚Šã¾ã—ãŸã€‚以å‰ãŠä½¿ã„ã«ãªã£ã¦ã„ãŸé›»å­ãƒ¡ãƒ¼ãƒ« アプリケーションã‹ã‚‰ã®æƒ…å ±ã®ã‚¤ãƒ³ãƒãƒ¼ãƒˆã‚‚容易ã«ã§ãã¾ã™ã€‚", Strings.LCase(MSWebSiteContent_Japanese));
+ NUnit.Framework.Assertion.AssertEquals ("JW#LCase/82", "будете автоматичеÑки перенаправлены", Strings.LCase(MSWebSiteContent_Russian));
+ NUnit.Framework.Assertion.AssertEquals ("JW#LCase/83", "Äníci nároÄných používateľovnové portfólio microsoft hardware. Å¡piÄkové optické bezdrôtové myÅ¡ky s novou technológiou - nakláňacím kolieskom. nezáleží na tom, aký stôl máte, pokiaľ je na ňom elegantná", Strings.LCase(MSWebSiteContent_Slovakian));
+ NUnit.Framework.Assertion.AssertEquals ("JW#LCase/84", "보안 ìº íŽ˜ì¸ - 스스로 지킨 ë‹¹ì‹ ì˜ pc! ë”ìš± 안전해집니다!", Strings.LCase(MSWebSiteContent_Korean));
+ NUnit.Framework.Assertion.AssertEquals ("JW#LCase/85", "كل الحقوق محÙوظة ليديعوت إنترنت", Strings.LCase(ArabynetComWebSiteContent_Arabic));
+ NUnit.Framework.Assertion.AssertEquals ("JW#LCase/86", "äöüäöüß", Strings.LCase(GermanUmlauts_German));
+ NUnit.Framework.Assertion.AssertEquals ("JW#LCase/87", "é›»å­ãƒ¡ãƒ¼ãƒ«ã‚’ã¯ã˜ã‚ã€äºˆå®šè¡¨ã‚„アドレス帳ãªã©ã®å€‹äººæƒ…å ±ã€ã•ã‚‰ã«ã¯ office v. x ã®å„アプリケーションã§ä½œæˆã—ãŸæ›¸é¡žã‚„ãã®ä»–ã®ãƒ•ã‚¡ã‚¤ãƒ«ã‚’リンクã•ã›ã¦çµ±åˆçš„ã«ç®¡ç†ã™ã‚‹ã“ã¨ãŒã§ãるコミュニケーションï¼å€‹äººæƒ…報管ç†ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã§ã™ã€‚インターフェースãŒä¸€æ–°ã•ã‚Œã€é«˜åº¦ã§å¤šå½©ãª entourage x ã®æ©Ÿèƒ½ãŒã‚ˆã‚Šç›´æ„Ÿçš„ã«åˆ©ç”¨ã§ãるよã†ã«ãªã‚Šã¾ã—ãŸã€‚以å‰ãŠä½¿ã„ã«ãªã£ã¦ã„ãŸé›»å­ãƒ¡ãƒ¼ãƒ« アプリケーションã‹ã‚‰ã®æƒ…å ±ã®ã‚¤ãƒ³ãƒãƒ¼ãƒˆã‚‚容易ã«ã§ãã¾ã™ã€‚будете автоматичеÑки перенаправленыÄníci nároÄných používateľovnové portfólio microsoft hardware. Å¡piÄkové optické bezdrôtové myÅ¡ky s novou technológiou - nakláňacím kolieskom. nezáleží na tom, aký stôl máte, pokiaľ je na ňom elegantná보안 ìº íŽ˜ì¸ - 스스로 지킨 ë‹¹ì‹ ì˜ pc! ë”ìš± 안전해집니다!كل الحقوق محÙوظة ليديعوت إنترنتäöüäöüß", Strings.LCase(TextStringOfMultipleLanguages));
+
+ System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo("ja-JP");
+ NUnit.Framework.Assertion.AssertEquals ("JW#LCase/90", "choose the location for which you want contact information:", Strings.LCase(MSWebSiteContent_English));
+ NUnit.Framework.Assertion.AssertEquals ("JW#LCase/91", "é›»å­ãƒ¡ãƒ¼ãƒ«ã‚’ã¯ã˜ã‚ã€äºˆå®šè¡¨ã‚„アドレス帳ãªã©ã®å€‹äººæƒ…å ±ã€ã•ã‚‰ã«ã¯ office v. x ã®å„アプリケーションã§ä½œæˆã—ãŸæ›¸é¡žã‚„ãã®ä»–ã®ãƒ•ã‚¡ã‚¤ãƒ«ã‚’リンクã•ã›ã¦çµ±åˆçš„ã«ç®¡ç†ã™ã‚‹ã“ã¨ãŒã§ãるコミュニケーションï¼å€‹äººæƒ…報管ç†ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã§ã™ã€‚インターフェースãŒä¸€æ–°ã•ã‚Œã€é«˜åº¦ã§å¤šå½©ãª entourage x ã®æ©Ÿèƒ½ãŒã‚ˆã‚Šç›´æ„Ÿçš„ã«åˆ©ç”¨ã§ãるよã†ã«ãªã‚Šã¾ã—ãŸã€‚以å‰ãŠä½¿ã„ã«ãªã£ã¦ã„ãŸé›»å­ãƒ¡ãƒ¼ãƒ« アプリケーションã‹ã‚‰ã®æƒ…å ±ã®ã‚¤ãƒ³ãƒãƒ¼ãƒˆã‚‚容易ã«ã§ãã¾ã™ã€‚", Strings.LCase(MSWebSiteContent_Japanese));
+ NUnit.Framework.Assertion.AssertEquals ("JW#LCase/92", "будете автоматичеÑки перенаправлены", Strings.LCase(MSWebSiteContent_Russian));
+ NUnit.Framework.Assertion.AssertEquals ("JW#LCase/93", "Äníci nároÄných používateľovnové portfólio microsoft hardware. Å¡piÄkové optické bezdrôtové myÅ¡ky s novou technológiou - nakláňacím kolieskom. nezáleží na tom, aký stôl máte, pokiaľ je na ňom elegantná", Strings.LCase(MSWebSiteContent_Slovakian));
+ NUnit.Framework.Assertion.AssertEquals ("JW#LCase/94", "보안 ìº íŽ˜ì¸ - 스스로 지킨 ë‹¹ì‹ ì˜ pc! ë”ìš± 안전해집니다!", Strings.LCase(MSWebSiteContent_Korean));
+ NUnit.Framework.Assertion.AssertEquals ("JW#LCase/95", "كل الحقوق محÙوظة ليديعوت إنترنت", Strings.LCase(ArabynetComWebSiteContent_Arabic));
+ NUnit.Framework.Assertion.AssertEquals ("JW#LCase/96", "äöüäöüß", Strings.LCase(GermanUmlauts_German));
+ NUnit.Framework.Assertion.AssertEquals ("JW#LCase/97", "é›»å­ãƒ¡ãƒ¼ãƒ«ã‚’ã¯ã˜ã‚ã€äºˆå®šè¡¨ã‚„アドレス帳ãªã©ã®å€‹äººæƒ…å ±ã€ã•ã‚‰ã«ã¯ office v. x ã®å„アプリケーションã§ä½œæˆã—ãŸæ›¸é¡žã‚„ãã®ä»–ã®ãƒ•ã‚¡ã‚¤ãƒ«ã‚’リンクã•ã›ã¦çµ±åˆçš„ã«ç®¡ç†ã™ã‚‹ã“ã¨ãŒã§ãるコミュニケーションï¼å€‹äººæƒ…報管ç†ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã§ã™ã€‚インターフェースãŒä¸€æ–°ã•ã‚Œã€é«˜åº¦ã§å¤šå½©ãª entourage x ã®æ©Ÿèƒ½ãŒã‚ˆã‚Šç›´æ„Ÿçš„ã«åˆ©ç”¨ã§ãるよã†ã«ãªã‚Šã¾ã—ãŸã€‚以å‰ãŠä½¿ã„ã«ãªã£ã¦ã„ãŸé›»å­ãƒ¡ãƒ¼ãƒ« アプリケーションã‹ã‚‰ã®æƒ…å ±ã®ã‚¤ãƒ³ãƒãƒ¼ãƒˆã‚‚容易ã«ã§ãã¾ã™ã€‚будете автоматичеÑки перенаправленыÄníci nároÄných používateľovnové portfólio microsoft hardware. Å¡piÄkové optické bezdrôtové myÅ¡ky s novou technológiou - nakláňacím kolieskom. nezáleží na tom, aký stôl máte, pokiaľ je na ňom elegantná보안 ìº íŽ˜ì¸ - 스스로 지킨 ë‹¹ì‹ ì˜ pc! ë”ìš± 안전해집니다!كل الحقوق محÙوظة ليديعوت إنترنتäöüäöüß", Strings.LCase(TextStringOfMultipleLanguages));
+
+ // restore buffered culture
+ System.Threading.Thread.CurrentThread.CurrentCulture = CurCulture;
+ }
+
+
+ [Test]
+ public void Left()
+ {
+ NUnit.Framework.Assertion.AssertEquals ("JW#40", "ä電電", Strings.Left("ä電電jklmeh",3));
+ NUnit.Framework.Assertion.AssertEquals ("JW#41", "jk", Strings.Left("jklmeh",2));
+ NUnit.Framework.Assertion.AssertEquals ("JW#42", "", Strings.Left("jklmeh",0));
+ try
+ {
+ object buffer = Strings.Left("jklmeh",-1);
+ NUnit.Framework.Assertion.Fail ("JW#43 hasn't thrown an error");
+ }
+ catch
+ {
+ NUnit.Framework.Assertion.Assert ("JW#43", true);
+ }
+ NUnit.Framework.Assertion.AssertEquals ("JW#44", "j", Strings.Left("j",2));
+ }
+
+ [Test]
+ public void Len()
+ {
+ Len_Object();
+ Len_Bool();
+ Len_Byte();
+ Len_Char();
+ Len_Double();
+ Len_Int();
+ Len_Long();
+ Len_Short();
+ Len_Float();
+ Len_String();
+ Len_DateTime();
+ Len_Decimal();
+ }
+
+ public void Len_Bool()
+ {
+ try
+ {
+ object buffer = Strings.Len(null);
+ NUnit.Framework.Assertion.Fail ("JW#Len/50 hasn't thrown an error");
+ }
+ catch
+ {
+ NUnit.Framework.Assertion.Assert ("JW#Len/50", true);
+ }
+ NUnit.Framework.Assertion.AssertEquals ("JW#Len/51", 2, Strings.Len(true));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Len/52", 2, Strings.Len(false));
+ /*
+ return 2; //sizeof(bool)
+ */
+ }
+
+ public void Len_Byte()
+ {
+ byte MyByte1a = 3;
+ const byte MyByte1 = 3;
+ const byte MyByte2 = 13;
+ const byte MyByte3 = 123;
+ NUnit.Framework.Assertion.AssertEquals ("JW#Len/60", 1, Strings.Len(MyByte1a));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Len/61", 1, Strings.Len(MyByte1));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Len/62", 1, Strings.Len(MyByte2));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Len/63", 1, Strings.Len(MyByte3));
+ }
+
+ public void Len_Char()
+ {
+ char MyChar0 = (char)0;
+ char MyChar1 = (char)73;
+ char MyChar1a = (char)1024;
+ char MyChar2 = (char)65000;
+ NUnit.Framework.Assertion.AssertEquals ("JW#Len/71", 2, Strings.Len(MyChar0));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Len/72", 2, Strings.Len(MyChar1));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Len/73", 2, Strings.Len(MyChar1a));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Len/74", 2, Strings.Len(MyChar2));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Len/74", 2, Strings.Len(Letter_Empty));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Len/74", 2, Strings.Len(Letter_German));
+ /*
+ return 2; //sizeof(char)
+ */
+ }
+
+ public void Len_Double()
+ {
+ double MyChar0 = (double)0;
+ double MyChar1 = (double)73;
+ double MyChar1a = (double)-1024;
+ double MyChar2 = (double)65000.398721733;
+ NUnit.Framework.Assertion.AssertEquals ("JW#Len/81", 8, Strings.Len(MyChar0));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Len/82", 8, Strings.Len(MyChar1));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Len/83", 8, Strings.Len(MyChar1a));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Len/84", 8, Strings.Len(MyChar2));
+ /*
+ return 8; //sizeof(double)
+ */
+ }
+
+ public void Len_Int()
+ {
+ int MyChar0 = (int)0;
+ int MyChar1 = (int)73;
+ int MyChar1a = (int)-1024;
+ int MyChar2 = (int)65000;
+ NUnit.Framework.Assertion.AssertEquals ("JW#Len/91", 4, Strings.Len(MyChar0));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Len/92", 4, Strings.Len(MyChar1));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Len/93", 4, Strings.Len(MyChar1a));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Len/94", 4, Strings.Len(MyChar2));
+ /*
+ return 4; //sizeof(int)
+ */
+ }
+
+ public void Len_Long()
+ {
+ long MyChar0 = (long)0;
+ long MyChar1 = (long)73;
+ long MyChar1a = (long)-1024;
+ long MyChar2 = (long)65000.398721733;
+ NUnit.Framework.Assertion.AssertEquals ("JW#Len/101", 8, Strings.Len(MyChar0));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Len/102", 8, Strings.Len(MyChar1));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Len/103", 8, Strings.Len(MyChar1a));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Len/104", 8, Strings.Len(MyChar2));
+ /*
+ return 8; //sizeof(long)
+ */
+ }
+
+ class TMyLenTestClass
+ {
+ public void esss()
+ {
+ }
+
+ int dummy = 16;
+ const int me34 = 23;
+ }
+
+ class TMyLenTestClass2
+ {
+ public void esss()
+ {
+ string dddd = "kjdfhdjfh";
+ }
+
+ public void esss2()
+ {
+ string dddd = "kjdfhdjfh";
+ }
+
+ int dummy = 16;
+ const int me34 = 23;
+ }
+
+ struct TMyLenTestStruct
+ {
+ public int dummy1;
+ public double dummy2;
+ double dummy3;
+ }
+
+ struct TMyLenTestStruct2
+ {
+ public int dummy1;
+ double dummy3;
+ }
+
+ public void Len_Object()
+ {
+ object ObjectOfTextStringEmpty = TextStringEmpty;
+ object ObjectOfTextStringUninitialized = TextStringUninitialized;
+ object ObjectOfTextStringOfMultipleLanguages = TextStringOfMultipleLanguages;
+ object ObjectOfInt = (int)0;
+ object ObjectOfEmptyObject = null;
+ TMyLenTestStruct MyLenTestStruct;
+ MyLenTestStruct = new TMyLenTestStruct();
+ MyLenTestStruct.dummy1 = 34;
+ MyLenTestStruct.dummy2 = 34.343;
+ object ObjectOfTMyLenTestStruct = MyLenTestStruct;
+ TMyLenTestClass MyLenTestClass = new TMyLenTestClass();
+ object ObjectOfTMyLenTestClass = MyLenTestClass;
+ TMyLenTestStruct2 MyLenTestStruct2;
+ MyLenTestStruct2 = new TMyLenTestStruct2();
+ MyLenTestStruct2.dummy1 = 34;
+ object ObjectOfTMyLenTestStruct2 = MyLenTestStruct2;
+ TMyLenTestClass2 MyLenTestClass2 = new TMyLenTestClass2();
+ object ObjectOfTMyLenTestClass2 = MyLenTestClass2;
+ NUnit.Framework.Assertion.AssertEquals ("JW#Len/111", 0, Strings.Len(ObjectOfTextStringEmpty));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Len/112", 0, Strings.Len(ObjectOfTextStringUninitialized));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Len/113", 525, Strings.Len(ObjectOfTextStringOfMultipleLanguages));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Len/114", 4, Strings.Len(ObjectOfInt));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Len/115", 0, Strings.Len(ObjectOfEmptyObject));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Len/116", 12, Strings.Len(ObjectOfTMyLenTestStruct));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Len/118", 4, Strings.Len(ObjectOfTMyLenTestStruct2));
+ try
+ {
+ int buffer = Strings.Len(ObjectOfTMyLenTestClass);
+ NUnit.Framework.Assertion.Fail ("JW#Len/117 hasn't thrown an error");
+ }
+ catch
+ {
+ NUnit.Framework.Assertion.Assert ("JW#Len/117", true);
+ }
+ try
+ {
+ int buffer = Strings.Len(ObjectOfTMyLenTestClass2);
+ NUnit.Framework.Assertion.Fail ("JW#Len/119 hasn't thrown an error");
+ }
+ catch
+ {
+ NUnit.Framework.Assertion.Assert ("JW#Len/119", true);
+ }
+ /*
+ // FIXME:
+ // With user-defined types and Object variables, the Len function returns the size as it will
+ // be written to the file. If an Object contains a String, it will return the length of the string.
+ // If an Object contains any other type, it will return the size of the object as it will be written
+ // to the file.
+ throw new NotImplementedException();
+ */
+ }
+
+ public void Len_Short()
+ {
+ short MyChar0 = (short)0;
+ short MyChar1 = (short)73;
+ short MyChar1a = (short)-1024;
+ short MyChar2 = short.MaxValue;
+ NUnit.Framework.Assertion.AssertEquals ("JW#Len/121", 2, Strings.Len(MyChar0));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Len/122", 2, Strings.Len(MyChar1));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Len/123", 2, Strings.Len(MyChar1a));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Len/124", 2, Strings.Len(MyChar2));
+ /*
+ return 2; //sizeof(short)
+ */
+ }
+
+ public void Len_Float()
+ {
+ float MyChar0 = (float)0;
+ float MyChar1 = (float)73;
+ float MyChar1a = (float)-1024;
+ float MyChar2 = (float)-465000.398721733;
+ NUnit.Framework.Assertion.AssertEquals ("JW#Len/131", 4, Strings.Len(MyChar0));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Len/132", 4, Strings.Len(MyChar1));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Len/133", 4, Strings.Len(MyChar1a));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Len/134", 4, Strings.Len(MyChar2));
+ /*
+ return 4; //sizeof(Single)
+ */
+ }
+
+ public void Len_String()
+ {
+ NUnit.Framework.Assertion.AssertEquals ("JW#Len/161", 0, Strings.Len(TextStringEmpty));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Len/162", 0, Strings.Len(TextStringUninitialized));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Len/163", 525, Strings.Len(TextStringOfMultipleLanguages));
+ /*
+ return Expression.Length; //length of the string
+ */
+ }
+
+ public void Len_DateTime()
+ {
+ System.DateTime MyChar0 = new System.DateTime(1000,1,1);
+ System.DateTime MyChar1 = new System.DateTime(2003,12,29);
+ System.DateTime MyChar1a = System.DateTime.Now;
+ System.DateTime MyChar2 = new System.DateTime(9999,12,31,23,59,59,999);
+ NUnit.Framework.Assertion.AssertEquals ("JW#Len/141", 8, Strings.Len(MyChar0));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Len/142", 8, Strings.Len(MyChar1));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Len/143", 8, Strings.Len(MyChar1a));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Len/144", 8, Strings.Len(MyChar2));
+ /*
+ return 8; //sizeof(DateTime)
+ */
+ }
+
+ public void Len_Decimal()
+ {
+ decimal MyChar0 = (decimal)0;
+ decimal MyChar1 = (decimal)-3840;
+ decimal MyChar1a = (decimal)-29843433.23984723894333333;
+ decimal MyChar2 = (decimal)2934838384323432333;
+ NUnit.Framework.Assertion.AssertEquals ("JW#Len/151", 8, Strings.Len(MyChar0));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Len/152", 8, Strings.Len(MyChar1));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Len/153", 8, Strings.Len(MyChar1a));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Len/154", 8, Strings.Len(MyChar2));
+ /*
+ return 16; //sizeof(decimal)
+ */
+ }
+
+ [Test]
+ public void LSet()
+ {
+ NUnit.Framework.Assertion.AssertEquals ("JW#LSet/10", " lf", Strings.LSet(" lfkdfkd ", 4));
+ NUnit.Framework.Assertion.AssertEquals ("JW#LSet/11", "", Strings.LSet(" lfkdfkd ", 0));
+ try
+ {
+ string buffer = Strings.LSet(" lfkdfkd ", -1);
+ NUnit.Framework.Assertion.Fail ("JW#LSet/12 hasn't thrown an error");
+ }
+ catch
+ {
+ NUnit.Framework.Assertion.Assert ("JW#LSet/12", true);
+ }
+ NUnit.Framework.Assertion.AssertEquals ("JW#LSet/11", " lfkdfkd ", Strings.LSet(" lfkdfkd ", 20));
+ }
+
+ [Test]
+ public void LTrim()
+ {
+ NUnit.Framework.Assertion.AssertEquals ("JW#LTrim/10", "dkfÄ ", Strings.LTrim(" dkfÄ "));
+ NUnit.Framework.Assertion.AssertEquals ("JW#LTrim/11", "", Strings.LTrim(" "));
+ NUnit.Framework.Assertion.AssertEquals ("JW#LTrim/12", "", Strings.LTrim(null));
+ NUnit.Framework.Assertion.AssertEquals ("JW#LTrim/13", "", Strings.LTrim(String.Empty));
+ }
+
+ [Test]
+ public void RTrim()
+ {
+ NUnit.Framework.Assertion.AssertEquals ("JW#RTrim/10", " dkfÄ", Strings.RTrim(" dkfÄ "));
+ NUnit.Framework.Assertion.AssertEquals ("JW#RTrim/11", "", Strings.RTrim(" "));
+ NUnit.Framework.Assertion.AssertEquals ("JW#RTrim/12", "", Strings.RTrim(null));
+ NUnit.Framework.Assertion.AssertEquals ("JW#RTrim/13", "", Strings.RTrim(String.Empty));
+ }
+
+ [Test]
+ public void Trim()
+ {
+ NUnit.Framework.Assertion.AssertEquals ("JW#Trim/10", "dkfÄ", Strings.Trim(" dkfÄ "));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Trim/11", "", Strings.Trim(" "));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Trim/12", "", Strings.Trim(null));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Trim/13", "", Strings.Trim(String.Empty));
+ }
+
+ [Test]
+ public void Mid()
+ {
+ Mid_WithLengthParameter();
+ Mid_WithOutLengthParameter();
+ }
+
+ public void Mid_WithLengthParameter()
+ {
+ try
+ {
+ string buffer = Strings.Mid(String.Empty,0,0);
+ NUnit.Framework.Assertion.Fail ("JW#Mid/10 hasn't thrown an error");
+ }
+ catch
+ {
+ NUnit.Framework.Assertion.Assert ("JW#Mid/10", true);
+ }
+ try
+ {
+ string buffer = Strings.Mid(String.Empty,0,1);
+ NUnit.Framework.Assertion.Fail ("JW#Mid/11 hasn't thrown an error");
+ }
+ catch
+ {
+ NUnit.Framework.Assertion.Assert ("JW#Mid/11", true);
+ }
+ NUnit.Framework.Assertion.AssertEquals ("JW#Mid/12", "", Strings.Mid(String.Empty,1,0));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Mid/13", "", Strings.Mid(String.Empty,1,1));
+ try
+ {
+ string buffer = Strings.Mid(String.Empty,-1,0);
+ NUnit.Framework.Assertion.Fail ("JW#Mid/14 hasn't thrown an error");
+ }
+ catch
+ {
+ NUnit.Framework.Assertion.Assert ("JW#Mid/14", true);
+ }
+ try
+ {
+ string buffer = Strings.Mid(String.Empty,1,-1);
+ NUnit.Framework.Assertion.Fail ("JW#Mid/15 hasn't thrown an error");
+ }
+ catch
+ {
+ NUnit.Framework.Assertion.Assert ("JW#Mid/15", true);
+ }
+
+ NUnit.Framework.Assertion.AssertEquals ("JW#Mid/22", "", Strings.Mid(GermanUmlauts_German,1,0));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Mid/23", "ä", Strings.Mid(GermanUmlauts_German,1,1));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Mid/27", "öüÄÖ", Strings.Mid(GermanUmlauts_German,2,4));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Mid/28", "öüÄÖÜß", Strings.Mid(GermanUmlauts_German,2,400));
+
+ NUnit.Framework.Assertion.AssertEquals ("JW#Mid/32", "", Strings.Mid(ArabynetComWebSiteContent_Arabic,1,0));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Mid/33", "Ùƒ", Strings.Mid(ArabynetComWebSiteContent_Arabic,1,1));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Mid/37", "ل ال", Strings.Mid(ArabynetComWebSiteContent_Arabic,2,4));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Mid/38", "Ù„ الحقوق محÙوظة ليديعوت إنترنت", Strings.Mid(ArabynetComWebSiteContent_Arabic,2,400));
+ }
+
+ public void Mid_WithOutLengthParameter ()
+ {
+ try
+ {
+ string buffer = Strings.Mid(String.Empty,0);
+ NUnit.Framework.Assertion.Fail ("JW#Mid/60 hasn't thrown an error");
+ }
+ catch
+ {
+ NUnit.Framework.Assertion.Assert ("JW#Mid/60", true);
+ }
+ NUnit.Framework.Assertion.AssertEquals ("JW#Mid/62", "", Strings.Mid(String.Empty,1));
+ try
+ {
+ string buffer = Strings.Mid(String.Empty,-1);
+ NUnit.Framework.Assertion.Fail ("JW#Mid/64 hasn't thrown an error");
+ }
+ catch
+ {
+ NUnit.Framework.Assertion.Assert ("JW#Mid/64", true);
+ }
+
+ NUnit.Framework.Assertion.AssertEquals ("JW#Mid/73", "äöüÄÖÜß", Strings.Mid(GermanUmlauts_German,1));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Mid/78", "öüÄÖÜß", Strings.Mid(GermanUmlauts_German,2));
+
+ NUnit.Framework.Assertion.AssertEquals ("JW#Mid/82", "كل الحقوق محÙوظة ليديعوت إنترنت", Strings.Mid(ArabynetComWebSiteContent_Arabic,1));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Mid/88", "Ù„ الحقوق محÙوظة ليديعوت إنترنت", Strings.Mid(ArabynetComWebSiteContent_Arabic,2));
+ }
+
+/* TODO: reenable when Mono supports compilation of these lines
+ [Test]
+ public void Replace()
+ {
+ string buffer;
+
+ buffer = GermanUmlauts_German + GermanUmlauts_German + GermanUmlauts_German + GermanUmlauts_German;
+
+ NUnit.Framework.Assertion.AssertEquals ("JW#Replace/10", null, Strings.Replace(String.Empty, "ÄÖ", "deee",1,-1,CompareMethod.Binary));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Replace/11", null, Strings.Replace(String.Empty, "ÄÖ", "deee",1,-1,CompareMethod.Text));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Replace/12", null, Strings.Replace(null, "ÄÖ", "deee",1,-1,CompareMethod.Binary));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Replace/13", null, Strings.Replace(null, "ÄÖ", "deee",1,-1,CompareMethod.Text));
+
+ try
+ {
+ string buffer2 = Strings.Replace(buffer, "ÄÖ", "ÄÖ",0,0,CompareMethod.Binary);
+ NUnit.Framework.Assertion.Fail ("JW#Replace/20 hasn't thrown an error");
+ }
+ catch
+ {
+ NUnit.Framework.Assertion.Assert ("JW#Replace/20", true);
+ }
+ NUnit.Framework.Assertion.AssertEquals ("JW#Replace/21", "ßäöüÄÖÜßäöüÄÖÜßäöüÄÖÜß", Strings.Replace(buffer, "ÄÖ", "ÄÖ",7,-1,CompareMethod.Binary));
+ try
+ {
+ string buffer2 = Strings.Replace(buffer, "ÄÖ", "ÄÖ",7,-2,CompareMethod.Binary);
+ NUnit.Framework.Assertion.Fail ("JW#Replace/22 hasn't thrown an error");
+ }
+ catch
+ {
+ NUnit.Framework.Assertion.Assert ("JW#Replace/22", true);
+ }
+ try
+ {
+ string buffer2 = Strings.Replace(buffer, "ÄÖ", "ÄÖ",-1,0,CompareMethod.Binary);
+ NUnit.Framework.Assertion.Fail ("JW#Replace/23 hasn't thrown an error");
+ }
+ catch
+ {
+ NUnit.Framework.Assertion.Assert ("JW#Replace/23", true);
+ }
+ try
+ {
+ string buffer2 = Strings.Replace(buffer, "ÄÖ", "ÄÖ",-2,0,CompareMethod.Binary);
+ NUnit.Framework.Assertion.Fail ("JW#Replace/24 hasn't thrown an error");
+ }
+ catch
+ {
+ NUnit.Framework.Assertion.Assert ("JW#Replace/24", true);
+ }
+ NUnit.Framework.Assertion.AssertEquals ("JW#Replace/25", "äöüÄÖÜßäöüÄÖÜßäöüÄÖÜßäöüÄÖÜß", Strings.Replace(buffer, "ÄÖ", "ÄÖ",1,0,CompareMethod.Binary));
+ try
+ {
+ string buffer2 = Strings.Replace(buffer, "ÄÖ", "ÄÖ",0,1,CompareMethod.Binary);
+ NUnit.Framework.Assertion.Fail ("JW#Replace/26 hasn't thrown an error");
+ }
+ catch
+ {
+ NUnit.Framework.Assertion.Assert ("JW#Replace/26", true);
+ }
+ NUnit.Framework.Assertion.AssertEquals ("JW#Replace/27", "äöüÄÖÜßäöüÄÖÜßäöüÄÖÜßäöüÄÖÜß", Strings.Replace(buffer, "ÄÖ", "ÄÖ",1,1,CompareMethod.Binary));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Replace/28", "ßäöüÄÖÜßäöüÄÖÜßäöüÄÖÜß", Strings.Replace(buffer, "ÄÖ", "ÄÖ",7,1,CompareMethod.Binary));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Replace/29", "ßäöüÄÖÜßäöüÄÖÜßäöüÄÖÜß", Strings.Replace(buffer, "ÄÖ", "ÄÖ",7,2,CompareMethod.Binary));
+
+ NUnit.Framework.Assertion.AssertEquals ("JW#Replace/31", "ßäöüudddÜßäöüudddÜßäöüudddÜß", Strings.Replace(buffer, "ÄÖ", "uddd",7,-1,CompareMethod.Binary));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Replace/35", "äöüÄÖÜßäöüÄÖÜßäöüÄÖÜßäöüÄÖÜß", Strings.Replace(buffer, "ÄÖ", "uddd",1,0,CompareMethod.Binary));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Replace/37", "äöüudddÜßäöüÄÖÜßäöüÄÖÜßäöüÄÖÜß", Strings.Replace(buffer, "ÄÖ", "uddd",1,1,CompareMethod.Binary));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Replace/38", "ßäöüudddÜßäöüÄÖÜßäöüÄÖÜß", Strings.Replace(buffer, "ÄÖ", "uddd",7,1,CompareMethod.Binary));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Replace/39", "ßäöüudddÜßäöüudddÜßäöüÄÖÜß", Strings.Replace(buffer, "ÄÖ", "uddd",7,2,CompareMethod.Binary));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Replace/39a", "", Strings.Replace(buffer, "äöüÄÖÜß", "",1,-1,CompareMethod.Binary));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Replace/39b", String.Empty, Strings.Replace(buffer, "äöüÄÖÜß", "",1,-1,CompareMethod.Binary));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Replace/39c", null, Strings.Replace(buffer, "äöüÄÖÜß", "",400,-1,CompareMethod.Binary));
+
+ buffer = ArabynetComWebSiteContent_Arabic + ArabynetComWebSiteContent_Arabic;
+ //ArabynetComWebSiteContent_Arabic = "كل الحقوق محÙوظة ليديعوت إنترنت";
+ NUnit.Framework.Assertion.AssertEquals ("JW#Replace/41", "وق محÙوظة ليديعوت إنترنتكل الحقوق محÙوظة ليديعوت إنترنت", Strings.Replace(buffer, "ÄÖ", "uddd",8,-1,CompareMethod.Binary));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Replace/45", "كل الحقوق محÙوظة ليديعوت إنترنتكل الحقوق محÙوظة ليديعوت إنترنت", Strings.Replace(buffer, "ÄÖ", "uddd",1,0,CompareMethod.Binary));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Replace/47", "كل الحقوق محÙوظة ليديعوت إنترنتكل الحقوق محÙوظة ليديعوت إنترنت", Strings.Replace(buffer, "ÄÖ", "uddd",1,1,CompareMethod.Binary));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Replace/48", "وق محÙوظة ليديعوت إنترنتكل الحقوق محÙوظة ليديعوت إنترنت", Strings.Replace(buffer, "ÄÖ", "uddd",8,1,CompareMethod.Binary));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Replace/49", "وق محÙوظة ليديعوت إنترنتكل الحقوق محÙوظة ليديعوت إنترنت", Strings.Replace(buffer, "ÄÖ", "uddd",8,2,CompareMethod.Binary));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Replace/49a", "", Strings.Replace(buffer, "كل الحقوق محÙوظة ليديعوت إنترنت", "",1,-1,CompareMethod.Binary));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Replace/49b", String.Empty, Strings.Replace(buffer, "كل الحقوق محÙوظة ليديعوت إنترنت", "",1,-1,CompareMethod.Binary));
+
+ buffer = MSWebSiteContent_Korean + MSWebSiteContent_Korean;
+ //MSWebSiteContent_Korean = "보안 ìº íŽ˜ì¸ - 스스로 지킨 ë‹¹ì‹ ì˜ PC! ë”ìš± 안전해집니다!";
+ NUnit.Framework.Assertion.AssertEquals ("JW#Replace/51", " - 스스로 지킨 ë‹¹ì‹ ì˜ PC! ë”ìš± 안전해집니다!보안 ìº íŽ˜ì¸ - 스스로 지킨 ë‹¹ì‹ ì˜ PC! ë”ìš± 안전해집니다!", Strings.Replace(buffer, "ÄÖ", "uddd",7,-1,CompareMethod.Binary));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Replace/55", "보안 ìº íŽ˜ì¸ - 스스로 지킨 ë‹¹ì‹ ì˜ PC! ë”ìš± 안전해집니다!보안 ìº íŽ˜ì¸ - 스스로 지킨 ë‹¹ì‹ ì˜ PC! ë”ìš± 안전해집니다!", Strings.Replace(buffer, "ÄÖ", "uddd",1,0,CompareMethod.Binary));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Replace/57", "보안 ìº íŽ˜ì¸ - 스스로 지킨 ë‹¹ì‹ ì˜ PC! ë”ìš± 안전해집니다!보안 ìº íŽ˜ì¸ - 스스로 지킨 ë‹¹ì‹ ì˜ PC! ë”ìš± 안전해집니다!", Strings.Replace(buffer, "ÄÖ", "uddd",1,1,CompareMethod.Binary));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Replace/58", " - 스스로 지킨 ë‹¹ì‹ ì˜ PC! ë”ìš± 안전해집니다!보안 ìº íŽ˜ì¸ - 스스로 지킨 ë‹¹ì‹ ì˜ PC! ë”ìš± 안전해집니다!", Strings.Replace(buffer, "ÄÖ", "uddd",7,1,CompareMethod.Binary));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Replace/59", " - 스스로 지킨 ë‹¹ì‹ ì˜ PC! ë”ìš± 안전해집니다!보안 ìº íŽ˜ì¸ - 스스로 지킨 ë‹¹ì‹ ì˜ PC! ë”ìš± 안전해집니다!", Strings.Replace(buffer, "ÄÖ", "uddd",7,2,CompareMethod.Binary));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Replace/59a", "", Strings.Replace(buffer, "보안 ìº íŽ˜ì¸ - 스스로 지킨 ë‹¹ì‹ ì˜ PC! ë”ìš± 안전해집니다!", "",1,-1,CompareMethod.Binary));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Replace/59b", String.Empty, Strings.Replace(buffer, "보안 ìº íŽ˜ì¸ - 스스로 지킨 ë‹¹ì‹ ì˜ PC! ë”ìš± 안전해집니다!", "",1,-1,CompareMethod.Binary));
+
+ buffer = GermanUmlauts_German + GermanUmlauts_German + GermanUmlauts_German + GermanUmlauts_German;
+ NUnit.Framework.Assertion.AssertEquals ("JW#Replace/61", "ßudddüudddÜßudddüudddÜßudddüudddÜß", Strings.Replace(buffer, "ÄÖ", "uddd",7,-1,CompareMethod.Text));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Replace/65", "äöüÄÖÜßäöüÄÖÜßäöüÄÖÜßäöüÄÖÜß", Strings.Replace(buffer, "ÄÖ", "uddd",1,0,CompareMethod.Text));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Replace/67", "udddüÄÖÜßäöüÄÖÜßäöüÄÖÜßäöüÄÖÜß", Strings.Replace(buffer, "ÄÖ", "uddd",1,1,CompareMethod.Text));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Replace/68", "ßudddüÄÖÜßäöüÄÖÜßäöüÄÖÜß", Strings.Replace(buffer, "ÄÖ", "uddd",7,1,CompareMethod.Text));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Replace/69", "ßudddüudddÜßäöüÄÖÜßäöüÄÖÜß", Strings.Replace(buffer, "ÄÖ", "uddd",7,2,CompareMethod.Text));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Replace/69a", "ßßßß", Strings.Replace(buffer, "äöü", "",1,-1,CompareMethod.Text));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Replace/69b", String.Empty, Strings.Replace(buffer, "äöüÄÖÜß", "",1,-1,CompareMethod.Text));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Replace/69c", null, Strings.Replace(buffer, "äöüÄÖÜß", "",400,-1,CompareMethod.Text));
+
+ buffer = ArabynetComWebSiteContent_Arabic + ArabynetComWebSiteContent_Arabic;
+ //ArabynetComWebSiteContent_Arabic = "كل الحقوق محÙوظة ليديعوت إنترنت";
+ NUnit.Framework.Assertion.AssertEquals ("JW#Replace/71", "وق محÙوظة ليديعوت إنترنتكل الحقوق محÙوظة ليديعوت إنترنت", Strings.Replace(buffer, "ÄÖ", "uddd",8,-1,CompareMethod.Text));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Replace/75", "كل الحقوق محÙوظة ليديعوت إنترنتكل الحقوق محÙوظة ليديعوت إنترنت", Strings.Replace(buffer, "ÄÖ", "uddd",1,0,CompareMethod.Text));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Replace/77", "كل الحقوق محÙوظة ليديعوت إنترنتكل الحقوق محÙوظة ليديعوت إنترنت", Strings.Replace(buffer, "ÄÖ", "uddd",1,1,CompareMethod.Text));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Replace/78", "وق محÙوظة ليديعوت إنترنتكل الحقوق محÙوظة ليديعوت إنترنت", Strings.Replace(buffer, "ÄÖ", "uddd",8,1,CompareMethod.Text));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Replace/79", "وق محÙوظة ليديعوت إنترنتكل الحقوق محÙوظة ليديعوت إنترنت", Strings.Replace(buffer, "ÄÖ", "uddd",8,2,CompareMethod.Text));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Replace/79a", "", Strings.Replace(buffer, "كل الحقوق محÙوظة ليديعوت إنترنت", "",1,-1,CompareMethod.Text));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Replace/79b", String.Empty, Strings.Replace(buffer, "كل الحقوق محÙوظة ليديعوت إنترنت", "",1,-1,CompareMethod.Text));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Replace/79c", "uddd", Strings.Replace(buffer, Strings.UCase("وق محÙوظة ليديعوت إنترنتكل الحقوق محÙوظة ليديعوت إنترنت"), "uddd",8,2,CompareMethod.Text));
+
+ buffer = MSWebSiteContent_Korean + MSWebSiteContent_Korean;
+ //MSWebSiteContent_Korean = "보안 ìº íŽ˜ì¸ - 스스로 지킨 ë‹¹ì‹ ì˜ PC! ë”ìš± 안전해집니다!";
+ NUnit.Framework.Assertion.AssertEquals ("JW#Replace/81", " - 스스로 지킨 ë‹¹ì‹ ì˜ PC! ë”ìš± 안전해집니다!보안 ìº íŽ˜ì¸ - 스스로 지킨 ë‹¹ì‹ ì˜ PC! ë”ìš± 안전해집니다!", Strings.Replace(buffer, "ÄÖ", "uddd",7,-1,CompareMethod.Text));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Replace/85", "보안 ìº íŽ˜ì¸ - 스스로 지킨 ë‹¹ì‹ ì˜ PC! ë”ìš± 안전해집니다!보안 ìº íŽ˜ì¸ - 스스로 지킨 ë‹¹ì‹ ì˜ PC! ë”ìš± 안전해집니다!", Strings.Replace(buffer, "ÄÖ", "uddd",1,0,CompareMethod.Text));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Replace/87", "보안 ìº íŽ˜ì¸ - 스스로 지킨 ë‹¹ì‹ ì˜ PC! ë”ìš± 안전해집니다!보안 ìº íŽ˜ì¸ - 스스로 지킨 ë‹¹ì‹ ì˜ PC! ë”ìš± 안전해집니다!", Strings.Replace(buffer, "ÄÖ", "uddd",1,1,CompareMethod.Text));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Replace/88", " - 스스로 지킨 ë‹¹ì‹ ì˜ PC! ë”ìš± 안전해집니다!보안 ìº íŽ˜ì¸ - 스스로 지킨 ë‹¹ì‹ ì˜ PC! ë”ìš± 안전해집니다!", Strings.Replace(buffer, "ÄÖ", "uddd",7,1,CompareMethod.Text));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Replace/89", " - 스스로 지킨 ë‹¹ì‹ ì˜ PC! ë”ìš± 안전해집니다!보안 ìº íŽ˜ì¸ - 스스로 지킨 ë‹¹ì‹ ì˜ PC! ë”ìš± 안전해집니다!", Strings.Replace(buffer, "ÄÖ", "uddd",7,2,CompareMethod.Text));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Replace/89a", "", Strings.Replace(buffer, "보안 ìº íŽ˜ì¸ - 스스로 지킨 ë‹¹ì‹ ì˜ PC! ë”ìš± 안전해집니다!", "",1,-1,CompareMethod.Text));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Replace/89b", String.Empty, Strings.Replace(buffer, "보안 ìº íŽ˜ì¸ - 스스로 지킨 ë‹¹ì‹ ì˜ PC! ë”ìš± 안전해집니다!", "",1,-1,CompareMethod.Text));
+ }
+*/
+
+ [Test]
+ public void Right()
+ {
+ try
+ {
+ string buffer2 = Strings.Right(TextStringOfMultipleLanguages, 0);
+ NUnit.Framework.Assertion.Fail ("JW#Right/20 hasn't thrown an error");
+ }
+ catch
+ {
+ NUnit.Framework.Assertion.Assert ("JW#Right/20", true);
+ }
+
+ NUnit.Framework.Assertion.AssertEquals ("JW#Right/21", "يديعوت إنترنتäöüÄÖÜß", Strings.Right(TextStringOfMultipleLanguages, 20));
+ NUnit.Framework.Assertion.AssertEquals ("JW#Right/22", TextStringOfMultipleLanguages, Strings.Right(TextStringOfMultipleLanguages, 20000));
+
+ }
+
+ [Test]
+ public void RSet()
+ {
+ NUnit.Framework.Assertion.AssertEquals ("JW#RSet/10", " lf", Strings.RSet(" lfkdfkd ", 4));
+ NUnit.Framework.Assertion.AssertEquals ("JW#RSet/11", "", Strings.RSet(" lfkdfkd ", 0));
+ try
+ {
+ string buffer = Strings.RSet(" lfkdfkd ", -1);
+ NUnit.Framework.Assertion.Fail ("JW#RSet/12 hasn't thrown an error");
+ }
+ catch
+ {
+ NUnit.Framework.Assertion.Assert ("JW#RSet/12", true);
+ }
+ NUnit.Framework.Assertion.AssertEquals ("JW#RSet/11", " lfkdfkd ", Strings.RSet(" lfkdfkd ", 20));
+ }
+
+ [Test]
+ public void Space()
+ {
+ NUnit.Framework.Assertion.AssertEquals ("JW*Space#01", "", Strings.Space(0));
+ NUnit.Framework.Assertion.AssertEquals ("JW*Space#02", " ", Strings.Space(2));
+ NUnit.Framework.Assertion.AssertEquals ("JW*Space#03", Strings.Chr(32).ToString() + Strings.Chr(32).ToString(), Strings.Space(2));
+ NUnit.Framework.Assertion.AssertEquals ("JW*Space#03a", String.Concat(Strings.Chr(32).ToString(), Strings.Chr(32).ToString()), Strings.Space(2));
+ NUnit.Framework.Assertion.AssertEquals ("JW*Space#04", " ", Strings.Space(8));
+ try
+ {
+ string buf = Strings.Space(-1);
+ NUnit.Framework.Assertion.Fail ("JW*Space#10");
+ }
+ catch
+ {
+ }
+ }
+
+/* TODO: reenable when Mono supports compilation of these lines
+ [Test]
+ public void Split()
+ {
+ string buffer = GermanUmlauts_German + GermanUmlauts_German + GermanUmlauts_German + GermanUmlauts_German;
+ NUnit.Framework.Assertion.AssertEquals ("JW*Split#01", 1, Strings.Split("äö","ü", 0, CompareMethod.Binary).Length);
+ NUnit.Framework.Assertion.AssertEquals ("JW*Split#01a", "", Strings.Split(String.Empty," ", -1, CompareMethod.Binary)[0]);
+ NUnit.Framework.Assertion.AssertEquals ("JW*Split#01a", 1, Strings.Split(String.Empty," ", -1, CompareMethod.Binary).Length);
+ NUnit.Framework.Assertion.AssertEquals ("JW*Split#01b", 1, Strings.Split(String.Empty,"", -1, CompareMethod.Binary).Length);
+ NUnit.Framework.Assertion.AssertEquals ("JW*Split#01b", "", Strings.Split(String.Empty,"", -1, CompareMethod.Binary)[0]);
+ try
+ {
+ string buffer2 = Strings.Split(buffer,"ü", 0, CompareMethod.Binary).Length.ToString();
+ NUnit.Framework.Assertion.Fail ("JW#Split#01c hasn't thrown an error");
+ }
+ catch
+ {
+ }
+ try
+ {
+ string buffer2 = Strings.Split(buffer,"ü", -2, CompareMethod.Binary).Length.ToString();
+ NUnit.Framework.Assertion.Fail ("JW#Split#02 hasn't thrown an error");
+ }
+ catch
+ {
+ }
+ NUnit.Framework.Assertion.AssertEquals ("JW*Split#10", 5, Strings.Split(buffer,"ü", -1, CompareMethod.Binary).Length);
+ NUnit.Framework.Assertion.AssertEquals ("JW*Split#11", 2, Strings.Split(buffer,"ü", 2, CompareMethod.Binary).Length);
+ NUnit.Framework.Assertion.AssertEquals ("JW*Split#12", 9, Strings.Split(buffer,"ü", -1, CompareMethod.Text).Length);
+ NUnit.Framework.Assertion.AssertEquals ("JW*Split#13", 1, Strings.Split(buffer,"ü", 1, CompareMethod.Text).Length);
+ NUnit.Framework.Assertion.AssertEquals ("JW*Split#14", 1, Strings.Split(buffer,"", -1, CompareMethod.Binary).Length);
+ NUnit.Framework.Assertion.AssertEquals ("JW*Split#15", 1, Strings.Split(buffer,"", 2, CompareMethod.Binary).Length);
+ NUnit.Framework.Assertion.AssertEquals ("JW*Split#16", 1, Strings.Split(buffer,"", -1, CompareMethod.Text).Length);
+ NUnit.Framework.Assertion.AssertEquals ("JW*Split#17", 1, Strings.Split(buffer,"", 1, CompareMethod.Text).Length);
+ NUnit.Framework.Assertion.AssertEquals ("JW*Split#14a", 5, Strings.Split(buffer,"äö", -1, CompareMethod.Binary).Length);
+ NUnit.Framework.Assertion.AssertEquals ("JW*Split#15a", 2, Strings.Split(buffer,"äö", 2, CompareMethod.Binary).Length);
+ NUnit.Framework.Assertion.AssertEquals ("JW*Split#16a", 9, Strings.Split(buffer,"äö", -1, CompareMethod.Text).Length);
+ NUnit.Framework.Assertion.AssertEquals ("JW*Split#17a", 1, Strings.Split(buffer,"äö", 1, CompareMethod.Text).Length);
+ NUnit.Framework.Assertion.AssertEquals ("JW*Split#14b", "üÄÖÜß", Strings.Split(buffer,"äö", -1, CompareMethod.Binary)[4]);
+ NUnit.Framework.Assertion.AssertEquals ("JW*Split#15b", "üÄÖÜßäöüÄÖÜßäöüÄÖÜßäöüÄÖÜß", Strings.Split(buffer,"äö", 2, CompareMethod.Binary)[1]);
+ NUnit.Framework.Assertion.AssertEquals ("JW*Split#16b", "Üß", Strings.Split(buffer,"äö", -1, CompareMethod.Text)[8]);
+ NUnit.Framework.Assertion.AssertEquals ("JW*Split#17b", "äöüÄÖÜßäöüÄÖÜßäöüÄÖÜßäöüÄÖÜß", Strings.Split(buffer,"äö", 1, CompareMethod.Text)[0]);
+ NUnit.Framework.Assertion.AssertEquals ("JW*Split#17c", "", Strings.Split(buffer,"äö", 2, CompareMethod.Text)[0]);
+
+ string myString = "Look at these!";
+ string[] myReturn = {"Look", "at", "these!"};
+ NUnit.Framework.Assertion.AssertEquals ("JW*Split#18", 3, Strings.Split(myString, " ", -1, CompareMethod.Binary).Length);
+ NUnit.Framework.Assertion.AssertEquals ("JW*Split#18a", myReturn[0], Strings.Split(myString, " ", -1, CompareMethod.Binary)[0]);
+ NUnit.Framework.Assertion.AssertEquals ("JW*Split#18b", myReturn[1], Strings.Split(myString, " ", -1, CompareMethod.Binary)[1]);
+ NUnit.Framework.Assertion.AssertEquals ("JW*Split#18c", myReturn[2], Strings.Split(myString, " ", -1, CompareMethod.Binary)[2]);
+
+ NUnit.Framework.Assertion.AssertEquals ("JW*Split#20", "äöüÄÖ", Strings.Split(buffer,"Ü", -1, CompareMethod.Binary)[0]);
+ NUnit.Framework.Assertion.AssertEquals ("JW*Split#21", "äöüÄÖ", Strings.Split(buffer,"Ü", 2, CompareMethod.Binary)[0]);
+ NUnit.Framework.Assertion.AssertEquals ("JW*Split#22", "äö", Strings.Split(buffer,"Ü", -1, CompareMethod.Text)[0]);
+ NUnit.Framework.Assertion.AssertEquals ("JW*Split#23", "äöüÄÖÜßäöüÄÖÜßäöüÄÖÜßäöüÄÖÜß", Strings.Split(buffer,"Ü", 1, CompareMethod.Text)[0]);
+ NUnit.Framework.Assertion.AssertEquals ("JW*Split#24", "äö", Strings.Split(buffer,"Ü", 2, CompareMethod.Text)[0]);
+
+ }
+
+ [Test]
+ public void StrComp()
+ {
+ NUnit.Framework.Assertion.AssertEquals ("JW*StrComp#01", -1, Strings.StrComp(Strings.UCase(TextStringOfMultipleLanguages),TextStringOfMultipleLanguages, CompareMethod.Binary));
+ NUnit.Framework.Assertion.AssertEquals ("JW*StrComp#02", 1, Strings.StrComp(Strings.LCase(TextStringOfMultipleLanguages),TextStringOfMultipleLanguages, CompareMethod.Binary));
+ NUnit.Framework.Assertion.AssertEquals ("JW*StrComp#03", 0, Strings.StrComp(TextStringOfMultipleLanguages,TextStringOfMultipleLanguages, CompareMethod.Binary));
+ NUnit.Framework.Assertion.AssertEquals ("JW*StrComp#04", -1, Strings.StrComp(String.Empty,TextStringOfMultipleLanguages, CompareMethod.Binary));
+ NUnit.Framework.Assertion.AssertEquals ("JW*StrComp#05", -1, Strings.StrComp(null,TextStringOfMultipleLanguages, CompareMethod.Binary));
+ NUnit.Framework.Assertion.AssertEquals ("JW*StrComp#06", -1, Strings.StrComp(" " + TextStringOfMultipleLanguages,TextStringOfMultipleLanguages, CompareMethod.Binary));
+ NUnit.Framework.Assertion.AssertEquals ("JW*StrComp#06a", -1, Strings.StrComp(Strings.ChrW(6444) + TextStringOfMultipleLanguages,TextStringOfMultipleLanguages, CompareMethod.Binary));
+ NUnit.Framework.Assertion.AssertEquals ("JW*StrComp#07", 1, Strings.StrComp(TextStringOfMultipleLanguages + " ",TextStringOfMultipleLanguages, CompareMethod.Binary));
+
+ NUnit.Framework.Assertion.AssertEquals ("JW*StrComp#11", 0, Strings.StrComp(Strings.UCase(TextStringOfMultipleLanguages),TextStringOfMultipleLanguages, CompareMethod.Text));
+ NUnit.Framework.Assertion.AssertEquals ("JW*StrComp#12", 0, Strings.StrComp(Strings.LCase(TextStringOfMultipleLanguages),TextStringOfMultipleLanguages, CompareMethod.Text));
+ NUnit.Framework.Assertion.AssertEquals ("JW*StrComp#13", 0, Strings.StrComp(TextStringOfMultipleLanguages,TextStringOfMultipleLanguages, CompareMethod.Binary));
+ NUnit.Framework.Assertion.AssertEquals ("JW*StrComp#14", -1, Strings.StrComp(String.Empty,TextStringOfMultipleLanguages, CompareMethod.Binary));
+ NUnit.Framework.Assertion.AssertEquals ("JW*StrComp#15", -1, Strings.StrComp(null,TextStringOfMultipleLanguages, CompareMethod.Binary));
+ NUnit.Framework.Assertion.AssertEquals ("JW*StrComp#06", -1, Strings.StrComp(" " + TextStringOfMultipleLanguages,TextStringOfMultipleLanguages, CompareMethod.Text));
+ NUnit.Framework.Assertion.AssertEquals ("JW*StrComp#06a", 0, Strings.StrComp(Strings.ChrW(10654) + TextStringOfMultipleLanguages,TextStringOfMultipleLanguages, CompareMethod.Text)); //seems to be a MS bug?
+ NUnit.Framework.Assertion.AssertEquals ("JW*StrComp#06b", -1, Strings.StrComp(Strings.ChrW(88) + TextStringOfMultipleLanguages,TextStringOfMultipleLanguages, CompareMethod.Text));
+ NUnit.Framework.Assertion.AssertEquals ("JW*StrComp#07", 1, Strings.StrComp(TextStringOfMultipleLanguages + " ",TextStringOfMultipleLanguages, CompareMethod.Text));
+ }
+*/
+
+ // TODO: Chinese testings
+ [Test]
+ public void StrConv ()
+ {
+ // buffer current culture
+ System.Globalization.CultureInfo CurCulture = System.Threading.Thread.CurrentThread.CurrentCulture;
+
+ // do testings
+
+ // ***********
+ // ** EN-US **
+ // ***********
+
+ System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
+
+ //requires japanese systems
+ //NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#02", 1, Strings.StrConv(TextStringOfMultipleLanguages, VbStrConv.Hiragana, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
+ //NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#03", 1, Strings.StrConv(TextStringOfMultipleLanguages, VbStrConv.Katakana, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
+
+ //TODO: how to write VbStrConv.LinguisticCasing + VbStrConv.UpperCase correctly?
+ //NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#04", 1, Strings.StrConv(TextStringOfMultipleLanguages, (VbStrConv.LinguisticCasing + VbStrConv.UpperCase), System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
+ //NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#04a", 1, Strings.StrConv(TextStringOfMultipleLanguages, VbStrConv.LinguisticCasing || VbStrConv.LowerCase, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
+
+ //not supported
+ //NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#05", 1, Strings.StrConv(TextStringOfMultipleLanguages, VbStrConv.Narrow, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
+ //NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#11", 1, Strings.StrConv(TextStringOfMultipleLanguages, VbStrConv.Wide, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
+
+ NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#06", TextStringOfMultipleLanguages, Strings.StrConv(TextStringOfMultipleLanguages, VbStrConv.None, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
+ NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#01", "é›»å­ãƒ¡ãƒ¼ãƒ«ã‚’ã¯ã˜ã‚ã€äºˆå®šè¡¨ã‚„アドレス帳ãªã©ã®å€‹äººæƒ…å ±ã€ã•ã‚‰ã«ã¯ office v. x ã®å„アプリケーションã§ä½œæˆã—ãŸæ›¸é¡žã‚„ãã®ä»–ã®ãƒ•ã‚¡ã‚¤ãƒ«ã‚’リンクã•ã›ã¦çµ±åˆçš„ã«ç®¡ç†ã™ã‚‹ã“ã¨ãŒã§ãるコミュニケーションï¼å€‹äººæƒ…報管ç†ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã§ã™ã€‚インターフェースãŒä¸€æ–°ã•ã‚Œã€é«˜åº¦ã§å¤šå½©ãª entourage x ã®æ©Ÿèƒ½ãŒã‚ˆã‚Šç›´æ„Ÿçš„ã«åˆ©ç”¨ã§ãるよã†ã«ãªã‚Šã¾ã—ãŸã€‚以å‰ãŠä½¿ã„ã«ãªã£ã¦ã„ãŸé›»å­ãƒ¡ãƒ¼ãƒ« アプリケーションã‹ã‚‰ã®æƒ…å ±ã®ã‚¤ãƒ³ãƒãƒ¼ãƒˆã‚‚容易ã«ã§ãã¾ã™ã€‚будете автоматичеÑки перенаправленыÄníci nároÄných používateľovnové portfólio microsoft hardware. Å¡piÄkové optické bezdrôtové myÅ¡ky s novou technológiou - nakláňacím kolieskom. nezáleží na tom, aký stôl máte, pokiaľ je na ňom elegantná보안 ìº íŽ˜ì¸ - 스스로 지킨 ë‹¹ì‹ ì˜ pc! ë”ìš± 안전해집니다!كل الحقوق محÙوظة ليديعوت إنترنتäöüäöüß", Strings.StrConv(TextStringOfMultipleLanguages, VbStrConv.LowerCase, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
+ NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#07", "é›»å­ãƒ¡ãƒ¼ãƒ«ã‚’ã¯ã˜ã‚ã€äºˆå®šè¡¨ã‚„アドレス帳ãªã©ã®å€‹äººæƒ…å ±ã€ã•ã‚‰ã«ã¯ Office V. X ã®å„アプリケーションã§ä½œæˆã—ãŸæ›¸é¡žã‚„ãã®ä»–ã®ãƒ•ã‚¡ã‚¤ãƒ«ã‚’リンクã•ã›ã¦çµ±åˆçš„ã«ç®¡ç†ã™ã‚‹ã“ã¨ãŒã§ãるコミュニケーションï¼å€‹äººæƒ…報管ç†ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã§ã™ã€‚インターフェースãŒä¸€æ–°ã•ã‚Œã€é«˜åº¦ã§å¤šå½©ãª Entourage X ã®æ©Ÿèƒ½ãŒã‚ˆã‚Šç›´æ„Ÿçš„ã«åˆ©ç”¨ã§ãるよã†ã«ãªã‚Šã¾ã—ãŸã€‚以å‰ãŠä½¿ã„ã«ãªã£ã¦ã„ãŸé›»å­ãƒ¡ãƒ¼ãƒ« アプリケーションã‹ã‚‰ã®æƒ…å ±ã®ã‚¤ãƒ³ãƒãƒ¼ãƒˆã‚‚容易ã«ã§ãã¾ã™ã€‚Будете ÐвтоматичеÑки ПеренаправленыÄníci NároÄných Používateľovnové Portfólio Microsoft Hardware. Å piÄkové Optické Bezdrôtové MyÅ¡ky S Novou Technológiou - Nakláňacím Kolieskom. Nezáleží Na Tom, Aký Stôl Máte, Pokiaľ Je Na Ňom Elegantná보안 ìº íŽ˜ì¸ - 스스로 지킨 ë‹¹ì‹ ì˜ Pc! ë”ìš± 안전해집니다!كل الحقوق محÙوظة ليديعوت إنترنتäöüäöüß", Strings.StrConv(TextStringOfMultipleLanguages, VbStrConv.ProperCase, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
+ NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#10", "é›»å­ãƒ¡ãƒ¼ãƒ«ã‚’ã¯ã˜ã‚ã€äºˆå®šè¡¨ã‚„アドレス帳ãªã©ã®å€‹äººæƒ…å ±ã€ã•ã‚‰ã«ã¯ OFFICE V. X ã®å„アプリケーションã§ä½œæˆã—ãŸæ›¸é¡žã‚„ãã®ä»–ã®ãƒ•ã‚¡ã‚¤ãƒ«ã‚’リンクã•ã›ã¦çµ±åˆçš„ã«ç®¡ç†ã™ã‚‹ã“ã¨ãŒã§ãるコミュニケーションï¼å€‹äººæƒ…報管ç†ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã§ã™ã€‚インターフェースãŒä¸€æ–°ã•ã‚Œã€é«˜åº¦ã§å¤šå½©ãª ENTOURAGE X ã®æ©Ÿèƒ½ãŒã‚ˆã‚Šç›´æ„Ÿçš„ã«åˆ©ç”¨ã§ãるよã†ã«ãªã‚Šã¾ã—ãŸã€‚以å‰ãŠä½¿ã„ã«ãªã£ã¦ã„ãŸé›»å­ãƒ¡ãƒ¼ãƒ« アプリケーションã‹ã‚‰ã®æƒ…å ±ã®ã‚¤ãƒ³ãƒãƒ¼ãƒˆã‚‚容易ã«ã§ãã¾ã™ã€‚БУДЕТЕ ÐВТОМÐТИЧЕСКИ ПЕРЕÐÐПРÐВЛЕÐЫČNÃCI NÃROÄŒNÃCH POUŽÃVATEĽOVNOVÉ PORTFÓLIO MICROSOFT HARDWARE. Å PIÄŒKOVÉ OPTICKÉ BEZDRÔTOVÉ MYÅ KY S NOVOU TECHNOLÓGIOU - NAKLÃŇACÃM KOLIESKOM. NEZÃLEŽà NA TOM, AKà STÔL MÃTE, POKIAĽ JE NA ŇOM ELEGANTNÃ보안 ìº íŽ˜ì¸ - 스스로 지킨 ë‹¹ì‹ ì˜ PC! ë”ìš± 안전해집니다!كل الحقوق محÙوظة ليديعوت إنترنتÄÖÜÄÖÜß", Strings.StrConv(TextStringOfMultipleLanguages, VbStrConv.UpperCase, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
+
+ //TODO: implementation for Chinese characters
+ //NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#08", 1, Strings.StrConv(TextStringOfMultipleLanguages, VbStrConv.SimplifiedChinese, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
+ //NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#09", 1, Strings.StrConv(TextStringOfMultipleLanguages, VbStrConv.TraditionalChinese, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
+
+ //ProperCase word delimiters
+ NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#13", "Lksdjfda Älkjdf Ükjlhj" + Strings.Chr(0) + "Ldkfjd", Strings.StrConv("lksdjfda älkjdf ükjlhj" + Strings.Chr(0) + "ldkfjd", VbStrConv.ProperCase, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
+ NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#14", "Lksdjfda Älkjdf Ükjlhj" + Strings.Chr(9) + "Ldkfjd", Strings.StrConv("lksdjfda älkjdf ükjlhj" + Strings.Chr(9) + "ldkfjd", VbStrConv.ProperCase, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
+ NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#15", "Lksdjfda Älkjdf Ükjlhj" + Strings.Chr(10) + "Ldkfjd", Strings.StrConv("lksdjfda älkjdf ükjlhj" + Strings.Chr(10) + "ldkfjd", VbStrConv.ProperCase, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
+ NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#16", "Lksdjfda Älkjdf Ükjlhj" + Strings.Chr(11) + "Ldkfjd", Strings.StrConv("lksdjfda älkjdf ükjlhj" + Strings.Chr(11) + "ldkfjd", VbStrConv.ProperCase, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
+ NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#17", "Lksdjfda Älkjdf Ükjlhj" + Strings.Chr(12) + "Ldkfjd", Strings.StrConv("lksdjfda älkjdf ükjlhj" + Strings.Chr(12) + "ldkfjd", VbStrConv.ProperCase, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
+ NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#18", "Lksdjfda Älkjdf Ükjlhj" + Strings.Chr(13) + "Ldkfjd", Strings.StrConv("lksdjfda älkjdf ükjlhj" + Strings.Chr(13) + "ldkfjd", VbStrConv.ProperCase, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
+ NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#19", "Lksdjfda Älkjdf Ükjlhj" + Strings.Chr(32) + "Ldkfjd", Strings.StrConv("lksdjfda älkjdf ükjlhj" + Strings.Chr(32) + "ldkfjd", VbStrConv.ProperCase, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
+
+ // ***********
+ // ** DE-DE **
+ // ***********
+
+ System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo("de-DE");
+
+ //requires japanese systems
+ //NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#22", 1, Strings.StrConv(TextStringOfMultipleLanguages, VbStrConv.Hiragana, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
+ //NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#23", 1, Strings.StrConv(TextStringOfMultipleLanguages, VbStrConv.Katakana, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
+
+ //TODO: how to write VbStrConv.LinguisticCasing + VbStrConv.UpperCase correctly?
+ //NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#24", 1, Strings.StrConv(TextStringOfMultipleLanguages, VbStrConv.LinguisticCasing, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
+
+ //not supported
+ //NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#25", 1, Strings.StrConv(TextStringOfMultipleLanguages, VbStrConv.Narrow, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
+ //NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#31", 1, Strings.StrConv(TextStringOfMultipleLanguages, VbStrConv.Wide, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
+
+ NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#26", TextStringOfMultipleLanguages, Strings.StrConv(TextStringOfMultipleLanguages, VbStrConv.None, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
+ NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#21", "é›»å­ãƒ¡ãƒ¼ãƒ«ã‚’ã¯ã˜ã‚ã€äºˆå®šè¡¨ã‚„アドレス帳ãªã©ã®å€‹äººæƒ…å ±ã€ã•ã‚‰ã«ã¯ office v. x ã®å„アプリケーションã§ä½œæˆã—ãŸæ›¸é¡žã‚„ãã®ä»–ã®ãƒ•ã‚¡ã‚¤ãƒ«ã‚’リンクã•ã›ã¦çµ±åˆçš„ã«ç®¡ç†ã™ã‚‹ã“ã¨ãŒã§ãるコミュニケーションï¼å€‹äººæƒ…報管ç†ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã§ã™ã€‚インターフェースãŒä¸€æ–°ã•ã‚Œã€é«˜åº¦ã§å¤šå½©ãª entourage x ã®æ©Ÿèƒ½ãŒã‚ˆã‚Šç›´æ„Ÿçš„ã«åˆ©ç”¨ã§ãるよã†ã«ãªã‚Šã¾ã—ãŸã€‚以å‰ãŠä½¿ã„ã«ãªã£ã¦ã„ãŸé›»å­ãƒ¡ãƒ¼ãƒ« アプリケーションã‹ã‚‰ã®æƒ…å ±ã®ã‚¤ãƒ³ãƒãƒ¼ãƒˆã‚‚容易ã«ã§ãã¾ã™ã€‚будете автоматичеÑки перенаправленыÄníci nároÄných používateľovnové portfólio microsoft hardware. Å¡piÄkové optické bezdrôtové myÅ¡ky s novou technológiou - nakláňacím kolieskom. nezáleží na tom, aký stôl máte, pokiaľ je na ňom elegantná보안 ìº íŽ˜ì¸ - 스스로 지킨 ë‹¹ì‹ ì˜ pc! ë”ìš± 안전해집니다!كل الحقوق محÙوظة ليديعوت إنترنتäöüäöüß", Strings.StrConv(TextStringOfMultipleLanguages, VbStrConv.LowerCase, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
+ NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#27", "é›»å­ãƒ¡ãƒ¼ãƒ«ã‚’ã¯ã˜ã‚ã€äºˆå®šè¡¨ã‚„アドレス帳ãªã©ã®å€‹äººæƒ…å ±ã€ã•ã‚‰ã«ã¯ Office V. X ã®å„アプリケーションã§ä½œæˆã—ãŸæ›¸é¡žã‚„ãã®ä»–ã®ãƒ•ã‚¡ã‚¤ãƒ«ã‚’リンクã•ã›ã¦çµ±åˆçš„ã«ç®¡ç†ã™ã‚‹ã“ã¨ãŒã§ãるコミュニケーションï¼å€‹äººæƒ…報管ç†ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã§ã™ã€‚インターフェースãŒä¸€æ–°ã•ã‚Œã€é«˜åº¦ã§å¤šå½©ãª Entourage X ã®æ©Ÿèƒ½ãŒã‚ˆã‚Šç›´æ„Ÿçš„ã«åˆ©ç”¨ã§ãるよã†ã«ãªã‚Šã¾ã—ãŸã€‚以å‰ãŠä½¿ã„ã«ãªã£ã¦ã„ãŸé›»å­ãƒ¡ãƒ¼ãƒ« アプリケーションã‹ã‚‰ã®æƒ…å ±ã®ã‚¤ãƒ³ãƒãƒ¼ãƒˆã‚‚容易ã«ã§ãã¾ã™ã€‚Будете ÐвтоматичеÑки ПеренаправленыÄníci NároÄných Používateľovnové Portfólio Microsoft Hardware. Å piÄkové Optické Bezdrôtové MyÅ¡ky S Novou Technológiou - Nakláňacím Kolieskom. Nezáleží Na Tom, Aký Stôl Máte, Pokiaľ Je Na Ňom Elegantná보안 ìº íŽ˜ì¸ - 스스로 지킨 ë‹¹ì‹ ì˜ Pc! ë”ìš± 안전해집니다!كل الحقوق محÙوظة ليديعوت إنترنتäöüäöüß", Strings.StrConv(TextStringOfMultipleLanguages, VbStrConv.ProperCase, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
+ NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#30", "é›»å­ãƒ¡ãƒ¼ãƒ«ã‚’ã¯ã˜ã‚ã€äºˆå®šè¡¨ã‚„アドレス帳ãªã©ã®å€‹äººæƒ…å ±ã€ã•ã‚‰ã«ã¯ OFFICE V. X ã®å„アプリケーションã§ä½œæˆã—ãŸæ›¸é¡žã‚„ãã®ä»–ã®ãƒ•ã‚¡ã‚¤ãƒ«ã‚’リンクã•ã›ã¦çµ±åˆçš„ã«ç®¡ç†ã™ã‚‹ã“ã¨ãŒã§ãるコミュニケーションï¼å€‹äººæƒ…報管ç†ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã§ã™ã€‚インターフェースãŒä¸€æ–°ã•ã‚Œã€é«˜åº¦ã§å¤šå½©ãª ENTOURAGE X ã®æ©Ÿèƒ½ãŒã‚ˆã‚Šç›´æ„Ÿçš„ã«åˆ©ç”¨ã§ãるよã†ã«ãªã‚Šã¾ã—ãŸã€‚以å‰ãŠä½¿ã„ã«ãªã£ã¦ã„ãŸé›»å­ãƒ¡ãƒ¼ãƒ« アプリケーションã‹ã‚‰ã®æƒ…å ±ã®ã‚¤ãƒ³ãƒãƒ¼ãƒˆã‚‚容易ã«ã§ãã¾ã™ã€‚БУДЕТЕ ÐВТОМÐТИЧЕСКИ ПЕРЕÐÐПРÐВЛЕÐЫČNÃCI NÃROÄŒNÃCH POUŽÃVATEĽOVNOVÉ PORTFÓLIO MICROSOFT HARDWARE. Å PIÄŒKOVÉ OPTICKÉ BEZDRÔTOVÉ MYÅ KY S NOVOU TECHNOLÓGIOU - NAKLÃŇACÃM KOLIESKOM. NEZÃLEŽà NA TOM, AKà STÔL MÃTE, POKIAĽ JE NA ŇOM ELEGANTNÃ보안 ìº íŽ˜ì¸ - 스스로 지킨 ë‹¹ì‹ ì˜ PC! ë”ìš± 안전해집니다!كل الحقوق محÙوظة ليديعوت إنترنتÄÖÜÄÖÜß", Strings.StrConv(TextStringOfMultipleLanguages, VbStrConv.UpperCase, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
+
+ //TODO: implementation for Chinese characters
+ //NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#28", 1, Strings.StrConv(TextStringOfMultipleLanguages, VbStrConv.SimplifiedChinese, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
+ //NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#29", 1, Strings.StrConv(TextStringOfMultipleLanguages, VbStrConv.TraditionalChinese, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
+
+ //ProperCase word delimiters
+ NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#33", "Lksdjfda Älkjdf Ükjlhj" + Strings.Chr(0) + "Ldkfjd", Strings.StrConv("lksdjfda älkjdf ükjlhj" + Strings.Chr(0) + "ldkfjd", VbStrConv.ProperCase, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
+ NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#34", "Lksdjfda Älkjdf Ükjlhj" + Strings.Chr(9) + "Ldkfjd", Strings.StrConv("lksdjfda älkjdf ükjlhj" + Strings.Chr(9) + "ldkfjd", VbStrConv.ProperCase, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
+ NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#35", "Lksdjfda Älkjdf Ükjlhj" + Strings.Chr(10) + "Ldkfjd", Strings.StrConv("lksdjfda älkjdf ükjlhj" + Strings.Chr(10) + "ldkfjd", VbStrConv.ProperCase, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
+ NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#36", "Lksdjfda Älkjdf Ükjlhj" + Strings.Chr(11) + "Ldkfjd", Strings.StrConv("lksdjfda älkjdf ükjlhj" + Strings.Chr(11) + "ldkfjd", VbStrConv.ProperCase, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
+ NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#37", "Lksdjfda Älkjdf Ükjlhj" + Strings.Chr(12) + "Ldkfjd", Strings.StrConv("lksdjfda älkjdf ükjlhj" + Strings.Chr(12) + "ldkfjd", VbStrConv.ProperCase, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
+ NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#38", "Lksdjfda Älkjdf Ükjlhj" + Strings.Chr(13) + "Ldkfjd", Strings.StrConv("lksdjfda älkjdf ükjlhj" + Strings.Chr(13) + "ldkfjd", VbStrConv.ProperCase, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
+ NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#39", "Lksdjfda Älkjdf Ükjlhj" + Strings.Chr(32) + "Ldkfjd", Strings.StrConv("lksdjfda älkjdf ükjlhj" + Strings.Chr(32) + "ldkfjd", VbStrConv.ProperCase, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
+
+ // ***********
+ // ** JA-JP **
+ // ***********
+
+ System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo("ja-JP");
+ NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#42", "é›»å­ã‚ーるをã¯ã˜ã‚ã€äºˆå®šè¡¨ã‚„ã‚ã©ã‚Œã™å¸³ãªã©ã®å€‹äººæƒ…å ±ã€ã•ã‚‰ã«ã¯ Office v. X ã®å„ã‚ã·ã‚Šã‘ーã—ょんã§ä½œæˆã—ãŸæ›¸é¡žã‚„ãã®ä»–ã®ãµãã„ã‚‹ã‚’ã‚Šã‚“ãã•ã›ã¦çµ±åˆçš„ã«ç®¡ç†ã™ã‚‹ã“ã¨ãŒã§ãã‚‹ã“ã¿ã‚…ã«ã‘ーã—ょんï¼å€‹äººæƒ…報管ç†ããµã¨ã†ã‡ã‚ã§ã™ã€‚ã„ã‚“ãŸãƒ¼ãµã‡ãƒ¼ã™ãŒä¸€æ–°ã•ã‚Œã€é«˜åº¦ã§å¤šå½©ãª Entourage X ã®æ©Ÿèƒ½ãŒã‚ˆã‚Šç›´æ„Ÿçš„ã«åˆ©ç”¨ã§ãるよã†ã«ãªã‚Šã¾ã—ãŸã€‚以å‰ãŠä½¿ã„ã«ãªã£ã¦ã„ãŸé›»å­ã‚ーる ã‚ã·ã‚Šã‘ーã—ょんã‹ã‚‰ã®æƒ…å ±ã®ã„ã‚“ã½ãƒ¼ã¨ã‚‚容易ã«ã§ãã¾ã™ã€‚будете автоматичеÑки перенаправлены?nici naro?nych pou?ivate?ovNove portfolio Microsoft Hardware. ?pi?kove opticke bezdrotove my?ky s novou technologiou - nakla?acim kolieskom. Nezale?i na tom, aky stol mate, pokia? je na ?om elegantna?? ??? - ??? ?? ??? PC! ?? ??????!?? ?????? ?????? ??????? ??????aouAOUs", Strings.StrConv(TextStringOfMultipleLanguages, VbStrConv.Hiragana, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
+ NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#43", "é›»å­ãƒ¡ãƒ¼ãƒ«ãƒ²ãƒã‚¸ãƒ¡ã€äºˆå®šè¡¨ãƒ¤ã‚¢ãƒ‰ãƒ¬ã‚¹å¸³ãƒŠãƒ‰ãƒŽå€‹äººæƒ…å ±ã€ã‚µãƒ©ãƒ‹ãƒ Office v. X ノå„アプリケーションデ作æˆã‚·ã‚¿æ›¸é¡žãƒ¤ã‚½ãƒŽä»–ノファイルヲリンクサセテ統åˆçš„ニ管ç†ã‚¹ãƒ«ã‚³ãƒˆã‚¬ãƒ‡ã‚­ãƒ«ã‚³ãƒŸãƒ¥ãƒ‹ã‚±ãƒ¼ã‚·ãƒ§ãƒ³ï¼å€‹äººæƒ…報管ç†ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ãƒ‡ã‚¹ã€‚インターフェースガ一新サレã€é«˜åº¦ãƒ‡å¤šå½©ãƒŠ Entourage X ノ機能ガヨリ直感的ニ利用デキルヨウニナリマシタ。以å‰ã‚ªä½¿ã‚¤ãƒ‹ãƒŠãƒƒãƒ†ã‚¤ã‚¿é›»å­ãƒ¡ãƒ¼ãƒ« アプリケーションカラノ情報ノインãƒãƒ¼ãƒˆãƒ¢å®¹æ˜“ニデキマス。будете автоматичеÑки перенаправлены?nici naro?nych pou?ivate?ovNove portfolio Microsoft Hardware. ?pi?kove opticke bezdrotove my?ky s novou technologiou - nakla?acim kolieskom. Nezale?i na tom, aky stol mate, pokia? je na ?om elegantna?? ??? - ??? ?? ??? PC! ?? ??????!?? ?????? ?????? ??????? ??????aouAOUs", Strings.StrConv(TextStringOfMultipleLanguages, VbStrConv.Katakana, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
+
+ //TODO: how to write VbStrConv.LinguisticCasing + VbStrConv.UpperCase correctly?
+ //NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#44", 1, Strings.StrConv(TextStringOfMultipleLanguages, VbStrConv.LinguisticCasing, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
+
+ //not supported
+ //NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#45", 1, Strings.StrConv(TextStringOfMultipleLanguages, VbStrConv.Narrow, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
+ //NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#51", 1, Strings.StrConv(TextStringOfMultipleLanguages, VbStrConv.Wide, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
+
+ NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#46", TextStringOfMultipleLanguages, Strings.StrConv(TextStringOfMultipleLanguages, VbStrConv.None, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
+ NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#41", "é›»å­ãƒ¡ãƒ¼ãƒ«ã‚’ã¯ã˜ã‚ã€äºˆå®šè¡¨ã‚„アドレス帳ãªã©ã®å€‹äººæƒ…å ±ã€ã•ã‚‰ã«ã¯ office v. x ã®å„アプリケーションã§ä½œæˆã—ãŸæ›¸é¡žã‚„ãã®ä»–ã®ãƒ•ã‚¡ã‚¤ãƒ«ã‚’リンクã•ã›ã¦çµ±åˆçš„ã«ç®¡ç†ã™ã‚‹ã“ã¨ãŒã§ãるコミュニケーションï¼å€‹äººæƒ…報管ç†ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã§ã™ã€‚インターフェースãŒä¸€æ–°ã•ã‚Œã€é«˜åº¦ã§å¤šå½©ãª entourage x ã®æ©Ÿèƒ½ãŒã‚ˆã‚Šç›´æ„Ÿçš„ã«åˆ©ç”¨ã§ãるよã†ã«ãªã‚Šã¾ã—ãŸã€‚以å‰ãŠä½¿ã„ã«ãªã£ã¦ã„ãŸé›»å­ãƒ¡ãƒ¼ãƒ« アプリケーションã‹ã‚‰ã®æƒ…å ±ã®ã‚¤ãƒ³ãƒãƒ¼ãƒˆã‚‚容易ã«ã§ãã¾ã™ã€‚будете автоматичеÑки перенаправленыÄníci nároÄných používateľovnové portfólio microsoft hardware. Å¡piÄkové optické bezdrôtové myÅ¡ky s novou technológiou - nakláňacím kolieskom. nezáleží na tom, aký stôl máte, pokiaľ je na ňom elegantná보안 ìº íŽ˜ì¸ - 스스로 지킨 ë‹¹ì‹ ì˜ pc! ë”ìš± 안전해집니다!كل الحقوق محÙوظة ليديعوت إنترنتäöüäöüß", Strings.StrConv(TextStringOfMultipleLanguages, VbStrConv.LowerCase, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
+ NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#47", "é›»å­ãƒ¡ãƒ¼ãƒ«ã‚’ã¯ã˜ã‚ã€äºˆå®šè¡¨ã‚„アドレス帳ãªã©ã®å€‹äººæƒ…å ±ã€ã•ã‚‰ã«ã¯ Office V. X ã®å„アプリケーションã§ä½œæˆã—ãŸæ›¸é¡žã‚„ãã®ä»–ã®ãƒ•ã‚¡ã‚¤ãƒ«ã‚’リンクã•ã›ã¦çµ±åˆçš„ã«ç®¡ç†ã™ã‚‹ã“ã¨ãŒã§ãるコミュニケーションï¼å€‹äººæƒ…報管ç†ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã§ã™ã€‚インターフェースãŒä¸€æ–°ã•ã‚Œã€é«˜åº¦ã§å¤šå½©ãª Entourage X ã®æ©Ÿèƒ½ãŒã‚ˆã‚Šç›´æ„Ÿçš„ã«åˆ©ç”¨ã§ãるよã†ã«ãªã‚Šã¾ã—ãŸã€‚以å‰ãŠä½¿ã„ã«ãªã£ã¦ã„ãŸé›»å­ãƒ¡ãƒ¼ãƒ« アプリケーションã‹ã‚‰ã®æƒ…å ±ã®ã‚¤ãƒ³ãƒãƒ¼ãƒˆã‚‚容易ã«ã§ãã¾ã™ã€‚Будете ÐвтоматичеÑки Перенаправлены?Nici Naro?Nych Pou?Ivate?Ovnove Portfolio Microsoft Hardware. ?Pi?Kove Opticke Bezdrotove My?Ky S Novou Technologiou - Nakla?Acim Kolieskom. Nezale?I Na Tom, Aky Stol Mate, Pokia? Je Na ?Om Elegantna?? ??? - ??? ?? ??? Pc! ?? ??????!?? ?????? ?????? ??????? ??????Aouaous", Strings.StrConv(TextStringOfMultipleLanguages, VbStrConv.ProperCase, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
+ NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#50", "é›»å­ãƒ¡ãƒ¼ãƒ«ã‚’ã¯ã˜ã‚ã€äºˆå®šè¡¨ã‚„アドレス帳ãªã©ã®å€‹äººæƒ…å ±ã€ã•ã‚‰ã«ã¯ OFFICE V. X ã®å„アプリケーションã§ä½œæˆã—ãŸæ›¸é¡žã‚„ãã®ä»–ã®ãƒ•ã‚¡ã‚¤ãƒ«ã‚’リンクã•ã›ã¦çµ±åˆçš„ã«ç®¡ç†ã™ã‚‹ã“ã¨ãŒã§ãるコミュニケーションï¼å€‹äººæƒ…報管ç†ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã§ã™ã€‚インターフェースãŒä¸€æ–°ã•ã‚Œã€é«˜åº¦ã§å¤šå½©ãª ENTOURAGE X ã®æ©Ÿèƒ½ãŒã‚ˆã‚Šç›´æ„Ÿçš„ã«åˆ©ç”¨ã§ãるよã†ã«ãªã‚Šã¾ã—ãŸã€‚以å‰ãŠä½¿ã„ã«ãªã£ã¦ã„ãŸé›»å­ãƒ¡ãƒ¼ãƒ« アプリケーションã‹ã‚‰ã®æƒ…å ±ã®ã‚¤ãƒ³ãƒãƒ¼ãƒˆã‚‚容易ã«ã§ãã¾ã™ã€‚БУДЕТЕ ÐВТОМÐТИЧЕСКИ ПЕРЕÐÐПРÐВЛЕÐЫČNÃCI NÃROÄŒNÃCH POUŽÃVATEĽOVNOVÉ PORTFÓLIO MICROSOFT HARDWARE. Å PIÄŒKOVÉ OPTICKÉ BEZDRÔTOVÉ MYÅ KY S NOVOU TECHNOLÓGIOU - NAKLÃŇACÃM KOLIESKOM. NEZÃLEŽà NA TOM, AKà STÔL MÃTE, POKIAĽ JE NA ŇOM ELEGANTNÃ보안 ìº íŽ˜ì¸ - 스스로 지킨 ë‹¹ì‹ ì˜ PC! ë”ìš± 안전해집니다!كل الحقوق محÙوظة ليديعوت إنترنتÄÖÜÄÖÜß", Strings.StrConv(TextStringOfMultipleLanguages, VbStrConv.UpperCase, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
+
+ //TODO: implementation for Chinese characters
+ //NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#48", 1, Strings.StrConv(TextStringOfMultipleLanguages, VbStrConv.SimplifiedChinese, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
+ //NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#49", 1, Strings.StrConv(TextStringOfMultipleLanguages, VbStrConv.TraditionalChinese, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
+
+ //ProperCase word delimiters
+ NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#53", "Lksdjfda Alkjdf Ukjlhj" + Strings.Chr(0) + "Ldkfjd", Strings.StrConv("lksdjfda älkjdf ükjlhj" + Strings.Chr(0) + "ldkfjd", VbStrConv.ProperCase, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
+ NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#54", "Lksdjfda Alkjdf Ukjlhj" + Strings.Chr(9) + "Ldkfjd", Strings.StrConv("lksdjfda älkjdf ükjlhj" + Strings.Chr(9) + "ldkfjd", VbStrConv.ProperCase, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
+ NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#55", "Lksdjfda Alkjdf Ukjlhj" + Strings.Chr(10) + "Ldkfjd", Strings.StrConv("lksdjfda älkjdf ükjlhj" + Strings.Chr(10) + "ldkfjd", VbStrConv.ProperCase, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
+ NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#56", "Lksdjfda Alkjdf Ukjlhj" + Strings.Chr(11) + "Ldkfjd", Strings.StrConv("lksdjfda älkjdf ükjlhj" + Strings.Chr(11) + "ldkfjd", VbStrConv.ProperCase, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
+ NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#57", "Lksdjfda Alkjdf Ukjlhj" + Strings.Chr(12) + "Ldkfjd", Strings.StrConv("lksdjfda älkjdf ükjlhj" + Strings.Chr(12) + "ldkfjd", VbStrConv.ProperCase, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
+ NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#58", "Lksdjfda Alkjdf Ukjlhj" + Strings.Chr(13) + "Ldkfjd", Strings.StrConv("lksdjfda älkjdf ükjlhj" + Strings.Chr(13) + "ldkfjd", VbStrConv.ProperCase, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
+ NUnit.Framework.Assertion.AssertEquals ("JW*StrConv#59", "Lksdjfda Alkjdf Ukjlhj" + Strings.Chr(32) + "Ldkfjd", Strings.StrConv("lksdjfda älkjdf ükjlhj" + Strings.Chr(32) + "ldkfjd", VbStrConv.ProperCase, System.Threading.Thread.CurrentThread.CurrentCulture.LCID));
+
+ // ***********
+ // ** Chinese **
+ // ***********
+
+ //TODO: implementation for Chinese locales
+ //System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo("ja-JP");
+ // .......
+
+ // restore buffered culture
+ System.Threading.Thread.CurrentThread.CurrentCulture = CurCulture;
+
+ }
+
+ [Test]
+ public void StrDup()
+ {
+ string aString = "Wow! What a string!";
+ object aObject = new object();
+ string myString ;
+ aObject = "This is a String contained within an Object";
+ NUnit.Framework.Assertion.AssertEquals ("JW*StrDup#01", "PPPPP", Strings.StrDup(5, (char)Strings.Asc("P")));
+ NUnit.Framework.Assertion.AssertEquals ("JW*StrDup#01", "WWWWWWWWWW", Strings.StrDup(10, aString));
+ NUnit.Framework.Assertion.AssertEquals ("JW*StrDup#01", "TTTTTT", Strings.StrDup(6, aObject));
+ }
+
+ [Test]
+ public void StrReverse()
+ {
+ NUnit.Framework.Assertion.AssertEquals ("JW*StrReverse#01", "", Strings.StrReverse(String.Empty));
+ NUnit.Framework.Assertion.AssertEquals ("JW*StrReverse#02", "ßÜÖÄüöä", Strings.StrReverse(GermanUmlauts_German));
+ NUnit.Framework.Assertion.AssertEquals ("JW*StrReverse#03", "", Strings.StrReverse(null));
+ }
+
+ public void UCase_Char()
+ {
+ // buffer current culture
+ System.Globalization.CultureInfo CurCulture = System.Threading.Thread.CurrentThread.CurrentCulture;
+
+ // do testings
+ NUnit.Framework.Assertion.AssertEquals ("JW#UCase/10c", 0, Strings.UCase(Letter_Empty));
+
+ System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
+ NUnit.Framework.Assertion.AssertEquals ("JW#UCase/10", Strings.AscW("C"), Strings.UCase(Letter_English));
+ NUnit.Framework.Assertion.AssertEquals ("JW#UCase/11", Strings.AscW("é›»"), Strings.UCase(Letter_Japanese));
+ NUnit.Framework.Assertion.AssertEquals ("JW#UCase/12", 1041, Strings.UCase(Letter_Russian));
+ NUnit.Framework.Assertion.AssertEquals ("JW#UCase/13", 268, Strings.UCase(Letter_Slovakian));
+ NUnit.Framework.Assertion.AssertEquals ("JW#UCase/14", Strings.AscW("ë³´"), Strings.UCase(Letter_Korean));
+ NUnit.Framework.Assertion.AssertEquals ("JW#UCase/15", 1603, Strings.UCase(Letter_Arabic));
+ NUnit.Framework.Assertion.AssertEquals ("JW#UCase/16", Strings.AscW("Ä"), Strings.UCase(Letter_German));
+
+ System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo("de-DE");
+ NUnit.Framework.Assertion.AssertEquals ("JW#UCase/20", Strings.AscW("C"), Strings.UCase(Letter_English));
+ NUnit.Framework.Assertion.AssertEquals ("JW#UCase/21", Strings.AscW("é›»"), Strings.UCase(Letter_Japanese));
+ NUnit.Framework.Assertion.AssertEquals ("JW#UCase/22", 1041, Strings.UCase(Letter_Russian));
+ NUnit.Framework.Assertion.AssertEquals ("JW#UCase/23", 268, Strings.UCase(Letter_Slovakian));
+ NUnit.Framework.Assertion.AssertEquals ("JW#UCase/24", Strings.AscW("ë³´"), Strings.UCase(Letter_Korean));
+ NUnit.Framework.Assertion.AssertEquals ("JW#UCase/25", 1603, Strings.UCase(Letter_Arabic));
+ NUnit.Framework.Assertion.AssertEquals ("JW#UCase/26", Strings.AscW("Ä"), Strings.UCase(Letter_German));
+
+ System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo("ja-JP");
+ NUnit.Framework.Assertion.AssertEquals ("JW#UCase/30", Strings.AscW("C"), Strings.UCase(Letter_English));
+ NUnit.Framework.Assertion.AssertEquals ("JW#UCase/31", Strings.AscW("é›»"), Strings.UCase(Letter_Japanese));
+ NUnit.Framework.Assertion.AssertEquals ("JW#UCase/32", 1041, Strings.UCase(Letter_Russian));
+ NUnit.Framework.Assertion.AssertEquals ("JW#UCase/33", 268, Strings.UCase(Letter_Slovakian));
+ NUnit.Framework.Assertion.AssertEquals ("JW#UCase/34", Strings.AscW("ë³´"), Strings.UCase(Letter_Korean));
+ NUnit.Framework.Assertion.AssertEquals ("JW#UCase/35", 1603, Strings.UCase(Letter_Arabic));
+ NUnit.Framework.Assertion.AssertEquals ("JW#UCase/36", Strings.AscW("Ä"), Strings.UCase(Letter_German));
+
+ // restore buffered culture
+ System.Threading.Thread.CurrentThread.CurrentCulture = CurCulture;
+ }
+
+ [Test]
+ public void UCase()
+ {
+ UCase_Char();
+ UCase_String();
+ }
+
+ public void UCase_String()
+ {
+ // buffer current culture
+ System.Globalization.CultureInfo CurCulture = System.Threading.Thread.CurrentThread.CurrentCulture;
+
+ // do testings
+ NUnit.Framework.Assertion.AssertEquals ("JW#UCase/64", String.Empty, Strings.UCase(TextStringUninitialized));
+ NUnit.Framework.Assertion.AssertEquals ("JW#UCase/65", "", Strings.UCase(TextStringUninitialized));
+ NUnit.Framework.Assertion.AssertEquals ("JW#UCase/67", String.Empty, Strings.UCase(TextStringEmpty));
+ NUnit.Framework.Assertion.AssertEquals ("JW#UCase/68", "", Strings.UCase(TextStringEmpty));
+
+ System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo("de-DE");
+ NUnit.Framework.Assertion.AssertEquals ("JW#UCase/70", "CHOOSE THE LOCATION FOR WHICH YOU WANT CONTACT INFORMATION:", Strings.UCase(MSWebSiteContent_English));
+ NUnit.Framework.Assertion.AssertEquals ("JW#UCase/71", "é›»å­ãƒ¡ãƒ¼ãƒ«ã‚’ã¯ã˜ã‚ã€äºˆå®šè¡¨ã‚„アドレス帳ãªã©ã®å€‹äººæƒ…å ±ã€ã•ã‚‰ã«ã¯ OFFICE V. X ã®å„アプリケーションã§ä½œæˆã—ãŸæ›¸é¡žã‚„ãã®ä»–ã®ãƒ•ã‚¡ã‚¤ãƒ«ã‚’リンクã•ã›ã¦çµ±åˆçš„ã«ç®¡ç†ã™ã‚‹ã“ã¨ãŒã§ãるコミュニケーションï¼å€‹äººæƒ…報管ç†ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã§ã™ã€‚インターフェースãŒä¸€æ–°ã•ã‚Œã€é«˜åº¦ã§å¤šå½©ãª ENTOURAGE X ã®æ©Ÿèƒ½ãŒã‚ˆã‚Šç›´æ„Ÿçš„ã«åˆ©ç”¨ã§ãるよã†ã«ãªã‚Šã¾ã—ãŸã€‚以å‰ãŠä½¿ã„ã«ãªã£ã¦ã„ãŸé›»å­ãƒ¡ãƒ¼ãƒ« アプリケーションã‹ã‚‰ã®æƒ…å ±ã®ã‚¤ãƒ³ãƒãƒ¼ãƒˆã‚‚容易ã«ã§ãã¾ã™ã€‚", Strings.UCase(MSWebSiteContent_Japanese));
+ NUnit.Framework.Assertion.AssertEquals ("JW#UCase/72", "БУДЕТЕ ÐВТОМÐТИЧЕСКИ ПЕРЕÐÐПРÐВЛЕÐЫ", Strings.UCase(MSWebSiteContent_Russian));
+ NUnit.Framework.Assertion.AssertEquals ("JW#UCase/73", "ÄŒNÃCI NÃROÄŒNÃCH POUŽÃVATEĽOVNOVÉ PORTFÓLIO MICROSOFT HARDWARE. Å PIÄŒKOVÉ OPTICKÉ BEZDRÔTOVÉ MYÅ KY S NOVOU TECHNOLÓGIOU - NAKLÃŇACÃM KOLIESKOM. NEZÃLEŽà NA TOM, AKà STÔL MÃTE, POKIAĽ JE NA ŇOM ELEGANTNÃ", Strings.UCase(MSWebSiteContent_Slovakian));
+ NUnit.Framework.Assertion.AssertEquals ("JW#UCase/74", "보안 ìº íŽ˜ì¸ - 스스로 지킨 ë‹¹ì‹ ì˜ PC! ë”ìš± 안전해집니다!", Strings.UCase(MSWebSiteContent_Korean));
+ NUnit.Framework.Assertion.AssertEquals ("JW#UCase/75", "كل الحقوق محÙوظة ليديعوت إنترنت", Strings.UCase(ArabynetComWebSiteContent_Arabic));
+ NUnit.Framework.Assertion.AssertEquals ("JW#UCase/76", "ÄÖÜÄÖÜß", Strings.UCase(GermanUmlauts_German));
+ NUnit.Framework.Assertion.AssertEquals ("JW#UCase/77", "é›»å­ãƒ¡ãƒ¼ãƒ«ã‚’ã¯ã˜ã‚ã€äºˆå®šè¡¨ã‚„アドレス帳ãªã©ã®å€‹äººæƒ…å ±ã€ã•ã‚‰ã«ã¯ OFFICE V. X ã®å„アプリケーションã§ä½œæˆã—ãŸæ›¸é¡žã‚„ãã®ä»–ã®ãƒ•ã‚¡ã‚¤ãƒ«ã‚’リンクã•ã›ã¦çµ±åˆçš„ã«ç®¡ç†ã™ã‚‹ã“ã¨ãŒã§ãるコミュニケーションï¼å€‹äººæƒ…報管ç†ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã§ã™ã€‚インターフェースãŒä¸€æ–°ã•ã‚Œã€é«˜åº¦ã§å¤šå½©ãª ENTOURAGE X ã®æ©Ÿèƒ½ãŒã‚ˆã‚Šç›´æ„Ÿçš„ã«åˆ©ç”¨ã§ãるよã†ã«ãªã‚Šã¾ã—ãŸã€‚以å‰ãŠä½¿ã„ã«ãªã£ã¦ã„ãŸé›»å­ãƒ¡ãƒ¼ãƒ« アプリケーションã‹ã‚‰ã®æƒ…å ±ã®ã‚¤ãƒ³ãƒãƒ¼ãƒˆã‚‚容易ã«ã§ãã¾ã™ã€‚БУДЕТЕ ÐВТОМÐТИЧЕСКИ ПЕРЕÐÐПРÐВЛЕÐЫČNÃCI NÃROÄŒNÃCH POUŽÃVATEĽOVNOVÉ PORTFÓLIO MICROSOFT HARDWARE. Å PIÄŒKOVÉ OPTICKÉ BEZDRÔTOVÉ MYÅ KY S NOVOU TECHNOLÓGIOU - NAKLÃŇACÃM KOLIESKOM. NEZÃLEŽà NA TOM, AKà STÔL MÃTE, POKIAĽ JE NA ŇOM ELEGANTNÃ보안 ìº íŽ˜ì¸ - 스스로 지킨 ë‹¹ì‹ ì˜ PC! ë”ìš± 안전해집니다!كل الحقوق محÙوظة ليديعوت إنترنتÄÖÜÄÖÜß", Strings.UCase(TextStringOfMultipleLanguages));
+
+ System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
+ NUnit.Framework.Assertion.AssertEquals ("JW#UCase/80", "CHOOSE THE LOCATION FOR WHICH YOU WANT CONTACT INFORMATION:", Strings.UCase(MSWebSiteContent_English));
+ NUnit.Framework.Assertion.AssertEquals ("JW#UCase/81", "é›»å­ãƒ¡ãƒ¼ãƒ«ã‚’ã¯ã˜ã‚ã€äºˆå®šè¡¨ã‚„アドレス帳ãªã©ã®å€‹äººæƒ…å ±ã€ã•ã‚‰ã«ã¯ OFFICE V. X ã®å„アプリケーションã§ä½œæˆã—ãŸæ›¸é¡žã‚„ãã®ä»–ã®ãƒ•ã‚¡ã‚¤ãƒ«ã‚’リンクã•ã›ã¦çµ±åˆçš„ã«ç®¡ç†ã™ã‚‹ã“ã¨ãŒã§ãるコミュニケーションï¼å€‹äººæƒ…報管ç†ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã§ã™ã€‚インターフェースãŒä¸€æ–°ã•ã‚Œã€é«˜åº¦ã§å¤šå½©ãª ENTOURAGE X ã®æ©Ÿèƒ½ãŒã‚ˆã‚Šç›´æ„Ÿçš„ã«åˆ©ç”¨ã§ãるよã†ã«ãªã‚Šã¾ã—ãŸã€‚以å‰ãŠä½¿ã„ã«ãªã£ã¦ã„ãŸé›»å­ãƒ¡ãƒ¼ãƒ« アプリケーションã‹ã‚‰ã®æƒ…å ±ã®ã‚¤ãƒ³ãƒãƒ¼ãƒˆã‚‚容易ã«ã§ãã¾ã™ã€‚", Strings.UCase(MSWebSiteContent_Japanese));
+ NUnit.Framework.Assertion.AssertEquals ("JW#UCase/82", "БУДЕТЕ ÐВТОМÐТИЧЕСКИ ПЕРЕÐÐПРÐВЛЕÐЫ", Strings.UCase(MSWebSiteContent_Russian));
+ NUnit.Framework.Assertion.AssertEquals ("JW#UCase/83", "ÄŒNÃCI NÃROÄŒNÃCH POUŽÃVATEĽOVNOVÉ PORTFÓLIO MICROSOFT HARDWARE. Å PIÄŒKOVÉ OPTICKÉ BEZDRÔTOVÉ MYÅ KY S NOVOU TECHNOLÓGIOU - NAKLÃŇACÃM KOLIESKOM. NEZÃLEŽà NA TOM, AKà STÔL MÃTE, POKIAĽ JE NA ŇOM ELEGANTNÃ", Strings.UCase(MSWebSiteContent_Slovakian));
+ NUnit.Framework.Assertion.AssertEquals ("JW#UCase/84", "보안 ìº íŽ˜ì¸ - 스스로 지킨 ë‹¹ì‹ ì˜ PC! ë”ìš± 안전해집니다!", Strings.UCase(MSWebSiteContent_Korean));
+ NUnit.Framework.Assertion.AssertEquals ("JW#UCase/85", "كل الحقوق محÙوظة ليديعوت إنترنت", Strings.UCase(ArabynetComWebSiteContent_Arabic));
+ NUnit.Framework.Assertion.AssertEquals ("JW#UCase/86", "ÄÖÜÄÖÜß", Strings.UCase(GermanUmlauts_German));
+ NUnit.Framework.Assertion.AssertEquals ("JW#UCase/87", "é›»å­ãƒ¡ãƒ¼ãƒ«ã‚’ã¯ã˜ã‚ã€äºˆå®šè¡¨ã‚„アドレス帳ãªã©ã®å€‹äººæƒ…å ±ã€ã•ã‚‰ã«ã¯ OFFICE V. X ã®å„アプリケーションã§ä½œæˆã—ãŸæ›¸é¡žã‚„ãã®ä»–ã®ãƒ•ã‚¡ã‚¤ãƒ«ã‚’リンクã•ã›ã¦çµ±åˆçš„ã«ç®¡ç†ã™ã‚‹ã“ã¨ãŒã§ãるコミュニケーションï¼å€‹äººæƒ…報管ç†ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã§ã™ã€‚インターフェースãŒä¸€æ–°ã•ã‚Œã€é«˜åº¦ã§å¤šå½©ãª ENTOURAGE X ã®æ©Ÿèƒ½ãŒã‚ˆã‚Šç›´æ„Ÿçš„ã«åˆ©ç”¨ã§ãるよã†ã«ãªã‚Šã¾ã—ãŸã€‚以å‰ãŠä½¿ã„ã«ãªã£ã¦ã„ãŸé›»å­ãƒ¡ãƒ¼ãƒ« アプリケーションã‹ã‚‰ã®æƒ…å ±ã®ã‚¤ãƒ³ãƒãƒ¼ãƒˆã‚‚容易ã«ã§ãã¾ã™ã€‚БУДЕТЕ ÐВТОМÐТИЧЕСКИ ПЕРЕÐÐПРÐВЛЕÐЫČNÃCI NÃROÄŒNÃCH POUŽÃVATEĽOVNOVÉ PORTFÓLIO MICROSOFT HARDWARE. Å PIÄŒKOVÉ OPTICKÉ BEZDRÔTOVÉ MYÅ KY S NOVOU TECHNOLÓGIOU - NAKLÃŇACÃM KOLIESKOM. NEZÃLEŽà NA TOM, AKà STÔL MÃTE, POKIAĽ JE NA ŇOM ELEGANTNÃ보안 ìº íŽ˜ì¸ - 스스로 지킨 ë‹¹ì‹ ì˜ PC! ë”ìš± 안전해집니다!كل الحقوق محÙوظة ليديعوت إنترنتÄÖÜÄÖÜß", Strings.UCase(TextStringOfMultipleLanguages));
+
+ System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo("ja-JP");
+ NUnit.Framework.Assertion.AssertEquals ("JW#UCase/90", "CHOOSE THE LOCATION FOR WHICH YOU WANT CONTACT INFORMATION:", Strings.UCase(MSWebSiteContent_English));
+ NUnit.Framework.Assertion.AssertEquals ("JW#UCase/91", "é›»å­ãƒ¡ãƒ¼ãƒ«ã‚’ã¯ã˜ã‚ã€äºˆå®šè¡¨ã‚„アドレス帳ãªã©ã®å€‹äººæƒ…å ±ã€ã•ã‚‰ã«ã¯ OFFICE V. X ã®å„アプリケーションã§ä½œæˆã—ãŸæ›¸é¡žã‚„ãã®ä»–ã®ãƒ•ã‚¡ã‚¤ãƒ«ã‚’リンクã•ã›ã¦çµ±åˆçš„ã«ç®¡ç†ã™ã‚‹ã“ã¨ãŒã§ãるコミュニケーションï¼å€‹äººæƒ…報管ç†ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã§ã™ã€‚インターフェースãŒä¸€æ–°ã•ã‚Œã€é«˜åº¦ã§å¤šå½©ãª ENTOURAGE X ã®æ©Ÿèƒ½ãŒã‚ˆã‚Šç›´æ„Ÿçš„ã«åˆ©ç”¨ã§ãるよã†ã«ãªã‚Šã¾ã—ãŸã€‚以å‰ãŠä½¿ã„ã«ãªã£ã¦ã„ãŸé›»å­ãƒ¡ãƒ¼ãƒ« アプリケーションã‹ã‚‰ã®æƒ…å ±ã®ã‚¤ãƒ³ãƒãƒ¼ãƒˆã‚‚容易ã«ã§ãã¾ã™ã€‚", Strings.UCase(MSWebSiteContent_Japanese));
+ NUnit.Framework.Assertion.AssertEquals ("JW#UCase/92", "БУДЕТЕ ÐВТОМÐТИЧЕСКИ ПЕРЕÐÐПРÐВЛЕÐЫ", Strings.UCase(MSWebSiteContent_Russian));
+ NUnit.Framework.Assertion.AssertEquals ("JW#UCase/93", "ÄŒNÃCI NÃROÄŒNÃCH POUŽÃVATEĽOVNOVÉ PORTFÓLIO MICROSOFT HARDWARE. Å PIÄŒKOVÉ OPTICKÉ BEZDRÔTOVÉ MYÅ KY S NOVOU TECHNOLÓGIOU - NAKLÃŇACÃM KOLIESKOM. NEZÃLEŽà NA TOM, AKà STÔL MÃTE, POKIAĽ JE NA ŇOM ELEGANTNÃ", Strings.UCase(MSWebSiteContent_Slovakian));
+ NUnit.Framework.Assertion.AssertEquals ("JW#UCase/94", "보안 ìº íŽ˜ì¸ - 스스로 지킨 ë‹¹ì‹ ì˜ PC! ë”ìš± 안전해집니다!", Strings.UCase(MSWebSiteContent_Korean));
+ NUnit.Framework.Assertion.AssertEquals ("JW#UCase/95", "كل الحقوق محÙوظة ليديعوت إنترنت", Strings.UCase(ArabynetComWebSiteContent_Arabic));
+ NUnit.Framework.Assertion.AssertEquals ("JW#UCase/96", "ÄÖÜÄÖÜß", Strings.UCase(GermanUmlauts_German));
+ NUnit.Framework.Assertion.AssertEquals ("JW#UCase/97", "é›»å­ãƒ¡ãƒ¼ãƒ«ã‚’ã¯ã˜ã‚ã€äºˆå®šè¡¨ã‚„アドレス帳ãªã©ã®å€‹äººæƒ…å ±ã€ã•ã‚‰ã«ã¯ OFFICE V. X ã®å„アプリケーションã§ä½œæˆã—ãŸæ›¸é¡žã‚„ãã®ä»–ã®ãƒ•ã‚¡ã‚¤ãƒ«ã‚’リンクã•ã›ã¦çµ±åˆçš„ã«ç®¡ç†ã™ã‚‹ã“ã¨ãŒã§ãるコミュニケーションï¼å€‹äººæƒ…報管ç†ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã§ã™ã€‚インターフェースãŒä¸€æ–°ã•ã‚Œã€é«˜åº¦ã§å¤šå½©ãª ENTOURAGE X ã®æ©Ÿèƒ½ãŒã‚ˆã‚Šç›´æ„Ÿçš„ã«åˆ©ç”¨ã§ãるよã†ã«ãªã‚Šã¾ã—ãŸã€‚以å‰ãŠä½¿ã„ã«ãªã£ã¦ã„ãŸé›»å­ãƒ¡ãƒ¼ãƒ« アプリケーションã‹ã‚‰ã®æƒ…å ±ã®ã‚¤ãƒ³ãƒãƒ¼ãƒˆã‚‚容易ã«ã§ãã¾ã™ã€‚БУДЕТЕ ÐВТОМÐТИЧЕСКИ ПЕРЕÐÐПРÐВЛЕÐЫČNÃCI NÃROÄŒNÃCH POUŽÃVATEĽOVNOVÉ PORTFÓLIO MICROSOFT HARDWARE. Å PIÄŒKOVÉ OPTICKÉ BEZDRÔTOVÉ MYÅ KY S NOVOU TECHNOLÓGIOU - NAKLÃŇACÃM KOLIESKOM. NEZÃLEŽà NA TOM, AKà STÔL MÃTE, POKIAĽ JE NA ŇOM ELEGANTNÃ보안 ìº íŽ˜ì¸ - 스스로 지킨 ë‹¹ì‹ ì˜ PC! ë”ìš± 안전해집니다!كل الحقوق محÙوظة ليديعوت إنترنتÄÖÜÄÖÜß", Strings.UCase(TextStringOfMultipleLanguages));
+
+ // restore buffered culture
+ System.Threading.Thread.CurrentThread.CurrentCulture = CurCulture;
+ }
+ }
+}
diff --git a/mcs/class/Microsoft.VisualBasic/Test/microsoftvisualbasic_test.args b/mcs/class/Microsoft.VisualBasic/Test/microsoftvisualbasic_test.args
deleted file mode 100644
index e3d4ef173f8..00000000000
--- a/mcs/class/Microsoft.VisualBasic/Test/microsoftvisualbasic_test.args
+++ /dev/null
@@ -1,3 +0,0 @@
-CollectionTest.cs
-ConversionTest.cs
-DateAndTimeTest.cs \ No newline at end of file
diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Messaging/ChangeLog b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Messaging/ChangeLog
index 48997d47a8a..836adf9bcb4 100644
--- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Messaging/ChangeLog
+++ b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Messaging/ChangeLog
@@ -1,3 +1,7 @@
+2004-01-26 Todd Berman <tberman@sevenl.net>
+
+ * SoapTcpChannel.cs: fix from Sami Vaaraniemi <sami@capehill.net>
+
2003-10-25 Todd Berman <tberman@gentoo.org>
* SoapTcpChannel.cs: fixes for csc
diff --git a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Messaging/SoapTcpTransport.cs b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Messaging/SoapTcpTransport.cs
index daee3f15e15..54341135902 100644
--- a/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Messaging/SoapTcpTransport.cs
+++ b/mcs/class/Microsoft.Web.Services/Microsoft.Web.Services.Messaging/SoapTcpTransport.cs
@@ -195,7 +195,7 @@ namespace Microsoft.Web.Services.Messaging
try {
env = tcp.EndReceive (result);
- tcp.BeginReceive (new AsyncCallback (OnReceive), result);
+ tcp.BeginReceive (new AsyncCallback (OnReceive), tcp);
} catch (Exception) {
lock (Channels.SyncRoot) {
Channels.Remove (tcp.Destination.AbsoluteUri);
diff --git a/mcs/class/Microsoft.Web.Services/Test/standalone/WSE2/Microsoft.Web.Services.Messaging/.cvsignore b/mcs/class/Microsoft.Web.Services/Test/standalone/WSE2/Microsoft.Web.Services.Messaging/.cvsignore
new file mode 100644
index 00000000000..b883f1fdc6d
--- /dev/null
+++ b/mcs/class/Microsoft.Web.Services/Test/standalone/WSE2/Microsoft.Web.Services.Messaging/.cvsignore
@@ -0,0 +1 @@
+*.exe
diff --git a/mcs/class/Microsoft.Web.Services/Test/standalone/WSE2/Microsoft.Web.Services.Messaging/README b/mcs/class/Microsoft.Web.Services/Test/standalone/WSE2/Microsoft.Web.Services.Messaging/README
new file mode 100644
index 00000000000..4614f828705
--- /dev/null
+++ b/mcs/class/Microsoft.Web.Services/Test/standalone/WSE2/Microsoft.Web.Services.Messaging/README
@@ -0,0 +1,5 @@
+These are some standalone tests that should be compiled with:
+
+mcs source.cs /r:Microsoft.Web.Services.dll
+
+You need be using WSE2 as the default. you can do this by make DEFAULT_WSE2=1 install from inside the Microsoft.Web.Services directory.
diff --git a/mcs/class/Microsoft.Web.Services/Test/standalone/WSE2/Microsoft.Web.Services.Messaging/simple_soap.tcp_testmessage.cs b/mcs/class/Microsoft.Web.Services/Test/standalone/WSE2/Microsoft.Web.Services.Messaging/simple_soap.tcp_testmessage.cs
new file mode 100644
index 00000000000..8b905401ea5
--- /dev/null
+++ b/mcs/class/Microsoft.Web.Services/Test/standalone/WSE2/Microsoft.Web.Services.Messaging/simple_soap.tcp_testmessage.cs
@@ -0,0 +1,46 @@
+using Microsoft.Web.Services;
+using Microsoft.Web.Services.Messaging;
+
+using System;
+using System.Net;
+using System.Threading;
+using System.Xml;
+
+namespace Test
+{
+
+ public class MessageDriver
+ {
+ public static void Main ()
+ {
+
+ Uri receiverUri = new Uri ("soap.tcp://localhost/math");
+ MathSoapListener listener = new MathSoapListener ();
+ SoapReceivers.Add (receiverUri, listener);
+
+ SoapEnvelope env = new SoapEnvelope ();
+ env.CreateBody ();
+ env.Body.InnerXml = "<v:add xmlns:v='urn:add'><x>33</x><y>66</y></v:add>";
+ env.Context.Action = "urn:math:add";
+ SoapSender sender = new SoapSender (receiverUri);
+ sender.Send (env);
+
+ Thread.Sleep (1000);
+
+ }
+
+ }
+
+ public class MathSoapListener : SoapReceiver
+ {
+
+ protected override void Receive (SoapEnvelope e)
+ {
+ double x = XmlConvert.ToDouble (e.SelectSingleNode ("//x").InnerText);
+ double y = XmlConvert.ToDouble (e.SelectSingleNode ("//y").InnerText);
+ Console.WriteLine ("Message received, x = {0}, y = {1}, x + y = {2}", x, y, x + y);
+ }
+
+ }
+
+}
diff --git a/mcs/class/Mono.CSharp.Debugger/ChangeLog b/mcs/class/Mono.CSharp.Debugger/ChangeLog
index 651bfb94224..a0defbf1a9d 100644
--- a/mcs/class/Mono.CSharp.Debugger/ChangeLog
+++ b/mcs/class/Mono.CSharp.Debugger/ChangeLog
@@ -1,21 +1,63 @@
+2004-01-16 Martin Baulig <martin@ximian.com>
+
+ Set version number to 36.
+
+ * MonoSymbolFile.cs (MonoSymbolFile): Removed 'FindMethod' and
+ 'MethodLookup'.
+
+ * MonoSymbolTable.cs (MethodEntry): Don't write the method's full
+ name into the symbol file.
+
+2004-01-16 Martin Baulig <martin@ximian.com>
+
+ * MonoSymbolFile.cs (MonoDebuggerSupport): As suggested by Ben
+ Maurer, create a delegate type for each of the methods and then
+ store the method.
+
+2004-01-15 Martin Baulig <martin@ximian.com>
+
+ * MonoSymbolFile.cs (MonoDebuggerSupport): New public class
+ containing static wrappers for calling the `MonoDebugger_*'
+ function in S.R.Assembly.
+
+2004-01-13 Martin Baulig <martin@ximian.com>
+
+ * MonoSymbolTable.cs: Added more #region's and a comment at the
+ top of the file.
+
+ * MonoSymbolWriter.cs (SourceMethod.BuildLineNumberTable): Removed
+ it here since it's in MethodEntry again.
+
+2004-01-13 Martin Baulig <martin@ximian.com>
+
+ * ChangeLog, MonoSymbolTable.cs: Reviewed Ben's patches. For
+ those which are not ok, I'll add detailed comments to the source
+ code.
+
2003-12-28 Ben Maurer <bmaurer@users.sourceforge.net>
+ [Revision 1.41, not approved. Martin]
* MonoSymbolTable.cs (MethodEntry): kill more
useless fields.
2003-12-28 Ben Maurer <bmaurer@users.sourceforge.net>
+ [Revision 1.40, not approved. Martin]
* MonoSymbolTable.cs (MethodEntry): Remove the
SourceFileIndex field, we already have the info.
2003-12-28 Ben Maurer <bmaurer@users.sourceforge.net>
+ [Revision 1.39, approved. Martin]
* MonoSymbolTable.cs: Don't make the MethodIndexEntry
part of the method entry class, because it just
takes up extra space.
2003-12-28 Ben Maurer <bmaurer@users.sourceforge.net>
+ [Revisions 1.37 and 1.38; not approved. Martin]
+ * MonoSymbolTable.cs (MethodEntry.BuildLineNumberTable): Removed.
+
* MonoSymbolTable.cs, MonoSymbolWriter.cs: Use
fewer arrays, dont use arraylists with structs.
@@ -25,6 +67,7 @@
2003-12-20 Ben Maurer <bmaurer@users.sourceforge.net>
+ [Revision 1.36, approved. Martin]
* MonoSymbolTable.cs: Fewer StringBuilder allocs.
2003-12-08 Zoltan Varga <vargaz@freemail.hu>
@@ -33,6 +76,7 @@
2003-12-07 Ben Maurer <bmaurer@users.sourceforge.net>
+ [Revision 1.35, approved. Martin]
* MonoSymbolTable.cs: It is faster to do a linear search
than it is to make a hashtable. Even though the linear
search is O(n^2) while the hashtable is O(n), the allocation
diff --git a/mcs/class/Mono.CSharp.Debugger/MonoSymbolFile.cs b/mcs/class/Mono.CSharp.Debugger/MonoSymbolFile.cs
index ac152a05b20..e0befd743bf 100644
--- a/mcs/class/Mono.CSharp.Debugger/MonoSymbolFile.cs
+++ b/mcs/class/Mono.CSharp.Debugger/MonoSymbolFile.cs
@@ -170,6 +170,67 @@ namespace Mono.CSharp.Debugger
}
}
+ public class MonoDebuggerSupport
+ {
+ static GetTypeFunc get_type;
+ static GetMethodTokenFunc get_method_token;
+ static GetMethodFunc get_method;
+ static GetLocalTypeFromSignatureFunc local_type_from_sig;
+
+ 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 Delegate create_delegate (Type delegate_type, string name)
+ {
+ Type type = typeof (Assembly);
+
+ MethodInfo mi = type.GetMethod (name, BindingFlags.Static |
+ BindingFlags.NonPublic);
+ if (mi == null)
+ throw new Exception ("Can't find " + name);
+
+ return Delegate.CreateDelegate (delegate_type, mi);
+ }
+
+ static MonoDebuggerSupport ()
+ {
+ get_type = (GetTypeFunc) create_delegate (
+ typeof (GetTypeFunc), "MonoDebugger_GetType");
+
+ get_method_token = (GetMethodTokenFunc) create_delegate (
+ typeof (GetMethodTokenFunc), "MonoDebugger_GetMethodToken");
+
+ get_method = (GetMethodFunc) create_delegate (
+ typeof (GetMethodFunc), "MonoDebugger_GetMethod");
+
+ local_type_from_sig = (GetLocalTypeFromSignatureFunc) create_delegate (
+ typeof (GetLocalTypeFromSignatureFunc),
+ "MonoDebugger_GetLocalTypeFromSignature");
+ }
+
+ public static Type GetType (Assembly assembly, int token)
+ {
+ return get_type (assembly, token);
+ }
+
+ 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 class MonoSymbolFile : IDisposable
{
ArrayList methods = new ArrayList ();
@@ -335,8 +396,6 @@ namespace Mono.CSharp.Debugger
Hashtable source_file_hash;
Hashtable method_token_hash;
- Hashtable method_name_hash;
- Hashtable method_full_name_hash;
Hashtable source_name_hash;
protected MonoSymbolFile (Assembly assembly, Stream stream)
@@ -458,7 +517,7 @@ namespace Mono.CSharp.Debugger
{
if (reader == null)
throw new InvalidOperationException ();
- int token = assembly.MonoDebugger_GetMethodToken (method);
+ int token = MonoDebuggerSupport.GetMethodToken (method);
return GetMethodByToken (token);
}
@@ -515,63 +574,6 @@ namespace Mono.CSharp.Debugger
throw new MonoSymbolFileException ("Internal error.");
}
- public int FindMethod (string full_name)
- {
- if (reader == null)
- throw new InvalidOperationException ();
-
- if (method_full_name_hash == null) {
- method_full_name_hash = new Hashtable ();
-
- for (int i = 0; i < ot.MethodCount; i++) {
- MethodIndexEntry ie = GetMethodIndexEntry (i + 1);
- string name = ReadString (ie.FullNameOffset);
-
- method_full_name_hash.Add (name, i + 1);
- }
- }
-
- object value = method_full_name_hash [full_name];
- if (value == null)
- return -1;
- return (int) value;
- }
-
- public int[] MethodLookup (string query)
- {
- if (reader == null)
- throw new InvalidOperationException ();
-
- ArrayList list;
- if (method_name_hash == null) {
- method_name_hash = new Hashtable ();
-
- for (int i = 0; i < ot.MethodCount; i++) {
- MethodIndexEntry ie = GetMethodIndexEntry (i + 1);
- string full_name = ReadString (ie.FullNameOffset);
-
- int pos = full_name.IndexOf ('(');
- string name = full_name.Substring (0, pos);
-
- list = method_name_hash [name] as ArrayList;
- if (list == null) {
- list = new ArrayList ();
- method_name_hash.Add (name, list);
- }
-
- list.Add (i + 1);
- }
- }
-
- list = method_name_hash [query] as ArrayList;
- if (list == null)
- return new int [0];
-
- int[] retval = new int [list.Count];
- list.CopyTo (retval, 0);
- return retval;
- }
-
public int FindSource (string file_name)
{
if (reader == null)
diff --git a/mcs/class/Mono.CSharp.Debugger/MonoSymbolTable.cs b/mcs/class/Mono.CSharp.Debugger/MonoSymbolTable.cs
index d47573f3a20..f0a3e1630d3 100644
--- a/mcs/class/Mono.CSharp.Debugger/MonoSymbolTable.cs
+++ b/mcs/class/Mono.CSharp.Debugger/MonoSymbolTable.cs
@@ -2,7 +2,7 @@
// System.Diagnostics.SymbolStore/MonoSymbolTable.cs
//
// Author:
-// Martin Baulig (martin@gnome.org)
+// Martin Baulig (martin@ximian.com)
//
// (C) 2002 Ximian, Inc. http://www.ximian.com
//
@@ -13,14 +13,49 @@ using System.Reflection.Emit;
using System.Collections;
using System.Text;
using System.IO;
-
+
+//
+// Parts which are actually written into the symbol file are marked with
+//
+// #region This is actually written to the symbol file
+// #endregion
+//
+// Please do not modify these regions without previously talking to me.
+//
+// All changes to the file format must be synchronized in several places:
+//
+// a) The fields in these regions (and their order) must match the actual
+// contents of the symbol file.
+//
+// This helps people to understand the symbol file format without reading
+// too much source code, ie. you look at the appropriate region and then
+// you know what's actually in the file.
+//
+// It is also required to help me enforce b).
+//
+// b) The regions must be kept in sync with the unmanaged code in
+// mono/metadata/debug-mono-symfile.h
+//
+// When making changes to the file format, you must also increase two version
+// numbers:
+//
+// i) OffsetTable.Version in this file.
+// ii) MONO_SYMBOL_FILE_VERSION in mono/metadata/debug-mono-symfile.h
+//
+// After doing so, recompile everything, including the debugger. Symbol files
+// with different versions are incompatible to each other and the debugger and
+// the runtime enfore this, so you need to recompile all your assemblies after
+// changing the file format.
+//
+
namespace Mono.CSharp.Debugger
{
public struct OffsetTable
{
- public const int Version = 35;
+ public const int Version = 36;
public const long Magic = 0x45e82623fd7fa614;
+ #region This is actually written to the symbol file
public int TotalFileSize;
public int DataSectionOffset;
public int DataSectionSize;
@@ -31,6 +66,7 @@ namespace Mono.CSharp.Debugger
public int MethodTableOffset;
public int MethodTableSize;
public int TypeCount;
+ #endregion
internal OffsetTable (BinaryReader reader)
{
@@ -72,8 +108,10 @@ namespace Mono.CSharp.Debugger
public struct LineNumberEntry
{
+ #region This is actually written to the symbol file
public readonly int Row;
public readonly int Offset;
+ #endregion
public LineNumberEntry (int row, int offset)
{
@@ -139,8 +177,10 @@ namespace Mono.CSharp.Debugger
public class LexicalBlockEntry
{
public int Index;
+ #region This is actually written to the symbol file
public int StartOffset;
public int EndOffset;
+ #endregion
public LexicalBlockEntry (int index, int start_offset)
{
@@ -174,10 +214,12 @@ namespace Mono.CSharp.Debugger
public struct LocalVariableEntry
{
+ #region This is actually written to the symbol file
public readonly string Name;
public readonly FieldAttributes Attributes;
public readonly byte[] Signature;
public readonly int BlockIndex;
+ #endregion
public LocalVariableEntry (string Name, FieldAttributes Attributes, byte[] Signature,
int BlockIndex)
@@ -216,12 +258,19 @@ namespace Mono.CSharp.Debugger
public class SourceFileEntry
{
+ #region This is actually written to the symbol file
+ public readonly int Index;
+ int Count;
+ int NamespaceCount;
+ int NameOffset;
+ int MethodOffset;
+ int NamespaceTableOffset;
+ #endregion
+
MonoSymbolFile file;
string file_name;
ArrayList methods;
ArrayList namespaces;
- int index, count, name_offset, method_offset;
- int namespace_count, nstable_offset;
bool creating;
public static int Size {
@@ -232,7 +281,7 @@ namespace Mono.CSharp.Debugger
{
this.file = file;
this.file_name = file_name;
- this.index = file.AddSource (this);
+ this.Index = file.AddSource (this);
creating = true;
methods = new ArrayList ();
@@ -266,51 +315,47 @@ namespace Mono.CSharp.Debugger
internal void WriteData (BinaryWriter bw)
{
- name_offset = (int) bw.BaseStream.Position;
+ NameOffset = (int) bw.BaseStream.Position;
file.WriteString (bw, file_name);
ArrayList list = new ArrayList ();
foreach (MethodEntry entry in methods)
list.Add (entry.Write (file, bw));
list.Sort ();
- count = list.Count;
+ Count = list.Count;
- method_offset = (int) bw.BaseStream.Position;
+ MethodOffset = (int) bw.BaseStream.Position;
foreach (MethodSourceEntry method in list)
method.Write (bw);
- namespace_count = namespaces.Count;
- nstable_offset = (int) bw.BaseStream.Position;
+ NamespaceCount = namespaces.Count;
+ NamespaceTableOffset = (int) bw.BaseStream.Position;
foreach (NamespaceEntry ns in namespaces)
ns.Write (file, bw);
}
internal void Write (BinaryWriter bw)
{
- bw.Write (index);
- bw.Write (count);
- bw.Write (namespace_count);
- bw.Write (name_offset);
- bw.Write (method_offset);
- bw.Write (nstable_offset);
+ bw.Write (Index);
+ bw.Write (Count);
+ bw.Write (NamespaceCount);
+ bw.Write (NameOffset);
+ bw.Write (MethodOffset);
+ bw.Write (NamespaceTableOffset);
}
internal SourceFileEntry (MonoSymbolFile file, BinaryReader reader)
{
this.file = file;
- index = reader.ReadInt32 ();
- count = reader.ReadInt32 ();
- namespace_count = reader.ReadInt32 ();
- name_offset = reader.ReadInt32 ();
- method_offset = reader.ReadInt32 ();
- nstable_offset = reader.ReadInt32 ();
-
- file_name = file.ReadString (name_offset);
- }
+ Index = reader.ReadInt32 ();
+ Count = reader.ReadInt32 ();
+ NamespaceCount = reader.ReadInt32 ();
+ NameOffset = reader.ReadInt32 ();
+ MethodOffset = reader.ReadInt32 ();
+ NamespaceTableOffset = reader.ReadInt32 ();
- public int Index {
- get { return index; }
+ file_name = file.ReadString (NameOffset);
}
public string FileName {
@@ -325,13 +370,13 @@ namespace Mono.CSharp.Debugger
BinaryReader reader = file.BinaryReader;
int old_pos = (int) reader.BaseStream.Position;
- reader.BaseStream.Position = method_offset;
+ reader.BaseStream.Position = MethodOffset;
ArrayList list = new ArrayList ();
- for (int i = 0; i < count; i ++)
+ for (int i = 0; i < Count; i ++)
list.Add (new MethodSourceEntry (reader));
reader.BaseStream.Position = old_pos;
- MethodSourceEntry[] retval = new MethodSourceEntry [count];
+ MethodSourceEntry[] retval = new MethodSourceEntry [Count];
list.CopyTo (retval, 0);
return retval;
}
@@ -339,16 +384,19 @@ namespace Mono.CSharp.Debugger
public override string ToString ()
{
- return String.Format ("SourceFileEntry ({0}:{1}:{2})", index, file_name, count);
+ return String.Format ("SourceFileEntry ({0}:{1}:{2})",
+ Index, file_name, Count);
}
}
public struct MethodSourceEntry : IComparable
{
+ #region This is actually written to the symbol file
public readonly int Index;
public readonly int FileOffset;
public readonly int StartRow;
public readonly int EndRow;
+ #endregion
public MethodSourceEntry (int index, int file_offset, int start, int end)
{
@@ -399,68 +447,64 @@ namespace Mono.CSharp.Debugger
public struct MethodIndexEntry
{
+ #region This is actually written to the symbol file
public readonly int FileOffset;
- public readonly int FullNameOffset;
public readonly int Token;
+ #endregion
public static int Size {
- get { return 12; }
+ get { return 8; }
}
- public MethodIndexEntry (int offset, int name_offset, int token)
+ public MethodIndexEntry (int offset, int token)
{
this.FileOffset = offset;
- this.FullNameOffset = name_offset;
this.Token = token;
}
internal MethodIndexEntry (BinaryReader reader)
{
FileOffset = reader.ReadInt32 ();
- FullNameOffset = reader.ReadInt32 ();
Token = reader.ReadInt32 ();
}
internal void Write (BinaryWriter bw)
{
bw.Write (FileOffset);
- bw.Write (FullNameOffset);
bw.Write (Token);
}
public override string ToString ()
{
- return String.Format ("MethodIndexEntry ({0}:{1}:{2:x})",
- FileOffset, FullNameOffset, Token);
+ return String.Format ("MethodIndexEntry ({0}:{1:x})",
+ FileOffset, Token);
}
}
public class MethodEntry
{
#region This is actually written to the symbol file
- //public readonly int SourceFileIndex; (we take this from the SourceFile)
+ public readonly int SourceFileIndex;
public readonly int Token;
public readonly int StartRow;
public readonly int EndRow;
public readonly int ClassTypeIndex;
- //public readonly int NumParameters;
- //public readonly int NumLocals;
- //public readonly int NumLineNumbers;
+ public readonly int NumParameters;
+ public readonly int NumLocals;
+ public readonly int NumLineNumbers;
public readonly int NamespaceID;
public readonly bool LocalNamesAmbiguous;
- //int NameOffset;
- int FullNameOffset;
- //int TypeIndexTableOffset;
- //int LocalVariableTableOffset;
- //int LineNumberTableOffset;
- //int NumLexicalBlocks;
- //int LexicalBlockTableOffset;
+ int NameOffset;
+ int TypeIndexTableOffset;
+ int LocalVariableTableOffset;
+ int LineNumberTableOffset;
+ int NumLexicalBlocks;
+ int LexicalBlockTableOffset;
#endregion
int file_offset;
string name;
- string full_name;
public readonly int Index;
public readonly SourceFileEntry SourceFile;
@@ -481,38 +525,32 @@ namespace Mono.CSharp.Debugger
get { return name; }
}
- public string FullName {
- get { return full_name; }
- }
-
public MethodBase MethodBase {
- get { return SymbolFile.Assembly.MonoDebugger_GetMethod (Token); }
+ get { return MonoDebuggerSupport.GetMethod (SymbolFile.Assembly, Token); }
}
internal MethodEntry (MonoSymbolFile file, BinaryReader reader, int index)
{
this.SymbolFile = file;
this.Index = index;
- int SourceFileIndex = reader.ReadInt32 ();
+ SourceFileIndex = reader.ReadInt32 ();
Token = reader.ReadInt32 ();
StartRow = reader.ReadInt32 ();
EndRow = reader.ReadInt32 ();
ClassTypeIndex = reader.ReadInt32 ();
- int NumParameters = reader.ReadInt32 ();
- int NumLocals = reader.ReadInt32 ();
- int NumLineNumbers = reader.ReadInt32 ();
- int NameOffset = reader.ReadInt32 ();
- FullNameOffset = reader.ReadInt32 ();
- int TypeIndexTableOffset = reader.ReadInt32 ();
- int LocalVariableTableOffset = reader.ReadInt32 ();
- int LineNumberTableOffset = reader.ReadInt32 ();
- int NumLexicalBlocks = reader.ReadInt32 ();
- int LexicalBlockTableOffset = reader.ReadInt32 ();
+ NumParameters = reader.ReadInt32 ();
+ NumLocals = reader.ReadInt32 ();
+ NumLineNumbers = reader.ReadInt32 ();
+ NameOffset = reader.ReadInt32 ();
+ TypeIndexTableOffset = reader.ReadInt32 ();
+ LocalVariableTableOffset = reader.ReadInt32 ();
+ LineNumberTableOffset = reader.ReadInt32 ();
+ NumLexicalBlocks = reader.ReadInt32 ();
+ LexicalBlockTableOffset = reader.ReadInt32 ();
NamespaceID = reader.ReadInt32 ();
LocalNamesAmbiguous = reader.ReadInt32 () != 0;
name = file.ReadString (NameOffset);
- full_name = file.ReadString (FullNameOffset);
SourceFile = file.GetSourceFile (SourceFileIndex);
@@ -539,8 +577,8 @@ namespace Mono.CSharp.Debugger
for (int i = 0; i < NumLocals; i++) {
Locals [i] = new LocalVariableEntry (reader);
- LocalTypes [i] = ass.MonoDebugger_GetLocalTypeFromSignature (
- Locals [i].Signature);
+ LocalTypes [i] = MonoDebuggerSupport.GetLocalTypeFromSignature (
+ ass, Locals [i].Signature);
}
reader.BaseStream.Position = old_pos;
@@ -582,49 +620,29 @@ namespace Mono.CSharp.Debugger
Index = file.GetNextMethodIndex ();
Token = token;
+ SourceFileIndex = source.Index;
SourceFile = source;
StartRow = start_row;
EndRow = end_row;
NamespaceID = namespace_id;
LexicalBlocks = blocks;
- int NumLexicalBlocks = LexicalBlocks.Length;
+ NumLexicalBlocks = LexicalBlocks.Length;
- LineNumbers = lines;
- int NumLineNumbers = LineNumbers.Length;
+ LineNumbers = BuildLineNumberTable (lines);
+ NumLineNumbers = LineNumbers.Length;
ParameterInfo[] parameters = method.GetParameters ();
if (parameters == null)
parameters = new ParameterInfo [0];
- if (parameters.Length == 0)
- full_name = method.DeclaringType.FullName + "." + method.Name + "()";
- else if (parameters.Length == 1)
- full_name = method.DeclaringType.FullName + "." + method.Name + "(" + parameters [0].ParameterType.FullName + ")";
- else if (parameters.Length == 2)
- full_name = method.DeclaringType.FullName + "." + method.Name + "(" + parameters [0].ParameterType.FullName + "," + parameters [1].ParameterType.FullName + ")";
- else {
- StringBuilder sb = new StringBuilder ();
- sb.Append (method.DeclaringType.FullName);
- sb.Append (".");
- sb.Append (method.Name);
- sb.Append ("(");
- for (int i = 0; i < parameters.Length; i++) {
- if (i > 0)
- sb.Append (",");
- sb.Append (parameters [i].ParameterType.FullName);
- }
- sb.Append (")");
- full_name = sb.ToString ();
- }
-
name = method.Name;
- int NumParameters = parameters.Length;
+ NumParameters = parameters.Length;
ParamTypeIndices = new int [NumParameters];
for (int i = 0; i < NumParameters; i++)
ParamTypeIndices [i] = file.DefineType (parameters [i].ParameterType);
- int NumLocals = locals.Length;
+ NumLocals = locals.Length;
Locals = locals;
if (NumLocals <= 32) {
@@ -662,51 +680,86 @@ namespace Mono.CSharp.Debugger
ClassTypeIndex = file.DefineType (method.ReflectedType);
}
+ // BuildLineNumberTable() eliminates duplicate line numbers and ensures
+ // we aren't going "backwards" since this would counfuse the runtime's
+ // debugging code (and the debugger).
+ //
+ // In the line number table, the "offset" field most be strictly
+ // monotonic increasing; that is, the next entry must not have an offset
+ // which is equal to or less than the current one.
+ //
+ // The most common case is that our input (ie. the line number table as
+ // we get it from mcs) contains several entries with the same offset
+ // (and different line numbers) - but it may also happen that the offset
+ // is decreasing (this can be considered as an exception, such lines will
+ // simply be discarded).
+ LineNumberEntry[] BuildLineNumberTable (LineNumberEntry[] line_numbers)
+ {
+ ArrayList list = new ArrayList ();
+ int last_offset = -1;
+ int last_row = -1;
+
+ for (int i = 0; i < line_numbers.Length; i++) {
+ LineNumberEntry line = (LineNumberEntry) line_numbers [i];
+
+ if (line.Offset > last_offset) {
+ if (last_row >= 0)
+ list.Add (new LineNumberEntry (last_row, last_offset));
+ last_row = line.Row;
+ last_offset = line.Offset;
+ } else if (line.Row > last_row) {
+ last_row = line.Row;
+ }
+ }
+
+ if (last_row >= 0)
+ list.Add (new LineNumberEntry (last_row, last_offset));
+
+ LineNumberEntry[] retval = new LineNumberEntry [list.Count];
+ list.CopyTo (retval, 0);
+ return retval;
+ }
+
internal MethodSourceEntry Write (MonoSymbolFile file, BinaryWriter bw)
{
- int NameOffset = (int) bw.BaseStream.Position;
+ NameOffset = (int) bw.BaseStream.Position;
file.WriteString (bw, name);
- FullNameOffset = (int) bw.BaseStream.Position;
- file.WriteString (bw, full_name);
-
- int TypeIndexTableOffset = (int) bw.BaseStream.Position;
+ TypeIndexTableOffset = (int) bw.BaseStream.Position;
- for (int i = 0; i < ParamTypeIndices.Length; i++)
+ for (int i = 0; i < NumParameters; i++)
bw.Write (ParamTypeIndices [i]);
-
- for (int i = 0; i < LocalTypeIndices.Length; i++)
+ for (int i = 0; i < NumLocals; i++)
bw.Write (LocalTypeIndices [i]);
- int LocalVariableTableOffset = (int) bw.BaseStream.Position;
- for (int i = 0; i < Locals.Length; i++)
+ LocalVariableTableOffset = (int) bw.BaseStream.Position;
+ for (int i = 0; i < NumLocals; i++)
Locals [i].Write (file, bw);
- file.LocalCount += Locals.Length;
+ file.LocalCount += NumLocals;
- int LineNumberTableOffset = (int) bw.BaseStream.Position;
- for (int i = 0; i < LineNumbers.Length; i++)
+ LineNumberTableOffset = (int) bw.BaseStream.Position;
+ for (int i = 0; i < NumLineNumbers; i++)
LineNumbers [i].Write (bw);
- file.LineNumberCount += LineNumbers.Length;
+ file.LineNumberCount += NumLineNumbers;
- int LexicalBlockTableOffset = (int) bw.BaseStream.Position;
- for (int i = 0; i < LexicalBlocks.Length; i++)
+ LexicalBlockTableOffset = (int) bw.BaseStream.Position;
+ for (int i = 0; i < NumLexicalBlocks; i++)
LexicalBlocks [i].Write (bw);
file_offset = (int) bw.BaseStream.Position;
- bw.Write (SourceFile.Index);
+ bw.Write (SourceFileIndex);
bw.Write (Token);
bw.Write (StartRow);
bw.Write (EndRow);
bw.Write (ClassTypeIndex);
- bw.Write (ParamTypeIndices.Length);
- bw.Write (Locals.Length);
- bw.Write (LineNumbers.Length);
+ bw.Write (NumParameters);
+ bw.Write (NumLocals);
+ bw.Write (NumLineNumbers);
bw.Write (NameOffset);
- bw.Write (FullNameOffset);
bw.Write (TypeIndexTableOffset);
bw.Write (LocalVariableTableOffset);
bw.Write (LineNumberTableOffset);
- bw.Write (LexicalBlocks.Length);
+ bw.Write (NumLexicalBlocks);
bw.Write (LexicalBlockTableOffset);
bw.Write (NamespaceID);
bw.Write (LocalNamesAmbiguous ? 1 : 0);
@@ -716,24 +769,26 @@ namespace Mono.CSharp.Debugger
internal void WriteIndex (BinaryWriter bw)
{
- new MethodIndexEntry (file_offset, FullNameOffset, Token).Write (bw);
+ new MethodIndexEntry (file_offset, Token).Write (bw);
}
public override string ToString ()
{
- return String.Format ("[Method {0}:{1}:{2}:{3}:{4} - {7}:{8}:{9}:{10} - {5} - {6}]",
- Index, Token, SourceFile.Index, StartRow, EndRow,
- SourceFile, FullName, ClassTypeIndex, ParamTypeIndices.Length,
- Locals.Length, LineNumbers.Length);
+ return String.Format ("[Method {0}:{1}:{2}:{3}:{4} - {7}:{8}:{9}:{10} - {5}]",
+ Index, Token, SourceFileIndex, StartRow, EndRow,
+ SourceFile, ClassTypeIndex, NumParameters,
+ NumLocals, NumLineNumbers);
}
}
public struct NamespaceEntry
{
+ #region This is actually written to the symbol file
public readonly string Name;
public readonly int Index;
public readonly int Parent;
public readonly string[] UsingClauses;
+ #endregion
public NamespaceEntry (string name, int index, string[] using_clauses, int parent)
{
diff --git a/mcs/class/Mono.CSharp.Debugger/MonoSymbolWriter.cs b/mcs/class/Mono.CSharp.Debugger/MonoSymbolWriter.cs
index e8067ca400c..5c89af6566f 100755
--- a/mcs/class/Mono.CSharp.Debugger/MonoSymbolWriter.cs
+++ b/mcs/class/Mono.CSharp.Debugger/MonoSymbolWriter.cs
@@ -252,17 +252,6 @@ namespace Mono.CSharp.Debugger
if (last_row >= 0)
lines [pos] = new LineNumberEntry (last_row, last_offset);
}
-
- LineNumberEntry[] BuildLineNumberTable (LineNumberEntry[] line_numbers)
- {
- ArrayList list = new ArrayList ();
-
-
-
- LineNumberEntry[] retval = new LineNumberEntry [list.Count];
- list.CopyTo (retval, 0);
- return retval;
- }
}
public class MonoSymbolWriter : IMonoSymbolWriter
diff --git a/mcs/class/Mono.Directory.LDAP/.cvsignore b/mcs/class/Mono.Directory.LDAP/.cvsignore
new file mode 100755
index 00000000000..70feead69ab
--- /dev/null
+++ b/mcs/class/Mono.Directory.LDAP/.cvsignore
@@ -0,0 +1,6 @@
+Mono.Directory.LDAP_test.dll
+Mono.Directory.LDAP_test.pdb
+list
+.makefrag
+.response
+library-deps.stamp
diff --git a/mcs/class/Mono.GetOptions/.cvsignore b/mcs/class/Mono.GetOptions/.cvsignore
index 87b26079b5a..cccada30e6b 100644
--- a/mcs/class/Mono.GetOptions/.cvsignore
+++ b/mcs/class/Mono.GetOptions/.cvsignore
@@ -1,6 +1,7 @@
*.pdb
*.dll
*.csproj.user
-.makefrag
-.response
+*.prj
+*.pws
+.*
library-deps.stamp
diff --git a/mcs/class/Mono.PEToolkit/.cvsignore b/mcs/class/Mono.PEToolkit/build/.cvsignore
index 0c2ee6906fa..2f4bd5a6349 100644
--- a/mcs/class/Mono.PEToolkit/.cvsignore
+++ b/mcs/class/Mono.PEToolkit/build/.cvsignore
@@ -1,3 +1,4 @@
+mddump.pdb
list
.makefrag
.response
diff --git a/mcs/class/Mono.Posix/ChangeLog b/mcs/class/Mono.Posix/ChangeLog
index 1f55fafa41b..b28515ead83 100644
--- a/mcs/class/Mono.Posix/ChangeLog
+++ b/mcs/class/Mono.Posix/ChangeLog
@@ -1,3 +1,8 @@
+2004-01-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Makefile: handle win32 paths and copy Mono.Posix.dll to Mono.Posix
+ directory so that MS runtime finds it.
+
2003-02-05 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* Check in.
diff --git a/mcs/class/Mono.Posix/Makefile b/mcs/class/Mono.Posix/Makefile
index 5cd2f6dc057..e213503e239 100644
--- a/mcs/class/Mono.Posix/Makefile
+++ b/mcs/class/Mono.Posix/Makefile
@@ -12,10 +12,20 @@ include ../../build/library.make
all-local: Mono.Posix/map.h ../lib/libMonoPosixHelper.so
Mono.Posix/map.h Mono.Posix/map.c: Mono.Posix/make-map.exe ../lib/Mono.Posix.dll
- MONO_PATH=../lib/ $(RUNTIME) Mono.Posix/make-map.exe ../lib/Mono.Posix.dll Mono.Posix/map
+ cp ../lib/Mono.Posix.dll Mono.Posix/
+ifneq ($(PLATFORM),win32)
+ MONO_PATH=../lib/ $(PLATFORM_RUNTIME) Mono.Posix/make-map.exe ../lib/Mono.Posix.dll Mono.Posix/map
+else
+ Mono.Posix/make-map.exe ..\\lib\\Mono.Posix.dll Mono.Posix/map
+endif
Mono.Posix/make-map.exe: Mono.Posix/make-map.cs ../lib/Mono.Posix.dll
- $(CSCOMPILE) Mono.Posix/make-map.cs -out:Mono.Posix/make-map.exe -r:../lib/Mono.Posix.dll
+ cp ../lib/Mono.Posix.dll Mono.Posix/
+ifneq ($(PLATFORM),win32)
+ $(CSCOMPILE) -out:Mono.Posix/make-map.exe -r:../lib/Mono.Posix.dll Mono.Posix/make-map.cs
+else
+ $(CSCOMPILE) -out:Mono.Posix/make-map.exe -r:../lib/Mono.Posix.dll Mono.Posix\\make-map.cs
+endif
local_sources = \
Mono.Posix/map.c \
@@ -29,4 +39,4 @@ local_objs = \
$(CCOMPILE) -fPIC -c -o $@ $^
../lib/libMonoPosixHelper.so: $(local_objs)
- gcc -shared -Wl,-soname,libMonoPosixHelper.dll.so -o $(MonoPosixHelper) $(local_objs) $(LOCAL_LDFLAGS) \ No newline at end of file
+ gcc -shared -Wl,-soname,libMonoPosixHelper.dll.so -o $(MonoPosixHelper) $(local_objs) $(LOCAL_LDFLAGS)
diff --git a/mcs/class/Mono.Posix/Mono.Posix/ChangeLog b/mcs/class/Mono.Posix/Mono.Posix/ChangeLog
index 910ac63db4e..365fbba578f 100644
--- a/mcs/class/Mono.Posix/Mono.Posix/ChangeLog
+++ b/mcs/class/Mono.Posix/Mono.Posix/ChangeLog
@@ -1,3 +1,16 @@
+2004-01-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Syscall.cs: moved the assembly attribute to a proper place
+ and added 'signal.h'
+ * make-map.cs: use reflection to invoke the properties, as it
+ fails under MS runtime.
+
+
+2004-01-05 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Syscall.cs: moved assembly attribute and added unsafe block to fix
+ the build on windows.
+
2003-11-11 Wojciech Polak <polak@gnu.org
* Syscall.cs: Applied patch from Wojciech Polak <polak@gnu.org> to
diff --git a/mcs/class/Mono.Posix/Mono.Posix/Syscall.cs b/mcs/class/Mono.Posix/Mono.Posix/Syscall.cs
index af8f4cf8383..b3774509952 100644
--- a/mcs/class/Mono.Posix/Mono.Posix/Syscall.cs
+++ b/mcs/class/Mono.Posix/Mono.Posix/Syscall.cs
@@ -34,10 +34,10 @@ using System;
using System.Text;
using System.Runtime.InteropServices;
+[assembly:Mono.Posix.IncludeAttribute (new string [] {"sys/types.h", "sys/stat.h", "sys/wait.h", "unistd.h", "fcntl.h", "signal.h"},
+ new string [] {"_GNU_SOURCE"})]
namespace Mono.Posix {
- [assembly:Mono.Posix.IncludeAttribute (new string [] {"sys/types.h", "sys/stat.h", "sys/wait.h", "unistd.h", "fcntl.h"},
- new string [] {"_GNU_SOURCE"})]
[Map][Flags]
public enum OpenFlags {
//
@@ -57,11 +57,17 @@ namespace Mono.Posix {
O_APPEND = 64,
O_NONBLOCK = 128,
O_SYNC = 256,
- O_NOFOLLOW = 512,
- O_DIRECTORY = 1024,
- O_DIRECT = 2048,
- O_ASYNC = 4096,
- O_LARGEFILE = 8192
+
+ //
+ // These are non-Posix, think of a way of exposing
+ // this for Linux users.
+ //
+
+ // O_NOFOLLOW = 512,
+ // O_DIRECTORY = 1024,
+ // O_DIRECT = 2048,
+ // O_ASYNC = 4096,
+ // O_LARGEFILE = 8192
}
[Flags][Map]
@@ -100,7 +106,11 @@ namespace Mono.Posix {
SIGFPE, SIGKILL, SIGUSR1, SIGSEGV, SIGUSR2, SIGPIPE,
SIGALRM, SIGTERM, SIGCHLD, SIGCONT, SIGSTOP, SIGTSTP,
SIGTTIN, SIGTTOU, SIGURG, SIGXCPU, SIGXFSZ, SIGVTALRM,
- SIGPROF, SIGWINCH, SIGIO, SIGPWR, SIGSYS, SIGRTMIN
+ SIGPROF, SIGWINCH, SIGIO,
+
+ // SIGPWR,
+ SIGSYS,
+ // SIGRTMIN
}
public class Syscall {
@@ -163,7 +173,9 @@ namespace Mono.Posix {
public static int waitpid (int pid, WaitOptions options)
{
- return syscall_waitpid (pid, null, map_Mono_Posix_WaitOptions (options));
+ unsafe {
+ return syscall_waitpid (pid, null, map_Mono_Posix_WaitOptions (options));
+ }
}
[DllImport ("MonoPosixHelper", EntryPoint="wifexited")]
diff --git a/mcs/class/Mono.Posix/Mono.Posix/make-map.cs b/mcs/class/Mono.Posix/Mono.Posix/make-map.cs
new file mode 100644
index 00000000000..6b714e88c86
--- /dev/null
+++ b/mcs/class/Mono.Posix/Mono.Posix/make-map.cs
@@ -0,0 +1,115 @@
+//
+// MakeMap.cs: Builds a C map of constants defined on C# land
+//
+// Author: Miguel de Icaza (miguel@novell.com)
+//
+// (C) 2003 Novell, Inc.
+//
+using System;
+using System.IO;
+using System.Reflection;
+using Mono.Posix;
+
+class MakeMap {
+
+ static int Main (string [] args)
+ {
+ if (args.Length != 2){
+ Console.WriteLine ("Usage is: make-map assembly output");
+ return 1;
+ }
+
+ StreamWriter sh = new StreamWriter (File.Create (args [1] + ".h"));
+ StreamWriter sc = new StreamWriter (File.Create (args [1] + ".c"));
+ sh.WriteLine ("/* This file was automatically generated by make-map from {0} */\n", args [0]);
+ sc.WriteLine ("/* This file was automatically generated by make-map from {0} */\n", args [0]);
+
+ Assembly a = Assembly.LoadFrom (args [0]);
+ object [] x = a.GetCustomAttributes (false);
+ Console.WriteLine ("Got: " + x.Length);
+ foreach (object aattr in a.GetCustomAttributes (false)){
+ Console.WriteLine ("Got: " + aattr.GetType ().Name);
+ if (aattr.GetType ().Name == "IncludeAttribute"){
+ WriteDefines (sc, aattr);
+ WriteIncludes (sc, aattr);
+ }
+ }
+ string f = args [1];
+
+ if (f.IndexOf ("/") != -1)
+ f = f.Substring (f.IndexOf ("/") + 1);
+ sc.WriteLine ("#include \"{0}.h\"", f);
+
+ Type [] exported_types = a.GetTypes ();
+
+ foreach (Type t in exported_types){
+ object [] attributes = t.GetCustomAttributes (false);
+ bool do_map = false;
+ bool do_bits = false;
+
+ foreach (object attr in attributes){
+ if (attr.GetType ().Name == "MapAttribute")
+ do_map = true;
+ if (attr.GetType ().Name == "FlagsAttribute")
+ do_bits = true;
+
+ }
+ if (!do_map)
+ continue;
+
+ string n = t.FullName.Replace (".", "_");
+ foreach (FieldInfo fi in t.GetFields ()){
+ if (!fi.IsLiteral)
+ continue;
+ sh.WriteLine ("#define {0}_{1} {1}", n, fi.Name);
+ }
+ sh.WriteLine ();
+
+ sc.WriteLine ("int map_{0} (int x)", n);
+ sc.WriteLine ("{");
+ if (do_bits)
+ sc.WriteLine ("\tint r = 0;");
+ foreach (FieldInfo fi in t.GetFields ()){
+ if (!fi.IsLiteral)
+ continue;
+ if (do_bits)
+ sc.WriteLine ("\tif ((x & {0}_{1}) != 0)\n\t\tr |= {1};", n, fi.Name);
+ else
+ sc.WriteLine ("\tif (x == {0}_{1})\n\t\t return {1};", n, fi.Name);
+ }
+ if (do_bits)
+ sc.WriteLine ("\treturn r;");
+ else
+ sc.WriteLine ("\treturn -1;");
+ sc.WriteLine ("}\n");
+ }
+ sh.Close ();
+ sc.Close ();
+
+ return 0;
+ }
+
+ 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 ("#define {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)
+ writer.WriteLine ("#include <{0}>", inc);
+ }
+}
diff --git a/mcs/class/Mono.Security.Win32/.cvsignore b/mcs/class/Mono.Security.Win32/.cvsignore
new file mode 100755
index 00000000000..c661f75cebd
--- /dev/null
+++ b/mcs/class/Mono.Security.Win32/.cvsignore
@@ -0,0 +1,6 @@
+Mono.Security.Win32_test.dll
+Mono.Security.Win32_test.pdb
+list
+.makefrag
+.response
+library-deps.stamp
diff --git a/mcs/class/Mono.Security/.cvsignore b/mcs/class/Mono.Security/.cvsignore
new file mode 100755
index 00000000000..77bfdc2bd50
--- /dev/null
+++ b/mcs/class/Mono.Security/.cvsignore
@@ -0,0 +1,6 @@
+Mono.Security_test.dll
+Mono.Security_test.pdb
+list
+.makefrag
+.response
+library-deps.stamp
diff --git a/mcs/class/Mono.Security/Mono.Security.Cryptography/ChangeLog b/mcs/class/Mono.Security/Mono.Security.Cryptography/ChangeLog
index 918d23fa7fb..95da6ff1965 100644
--- a/mcs/class/Mono.Security/Mono.Security.Cryptography/ChangeLog
+++ b/mcs/class/Mono.Security/Mono.Security.Cryptography/ChangeLog
@@ -1,3 +1,8 @@
+2004-01-12 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * CryptoConvert.cs: RSA doesn't start with a Q - at least that what
+ a strongname told me. Sorry Ron :(
+
2003-11-27 Sebastien Pouliot <spouliot@videotron.ca>
* MD4.cs: New. Asbtract class for all MD4 implementations. WARNING:
diff --git a/mcs/class/Mono.Security/Mono.Security.Cryptography/CryptoConvert.cs b/mcs/class/Mono.Security/Mono.Security.Cryptography/CryptoConvert.cs
index eda9e982659..958d5232a70 100644
--- a/mcs/class/Mono.Security/Mono.Security.Cryptography/CryptoConvert.cs
+++ b/mcs/class/Mono.Security/Mono.Security.Cryptography/CryptoConvert.cs
@@ -235,7 +235,7 @@ namespace Mono.Security.Cryptography {
blob [1] = 0x02; // Version - Always CUR_BLOB_VERSION (0x02)
// [2], [3] // RESERVED - Always 0
blob [5] = 0x24; // ALGID - Always 00 24 00 00 (for CALG_RSA_SIGN)
- blob [8] = 0x51; // Magic - RSA1 (ASCII in hex)
+ blob [8] = 0x52; // Magic - RSA1 (ASCII in hex)
blob [9] = 0x53;
blob [10] = 0x41;
blob [11] = 0x31;
diff --git a/mcs/class/Npgsql/ChangeLog b/mcs/class/Npgsql/ChangeLog
index 35a658bfa61..76458bc247f 100644
--- a/mcs/class/Npgsql/ChangeLog
+++ b/mcs/class/Npgsql/ChangeLog
@@ -1,3 +1,7 @@
+2004-01-15 Jackson Harper <jackson@ximian.com>
+
+ * NpgslTypes/NpgsqlTypesHelper.cs: Add StringFixedLength type.
+
2003-11-23 Pedro Martínez Juliá <yoros@wanadoo.es>
* Npgsql/HashAlgorithm.cs:
diff --git a/mcs/class/Npgsql/Makefile b/mcs/class/Npgsql/Makefile
index 4adaf701cbf..02cfec6a00a 100755
--- a/mcs/class/Npgsql/Makefile
+++ b/mcs/class/Npgsql/Makefile
@@ -31,7 +31,8 @@ LIB_MCS_FLAGS = /r:$(corlib) /r:System.dll /r:System.Xml.dll \
-resource:NpgsqlTypes/NpgsqlTypesHelper.resources,NpgsqlTypes.NpgsqlTypesHelper.resources \
-resource:Npgsql/Design/ConnectionStringEditorForm.resources,Npgsql.Design.ConnectionStringEditorForm.resources
-TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
+TEST_MCS_FLAGS = /r:$(corlib) /r:System.dll /r:System.Xml.dll \
+ /r:System.Web.dll /r:System.Data.dll
LIB_MCS_FLAGS_RESOURCES = $(LIB_MCS_FLAGS)
@@ -62,5 +63,11 @@ install: install-recursive install-local
uninstall: uninstall-recursive uninstall-local
-test:
+test: test-recursive test-local
+
+run-test: run-test-recursive test-local run-test-local
+
+clean: clean-recursive clean-local
+
+uninstall: uninstall-recursive uninstall-local
diff --git a/mcs/class/Npgsql/Npgsql/NpgsqlClosedState.cs b/mcs/class/Npgsql/Npgsql/NpgsqlClosedState.cs
index 331e17e7aaa..ced6457575b 100755
--- a/mcs/class/Npgsql/Npgsql/NpgsqlClosedState.cs
+++ b/mcs/class/Npgsql/Npgsql/NpgsqlClosedState.cs
@@ -26,6 +26,7 @@ using System.IO;
using System.Net;
using System.Net.Sockets;
using System.Resources;
+using System.Collections;
using Mono.Security.Protocol.Tls;
namespace Npgsql
@@ -56,7 +57,6 @@ namespace Npgsql
{
NpgsqlEventLog.LogMethodEnter(LogLevel.Debug, CLASSNAME, "Open");
- // Create a new TLS Session
try
{
TcpClient tcpc = new TcpClient(context.ServerName, Int32.Parse(context.ServerPort));
@@ -73,16 +73,20 @@ namespace Npgsql
stream = new SslClientStream(tcpc.GetStream(), context.ServerName, true, Mono.Security.Protocol.Tls.SecurityProtocolType.Default);
}
}
- context.Stream = stream;
+ context.Connector.Stream = stream;
+
+
}
catch (TlsException e)
{
throw new NpgsqlException(e.ToString());
}
+
NpgsqlEventLog.LogMsg(resman, "Log_ConnectedTo", LogLevel.Normal, context.ServerName, context.ServerPort);
ChangeState(context, NpgsqlConnectedState.Instance);
context.Startup();
+
}
}
diff --git a/mcs/class/Npgsql/Npgsql/NpgsqlCommand.cs b/mcs/class/Npgsql/Npgsql/NpgsqlCommand.cs
index effb75b64ec..99694ea3dc4 100755
--- a/mcs/class/Npgsql/Npgsql/NpgsqlCommand.cs
+++ b/mcs/class/Npgsql/Npgsql/NpgsqlCommand.cs
@@ -104,10 +104,10 @@ namespace Npgsql
/// <summary>
/// Finalizer for <see cref="Npgsql.NpgsqlCommand">NpgsqlCommand</see>.
/// </summary>
- ~NpgsqlCommand ()
+ /*~NpgsqlCommand ()
{
Dispose(false);
- }
+ }*/
// Public properties.
/// <summary>
@@ -471,7 +471,7 @@ namespace Npgsql
CheckNotification();
-
+
// Get the resultsets and create a Datareader with them.
return new NpgsqlDataReader(connection.Mediator.GetResultSets(), connection.Mediator.GetCompletedResponses(), connection, cb);
}
@@ -616,9 +616,12 @@ namespace Npgsql
/// </summary>
protected override void Dispose (bool disposing)
{
- NpgsqlEventLog.LogMethodEnter(LogLevel.Debug, CLASSNAME, "Dispose");
+
if (disposing)
{
+ // Only if explicitly calling Close or dispose we still have access to
+ // managed resources.
+ NpgsqlEventLog.LogMethodEnter(LogLevel.Debug, CLASSNAME, "Dispose");
if (connection != null)
{
connection.Dispose();
diff --git a/mcs/class/Npgsql/Npgsql/NpgsqlCommandBuilder.cs b/mcs/class/Npgsql/Npgsql/NpgsqlCommandBuilder.cs
index fa6492a9021..f36502985b3 100644
--- a/mcs/class/Npgsql/Npgsql/NpgsqlCommandBuilder.cs
+++ b/mcs/class/Npgsql/Npgsql/NpgsqlCommandBuilder.cs
@@ -242,10 +242,10 @@ namespace Npgsql
}
}
- ~NpgsqlCommandBuilder ()
+ /*~NpgsqlCommandBuilder ()
{
Dispose(false);
- }
+ }*/
}
diff --git a/mcs/class/Npgsql/Npgsql/NpgsqlConnection.cs b/mcs/class/Npgsql/Npgsql/NpgsqlConnection.cs
index 2c14efa8aca..63eb2b5ea16 100755
--- a/mcs/class/Npgsql/Npgsql/NpgsqlConnection.cs
+++ b/mcs/class/Npgsql/Npgsql/NpgsqlConnection.cs
@@ -50,7 +50,7 @@ namespace Npgsql
/// PostgreSQL server.
/// </summary>
[System.Drawing.ToolboxBitmapAttribute(typeof(NpgsqlConnection))]
- public sealed class NpgsqlConnection : Component, IDbConnection, IDisposable
+ public sealed class NpgsqlConnection : Component, IDbConnection
{
//Changed the Name of this event because events usually don't start with 'On' in the .Net-Framework
// (but their handlers do ;-)
@@ -84,6 +84,10 @@ namespace Npgsql
// These are for ODBC connection string compatibility
internal readonly String ODBC_USERID = "UID";
internal readonly String ODBC_PASSWORD = "PWD";
+
+ // These are for the connection pool
+ internal readonly String MIN_POOL_SIZE = "MINPOOLSIZE";
+ internal readonly String MAX_POOL_SIZE = "MAXPOOLSIZE";
// Values for possible CancelRequest messages.
private NpgsqlBackEndKeyData backend_keydata;
@@ -99,6 +103,8 @@ namespace Npgsql
private Stream stream;
+ private Connector _connector;
+
private Encoding connection_encoding;
private Boolean _supportsPrepare = false;
@@ -144,14 +150,7 @@ namespace Npgsql
ParseConnectionString();
}
- /// <summary>
- /// Finalizer for NpgsqlConnection
- /// </summary>
- ~NpgsqlConnection ()
- {
- Dispose(false);
- }
-
+
/// <summary>
/// Gets or sets the string used to open a SQL Server database.
/// </summary>
@@ -355,84 +354,102 @@ namespace Npgsql
connection_string_values[CONN_PORT] = PG_PORT;
if (connection_string_values[SSL_ENABLED] == null)
connection_string_values[SSL_ENABLED] = "no";
-
+ if (connection_string_values[MIN_POOL_SIZE] == null)
+ connection_string_values[MIN_POOL_SIZE] = "1";
+ if (connection_string_values[MAX_POOL_SIZE] == null)
+ connection_string_values[MAX_POOL_SIZE] = "-1";
+
try
{
-
+
// Check if the connection is already open.
if (connection_state == ConnectionState.Open)
throw new NpgsqlException(resman.GetString("Exception_ConnOpen"));
-
- // Try first connect using the 3.0 protocol...
- CurrentState.Open(this);
-
-
- // Check if there were any errors.
- if (_mediator.Errors.Count > 0)
+ lock(ConnectorPool.ConnectorPoolMgr)
{
- // Check if there is an error of protocol not supported...
- // As the message can be localized, just check the initial unlocalized part of the
- // message. If it is an error other than protocol error, when connecting using
- // version 2.0 we shall catch the error again.
- if (((String)_mediator.Errors[0]).StartsWith("FATAL"))
- {
- // Try using the 2.0 protocol.
- _mediator.Reset();
- CurrentState = NpgsqlClosedState.Instance;
- BackendProtocolVersion = ProtocolVersion.Version2;
- CurrentState.Open(this);
- }
-
- // Keep checking for errors...
- if(_mediator.Errors.Count > 0)
+ Connector = ConnectorPool.ConnectorPoolMgr.RequestConnector(ConnectionString, false);
+ Connector.InUse = true;
+ }
+
+ if (!Connector.IsInitialized)
+ {
+
+ // Reset state to initialize new connector in pool.
+ CurrentState = NpgsqlClosedState.Instance;
+
+ // Try first connect using the 3.0 protocol...
+ CurrentState.Open(this);
+
+ // Change the state of connection to open.
+ connection_state = ConnectionState.Open;
+
+ // Check if there were any errors.
+ if (_mediator.Errors.Count > 0)
{
- StringWriter sw = new StringWriter();
- sw.WriteLine(resman.GetString("Exception_OpenError"));
- uint i = 1;
- foreach(string error in _mediator.Errors)
+ // Check if there is an error of protocol not supported...
+ // As the message can be localized, just check the initial unlocalized part of the
+ // message. If it is an error other than protocol error, when connecting using
+ // version 2.0 we shall catch the error again.
+ if (((String)_mediator.Errors[0]).StartsWith("FATAL"))
{
- sw.WriteLine("{0}. {1}", i++, error);
+ // Try using the 2.0 protocol.
+ _mediator.Reset();
+ CurrentState = NpgsqlClosedState.Instance;
+ BackendProtocolVersion = ProtocolVersion.Version2;
+ CurrentState.Open(this);
+ }
+
+ // Keep checking for errors...
+ if(_mediator.Errors.Count > 0)
+ {
+ StringWriter sw = new StringWriter();
+ sw.WriteLine(resman.GetString("Exception_OpenError"));
+ uint i = 1;
+ foreach(string error in _mediator.Errors)
+ {
+ sw.WriteLine("{0}. {1}", i++, error);
+ }
+ CurrentState = NpgsqlClosedState.Instance;
+ _mediator.Reset();
+ throw new NpgsqlException(sw.ToString());
}
- CurrentState = NpgsqlClosedState.Instance;
- _mediator.Reset();
- throw new NpgsqlException(sw.ToString());
}
- }
-
- backend_keydata = _mediator.GetBackEndKeyData();
-
- // Change the state of connection to open.
- connection_state = ConnectionState.Open;
+
+ backend_keydata = _mediator.GetBackEndKeyData();
- // Get version information to enable/disable server version features.
- // Only for protocol 2.0.
- if (BackendProtocolVersion == ProtocolVersion.Version2)
- {
- NpgsqlCommand command = new NpgsqlCommand("select version();set DATESTYLE TO ISO;", this);
- _serverVersion = (String) command.ExecuteScalar();
+ // Get version information to enable/disable server version features.
+ // Only for protocol 2.0.
+ if (BackendProtocolVersion == ProtocolVersion.Version2)
+ {
+ NpgsqlCommand command = new NpgsqlCommand("select version();set DATESTYLE TO ISO;", this);
+ _serverVersion = (String) command.ExecuteScalar();
+ }
+
+ Connector.ServerVersion = ServerVersion;
+ Connector.BackendProtocolVersion = BackendProtocolVersion;
+
}
-
-
//NpgsqlCommand commandEncoding = new NpgsqlCommand("show client_encoding", this);
//String serverEncoding = (String)commandEncoding.ExecuteScalar();
//if (serverEncoding.Equals("UNICODE"))
// connection_encoding = Encoding.UTF8;
-
-
-
+
+
+ // Connector was obtained from pool.
+ // Do a mini initialization in the state machine.
+
+ connection_state = ConnectionState.Open;
+ ServerVersion = Connector.ServerVersion;
+ BackendProtocolVersion = Connector.BackendProtocolVersion;
+ CurrentState = NpgsqlReadyState.Instance;
+
ProcessServerVersion();
_oidToNameMapping = NpgsqlTypesHelper.LoadTypesMapping(this);
-
-
}
-
-
-
-
catch(IOException e)
{
// This exception was thrown by StartupPacket handling functions.
@@ -450,26 +467,8 @@ namespace Npgsql
/// </summary>
public void Close()
{
- NpgsqlEventLog.LogMethodEnter(LogLevel.Debug, CLASSNAME, "Close");
-
- try
- {
- if ((connection_state == ConnectionState.Open))
- {
- CurrentState.Close(this);
- }
- }
- catch (IOException e)
- {
- throw new NpgsqlException(resman.GetString("Exception_CloseError"), e);
- }
- finally
- {
- // Even if an exception occurs, let object in a consistent state.
- if (stream != null)
- stream.Close();
- connection_state = ConnectionState.Closed;
- }
+ Dispose(true);
+
}
/// <summary>
@@ -503,12 +502,32 @@ namespace Npgsql
/// <b>false</b> to release only unmanaged resources.</param>
protected override void Dispose(bool disposing)
{
- NpgsqlEventLog.LogMethodEnter(LogLevel.Debug, CLASSNAME, "Dispose", disposing);
- if (disposing == true)
+ if (disposing)
{
- if (this.connection_state == ConnectionState.Open)
- this.Close();
- this.connection_string = null;
+ // Only if explicitly calling Close or dispose we still have access to
+ // managed resources.
+ NpgsqlEventLog.LogMethodEnter(LogLevel.Debug, CLASSNAME, "Dispose", disposing);
+
+ try
+ {
+ if ((connection_state == ConnectionState.Open))
+ {
+ CurrentState.Close(this);
+ }
+
+ }
+ catch (IOException e)
+ {
+ throw new NpgsqlException(resman.GetString("Exception_CloseError"), e);
+ }
+ finally
+ {
+ // Even if an exception occurs, let object in a consistent state.
+ /*if (stream != null)
+ stream.Close();*/
+ connection_state = ConnectionState.Closed;
+ }
+
}
base.Dispose (disposing);
}
@@ -524,6 +543,8 @@ namespace Npgsql
/// Database - Database name. Defaults to user name if not specified
/// User - User name
/// Password - Password for clear text authentication
+ /// MinPoolSize - Min size of connection pool
+ /// MaxPoolSize - Max size of connection pool
/// </summary>
private void ParseConnectionString()
{
@@ -572,28 +593,45 @@ namespace Npgsql
private void ProcessServerVersion ()
{
NpgsqlEventLog.LogMethodEnter(LogLevel.Debug, CLASSNAME, "ProcessServerVersion");
+ // FIXME: Do a better parsing of server version to avoid
+ // hardcode version numbers.
if (BackendProtocolVersion == ProtocolVersion.Version2)
{
+ // With protocol version 2, only 7.3 version supports prepare.
SupportsPrepare = (_serverVersion.IndexOf("PostgreSQL 7.3") != -1);
}
else
{
// 3.0+ version is set by ParameterStatus message.
- SupportsPrepare = (_serverVersion.IndexOf("7.4") != -1);
+ // On protocol 3.0, 7.4 and above support it.
+ SupportsPrepare = (_serverVersion.IndexOf("7.4") != -1)
+ || (_serverVersion.IndexOf("7.5") != -1);
}
}
internal Stream Stream {
get
{
- return stream;
+ return _connector.Stream;
}
set
{
stream = value;
}
}
+
+ internal Connector Connector
+ {
+ get
+ {
+ return _connector;
+ }
+ set
+ {
+ _connector = value;
+ }
+ }
/*
public bool useSSL()
@@ -779,6 +817,20 @@ namespace Npgsql
_backendProtocolVersion = value;
}
}
+
+ internal Int32 MinPoolSize {
+ get
+ {
+ return Int32.Parse((String)connection_string_values[MIN_POOL_SIZE]);
+ }
+ }
+
+ internal Int32 MaxPoolSize {
+ get
+ {
+ return Int32.Parse((String)connection_string_values[MAX_POOL_SIZE]);
+ }
+ }
}
diff --git a/mcs/class/Npgsql/Npgsql/NpgsqlConnector.cs b/mcs/class/Npgsql/Npgsql/NpgsqlConnector.cs
index 2bb4a9b7320..4affc8917e3 100755
--- a/mcs/class/Npgsql/Npgsql/NpgsqlConnector.cs
+++ b/mcs/class/Npgsql/Npgsql/NpgsqlConnector.cs
@@ -25,24 +25,14 @@
using System;
using System.Net.Sockets;
+using System.IO;
namespace Npgsql
{
/// <summary>
/// !!! Helper class, for compilation only.
/// </summary>
- internal class Socket
- {
- internal void Open()
- {
- return;
- }
- internal void Close()
- {
- return;
- }
- }
-
+
/// <summary>
/// Connector implements the logic for the Connection Objects to
/// access the physical connection to the database, and isolate
@@ -51,7 +41,22 @@ namespace Npgsql
internal class Connector
{
/// <value>Buffer for the public Pooled property</value>
- private bool mPooled;
+ private Boolean _inUse;
+
+
+ private Stream _stream;
+
+ // This is information about the connection
+ // this connector is holding. For while only the server version is used.
+ // Change later for a more generic way to keep it. (Hashtable)
+ private String _serverVersion;
+
+ private Int32 _backendProtocolVersion;
+
+ private Boolean _isInitialized;
+
+ private Boolean mPooled;
+ private Boolean mOpen;
/// <value>Chain references for implementing a double linked
/// list</value>
@@ -79,6 +84,54 @@ namespace Npgsql
this.mPooled = value;
}
}
+
+ internal String ServerVersion
+ {
+ get
+ {
+ return _serverVersion;
+ }
+
+ set
+ {
+ _serverVersion = value;
+ }
+ }
+
+ internal Int32 BackendProtocolVersion
+ {
+ get
+ {
+ return _backendProtocolVersion;
+ }
+
+ set
+ {
+ _backendProtocolVersion = value;
+ }
+ }
+
+ internal Stream Stream {
+ get
+ {
+ return _stream;
+ }
+ set
+ {
+ _stream = value;
+ _isInitialized = true;
+ }
+ }
+
+ internal Boolean IsInitialized
+ {
+ get
+ {
+ return _isInitialized;
+ }
+
+ }
+
/// <value>Buffer for the public Shared property</value>
private bool mShared;
@@ -132,17 +185,16 @@ namespace Npgsql
/// <value>Provides physical access to the server</value>
// !!! to be fixed
- private Npgsql.Socket Socket;
-
- /// <value>True if the physical connection is open.</value>
- private bool mOpen;
+ //private Npgsql.Socket Socket;
+
/// <summary>
/// Default constructor. Creates a pooled Connector by default.
/// </summary>
public Connector()
{
- this.Pooled = true;
+ Pooled = true;
+ _isInitialized = false;
}
/// <summary>
@@ -150,9 +202,9 @@ namespace Npgsql
/// </summary>
internal Connector( string ConnectString, bool Shared )
{
- this.ConnectString = ConnectString;
- this.Shared = Shared;
- this.Pooled = true;
+ ConnectString = ConnectString;
+ Shared = Shared;
+ Pooled = true;
}
/// <summary>
@@ -162,9 +214,22 @@ namespace Npgsql
/// Method of the connection pool manager.</remarks>
internal void Open()
{
- this.Socket = new Npgsql.Socket();
- this.Socket.Open(); // !!! to be fixed
- this.mOpen = true;
+ //this.Socket = new Npgsql.Socket();
+ //this.Socket.Open(); // !!! to be fixed
+ //this.mOpen = true;
+ }
+
+
+ internal Boolean InUse {
+ get
+ {
+ return _inUse;
+ }
+ set
+ {
+ _inUse = value;
+ }
+
}
/// <summary>
@@ -175,7 +240,7 @@ namespace Npgsql
/// evaluation inside this method, so they are left in their current state.
/// They get new meaning again when the connector is requested from the
/// pool manager later. </remarks>
- public void Release()
+ /*public void Release()
{
if ( this.mShared )
{
@@ -207,9 +272,9 @@ namespace Npgsql
// Instead they are (implicitly) handed over to the
// garbage collection.
// !!! to be fixed
- this.Socket.Close();
+ //this.Socket.Close();
}
}
- }
+ }*/
}
}
diff --git a/mcs/class/Npgsql/Npgsql/NpgsqlConnectorPool.cs b/mcs/class/Npgsql/Npgsql/NpgsqlConnectorPool.cs
index 402e610f763..4eb20332ad3 100755
--- a/mcs/class/Npgsql/Npgsql/NpgsqlConnectorPool.cs
+++ b/mcs/class/Npgsql/Npgsql/NpgsqlConnectorPool.cs
@@ -22,6 +22,7 @@
// 0.00.0000 - 06/17/2002 - ulrich sprick - creation
using System;
+using System.Collections;
using Npgsql;
namespace Npgsql
@@ -31,11 +32,18 @@ namespace Npgsql
/// <value>Unique static instance of the connector pool
/// mamager.</value>
internal static ConnectorPool ConnectorPoolMgr = new Npgsql.ConnectorPool();
+
+ public ConnectorPool()
+ {
+ PooledConnectors = new Hashtable();
+ }
+
- /// <value>List of unused, pooled connectors avaliable to the
+ /// <value>Map of index to unused pooled connectors, avaliable to the
/// next RequestConnector() call.</value>
- /// <remarks>Points to the head of a double linked list</remarks>
- internal Npgsql.Connector PooledConnectors;
+ /// <remarks>This hasmap will be indexed by connection string.
+ /// This key will hold a list of the pooled connectors available to be used.</remarks>
+ internal Hashtable PooledConnectors;
/// <value>List of used, shared conncetors.</value>
/// <remarks>Points to the head of a double linked list</remarks>
@@ -81,7 +89,7 @@ namespace Npgsql
/// Inserts a connector at the head of a pooled connector list.
/// </summary>
/// <param name="Connector">The connctor to be inserted</param>
- internal void InsertPooledConnector( Npgsql.Connector Connector )
+ /*internal void InsertPooledConnector( Npgsql.Connector Connector )
{
if ( this.PooledConnectors == null ) // the list is empty
{
@@ -97,6 +105,18 @@ namespace Npgsql
}
// point the list to the new head
this.PooledConnectors = Connector;
+ }*/
+
+
+ internal Int32 GetPoolSize(String connectionString)
+ {
+ ArrayList pool = (ArrayList)PooledConnectors[connectionString];
+ if (pool == null)
+ return 0;
+ else
+ return pool.Count;
+
+
}
/// <summary>
@@ -108,67 +128,69 @@ namespace Npgsql
/// <param name="Shared">Allows multiple connections
/// on a single connector. </param>
/// <returns>A pooled connector object.</returns>
- internal Npgsql.Connector RequestConnector ( string ConnectString,
+ internal Npgsql.Connector RequestConnector ( String connectionString,
bool Shared )
{
- Npgsql.Connector Connector;
+ Connector connector;
+ ArrayList connectorPool = null;
if ( Shared )
{
// if a shared connector is requested then the
// Shared Connector List is searched first
- for ( Connector = Npgsql.ConnectorPool.ConnectorPoolMgr.SharedConnectors;
+ /*for ( Connector = Npgsql.ConnectorPool.ConnectorPoolMgr.SharedConnectors;
Connector != null; Connector = Connector.Next )
{
- if ( Connector.ConnectString == ConnectString )
+ if ( Connector.ConnectString == connectionString )
{ // Bingo!
// Return the shared connector to caller
Connector.mShareCount++;
return Connector;
}
- }
+ }*/
+
+ return null;
}
else
{
// if a shared connector could not be found or a
// nonshared connector is requested, then the pooled
// (unused) connectors are beeing searched.
-
- for ( Connector = Npgsql.ConnectorPool.ConnectorPoolMgr.PooledConnectors;
- Connector != null; Connector = Connector.Next )
+
+
+ connectorPool = (ArrayList)PooledConnectors[connectionString];
+
+ if (connectorPool == null)
{
- if ( Connector.ConnectString == ConnectString )
- { // Bingo!
- // Remove the Connector from the pooled connectors list.
- this.CutOutConnector( Connector );
- }
- Connector.Shared = Shared;
- if ( Shared )
- {
- // Shared Connectors are then put in the shared
- // connectors list in order to be used by
- // additional clients.
- this.InsertSharedConnector( Connector );
- Connector.mShareCount++;
- }
- // done...
- return Connector;
+ connectorPool = new ArrayList();
+ PooledConnectors[connectionString] = connectorPool;
}
- }
+
+
+ // Now look for an available connector.
+
+
+ foreach (Connector c in connectorPool)
+ {
+ if (!c.InUse)
+ return c;
+ }
+
+ // No suitable connector could be found, so create new one
+ connector = new Npgsql.Connector( connectionString, Shared );
- // No suitable connector could be found, so create new one
- Connector = new Npgsql.Connector( ConnectString, Shared );
+ connectorPool.Add(connector);
+
- // Shared connections are added to the shared connectors list
- if ( Shared )
- {
- this.InsertSharedConnector( Connector );
- Connector.mShareCount++;
+ // and then returned to the caller
+ return connector;
+
+
+
}
- // and then returned to the caller
- return Connector;
+
}
}
}
diff --git a/mcs/class/Npgsql/Npgsql/NpgsqlDataReader.cs b/mcs/class/Npgsql/Npgsql/NpgsqlDataReader.cs
index b1459c050b2..3812e984e06 100755
--- a/mcs/class/Npgsql/Npgsql/NpgsqlDataReader.cs
+++ b/mcs/class/Npgsql/Npgsql/NpgsqlDataReader.cs
@@ -243,8 +243,10 @@ namespace Npgsql
CheckCanRead();
- if (i < 0 || _rowIndex < 0)
- throw new InvalidOperationException("Cannot read data.");
+ if (i < 0)
+ throw new InvalidOperationException("Cannot read data. Column less than 0 specified.");
+ if (_rowIndex < 0)
+ throw new InvalidOperationException("Cannot read data. DataReader not initialized. Maybe you forgot to call Read()?");
return ((NpgsqlAsciiRow)_currentResultset[_rowIndex])[i];
diff --git a/mcs/class/Npgsql/Npgsql/NpgsqlEventLog.cs b/mcs/class/Npgsql/Npgsql/NpgsqlEventLog.cs
index 9df92da4f3c..cfaa0762876 100755
--- a/mcs/class/Npgsql/Npgsql/NpgsqlEventLog.cs
+++ b/mcs/class/Npgsql/Npgsql/NpgsqlEventLog.cs
@@ -146,7 +146,7 @@ namespace Npgsql
{
Console.WriteLine(message);
}
-
+
if (logfile != null)
{
if (logfile != "")
diff --git a/mcs/class/Npgsql/Npgsql/NpgsqlState.cs b/mcs/class/Npgsql/Npgsql/NpgsqlState.cs
index af6d7881fdc..fe61e619cda 100755
--- a/mcs/class/Npgsql/Npgsql/NpgsqlState.cs
+++ b/mcs/class/Npgsql/Npgsql/NpgsqlState.cs
@@ -46,27 +46,49 @@ namespace Npgsql
protected ResourceManager resman = null;
public virtual void Open(NpgsqlConnection context)
- {}
+ {
+ throw new InvalidOperationException("Internal Error! " + this);
+ }
public virtual void Startup(NpgsqlConnection context)
- {}
+ {
+ throw new InvalidOperationException("Internal Error! " + this);
+ }
public virtual void Authenticate(NpgsqlConnection context, string password)
- {}
+ {
+ throw new InvalidOperationException("Internal Error! " + this);
+ }
public virtual void Query(NpgsqlConnection context, NpgsqlCommand command)
- {}
+ {
+ throw new InvalidOperationException("Internal Error! " + this);
+ }
public virtual void Ready( NpgsqlConnection context )
- {}
+ {
+ throw new InvalidOperationException("Internal Error! " + this);
+ }
public virtual void FunctionCall(NpgsqlConnection context, NpgsqlCommand command)
- {}
+ {
+ throw new InvalidOperationException("Internal Error! " + this);
+ }
public virtual void Parse(NpgsqlConnection context, NpgsqlParse parse)
- {}
+ {
+ throw new InvalidOperationException("Internal Error! " + this);
+ }
public virtual void Flush(NpgsqlConnection context)
- {}
+ {
+ throw new InvalidOperationException("Internal Error! " + this);
+ }
public virtual void Sync(NpgsqlConnection context)
- {}
+ {
+ throw new InvalidOperationException("Internal Error! " + this);
+ }
public virtual void Bind(NpgsqlConnection context, NpgsqlBind bind)
- {}
+ {
+ throw new InvalidOperationException("Internal Error! " + this);
+ }
public virtual void Execute(NpgsqlConnection context, NpgsqlExecute execute)
- {}
+ {
+ throw new InvalidOperationException("Internal Error! " + this);
+ }
public NpgsqlState()
{
@@ -75,7 +97,7 @@ namespace Npgsql
public virtual void Close( NpgsqlConnection context )
{
- NpgsqlEventLog.LogMethodEnter(LogLevel.Debug, CLASSNAME, "Close");
+ /*NpgsqlEventLog.LogMethodEnter(LogLevel.Debug, CLASSNAME, "Close");
if ( context.State == ConnectionState.Open )
{
Stream stream = context.Stream;
@@ -86,8 +108,11 @@ namespace Npgsql
PGUtil.WriteInt32(stream, 4);
stream.Flush();
}
- }
- ChangeState( context, NpgsqlClosedState.Instance );
+ }*/
+
+ context.Connector.InUse = false;
+ context.Connector = null;
+ //ChangeState( context, NpgsqlClosedState.Instance );
}
///<summary> This method is used by the states to change the state of the context.
diff --git a/mcs/class/Npgsql/NpgsqlTypes/NpgsqlTypesHelper.cs b/mcs/class/Npgsql/NpgsqlTypes/NpgsqlTypesHelper.cs
index 71e9a6782ca..ef5a4da39b2 100755
--- a/mcs/class/Npgsql/NpgsqlTypes/NpgsqlTypesHelper.cs
+++ b/mcs/class/Npgsql/NpgsqlTypes/NpgsqlTypesHelper.cs
@@ -181,6 +181,7 @@ namespace NpgsqlTypes
case DbType.String:
case DbType.AnsiString:
+ case DbType.StringFixedLength:
return "'" + parameter.Value.ToString().Replace("'", "\\'") + "'";
case DbType.Time:
@@ -246,7 +247,7 @@ namespace NpgsqlTypes
// Get the date time parsed in all expected formats for timestamp.
return DateTime.ParseExact(data,
- new String[] {"yyyy-MM-dd HH:mm:ss.fff", "yyyy-MM-dd HH:mm:ss.ff", "yyyy-MM-dd HH:mm:ss.f", "yyyy-MM-dd HH:mm:ss"},
+ new String[] {"yyyy-MM-dd HH:mm:ss.ffffff", "yyyy-MM-dd HH:mm:ss.fffff", "yyyy-MM-dd HH:mm:ss.ffff", "yyyy-MM-dd HH:mm:ss.fff", "yyyy-MM-dd HH:mm:ss.ff", "yyyy-MM-dd HH:mm:ss.f", "yyyy-MM-dd HH:mm:ss"},
DateTimeFormatInfo.InvariantInfo,
DateTimeStyles.NoCurrentDateDefault | DateTimeStyles.AllowWhiteSpaces);
@@ -484,18 +485,17 @@ namespace NpgsqlTypes
private static String ConvertByteArrayToBytea(Byte[] byteArray)
{
NpgsqlEventLog.LogMethodEnter(LogLevel.Debug, CLASSNAME, "ConvertByteArrayToBytea");
- Int32 len = byteArray.Length;
- Char[] res = new Char [len * 5];
- for (Int32 i = 0; i <len; i++)
+ int len = byteArray.Length;
+ char[] res = new char[len * 5];
+ for (int i=0, o=0; i<len; ++i, o += 5)
{
- res [(i*5)] = '\\';
- res [(i*5)+1] = '\\';
- res [(i*5)+2] = (Char) (((byteArray[i] & 0xC0) >> 6) + '0');
- res [(i*5)+3] = (Char) (((byteArray[i] & 0x38) >> 3) + '0');
- res [(i*5)+4] = (Char) ((byteArray[i] & 0x07) + '0');
+ byte item = byteArray[i];
+ res[o] = res[o + 1] = '\\';
+ res[o + 2] = (char)('0' + (7 & (item >> 6)));
+ res[o + 3] = (char)('0' + (7 & (item >> 3)));
+ res[o + 4] = (char)('0' + (7 & item));
}
-
- return new String (res);
+ return new String(res);
}
}
diff --git a/mcs/class/Npgsql/Npgsql_test.dll.sources b/mcs/class/Npgsql/Npgsql_test.dll.sources
index b15313ab058..58edd111554 100644
--- a/mcs/class/Npgsql/Npgsql_test.dll.sources
+++ b/mcs/class/Npgsql/Npgsql_test.dll.sources
@@ -1,2 +1,4 @@
CommandTests.cs
ConnectionTests.cs
+DataAdapterTests.cs
+DataReaderTests.cs
diff --git a/mcs/class/Npgsql/Test/CommandTests.cs b/mcs/class/Npgsql/Test/CommandTests.cs
index 0600ce395f6..963b6b3ca2e 100755
--- a/mcs/class/Npgsql/Test/CommandTests.cs
+++ b/mcs/class/Npgsql/Test/CommandTests.cs
@@ -35,14 +35,14 @@ namespace NpgsqlTests
public class CommandTests
{
private NpgsqlConnection _conn = null;
- private String _connString = "Server=localhost;User ID=npgsql_tests;Password=npgsql_tests;Database=npgsql_tests";
+ private String _connString = "Server=localhost;User ID=npgsql_tests;Password=npgsql_tests;Database=npgsql_tests;SSL=yes";
[SetUp]
protected void SetUp()
{
- NpgsqlEventLog.Level = LogLevel.None;
- //NpgsqlEventLog.Level = LogLevel.Debug;
- //NpgsqlEventLog.LogName = "NpgsqlTests.LogFile";
+ //NpgsqlEventLog.Level = LogLevel.None;
+ NpgsqlEventLog.Level = LogLevel.Debug;
+ NpgsqlEventLog.LogName = "NpgsqlTests.LogFile";
_conn = new NpgsqlConnection(_connString);
}
@@ -321,7 +321,7 @@ namespace NpgsqlTests
NpgsqlCommand command = new NpgsqlCommand("listen notifytest;", _conn);
command.ExecuteNonQuery();
- _conn.OnNotification += new NotificationEventHandler(NotificationSupportHelper);
+ _conn.Notification += new NotificationEventHandler(NotificationSupportHelper);
command = new NpgsqlCommand("notify notifytest;", _conn);
@@ -417,6 +417,72 @@ namespace NpgsqlTests
}
[Test]
+ public void InsertSingleValue()
+ {
+ _conn.Open();
+
+
+ NpgsqlCommand command = new NpgsqlCommand("insert into tabled(field_float4) values (:a)", _conn);
+ command.Parameters.Add(new NpgsqlParameter(":a", DbType.Single));
+
+ command.Parameters[0].Value = 7.4F;
+
+ Int32 rowsAdded = command.ExecuteNonQuery();
+
+ Assertion.AssertEquals(1, rowsAdded);
+
+ command.CommandText = "select * from tabled where field_float4 = :a";
+
+
+ NpgsqlDataReader dr = command.ExecuteReader();
+ dr.Read();
+
+ Single result = dr.GetFloat(1);
+
+
+ command.CommandText = "delete from tabled where field_serial > 2;";
+ command.Parameters.Clear();
+ command.ExecuteNonQuery();
+
+
+ Assertion.AssertEquals(7.4F, result);
+
+ }
+
+ [Test]
+ public void InsertDoubleValue()
+ {
+ _conn.Open();
+
+
+ NpgsqlCommand command = new NpgsqlCommand("insert into tabled(field_float8) values (:a)", _conn);
+ command.Parameters.Add(new NpgsqlParameter(":a", DbType.Double));
+
+ command.Parameters[0].Value = 7.4D;
+
+ Int32 rowsAdded = command.ExecuteNonQuery();
+
+ Assertion.AssertEquals(1, rowsAdded);
+
+ command.CommandText = "select * from tabled where field_float8 = :a";
+
+
+ NpgsqlDataReader dr = command.ExecuteReader();
+ dr.Read();
+
+ Double result = dr.GetDouble(2);
+
+
+ command.CommandText = "delete from tabled where field_serial > 2;";
+ command.Parameters.Clear();
+ //command.ExecuteNonQuery();
+
+
+ Assertion.AssertEquals(7.4D, result);
+
+ }
+
+ [Test]
public void NegativeNumericSupport()
{
_conn.Open();
@@ -627,6 +693,33 @@ namespace NpgsqlTests
Assertion.AssertEquals(5, result);
}
+
+ [Test]
+ public void AnsiStringSupport()
+ {
+ _conn.Open();
+
+ NpgsqlCommand command = new NpgsqlCommand("insert into tablea(field_text) values (:a)", _conn);
+
+ command.Parameters.Add(new NpgsqlParameter("a", DbType.AnsiString));
+
+ command.Parameters[0].Value = "TesteAnsiString";
+
+ Int32 rowsAdded = command.ExecuteNonQuery();
+
+ Assertion.AssertEquals(1, rowsAdded);
+
+ command.CommandText = String.Format("select count(*) from tablea where field_text = '{0}'", command.Parameters[0].Value);
+ command.Parameters.Clear();
+
+ Object result = command.ExecuteScalar(); // The missed cast is needed as Server7.2 returns Int32 and Server7.3+ returns Int64
+
+ command.CommandText = "delete from tablea where field_serial = (select max(field_serial) from tablea);";
+ command.ExecuteNonQuery();
+
+ Assertion.AssertEquals(1, result);
+
+ }
diff --git a/mcs/class/Npgsql/Test/ConnectionTests.cs b/mcs/class/Npgsql/Test/ConnectionTests.cs
index 1d7696e4ef6..5348bb6b004 100755
--- a/mcs/class/Npgsql/Test/ConnectionTests.cs
+++ b/mcs/class/Npgsql/Test/ConnectionTests.cs
@@ -1,4 +1,26 @@
// project created on 30/11/2002 at 22:00
+//
+// Author:
+// Francisco Figueiredo Jr. <fxjrlists@yahoo.com>
+//
+// Copyright (C) 2002 The Npgsql Development Team
+// npgsql-general@gborg.postgresql.org
+// http://gborg.postgresql.org/project/npgsql/projdisplay.php
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
using System;
using Npgsql;
using System.Data;
@@ -19,8 +41,9 @@ namespace NpgsqlTests
[SetUp]
protected void SetUp()
{
- NpgsqlEventLog.Level = LogLevel.None;
- //NpgsqlEventLog.LogName = "NpgsqlTests.LogFile";
+ //NpgsqlEventLog.Level = LogLevel.None;
+ NpgsqlEventLog.Level = LogLevel.Debug;
+ NpgsqlEventLog.LogName = "NpgsqlTests.LogFile";
_conn = new NpgsqlConnection(_connString);
}
@@ -66,9 +89,21 @@ namespace NpgsqlTests
{
_conn.Open();
- NpgsqlTransaction t = _conn.BeginTransaction();
+ NpgsqlTransaction t = null;
+ try
+ {
+ t = _conn.BeginTransaction();
- t = _conn.BeginTransaction();
+ t = _conn.BeginTransaction();
+ }
+ catch(Exception e)
+ {
+ // Catch exception so we call rollback the transaction initiated.
+ // This way, the connection pool doesn't get a connection with a transaction
+ // started.
+ t.Rollback();
+ throw e;
+ }
}
diff --git a/mcs/class/Npgsql/Test/DataAdapterTests.cs b/mcs/class/Npgsql/Test/DataAdapterTests.cs
index a75ca1a86b7..85c28cc4806 100755
--- a/mcs/class/Npgsql/Test/DataAdapterTests.cs
+++ b/mcs/class/Npgsql/Test/DataAdapterTests.cs
@@ -1,4 +1,26 @@
// created on 3/5/2003 at 14:29
+//
+// Author:
+// Francisco Figueiredo Jr. <fxjrlists@yahoo.com>
+//
+// Copyright (C) 2002 The Npgsql Development Team
+// npgsql-general@gborg.postgresql.org
+// http://gborg.postgresql.org/project/npgsql/projdisplay.php
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
using System;
using System.Data;
@@ -23,7 +45,8 @@ namespace NpgsqlTests
[SetUp]
protected void SetUp()
{
- NpgsqlEventLog.Level = LogLevel.Debug;
+ //NpgsqlEventLog.Level = LogLevel.None;
+ NpgsqlEventLog.Level = LogLevel.Debug;
NpgsqlEventLog.LogName = "NpgsqlTests.LogFile";
_conn = new NpgsqlConnection(_connString);
}
@@ -94,5 +117,39 @@ namespace NpgsqlTests
}
+
+ [Test]
+ public void FillWithEmptyResultset()
+ {
+
+ _conn.Open();
+
+ DataSet ds = new DataSet();
+
+ NpgsqlDataAdapter da = new NpgsqlDataAdapter("select * from tableb where field_serial = -1", _conn);
+
+
+ da.Fill(ds);
+
+ Assertion.AssertEquals(1, ds.Tables.Count);
+ Assertion.AssertEquals(4, ds.Tables[0].Columns.Count);
+ Assertion.AssertEquals("field_serial", ds.Tables[0].Columns[0].ColumnName);
+ Assertion.AssertEquals("field_int2", ds.Tables[0].Columns[1].ColumnName);
+ Assertion.AssertEquals("field_timestamp", ds.Tables[0].Columns[2].ColumnName);
+ Assertion.AssertEquals("field_numeric", ds.Tables[0].Columns[3].ColumnName);
+
+ }
+
+ [Test]
+ public void FillWithDuplicateColumnName()
+ {
+ _conn.Open();
+ DataSet ds = new DataSet();
+
+ NpgsqlDataAdapter da = new NpgsqlDataAdapter("select field_serial, field_serial from tableb", _conn);
+
+ da.Fill(ds);
+
+ }
}
}
diff --git a/mcs/class/Npgsql/Test/DataReaderTests.cs b/mcs/class/Npgsql/Test/DataReaderTests.cs
index a435ec03a1c..4fc9a4e4866 100755
--- a/mcs/class/Npgsql/Test/DataReaderTests.cs
+++ b/mcs/class/Npgsql/Test/DataReaderTests.cs
@@ -42,9 +42,9 @@ namespace NpgsqlTests
[SetUp]
protected void SetUp()
{
- NpgsqlEventLog.Level = LogLevel.None;
- //NpgsqlEventLog.Level = LogLevel.Debug;
- //NpgsqlEventLog.LogName = "NpgsqlTests.LogFile";
+ //NpgsqlEventLog.Level = LogLevel.None;
+ NpgsqlEventLog.Level = LogLevel.Debug;
+ NpgsqlEventLog.LogName = "NpgsqlTests.LogFile";
_conn = new NpgsqlConnection(_connString);
}
@@ -155,15 +155,16 @@ namespace NpgsqlTests
public void GetDouble()
{
_conn.Open();
- NpgsqlCommand command = new NpgsqlCommand("select * from tablea where field_serial = 2;", _conn);
+ NpgsqlCommand command = new NpgsqlCommand("select * from tabled where field_serial = 2;", _conn);
NpgsqlDataReader dr = command.ExecuteReader();
dr.Read();
- Double result = Double.Parse(dr.GetInt32(2).ToString());
+ //Double result = Double.Parse(dr.GetInt32(2).ToString());
+ Double result = dr.GetDouble(2);
- Assertion.AssertEquals(4, result);
+ Assertion.AssertEquals(.123456789012345D, result);
}
@@ -172,15 +173,16 @@ namespace NpgsqlTests
public void GetFloat()
{
_conn.Open();
- NpgsqlCommand command = new NpgsqlCommand("select * from tablea where field_serial = 2;", _conn);
+ NpgsqlCommand command = new NpgsqlCommand("select * from tabled where field_serial = 1;", _conn);
NpgsqlDataReader dr = command.ExecuteReader();
dr.Read();
- Single result = Single.Parse(dr.GetInt32(2).ToString());
+ //Single result = Single.Parse(dr.GetInt32(2).ToString());
+ Single result = dr.GetFloat(1);
- Assertion.AssertEquals(4, result);
+ Assertion.AssertEquals(.123456F, result);
}
diff --git a/mcs/class/System.Configuration.Install/.cvsignore b/mcs/class/System.Configuration.Install/.cvsignore
index 0c2ee6906fa..eb59615ea9a 100644
--- a/mcs/class/System.Configuration.Install/.cvsignore
+++ b/mcs/class/System.Configuration.Install/.cvsignore
@@ -1,3 +1,5 @@
+System.Configuration.Install_test.dll
+System.Configuration.Install_test.pdb
list
.makefrag
.response
diff --git a/mcs/class/System.Data.ObjectSpaces/System.Data.ObjectSpaces/ChangeLog b/mcs/class/System.Data.ObjectSpaces/System.Data.ObjectSpaces/ChangeLog
new file mode 100644
index 00000000000..25d1dc08e02
--- /dev/null
+++ b/mcs/class/System.Data.ObjectSpaces/System.Data.ObjectSpaces/ChangeLog
@@ -0,0 +1,6 @@
+2004-01-02 Tim Coleman <tim@timcoleman.com>
+ * ChangeLog:
+ Start ChangeLog in this directory
+ * DynamicAssembly.cs ObjectList.cs ObjectReader.cs ObjectSet.cs
+ * ObjectSources.cs PersistenceError.cs PersistenceOptions.cs:
+ More implementation of these classes
diff --git a/mcs/class/System.Data.ObjectSpaces/System.Data.ObjectSpaces/DynamicAssembly.cs b/mcs/class/System.Data.ObjectSpaces/System.Data.ObjectSpaces/DynamicAssembly.cs
index 3c0209d3566..c73089a0653 100755
--- a/mcs/class/System.Data.ObjectSpaces/System.Data.ObjectSpaces/DynamicAssembly.cs
+++ b/mcs/class/System.Data.ObjectSpaces/System.Data.ObjectSpaces/DynamicAssembly.cs
@@ -3,8 +3,10 @@
//
// Author:
// Mark Easton (mark.easton@blinksoftware.co.uk)
+// Tim Coleman (tim@timcoleman.com)
//
// (C) BLiNK Software Ltd. http://www.blinksoftware.co.uk
+// Copyright (C) Tim Coleman, 2003-2004
//
#if NET_1_2
@@ -18,17 +20,19 @@ namespace System.Data.ObjectSpaces
public class DynamicAssembly
{
private Type type; //The underlying type
-
protected FieldInfo fInfo;
protected PropertyInfo pInfo;
-
+
[MonoTODO]
protected DynamicAssembly (Type type)
{
- this.type = type;
+ ConstructorInfo ci = type.GetConstructor (Type.EmptyTypes);
+ if (ci == null)
+ throw new ObjectException (String.Format ("Cannot find suitable constructor in type '{0}'", type.FullName));
+ this.type = type;
}
-
- public Type UnderLyingType {
+
+ public Type UnderlyingType {
get { return this.type; }
}
@@ -42,6 +46,11 @@ namespace System.Data.ObjectSpaces
return null;
}
+ internal static DynamicAssembly GetDynamicAssembly (Type type)
+ {
+ return new DynamicAssembly (type);
+ }
+
[MonoTODO]
public FieldInfo[] GetFields()
{
diff --git a/mcs/class/System.Data.ObjectSpaces/System.Data.ObjectSpaces/ObjectList.cs b/mcs/class/System.Data.ObjectSpaces/System.Data.ObjectSpaces/ObjectList.cs
index 001a0a8091f..7ba921441b7 100755
--- a/mcs/class/System.Data.ObjectSpaces/System.Data.ObjectSpaces/ObjectList.cs
+++ b/mcs/class/System.Data.ObjectSpaces/System.Data.ObjectSpaces/ObjectList.cs
@@ -6,104 +6,138 @@
// Tim Coleman (tim@timcoleman.com)
//
// (C) BLiNK Software Ltd. http://www.blinksoftware.co.uk
-// Copyright (C) Tim Coleman, 2003
+// Copyright (C) Tim Coleman, 2003-2004
//
#if NET_1_2
using System.Collections;
+using System.Reflection;
namespace System.Data.ObjectSpaces
{
[MonoTODO]
public class ObjectList : ICollection, IEnumerable, IList
{
-
- [MonoTODO]
- public ObjectList () : this (typeof (ArrayList), null) {}
+ #region Fields
+
+ IList list;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public ObjectList ()
+ : this (typeof (ArrayList), null)
+ {
+ }
- [MonoTODO]
public ObjectList (Type type, object[] parameters)
{
- if (type == null || !(type is IList))
+ if (type == null)
+ throw new ObjectException ();
+
+ bool isIList = false;
+ foreach (Type t in type.GetInterfaces ())
+ if (t.Equals (typeof (IList))) {
+ isIList = true;
+ break;
+ }
+
+ if (!isIList)
throw new ObjectException ();
+
+ Type[] types = Type.EmptyTypes;
+ if (parameters != null)
+ types = Type.GetTypeArray (parameters);
+
+ ConstructorInfo ci = type.GetConstructor (types);
+ list = (IList) ci.Invoke (parameters);
}
- [MonoTODO]
+ #endregion // Constructors
+
+ #region Properties
+
public int Count {
- get { return 0; }
+ get { return InnerList.Count; }
}
- [MonoTODO]
- bool ICollection.IsSynchronized {
- get { throw new NotImplementedException (); }
+ bool ICollection.IsSynchronized {
+ get { return InnerList.IsSynchronized; }
}
- [MonoTODO]
object ICollection.SyncRoot {
- get { throw new NotImplementedException (); }
+ get { return InnerList.SyncRoot; }
}
- [MonoTODO]
public IList InnerList {
- get { return null; }
+ get { return list; }
}
- [MonoTODO]
public bool IsFixedSize {
- get { return false; }
+ get { return InnerList.IsFixedSize; }
}
- [MonoTODO]
public bool IsReadOnly {
- get { return false; }
+ get { return InnerList.IsReadOnly; }
}
- [MonoTODO]
- public object this[int index] {
- get { throw new NotImplementedException (); }
- set { throw new NotImplementedException (); }
+ public object this [int index] {
+ get { return InnerList [index]; }
+ set { InnerList [index] = value; }
}
+
+ #endregion // Properties
+
+ #region Methods
- [MonoTODO]
public int Add (object value)
{
- return 0;
+ return InnerList.Add (value);
}
- [MonoTODO]
- public void Clear () {}
+ public void Clear ()
+ {
+ InnerList.Clear ();
+ }
- [MonoTODO]
public bool Contains (object value)
{
- return false;
+ return InnerList.Contains (value);
}
- [MonoTODO]
- public void CopyTo (Array array, int index) {}
-
+ public void CopyTo (Array array, int index)
+ {
+ InnerList.CopyTo (array, index);
+ }
- [MonoTODO]
public IEnumerator GetEnumerator ()
{
- return null;
+ return InnerList.GetEnumerator ();
}
- [MonoTODO]
public int IndexOf (object value)
{
- return 0;
+ return InnerList.IndexOf (value);
}
- [MonoTODO]
- public void Insert (int index, object value) {}
+ public void Insert (int index, object value)
+ {
+ InnerList.Insert (index, value);
+ }
- [MonoTODO]
- public void Remove (object value) {}
+ public void Remove (object value)
+ {
+ InnerList.Remove (value);
+ }
- [MonoTODO]
- public void RemoveAt (int index) {}
+ public void RemoveAt (int index)
+ {
+ InnerList.RemoveAt (index);
+ }
+
+ #endregion // Methods
}
}
diff --git a/mcs/class/System.Data.ObjectSpaces/System.Data.ObjectSpaces/ObjectReader.cs b/mcs/class/System.Data.ObjectSpaces/System.Data.ObjectSpaces/ObjectReader.cs
index d1f7a1348b6..734ce92b2b6 100755
--- a/mcs/class/System.Data.ObjectSpaces/System.Data.ObjectSpaces/ObjectReader.cs
+++ b/mcs/class/System.Data.ObjectSpaces/System.Data.ObjectSpaces/ObjectReader.cs
@@ -6,7 +6,7 @@
// Tim Coleman (tim@timcoleman.com)
//
// (C) BLiNK Software Ltd. http://www.blinksoftware.co.uk
-// Copyright (C) Tim Coleman, 2003
+// Copyright (C) Tim Coleman, 2003-2004
//
#if NET_1_2
@@ -17,12 +17,15 @@ namespace System.Data.ObjectSpaces
{
public abstract class ObjectReader : IDisposable, IEnumerable
{
- //Inform listeners when a ValueRecord is being merged
- public event ValueRecordMergeEventHandler ValueMerging;
-
+ #region Fields
+
bool isClosed = true;
bool disposed;
+ #endregion // Fields
+
+ #region Properties
+
[MonoTODO]
public object Current {
get { return null; }
@@ -54,6 +57,17 @@ namespace System.Data.ObjectSpaces
this.isClosed = true;
}
+ #endregion // Properties
+
+ #region Events and Delegates
+
+ //Inform listeners when a ValueRecord is being merged
+ public event ValueRecordMergeEventHandler ValueMerging;
+
+ #endregion // Events and Delegates
+
+ #region Methods
+
protected virtual void Dispose (bool disposing)
{
if (!disposed) {
@@ -89,6 +103,8 @@ namespace System.Data.ObjectSpaces
{
return false;
}
+
+ #endregion // Methods
}
}
diff --git a/mcs/class/System.Data.ObjectSpaces/System.Data.ObjectSpaces/ObjectSet.cs b/mcs/class/System.Data.ObjectSpaces/System.Data.ObjectSpaces/ObjectSet.cs
index 775fde1787e..07afafdcd5a 100755
--- a/mcs/class/System.Data.ObjectSpaces/System.Data.ObjectSpaces/ObjectSet.cs
+++ b/mcs/class/System.Data.ObjectSpaces/System.Data.ObjectSpaces/ObjectSet.cs
@@ -4,7 +4,7 @@
// Author:
// Tim Coleman (tim@timcoleman.com)
//
-// Copyright (C) Tim Coleman, 2003
+// Copyright (C) Tim Coleman, 2003-2004
//
#if NET_1_2
@@ -22,22 +22,24 @@ namespace System.Data.ObjectSpaces
{
#region Fields
+ DynamicAssembly da;
ObjectContext context;
+ ObjectSchema os;
#endregion // Fields
#region Constructors
- [MonoTODO]
public ObjectSet (Type t, ObjectSchema oschema)
{
- throw new NotImplementedException();
+ da = DynamicAssembly.GetDynamicAssembly (t);
+ os = oschema;
+ context = new CommonObjectContext (oschema);
}
- [MonoTODO]
public ObjectSet ()
+ : this (typeof (object), new ObjectSchema ())
{
- throw new NotImplementedException ();
}
#endregion // Constructors
@@ -46,8 +48,8 @@ namespace System.Data.ObjectSpaces
[MonoTODO]
public object this [int i] {
- get { throw new NotImplementedException(); }
- set { throw new NotImplementedException(); }
+ get { return InnerList [i]; }
+ set { InnerList [i] = value; }
}
[MonoTODO]
@@ -63,22 +65,28 @@ namespace System.Data.ObjectSpaces
#region Methods
- [MonoTODO]
public void Add (object o)
{
- throw new NotImplementedException ();
+ Type t = o.GetType ();
+ if (t != da.UnderlyingType)
+ throw new ObjectException (String.Format (Locale.GetText ("Wrong Object type '{0}' added to ObjectSet. ObjectSet type is '{1}'"), t.FullName, da.UnderlyingType.FullName));
+ context.Add (o, ObjectState.Inserted);
+ InnerList.Add (o);
}
- [MonoTODO]
public void Add (ICollection c)
{
- throw new NotImplementedException ();
+ foreach (object o in c)
+ Add (o);
}
- [MonoTODO]
public void Add (object o, ObjectState state)
{
- throw new NotImplementedException ();
+ Type t = o.GetType ();
+ if (t != da.UnderlyingType)
+ throw new ObjectException (String.Format (Locale.GetText ("Wrong Object type '{0}' added to ObjectSet. ObjectSet type is '{1}'"), t.FullName, da.UnderlyingType.FullName));
+ context.Add (o, state);
+ InnerList.Add (o);
}
[MonoTODO]
@@ -87,10 +95,9 @@ namespace System.Data.ObjectSpaces
throw new NotImplementedException ();
}
- [MonoTODO]
IList IListSource.GetList ()
{
- throw new NotImplementedException ();
+ return List;
}
[MonoTODO]
diff --git a/mcs/class/System.Data.ObjectSpaces/System.Data.ObjectSpaces/ObjectSources.cs b/mcs/class/System.Data.ObjectSpaces/System.Data.ObjectSpaces/ObjectSources.cs
index a6851c6429b..670c04c64b2 100755
--- a/mcs/class/System.Data.ObjectSpaces/System.Data.ObjectSpaces/ObjectSources.cs
+++ b/mcs/class/System.Data.ObjectSpaces/System.Data.ObjectSpaces/ObjectSources.cs
@@ -4,7 +4,7 @@
// Author:
// Tim Coleman (tim@timcoleman.com)
//
-// Copyright (C) Tim Coleman, 2003
+// Copyright (C) Tim Coleman, 2003-2004
//
#if NET_1_2
@@ -14,69 +14,64 @@ using System.Collections;
namespace System.Data.ObjectSpaces {
public class ObjectSources : IDataSources, IEnumerable
{
+ Hashtable table;
+
#region Constructors
public ObjectSources ()
{
+ table = new Hashtable ();
}
#endregion // Constructors
#region Properties
- [MonoTODO]
public int Count {
- get { throw new NotImplementedException (); }
+ get { return table.Count; }
}
public object this [string name] {
- get { throw new NotImplementedException (); }
+ get { return table [name]; }
}
#endregion // Properties
#region Methods
- [MonoTODO]
public void Add (string name, IDbConnection connection)
{
- throw new NotImplementedException ();
+ table.Add (name, connection);
}
- [MonoTODO]
public void Add (string name, IDbTransaction transaction)
{
- throw new NotImplementedException ();
+ table.Add (name, transaction);
}
- [MonoTODO]
public void Clear ()
{
- throw new NotImplementedException ();
+ table.Clear ();
}
- [MonoTODO]
public bool Contains (string name)
{
- throw new NotImplementedException ();
+ return table.Contains (name);
}
- [MonoTODO]
public void Remove (string name)
{
- throw new NotImplementedException ();
+ table.Remove (name);
}
- [MonoTODO]
public virtual IDictionaryEnumerator GetEnumerator ()
{
- throw new NotImplementedException ();
+ return table.GetEnumerator ();
}
- [MonoTODO]
IEnumerator IEnumerable.GetEnumerator ()
{
- throw new NotImplementedException ();
+ return GetEnumerator ();
}
#endregion // Methods
diff --git a/mcs/class/System.Data.ObjectSpaces/System.Data.ObjectSpaces/PersistenceError.cs b/mcs/class/System.Data.ObjectSpaces/System.Data.ObjectSpaces/PersistenceError.cs
index 9988d189004..c113e589b0d 100755
--- a/mcs/class/System.Data.ObjectSpaces/System.Data.ObjectSpaces/PersistenceError.cs
+++ b/mcs/class/System.Data.ObjectSpaces/System.Data.ObjectSpaces/PersistenceError.cs
@@ -4,7 +4,7 @@
// Author:
// Tim Coleman (tim@timcoleman.com)
//
-// Copyright (C) Tim Coleman, 2003
+// Copyright (C) Tim Coleman, 2003-2004
//
#if NET_1_2
@@ -12,21 +12,39 @@
namespace System.Data.ObjectSpaces {
public class PersistenceError
{
+ #region Fields
+
+ object errorObject;
+ PersistenceErrorType errorType;
+ Exception innerException;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ internal PersistenceError (object errorObject, PersistenceErrorType errorType, Exception innerException)
+ : base ()
+ {
+ this.errorObject = errorObject;
+ this.errorType = errorType;
+ this.innerException = innerException;
+ }
+
+ #endregion // Constructors
+
#region Properties
- [MonoTODO]
public object ErrorObject {
- get { throw new NotImplementedException (); }
+ get { return errorObject; }
}
- [MonoTODO]
public PersistenceErrorType ErrorType {
- get { throw new NotImplementedException (); }
+ get { return errorType; }
}
- [MonoTODO]
public Exception InnerException {
- get { throw new NotImplementedException (); }
+ get { return innerException; }
+
}
#endregion // Properties
diff --git a/mcs/class/System.Data.ObjectSpaces/System.Data.ObjectSpaces/PersistenceOptions.cs b/mcs/class/System.Data.ObjectSpaces/System.Data.ObjectSpaces/PersistenceOptions.cs
index b8350c2f817..b78b12f844f 100755
--- a/mcs/class/System.Data.ObjectSpaces/System.Data.ObjectSpaces/PersistenceOptions.cs
+++ b/mcs/class/System.Data.ObjectSpaces/System.Data.ObjectSpaces/PersistenceOptions.cs
@@ -4,7 +4,7 @@
// Author:
// Tim Coleman (tim@timcoleman.com)
//
-// Copyright (C) Tim Coleman, 2003
+// Copyright (C) Tim Coleman, 2003-2004
//
#if NET_1_2
@@ -12,25 +12,34 @@
namespace System.Data.ObjectSpaces {
public class PersistenceOptions
{
+ #region Fields
+
+ Depth depth;
+ PersistenceErrorBehavior errorBehavior;
+ static readonly PersistenceOptions DefaultPersistenceOptions = new PersistenceOptions ();
+
+ #endregion // Fields
+
#region Constructors
- [MonoTODO]
public PersistenceOptions (Depth depth, PersistenceErrorBehavior errorBehavior)
{
+ this.depth = depth;
+ this.errorBehavior = errorBehavior;
}
- [MonoTODO]
public PersistenceOptions (PersistenceErrorBehavior errorBehavior)
+ : this (Depth.ObjectGraph, errorBehavior)
{
}
- [MonoTODO]
public PersistenceOptions (Depth depth)
+ : this (depth, PersistenceErrorBehavior.ThrowAtFirstError)
{
}
- [MonoTODO]
public PersistenceOptions ()
+ : this (Depth.ObjectGraph, PersistenceErrorBehavior.ThrowAtFirstError)
{
}
@@ -38,19 +47,16 @@ namespace System.Data.ObjectSpaces {
#region Properties
- [MonoTODO]
public static PersistenceOptions Default {
- get { throw new NotImplementedException (); }
+ get { return DefaultPersistenceOptions; }
}
- [MonoTODO]
public Depth Depth {
- get { throw new NotImplementedException (); }
+ get { return depth; }
}
- [MonoTODO]
public PersistenceErrorBehavior ErrorBehavior {
- get { throw new NotImplementedException (); }
+ get { return errorBehavior; }
}
#endregion // Properties
diff --git a/mcs/class/System.Data.OracleClient/ChangeLog b/mcs/class/System.Data.OracleClient/ChangeLog
index b5cf9baf2df..7d001c03494 100755
--- a/mcs/class/System.Data.OracleClient/ChangeLog
+++ b/mcs/class/System.Data.OracleClient/ChangeLog
@@ -1,3 +1,53 @@
+2004-01-26 Joerg Rosenkranz <joergr@voelcker.com>
+
+ * System.Data.OracleClient.Oci/OciCalls.cs:
+ Changed binding of OciStmtPrepare from string
+ to byte [].
+ * System.Data.OracleClient.Oci/OciDefineHandle.cs:
+ Character types are converted using UTF8 encoding.
+ * System.Data.OracleClient.Oci/OciStatementHandle.cs:
+ SQL statement to be prepared is converted to byte
+ array using UTF8 encoding.
+
+2004-01-09 Joerg Rosenkranz <joergr@voelcker.com>
+
+ * System.Data.OracleClient.Oci/OciCalls.cs:
+ Added. It contains all external OCI calls which are
+ removed from all other files.
+ * System.Data.OracleClient/OciGlue.cs:
+ Fix for #52699 (OCI not thread safe).
+ * System.Data.OracleClient.Oci/OciHandle.cs:
+ Introduced special handling for Bind, Define and
+ Environment handles in FreeHandle. Revised the handling for
+ other types. Minor change in Dispose.
+ Replaced OCI calls.
+ * System.Data.OracleClient.Oci/OciDescriptorHandle.cs:
+ Special handling for Parameter handles in FreeHandle.
+ Replaced OCI calls.
+ * System.Data.OracleClient.Oci/OciDefineHandle.cs:
+ Character types are converted using the DefaultEncoding.
+ Replaced OCI calls.
+ * System.Data.OracleClient/OracleCommand.cs:
+ Dispose created OciStatementHandles.
+ * System.Data.OracleClient/OracleDataReader.cs:
+ Dispose used OciStatementHandle.
+ * System.Data.OracleClient/OracleTransaction.cs:
+ Dispose transaction handle.
+ * System.Data.OracleClient.Oci/OciStatementHandle.cs:
+ OCI_INVALID_HANDLE results in exception "Invalid handle."
+ Replaced OCI calls.
+ * System.Data.OracleClient.Oci/OciTransactionHandle.cs:
+ Introduced DetachFromServiceContext which is called in Commit
+ and Rollback (Fix for #52702).
+ * System.Data.OracleClient/OracleParameter.cs:
+ * System.Data.OracleClient.Oci/OciEnvironmentHandle.cs:
+ * System.Data.OracleClient.Oci/OciErrorHandle.cs:
+ * System.Data.OracleClient.Oci/OciLobLocator.cs:
+ * System.Data.OracleClient.Oci/OciServerHandle.cs:
+ * System.Data.OracleClient.Oci/OciServiceHandle.cs:
+ * System.Data.OracleClient.Oci/OciSessionHandle.cs:
+ Replaced OCI calls.
+
2003-12-16 Joerg Rosenkranz <joergr@voelcker.com>
* System.Data.OracleClient/OracleCommand.cs:
diff --git a/mcs/class/System.Data.OracleClient/System.Data.OracleClient.Oci/OciCalls.cs b/mcs/class/System.Data.OracleClient/System.Data.OracleClient.Oci/OciCalls.cs
new file mode 100644
index 00000000000..7db73b87fde
--- /dev/null
+++ b/mcs/class/System.Data.OracleClient/System.Data.OracleClient.Oci/OciCalls.cs
@@ -0,0 +1,760 @@
+//
+// OciCalls.cs
+//
+// Part of the Mono class libraries at
+// mcs/class/System.Data.OracleClient/System.Data.OracleClient.Oci
+//
+// Assembly: System.Data.OracleClient.dll
+// Namespace: System.Data.OracleClient.Oci
+//
+// Authors: Joerg Rosenkranz <joergr@voelcker.com>
+//
+// Copyright (C) Joerg Rosenkranz, 2004
+//
+// Licensed under the MIT/X11 License.
+//
+
+using System;
+using System.Diagnostics;
+using System.Runtime.InteropServices;
+
+namespace System.Data.OracleClient.Oci
+{
+ internal sealed class OciCalls
+ {
+
+ private static bool traceOci;
+#if TRACE
+
+ static OciCalls()
+ {
+ string env = Environment.GetEnvironmentVariable("OCI_TRACE");
+
+ traceOci = (env != null && env.Length > 0);
+ }
+#endif
+
+ private OciCalls ()
+ {}
+
+ #region OCI native calls
+
+ private sealed class OciNativeCalls
+ {
+ private OciNativeCalls ()
+ {}
+
+ [DllImport ("oci", EntryPoint = "OCIAttrSet")]
+ internal static extern int OCIAttrSet (IntPtr trgthndlp,
+ [MarshalAs (UnmanagedType.U4)] OciHandleType trghndltyp,
+ IntPtr attributep,
+ uint size,
+ [MarshalAs (UnmanagedType.U4)] OciAttributeType attrtype,
+ IntPtr errhp);
+
+ [DllImport ("oci", EntryPoint = "OCIAttrSet")]
+ internal static extern int OCIAttrSetString (IntPtr trgthndlp,
+ [MarshalAs (UnmanagedType.U4)] OciHandleType trghndltyp,
+ string attributep,
+ uint size,
+ [MarshalAs (UnmanagedType.U4)] OciAttributeType attrtype,
+ IntPtr errhp);
+
+ [DllImport ("oci")]
+ internal static extern int OCIErrorGet (IntPtr hndlp,
+ uint recordno,
+ IntPtr sqlstate,
+ out int errcodep,
+ IntPtr bufp,
+ uint bufsize,
+ [MarshalAs (UnmanagedType.U4)] OciHandleType type);
+
+ [DllImport ("oci")]
+ internal static extern int OCIBindByName (IntPtr stmtp,
+ out IntPtr bindpp,
+ IntPtr errhp,
+ string placeholder,
+ int placeh_len,
+ IntPtr valuep,
+ int value_sz,
+ [MarshalAs (UnmanagedType.U2)] OciDataType dty,
+ int indp,
+ IntPtr alenp,
+ IntPtr rcodep,
+ uint maxarr_len,
+ IntPtr curelp,
+ uint mode);
+
+ [DllImport ("oci")]
+ internal static extern int OCIDefineByPos (IntPtr stmtp,
+ out IntPtr defnpp,
+ IntPtr errhp,
+ [MarshalAs (UnmanagedType.U4)] int position,
+ IntPtr valuep,
+ int value_sz,
+ [MarshalAs (UnmanagedType.U2)] OciDataType dty,
+ ref short indp,
+ ref int rlenp,
+ IntPtr rcodep,
+ uint mode);
+
+ [DllImport ("oci", EntryPoint="OCIDefineByPos")]
+ internal static extern int OCIDefineByPosPtr (IntPtr stmtp,
+ out IntPtr defnpp,
+ IntPtr errhp,
+ [MarshalAs (UnmanagedType.U4)] int position,
+ ref IntPtr valuep,
+ int value_sz,
+ [MarshalAs (UnmanagedType.U2)] OciDataType dty,
+ ref short indp,
+ ref int rlenp,
+ IntPtr rcodep,
+ uint mode);
+
+ [DllImport ("oci")]
+ internal static extern int OCIDescriptorFree (IntPtr hndlp,
+ [MarshalAs (UnmanagedType.U4)] OciHandleType type);
+
+ [DllImport ("oci")]
+ internal static extern int OCIEnvCreate (out IntPtr envhpp,
+ [MarshalAs (UnmanagedType.U4)] OciEnvironmentMode mode,
+ IntPtr ctxp,
+ IntPtr malocfp,
+ IntPtr ralocfp,
+ IntPtr mfreep,
+ int xtramem_sz,
+ IntPtr usrmempp);
+
+ [DllImport ("oci")]
+ internal static extern int OCIAttrGet (IntPtr trgthndlp,
+ [MarshalAs (UnmanagedType.U4)] OciHandleType trghndltyp,
+ out IntPtr attributep,
+ out int sizep,
+ [MarshalAs (UnmanagedType.U4)] OciAttributeType attrtype,
+ IntPtr errhp);
+
+ [DllImport ("oci", EntryPoint = "OCIAttrGet")]
+ internal static extern int OCIAttrGetSByte (IntPtr trgthndlp,
+ [MarshalAs (UnmanagedType.U4)] OciHandleType trghndltyp,
+ out sbyte attributep,
+ IntPtr sizep,
+ [MarshalAs (UnmanagedType.U4)] OciAttributeType attrtype,
+ IntPtr errhp);
+
+ [DllImport ("oci", EntryPoint = "OCIAttrGet")]
+ internal static extern int OCIAttrGetByte (IntPtr trgthndlp,
+ [MarshalAs (UnmanagedType.U4)] OciHandleType trghndltyp,
+ out byte attributep,
+ IntPtr sizep,
+ [MarshalAs (UnmanagedType.U4)] OciAttributeType attrtype,
+ IntPtr errhp);
+
+ [DllImport ("oci", EntryPoint = "OCIAttrGet")]
+ internal static extern int OCIAttrGetUInt16 (IntPtr trgthndlp,
+ [MarshalAs (UnmanagedType.U4)] OciHandleType trghndltyp,
+ out ushort attributep,
+ IntPtr sizep,
+ [MarshalAs (UnmanagedType.U4)] OciAttributeType attrtype,
+ IntPtr errhp);
+
+ [DllImport ("oci", EntryPoint = "OCIAttrGet")]
+ internal static extern int OCIAttrGetInt32 (IntPtr trgthndlp,
+ [MarshalAs (UnmanagedType.U4)] OciHandleType trghndltyp,
+ out int attributep,
+ IntPtr sizep,
+ [MarshalAs (UnmanagedType.U4)] OciAttributeType attrtype,
+ IntPtr errhp);
+
+ [DllImport ("oci", EntryPoint = "OCIAttrGet")]
+ internal static extern int OCIAttrGetIntPtr (IntPtr trgthndlp,
+ [MarshalAs (UnmanagedType.U4)] OciHandleType trghndltyp,
+ out IntPtr attributep,
+ IntPtr sizep,
+ [MarshalAs (UnmanagedType.U4)] OciAttributeType attrtype,
+ IntPtr errhp);
+
+ [DllImport ("oci")]
+ internal static extern int OCIDescriptorAlloc (IntPtr parenth,
+ out IntPtr hndlpp,
+ [MarshalAs (UnmanagedType.U4)] OciHandleType type,
+ int xtramem_sz,
+ IntPtr usrmempp);
+
+ [DllImport ("oci")]
+ internal static extern int OCIHandleAlloc (IntPtr parenth,
+ out IntPtr descpp,
+ [MarshalAs (UnmanagedType.U4)] OciHandleType type,
+ int xtramem_sz,
+ IntPtr usrmempp);
+
+ [DllImport ("oci")]
+ internal static extern int OCIHandleFree (IntPtr hndlp,
+ [MarshalAs (UnmanagedType.U4)] OciHandleType type);
+
+ [DllImport ("oci")]
+ internal static extern int OCILobClose (IntPtr svchp,
+ IntPtr errhp,
+ IntPtr locp);
+
+ [DllImport ("oci")]
+ internal static extern int OCILobCopy (IntPtr svchp,
+ IntPtr errhp,
+ IntPtr dst_locp,
+ IntPtr src_locp,
+ uint amount,
+ uint dst_offset,
+ uint src_offset);
+
+ [DllImport ("oci")]
+ internal static extern int OCILobErase (IntPtr svchp,
+ IntPtr errhp,
+ IntPtr locp,
+ ref uint amount,
+ uint offset);
+
+ [DllImport ("oci")]
+ internal static extern int OCILobGetChunkSize (IntPtr svchp,
+ IntPtr errhp,
+ IntPtr locp,
+ out uint chunk_size);
+
+ [DllImport ("oci")]
+ internal static extern int OCILobGetLength (IntPtr svchp,
+ IntPtr errhp,
+ IntPtr locp,
+ out uint lenp);
+
+ [DllImport ("oci")]
+ internal static extern int OCILobOpen (IntPtr svchp,
+ IntPtr errhp,
+ IntPtr locp,
+ byte mode);
+
+ [DllImport ("oci")]
+ internal static extern int OCILobRead (IntPtr svchp,
+ IntPtr errhp,
+ IntPtr locp,
+ ref uint amtp,
+ uint offset,
+ byte[] bufp,
+ uint bufl,
+ IntPtr ctxp,
+ IntPtr cbfp,
+ ushort csid,
+ byte csfrm);
+
+ [DllImport ("oci")]
+ internal static extern int OCILobTrim (IntPtr svchp,
+ IntPtr errhp,
+ IntPtr locp,
+ uint newlen);
+
+ [DllImport ("oci")]
+ internal static extern int OCILobWrite (IntPtr svchp,
+ IntPtr errhp,
+ IntPtr locp,
+ ref uint amtp,
+ uint offset,
+ byte[] bufp,
+ uint bufl,
+ byte piece,
+ IntPtr ctxp,
+ IntPtr cbfp,
+ ushort csid,
+ byte csfrm);
+
+ [DllImport ("oci")]
+ internal static extern int OCIServerAttach (IntPtr srvhp,
+ IntPtr errhp,
+ string dblink,
+ [MarshalAs (UnmanagedType.U4)] int dblink_len,
+ uint mode);
+
+ [DllImport ("oci")]
+ internal static extern int OCIServerDetach (IntPtr srvhp,
+ IntPtr errhp,
+ uint mode);
+
+ [DllImport ("oci")]
+ internal static extern int OCISessionBegin (IntPtr svchp,
+ IntPtr errhp,
+ IntPtr usrhp,
+ [MarshalAs (UnmanagedType.U4)] OciCredentialType credt,
+ [MarshalAs (UnmanagedType.U4)] OciSessionMode mode);
+
+ [DllImport ("oci")]
+ internal static extern int OCISessionEnd (IntPtr svchp,
+ IntPtr errhp,
+ IntPtr usrhp,
+ uint mode);
+
+ [DllImport ("oci")]
+ internal static extern int OCIParamGet (IntPtr hndlp,
+ [MarshalAs (UnmanagedType.U4)] OciHandleType htype,
+ IntPtr errhp,
+ out IntPtr parmdpp,
+ [MarshalAs (UnmanagedType.U4)] int pos);
+
+ [DllImport ("oci")]
+ internal static extern int OCIStmtExecute (IntPtr svchp,
+ IntPtr stmthp,
+ IntPtr errhp,
+ [MarshalAs (UnmanagedType.U4)] bool iters,
+ uint rowoff,
+ IntPtr snap_in,
+ IntPtr snap_out,
+ [MarshalAs (UnmanagedType.U4)] OciExecuteMode mode);
+
+ [DllImport ("oci")]
+ internal static extern int OCIStmtFetch (IntPtr stmtp,
+ IntPtr errhp,
+ uint nrows,
+ ushort orientation,
+ uint mode);
+
+
+ [DllImport ("oci")]
+ internal static extern int OCIStmtPrepare (IntPtr stmthp,
+ IntPtr errhp,
+ byte [] stmt,
+ [MarshalAs (UnmanagedType.U4)] int stmt_length,
+ [MarshalAs (UnmanagedType.U4)] OciStatementLanguage language,
+ [MarshalAs (UnmanagedType.U4)] OciStatementMode mode);
+
+ [DllImport ("oci")]
+ internal static extern int OCITransCommit (IntPtr svchp,
+ IntPtr errhp,
+ uint flags);
+
+ [DllImport ("oci")]
+ internal static extern int OCITransRollback (IntPtr svchp,
+ IntPtr errhp,
+ uint flags);
+
+ [DllImport ("oci")]
+ internal static extern int OCITransStart (IntPtr svchp,
+ IntPtr errhp,
+ uint timeout,
+ [MarshalAs (UnmanagedType.U4)] OciTransactionFlags flags);
+
+ }
+
+ #endregion
+
+ #region OCI call wrappers
+
+ internal static int OCIAttrSet (IntPtr trgthndlp,
+ OciHandleType trghndltyp,
+ IntPtr attributep,
+ uint size,
+ OciAttributeType attrtype,
+ IntPtr errhp)
+ {
+ Trace.WriteLineIf(traceOci, string.Format("OCIAttrSet ({0}, {1})", trghndltyp, attrtype), "OCI");
+ return OciNativeCalls.OCIAttrSet (trgthndlp, trghndltyp, attributep, size, attrtype, errhp);
+ }
+
+ internal static int OCIAttrSetString (IntPtr trgthndlp,
+ OciHandleType trghndltyp,
+ string attributep,
+ uint size,
+ OciAttributeType attrtype,
+ IntPtr errhp)
+ {
+ Trace.WriteLineIf(traceOci, string.Format("OCIAttrSetString ({0}, {1})", trghndltyp, attrtype), "OCI");
+ return OciNativeCalls.OCIAttrSetString (trgthndlp, trghndltyp, attributep, size, attrtype, errhp);
+ }
+
+ internal static int OCIErrorGet (IntPtr hndlp,
+ uint recordno,
+ IntPtr sqlstate,
+ out int errcodep,
+ IntPtr bufp,
+ uint bufsize,
+ OciHandleType type)
+ {
+ Trace.WriteLineIf(traceOci, "OCIErrorGet", "OCI");
+ return OciNativeCalls.OCIErrorGet (hndlp, recordno, sqlstate, out errcodep, bufp, bufsize, type);
+ }
+
+ internal static int OCIBindByName (IntPtr stmtp,
+ out IntPtr bindpp,
+ IntPtr errhp,
+ string placeholder,
+ int placeh_len,
+ IntPtr valuep,
+ int value_sz,
+ OciDataType dty,
+ int indp,
+ IntPtr alenp,
+ IntPtr rcodep,
+ uint maxarr_len,
+ IntPtr curelp,
+ uint mode)
+ {
+ Trace.WriteLineIf(traceOci, "OCIBindByName", "OCI");
+ return OciNativeCalls.OCIBindByName (stmtp, out bindpp, errhp, placeholder, placeh_len, valuep,
+ value_sz, dty, indp, alenp, rcodep, maxarr_len, curelp, mode);
+ }
+
+ internal static int OCIDefineByPos (IntPtr stmtp,
+ out IntPtr defnpp,
+ IntPtr errhp,
+ int position,
+ IntPtr valuep,
+ int value_sz,
+ OciDataType dty,
+ ref short indp,
+ ref int rlenp,
+ IntPtr rcodep,
+ uint mode)
+ {
+ Trace.WriteLineIf(traceOci, "OCIDefineByPos", "OCI");
+ return OciNativeCalls.OCIDefineByPos (stmtp, out defnpp, errhp, position, valuep,
+ value_sz, dty, ref indp, ref rlenp, rcodep, mode);
+ }
+
+ internal static int OCIDefineByPosPtr (IntPtr stmtp,
+ out IntPtr defnpp,
+ IntPtr errhp,
+ int position,
+ ref IntPtr valuep,
+ int value_sz,
+ OciDataType dty,
+ ref short indp,
+ ref int rlenp,
+ IntPtr rcodep,
+ uint mode)
+ {
+ Trace.WriteLineIf(traceOci, "OCIDefineByPosPtr", "OCI");
+ return OciNativeCalls.OCIDefineByPosPtr (stmtp, out defnpp, errhp, position, ref valuep,
+ value_sz, dty, ref indp, ref rlenp, rcodep, mode);
+ }
+
+ internal static int OCIDescriptorFree (IntPtr hndlp,
+ OciHandleType type)
+ {
+ Trace.WriteLineIf(traceOci, string.Format("OCIDescriptorFree ({0})", type), "OCI");
+ return OciNativeCalls.OCIDescriptorFree (hndlp, type);
+ }
+
+ internal static int OCIEnvCreate (out IntPtr envhpp,
+ OciEnvironmentMode mode,
+ IntPtr ctxp,
+ IntPtr malocfp,
+ IntPtr ralocfp,
+ IntPtr mfreep,
+ int xtramem_sz,
+ IntPtr usrmempp)
+ {
+ Trace.WriteLineIf(traceOci, "OCIEnvCreate", "OCI");
+ return OciNativeCalls.OCIEnvCreate (out envhpp, mode, ctxp, malocfp, ralocfp, mfreep,
+ xtramem_sz, usrmempp);
+ }
+
+ internal static int OCIAttrGet (IntPtr trgthndlp,
+ OciHandleType trghndltyp,
+ out IntPtr attributep,
+ out int sizep,
+ OciAttributeType attrtype,
+ IntPtr errhp)
+ {
+ Trace.WriteLineIf(traceOci, "OCIAttrGet", "OCI");
+ return OciNativeCalls.OCIAttrGet (trgthndlp, trghndltyp, out attributep, out sizep, attrtype, errhp);
+ }
+
+ internal static int OCIAttrGetSByte (IntPtr trgthndlp,
+ OciHandleType trghndltyp,
+ out sbyte attributep,
+ IntPtr sizep,
+ OciAttributeType attrtype,
+ IntPtr errhp)
+ {
+ Trace.WriteLineIf(traceOci, "OCIAttrGetSByte", "OCI");
+ return OciNativeCalls.OCIAttrGetSByte (trgthndlp, trghndltyp, out attributep, sizep, attrtype, errhp);
+ }
+
+ internal static int OCIAttrGetByte (IntPtr trgthndlp,
+ OciHandleType trghndltyp,
+ out byte attributep,
+ IntPtr sizep,
+ OciAttributeType attrtype,
+ IntPtr errhp)
+ {
+ Trace.WriteLineIf(traceOci, "OCIAttrGetByte", "OCI");
+ return OciNativeCalls.OCIAttrGetByte (trgthndlp, trghndltyp, out attributep, sizep, attrtype, errhp);
+ }
+
+ internal static int OCIAttrGetUInt16 (IntPtr trgthndlp,
+ OciHandleType trghndltyp,
+ out ushort attributep,
+ IntPtr sizep,
+ OciAttributeType attrtype,
+ IntPtr errhp)
+ {
+ Trace.WriteLineIf(traceOci, "OCIAttrGetUInt16", "OCI");
+ return OciNativeCalls.OCIAttrGetUInt16 (trgthndlp, trghndltyp, out attributep, sizep, attrtype, errhp);
+ }
+
+ internal static int OCIAttrGetInt32 (IntPtr trgthndlp,
+ OciHandleType trghndltyp,
+ out int attributep,
+ IntPtr sizep,
+ OciAttributeType attrtype,
+ IntPtr errhp)
+ {
+ Trace.WriteLineIf(traceOci, "OCIAttrGetInt32", "OCI");
+ return OciNativeCalls.OCIAttrGetInt32 (trgthndlp, trghndltyp, out attributep, sizep, attrtype, errhp);
+ }
+
+ internal static int OCIAttrGetIntPtr (IntPtr trgthndlp,
+ OciHandleType trghndltyp,
+ out IntPtr attributep,
+ IntPtr sizep,
+ OciAttributeType attrtype,
+ IntPtr errhp)
+ {
+ Trace.WriteLineIf(traceOci, "OCIAttrGetIntPtr", "OCI");
+ return OciNativeCalls.OCIAttrGetIntPtr (trgthndlp, trghndltyp, out attributep, sizep, attrtype, errhp);
+ }
+
+ internal static int OCIDescriptorAlloc (IntPtr parenth,
+ out IntPtr hndlpp,
+ OciHandleType type,
+ int xtramem_sz,
+ IntPtr usrmempp)
+ {
+ Trace.WriteLineIf(traceOci, "OCIDescriptorAlloc", "OCI");
+ return OciNativeCalls.OCIDescriptorAlloc (parenth, out hndlpp, type, xtramem_sz, usrmempp);
+ }
+
+ internal static int OCIHandleAlloc (IntPtr parenth,
+ out IntPtr descpp,
+ OciHandleType type,
+ int xtramem_sz,
+ IntPtr usrmempp)
+ {
+ Trace.WriteLineIf(traceOci, string.Format("OCIHandleAlloc ({0})", type), "OCI");
+ return OciNativeCalls.OCIHandleAlloc (parenth, out descpp, type, xtramem_sz, usrmempp);
+ }
+
+ internal static int OCIHandleFree (IntPtr hndlp,
+ OciHandleType type)
+ {
+ Trace.WriteLineIf(traceOci, string.Format("OCIHandleFree ({0})", type), "OCI");
+ return OciNativeCalls.OCIHandleFree (hndlp, type);
+ }
+
+ internal static int OCILobClose (IntPtr svchp,
+ IntPtr errhp,
+ IntPtr locp)
+ {
+ Trace.WriteLineIf(traceOci, "OCILobClose", "OCI");
+ return OciNativeCalls.OCILobClose (svchp, errhp, locp);
+ }
+
+ internal static int OCILobCopy (IntPtr svchp,
+ IntPtr errhp,
+ IntPtr dst_locp,
+ IntPtr src_locp,
+ uint amount,
+ uint dst_offset,
+ uint src_offset)
+ {
+ Trace.WriteLineIf(traceOci, "OCILobCopy", "OCI");
+ return OciNativeCalls.OCILobCopy (svchp, errhp, dst_locp, src_locp, amount, dst_offset, src_offset);
+ }
+
+ internal static int OCILobErase (IntPtr svchp,
+ IntPtr errhp,
+ IntPtr locp,
+ ref uint amount,
+ uint offset)
+ {
+ Trace.WriteLineIf(traceOci, "OCILobErase", "OCI");
+ return OciNativeCalls.OCILobErase (svchp, errhp, locp, ref amount, offset);
+ }
+
+ internal static int OCILobGetChunkSize (IntPtr svchp,
+ IntPtr errhp,
+ IntPtr locp,
+ out uint chunk_size)
+ {
+ Trace.WriteLineIf(traceOci, "OCILobGetChunkSize", "OCI");
+ return OciNativeCalls.OCILobGetChunkSize (svchp, errhp, locp, out chunk_size);
+ }
+
+ internal static int OCILobGetLength (IntPtr svchp,
+ IntPtr errhp,
+ IntPtr locp,
+ out uint lenp)
+ {
+ Trace.WriteLineIf(traceOci, "OCILobGetLength", "OCI");
+ return OciNativeCalls.OCILobGetLength (svchp, errhp, locp, out lenp);
+ }
+
+ internal static int OCILobOpen (IntPtr svchp,
+ IntPtr errhp,
+ IntPtr locp,
+ byte mode)
+ {
+ Trace.WriteLineIf(traceOci, "OCILobOpen", "OCI");
+ return OciNativeCalls.OCILobOpen (svchp, errhp, locp, mode);
+ }
+
+ internal static int OCILobRead (IntPtr svchp,
+ IntPtr errhp,
+ IntPtr locp,
+ ref uint amtp,
+ uint offset,
+ byte[] bufp,
+ uint bufl,
+ IntPtr ctxp,
+ IntPtr cbfp,
+ ushort csid,
+ byte csfrm)
+ {
+ Trace.WriteLineIf(traceOci, "OCILobRead", "OCI");
+ return OciNativeCalls.OCILobRead (svchp, errhp, locp, ref amtp, offset, bufp, bufl,
+ ctxp, cbfp, csid, csfrm);
+ }
+
+ internal static int OCILobTrim (IntPtr svchp,
+ IntPtr errhp,
+ IntPtr locp,
+ uint newlen)
+ {
+ Trace.WriteLineIf(traceOci, "OCILobTrim", "OCI");
+ return OciNativeCalls.OCILobTrim (svchp, errhp, locp, newlen);
+ }
+
+ internal static int OCILobWrite (IntPtr svchp,
+ IntPtr errhp,
+ IntPtr locp,
+ ref uint amtp,
+ uint offset,
+ byte[] bufp,
+ uint bufl,
+ byte piece,
+ IntPtr ctxp,
+ IntPtr cbfp,
+ ushort csid,
+ byte csfrm)
+ {
+ Trace.WriteLineIf(traceOci, "OCILobWrite", "OCI");
+ return OciNativeCalls.OCILobWrite (svchp, errhp, locp, ref amtp, offset, bufp, bufl,
+ piece, ctxp, cbfp, csid, csfrm);
+ }
+
+ internal static int OCIServerAttach (IntPtr srvhp,
+ IntPtr errhp,
+ string dblink,
+ int dblink_len,
+ uint mode)
+ {
+ Trace.WriteLineIf(traceOci, "OCIServerAttach", "OCI");
+ return OciNativeCalls.OCIServerAttach (srvhp, errhp, dblink, dblink_len, mode);
+ }
+
+ internal static int OCIServerDetach (IntPtr srvhp,
+ IntPtr errhp,
+ uint mode)
+ {
+ Trace.WriteLineIf(traceOci, "OCIServerDetach", "OCI");
+ return OciNativeCalls.OCIServerDetach (srvhp, errhp, mode);
+ }
+
+ internal static int OCISessionBegin (IntPtr svchp,
+ IntPtr errhp,
+ IntPtr usrhp,
+ OciCredentialType credt,
+ OciSessionMode mode)
+ {
+ Trace.WriteLineIf(traceOci, "OCISessionBegin", "OCI");
+ return OciNativeCalls.OCISessionBegin (svchp, errhp, usrhp, credt, mode);
+ }
+
+ internal static int OCISessionEnd (IntPtr svchp,
+ IntPtr errhp,
+ IntPtr usrhp,
+ uint mode)
+ {
+ Trace.WriteLineIf(traceOci, "OCISessionEnd", "OCI");
+ return OciNativeCalls.OCISessionEnd (svchp, errhp, usrhp, mode);
+ }
+
+ internal static int OCIParamGet (IntPtr hndlp,
+ OciHandleType htype,
+ IntPtr errhp,
+ out IntPtr parmdpp,
+ int pos)
+ {
+ Trace.WriteLineIf(traceOci, "OCIParamGet", "OCI");
+ return OciNativeCalls.OCIParamGet (hndlp, htype, errhp, out parmdpp, pos);
+ }
+
+ internal static int OCIStmtExecute (IntPtr svchp,
+ IntPtr stmthp,
+ IntPtr errhp,
+ bool iters,
+ uint rowoff,
+ IntPtr snap_in,
+ IntPtr snap_out,
+ OciExecuteMode mode)
+ {
+ Trace.WriteLineIf(traceOci, "OCIStmtExecute", "OCI");
+ return OciNativeCalls.OCIStmtExecute (svchp, stmthp, errhp, iters, rowoff,
+ snap_in, snap_out, mode);
+ }
+
+ internal static int OCIStmtFetch (IntPtr stmtp,
+ IntPtr errhp,
+ uint nrows,
+ ushort orientation,
+ uint mode)
+ {
+ Trace.WriteLineIf(traceOci, "OCIStmtFetch", "OCI");
+ return OciNativeCalls.OCIStmtFetch (stmtp, errhp, nrows, orientation, mode);
+ }
+
+
+ internal static int OCIStmtPrepare (IntPtr stmthp,
+ IntPtr errhp,
+ byte [] stmt,
+ int stmt_length,
+ OciStatementLanguage language,
+ OciStatementMode mode)
+ {
+ Trace.WriteLineIf(traceOci, string.Format("OCIStmtPrepare ({0})", System.Text.Encoding.UTF8.GetString(stmt)), "OCI");
+
+ return OciNativeCalls.OCIStmtPrepare (stmthp, errhp, stmt, stmt_length, language, mode);
+ }
+
+ internal static int OCITransCommit (IntPtr svchp,
+ IntPtr errhp,
+ uint flags)
+ {
+ Trace.WriteLineIf(traceOci, "OCITransCommit", "OCI");
+ return OciNativeCalls.OCITransCommit (svchp, errhp, flags);
+ }
+
+ internal static int OCITransRollback (IntPtr svchp,
+ IntPtr errhp,
+ uint flags)
+ {
+ Trace.WriteLineIf(traceOci, "OCITransRollback", "OCI");
+ return OciNativeCalls.OCITransRollback (svchp, errhp, flags);
+ }
+
+ internal static int OCITransStart (IntPtr svchp,
+ IntPtr errhp,
+ uint timeout,
+ OciTransactionFlags flags)
+ {
+ Trace.WriteLineIf(traceOci, "OCITransStart", "OCI");
+ return OciNativeCalls.OCITransStart (svchp, errhp, timeout, flags);
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Data.OracleClient/System.Data.OracleClient.Oci/OciDefineHandle.cs b/mcs/class/System.Data.OracleClient/System.Data.OracleClient.Oci/OciDefineHandle.cs
index 0438cd0cf91..bdb213c33b9 100644
--- a/mcs/class/System.Data.OracleClient/System.Data.OracleClient.Oci/OciDefineHandle.cs
+++ b/mcs/class/System.Data.OracleClient/System.Data.OracleClient.Oci/OciDefineHandle.cs
@@ -98,32 +98,6 @@ namespace System.Data.OracleClient.Oci {
#region Methods
- [DllImport ("oci")]
- public static extern int OCIDefineByPos (IntPtr stmtp,
- out IntPtr defnpp,
- IntPtr errhp,
- [MarshalAs (UnmanagedType.U4)] int position,
- IntPtr valuep,
- int value_sz,
- [MarshalAs (UnmanagedType.U2)] OciDataType dty,
- ref short indp,
- ref int rlenp,
- IntPtr rcodep,
- uint mode);
-
- [DllImport ("oci", EntryPoint="OCIDefineByPos")]
- public static extern int OCIDefineByPosPtr (IntPtr stmtp,
- out IntPtr defnpp,
- IntPtr errhp,
- [MarshalAs (UnmanagedType.U4)] int position,
- ref IntPtr valuep,
- int value_sz,
- [MarshalAs (UnmanagedType.U2)] OciDataType dty,
- ref short indp,
- ref int rlenp,
- IntPtr rcodep,
- uint mode);
-
void Define (int position)
{
switch (definedType) {
@@ -149,7 +123,7 @@ namespace System.Data.OracleClient.Oci {
int status = 0;
- status = OCIDefineByPos (Parent,
+ status = OciCalls.OCIDefineByPos (Parent,
out handle,
ErrorHandle,
position + 1,
@@ -174,7 +148,7 @@ namespace System.Data.OracleClient.Oci {
int status = 0;
- status = OCIDefineByPos (Parent,
+ status = OciCalls.OCIDefineByPos (Parent,
out handle,
ErrorHandle,
position + 1,
@@ -210,7 +184,7 @@ namespace System.Data.OracleClient.Oci {
lobLocator.ErrorHandle = ErrorHandle;
lobLocator.Service = ((OciStatementHandle) Parent).Service;
- status = OCIDefineByPosPtr (Parent,
+ status = OciCalls.OCIDefineByPosPtr (Parent,
out handle,
ErrorHandle,
position + 1,
@@ -256,10 +230,11 @@ namespace System.Data.OracleClient.Oci {
case OciDataType.Char:
case OciDataType.CharZ:
case OciDataType.OciString:
- tmp = Marshal.PtrToStringAnsi (Value, Size);
- if (tmp != null)
- return String.Copy ((string) tmp);
- break;
+ byte [] buffer = new byte [Size];
+ Marshal.Copy (Value, buffer, 0, Size);
+
+ return Encoding.UTF8.GetString (buffer);
+
case OciDataType.Integer:
tmp = Marshal.PtrToStringAnsi (Value, Size);
if (tmp != null)
diff --git a/mcs/class/System.Data.OracleClient/System.Data.OracleClient.Oci/OciDescriptorHandle.cs b/mcs/class/System.Data.OracleClient/System.Data.OracleClient.Oci/OciDescriptorHandle.cs
index da431be69de..b63e7bbab42 100644
--- a/mcs/class/System.Data.OracleClient/System.Data.OracleClient.Oci/OciDescriptorHandle.cs
+++ b/mcs/class/System.Data.OracleClient/System.Data.OracleClient.Oci/OciDescriptorHandle.cs
@@ -32,14 +32,12 @@ namespace System.Data.OracleClient.Oci {
#region Methods
- [DllImport ("oci")]
- static extern int OCIDescriptorFree (IntPtr hndlp,
- [MarshalAs (UnmanagedType.U4)] OciHandleType type);
-
protected override void FreeHandle ()
{
- int status = 0;
- status = OCIDescriptorFree (this, HandleType);
+ if (HandleType != OciHandleType.Parameter) { // Parameter handles are disposed implicitely
+ int status = 0;
+ status = OciCalls.OCIDescriptorFree (this, HandleType);
+ }
}
#endregion // Methods
diff --git a/mcs/class/System.Data.OracleClient/System.Data.OracleClient.Oci/OciEnvironmentHandle.cs b/mcs/class/System.Data.OracleClient/System.Data.OracleClient.Oci/OciEnvironmentHandle.cs
index 2c435656267..551dabfd1cb 100644
--- a/mcs/class/System.Data.OracleClient/System.Data.OracleClient.Oci/OciEnvironmentHandle.cs
+++ b/mcs/class/System.Data.OracleClient/System.Data.OracleClient.Oci/OciEnvironmentHandle.cs
@@ -33,7 +33,7 @@ namespace System.Data.OracleClient.Oci {
{
int status = 0;
IntPtr newHandle = IntPtr.Zero;
- status = OCIEnvCreate (out newHandle,
+ status = OciCalls.OCIEnvCreate (out newHandle,
mode,
IntPtr.Zero,
IntPtr.Zero,
@@ -49,16 +49,6 @@ namespace System.Data.OracleClient.Oci {
#region Methods
- [DllImport ("oci")]
- static extern int OCIEnvCreate (out IntPtr envhpp,
- [MarshalAs (UnmanagedType.U4)] OciEnvironmentMode mode,
- IntPtr ctxp,
- IntPtr malocfp,
- IntPtr ralocfp,
- IntPtr mfreep,
- int xtramem_sz,
- IntPtr usrmempp);
-
public OciErrorInfo HandleError ()
{
int errbufSize = 512;
@@ -68,7 +58,7 @@ namespace System.Data.OracleClient.Oci {
info.ErrorCode = 0;
info.ErrorMessage = String.Empty;
- OciGlue.OCIErrorGet (Handle,
+ OciCalls.OCIErrorGet (Handle,
1,
IntPtr.Zero,
out info.ErrorCode,
diff --git a/mcs/class/System.Data.OracleClient/System.Data.OracleClient.Oci/OciErrorHandle.cs b/mcs/class/System.Data.OracleClient/System.Data.OracleClient.Oci/OciErrorHandle.cs
index 0c4fd12fbfb..3238c93d141 100644
--- a/mcs/class/System.Data.OracleClient/System.Data.OracleClient.Oci/OciErrorHandle.cs
+++ b/mcs/class/System.Data.OracleClient/System.Data.OracleClient.Oci/OciErrorHandle.cs
@@ -55,7 +55,7 @@ namespace System.Data.OracleClient.Oci {
int errbufSize = 512;
IntPtr errbuf = Marshal.AllocHGlobal (errbufSize);
- OciGlue.OCIErrorGet (this,
+ OciCalls.OCIErrorGet (this,
1,
IntPtr.Zero,
out info.ErrorCode,
diff --git a/mcs/class/System.Data.OracleClient/System.Data.OracleClient.Oci/OciHandle.cs b/mcs/class/System.Data.OracleClient/System.Data.OracleClient.Oci/OciHandle.cs
index e8fb1dae18b..32c23a9aad2 100644
--- a/mcs/class/System.Data.OracleClient/System.Data.OracleClient.Oci/OciHandle.cs
+++ b/mcs/class/System.Data.OracleClient/System.Data.OracleClient.Oci/OciHandle.cs
@@ -64,90 +64,24 @@ namespace System.Data.OracleClient.Oci {
#region Methods
- [DllImport ("oci")]
- static extern int OCIAttrGet (IntPtr trgthndlp,
- [MarshalAs (UnmanagedType.U4)] OciHandleType trghndltyp,
- out IntPtr attributep,
- out int sizep,
- [MarshalAs (UnmanagedType.U4)] OciAttributeType attrtype,
- IntPtr errhp);
-
- [DllImport ("oci", EntryPoint = "OCIAttrGet")]
- static extern int OCIAttrGetSByte (IntPtr trgthndlp,
- [MarshalAs (UnmanagedType.U4)] OciHandleType trghndltyp,
- out sbyte attributep,
- IntPtr sizep,
- [MarshalAs (UnmanagedType.U4)] OciAttributeType attrtype,
- IntPtr errhp);
-
- [DllImport ("oci", EntryPoint = "OCIAttrGet")]
- static extern int OCIAttrGetByte (IntPtr trgthndlp,
- [MarshalAs (UnmanagedType.U4)] OciHandleType trghndltyp,
- out byte attributep,
- IntPtr sizep,
- [MarshalAs (UnmanagedType.U4)] OciAttributeType attrtype,
- IntPtr errhp);
-
- [DllImport ("oci", EntryPoint = "OCIAttrGet")]
- static extern int OCIAttrGetUInt16 (IntPtr trgthndlp,
- [MarshalAs (UnmanagedType.U4)] OciHandleType trghndltyp,
- out ushort attributep,
- IntPtr sizep,
- [MarshalAs (UnmanagedType.U4)] OciAttributeType attrtype,
- IntPtr errhp);
-
- [DllImport ("oci", EntryPoint = "OCIAttrGet")]
- static extern int OCIAttrGetInt32 (IntPtr trgthndlp,
- [MarshalAs (UnmanagedType.U4)] OciHandleType trghndltyp,
- out int attributep,
- IntPtr sizep,
- [MarshalAs (UnmanagedType.U4)] OciAttributeType attrtype,
- IntPtr errhp);
-
- [DllImport ("oci", EntryPoint = "OCIAttrGet")]
- static extern int OCIAttrGetIntPtr (IntPtr trgthndlp,
- [MarshalAs (UnmanagedType.U4)] OciHandleType trghndltyp,
- out IntPtr attributep,
- IntPtr sizep,
- [MarshalAs (UnmanagedType.U4)] OciAttributeType attrtype,
- IntPtr errhp);
-
- [DllImport ("oci")]
- static extern int OCIDescriptorAlloc (IntPtr parenth,
- out IntPtr hndlpp,
- [MarshalAs (UnmanagedType.U4)] OciHandleType type,
- int xtramem_sz,
- IntPtr usrmempp);
-
- [DllImport ("oci")]
- static extern int OCIHandleAlloc (IntPtr parenth,
- out IntPtr descpp,
- [MarshalAs (UnmanagedType.U4)] OciHandleType type,
- int xtramem_sz,
- IntPtr usrmempp);
-
- [DllImport ("oci")]
- static extern int OCIHandleFree (IntPtr hndlp,
- [MarshalAs (UnmanagedType.U4)] OciHandleType type);
-
public OciHandle Allocate (OciHandleType type)
{
int status = 0;
IntPtr newHandle = IntPtr.Zero;
if (type < OciHandleType.LobLocator)
- status = OCIHandleAlloc (this,
- out newHandle,
- type,
- 0,
- IntPtr.Zero);
+ status = OciCalls.OCIHandleAlloc (this,
+ out newHandle,
+ type,
+ 0,
+ IntPtr.Zero);
else
- status = OCIDescriptorAlloc (this,
- out newHandle,
- type,
- 0,
- IntPtr.Zero);
-
+ status = OciCalls.OCIDescriptorAlloc (this,
+ out newHandle,
+ type,
+ 0,
+ IntPtr.Zero);
+
if (status != 0 && status != 1)
throw new Exception (String.Format ("Could not allocate new OCI Handle of type {0}", type));
@@ -175,10 +109,10 @@ namespace System.Data.OracleClient.Oci {
protected virtual void Dispose (bool disposing)
{
if (!disposed) {
+ FreeHandle ();
if (disposing) {
parent = null;
}
- FreeHandle ();
disposed = true;
}
}
@@ -191,7 +125,25 @@ namespace System.Data.OracleClient.Oci {
protected virtual void FreeHandle ()
{
- OCIHandleFree (Handle, HandleType);
+ switch (type) {
+ case OciHandleType.Bind:
+ case OciHandleType.Define:
+ // Bind and Define handles are freed when Statement handle is disposed
+ break;
+ case OciHandleType.Environment:
+ if (handle != IntPtr.Zero) {
+ OciCalls.OCIHandleFree (handle, type);
+ }
+ break;
+ default:
+ if ( handle != IntPtr.Zero &&
+ parent != null &&
+ parent.Handle != IntPtr.Zero ) {
+
+ OciCalls.OCIHandleFree (handle, type);
+ }
+ break;
+ }
handle = IntPtr.Zero;
}
@@ -205,7 +157,7 @@ namespace System.Data.OracleClient.Oci {
int status = 0;
sbyte output;
- status = OCIAttrGetSByte (Handle,
+ status = OciCalls.OCIAttrGetSByte (Handle,
HandleType,
out output,
IntPtr.Zero,
@@ -225,7 +177,7 @@ namespace System.Data.OracleClient.Oci {
int status = 0;
byte output;
- status = OCIAttrGetByte (Handle,
+ status = OciCalls.OCIAttrGetByte (Handle,
HandleType,
out output,
IntPtr.Zero,
@@ -245,7 +197,7 @@ namespace System.Data.OracleClient.Oci {
int status = 0;
ushort output;
- status = OCIAttrGetUInt16 (Handle,
+ status = OciCalls.OCIAttrGetUInt16 (Handle,
HandleType,
out output,
IntPtr.Zero,
@@ -265,7 +217,7 @@ namespace System.Data.OracleClient.Oci {
int status = 0;
int output;
- status = OCIAttrGetInt32 (Handle,
+ status = OciCalls.OCIAttrGetInt32 (Handle,
HandleType,
out output,
IntPtr.Zero,
@@ -284,7 +236,7 @@ namespace System.Data.OracleClient.Oci {
{
int status = 0;
IntPtr output = IntPtr.Zero;
- status = OCIAttrGetIntPtr (Handle,
+ status = OciCalls.OCIAttrGetIntPtr (Handle,
HandleType,
out output,
IntPtr.Zero,
@@ -306,7 +258,7 @@ namespace System.Data.OracleClient.Oci {
int outSize;
int status = 0;
- status = OCIAttrGet (Handle,
+ status = OciCalls.OCIAttrGet (Handle,
HandleType,
out outputPtr,
out outSize,
diff --git a/mcs/class/System.Data.OracleClient/System.Data.OracleClient.Oci/OciLobLocator.cs b/mcs/class/System.Data.OracleClient/System.Data.OracleClient.Oci/OciLobLocator.cs
index b0dc74f0852..e51c79e360f 100644
--- a/mcs/class/System.Data.OracleClient/System.Data.OracleClient.Oci/OciLobLocator.cs
+++ b/mcs/class/System.Data.OracleClient/System.Data.OracleClient.Oci/OciLobLocator.cs
@@ -61,83 +61,10 @@ namespace System.Data.OracleClient.Oci {
#region Methods
- [DllImport ("oci")]
- static extern int OCILobClose (IntPtr svchp,
- IntPtr errhp,
- IntPtr locp);
-
- [DllImport ("oci")]
- static extern int OCILobCopy (IntPtr svchp,
- IntPtr errhp,
- IntPtr dst_locp,
- IntPtr src_locp,
- uint amount,
- uint dst_offset,
- uint src_offset);
-
- [DllImport ("oci")]
- static extern int OCILobErase (IntPtr svchp,
- IntPtr errhp,
- IntPtr locp,
- ref uint amount,
- uint offset);
-
- [DllImport ("oci")]
- static extern int OCILobGetChunkSize (IntPtr svchp,
- IntPtr errhp,
- IntPtr locp,
- out uint chunk_size);
-
- [DllImport ("oci")]
- static extern int OCILobGetLength (IntPtr svchp,
- IntPtr errhp,
- IntPtr locp,
- out uint lenp);
-
- [DllImport ("oci")]
- static extern int OCILobOpen (IntPtr svchp,
- IntPtr errhp,
- IntPtr locp,
- byte mode);
-
- [DllImport ("oci")]
- static extern int OCILobRead (IntPtr svchp,
- IntPtr errhp,
- IntPtr locp,
- ref uint amtp,
- uint offset,
- byte[] bufp,
- uint bufl,
- IntPtr ctxp,
- IntPtr cbfp,
- ushort csid,
- byte csfrm);
-
- [DllImport ("oci")]
- static extern int OCILobTrim (IntPtr svchp,
- IntPtr errhp,
- IntPtr locp,
- uint newlen);
-
- [DllImport ("oci")]
- static extern int OCILobWrite (IntPtr svchp,
- IntPtr errhp,
- IntPtr locp,
- ref uint amtp,
- uint offset,
- byte[] bufp,
- uint bufl,
- byte piece,
- IntPtr ctxp,
- IntPtr cbfp,
- ushort csid,
- byte csfrm);
-
-
public void BeginBatch (OracleLobOpenMode mode)
{
int status = 0;
- status = OCILobOpen (Service,
+ status = OciCalls.OCILobOpen (Service,
ErrorHandle,
Handle,
(byte) mode);
@@ -150,7 +77,7 @@ namespace System.Data.OracleClient.Oci {
public uint Copy (OciLobLocator destination, uint amount, uint destinationOffset, uint sourceOffset)
{
- OCILobCopy (Service,
+ OciCalls.OCILobCopy (Service,
ErrorHandle,
destination,
Handle,
@@ -171,7 +98,7 @@ namespace System.Data.OracleClient.Oci {
public void EndBatch ()
{
int status = 0;
- status = OCILobClose (Service, ErrorHandle, this);
+ status = OciCalls.OCILobClose (Service, ErrorHandle, this);
if (status != 0) {
OciErrorInfo info = ErrorHandle.HandleError ();
@@ -183,7 +110,7 @@ namespace System.Data.OracleClient.Oci {
{
int status = 0;
uint output = amount;
- status = OCILobErase (Service,
+ status = OciCalls.OCILobErase (Service,
ErrorHandle,
this,
ref output,
@@ -201,7 +128,7 @@ namespace System.Data.OracleClient.Oci {
{
int status = 0;
uint output;
- status = OCILobGetChunkSize (Service,
+ status = OciCalls.OCILobGetChunkSize (Service,
ErrorHandle,
this,
out output);
@@ -218,7 +145,7 @@ namespace System.Data.OracleClient.Oci {
{
int status = 0;
uint output;
- status = OCILobGetLength (Service,
+ status = OciCalls.OCILobGetLength (Service,
ErrorHandle,
this,
out output);
@@ -243,7 +170,7 @@ namespace System.Data.OracleClient.Oci {
if (!binary)
amount /= 2;
- status = OCILobRead (Service,
+ status = OciCalls.OCILobRead (Service,
ErrorHandle,
this,
ref amount,
@@ -266,7 +193,7 @@ namespace System.Data.OracleClient.Oci {
public void Trim (uint newlen)
{
int status = 0;
- status = OCILobTrim (Service,
+ status = OciCalls.OCILobTrim (Service,
ErrorHandle,
this,
newlen);
@@ -286,7 +213,7 @@ namespace System.Data.OracleClient.Oci {
if (type == OracleType.Clob)
amount /= 2;
- status = OCILobWrite (Service,
+ status = OciCalls.OCILobWrite (Service,
ErrorHandle,
this,
ref amount,
diff --git a/mcs/class/System.Data.OracleClient/System.Data.OracleClient.Oci/OciServerHandle.cs b/mcs/class/System.Data.OracleClient/System.Data.OracleClient.Oci/OciServerHandle.cs
index db7c5d7a536..7c30c63625f 100644
--- a/mcs/class/System.Data.OracleClient/System.Data.OracleClient.Oci/OciServerHandle.cs
+++ b/mcs/class/System.Data.OracleClient/System.Data.OracleClient.Oci/OciServerHandle.cs
@@ -40,23 +40,11 @@ namespace System.Data.OracleClient.Oci {
#region Methods
- [DllImport ("oci")]
- static extern int OCIServerAttach (IntPtr srvhp,
- IntPtr errhp,
- string dblink,
- [MarshalAs (UnmanagedType.U4)] int dblink_len,
- uint mode);
-
- [DllImport ("oci")]
- static extern int OCIServerDetach (IntPtr srvhp,
- IntPtr errhp,
- uint mode);
-
public bool Attach (string tnsname, OciErrorHandle error)
{
errorHandle = error;
- int status = OCIServerAttach (this, error, tnsname, tnsname.Length, 0);
+ int status = OciCalls.OCIServerAttach (this, error, tnsname, tnsname.Length, 0);
if (status != 0) {
OciErrorInfo info = errorHandle.HandleError ();
@@ -72,7 +60,7 @@ namespace System.Data.OracleClient.Oci {
if (!attached)
return;
- int status = OCIServerDetach (this, error, 0);
+ int status = OciCalls.OCIServerDetach (this, error, 0);
if (status != 0) {
OciErrorInfo info = errorHandle.HandleError ();
diff --git a/mcs/class/System.Data.OracleClient/System.Data.OracleClient.Oci/OciServiceHandle.cs b/mcs/class/System.Data.OracleClient/System.Data.OracleClient.Oci/OciServiceHandle.cs
index 6a724e474f3..41e0c876386 100644
--- a/mcs/class/System.Data.OracleClient/System.Data.OracleClient.Oci/OciServiceHandle.cs
+++ b/mcs/class/System.Data.OracleClient/System.Data.OracleClient.Oci/OciServiceHandle.cs
@@ -71,7 +71,7 @@ namespace System.Data.OracleClient.Oci {
public bool SetServer (OciServerHandle handle)
{
server = handle;
- int status = OciGlue.OCIAttrSet (this,
+ int status = OciCalls.OCIAttrSet (this,
HandleType,
server,
0,
@@ -83,7 +83,7 @@ namespace System.Data.OracleClient.Oci {
public bool SetSession (OciSessionHandle handle)
{
session = handle;
- int status = OciGlue.OCIAttrSet (this,
+ int status = OciCalls.OCIAttrSet (this,
HandleType,
session,
0,
diff --git a/mcs/class/System.Data.OracleClient/System.Data.OracleClient.Oci/OciSessionHandle.cs b/mcs/class/System.Data.OracleClient/System.Data.OracleClient.Oci/OciSessionHandle.cs
index 67fe21c5612..45947ecaa81 100644
--- a/mcs/class/System.Data.OracleClient/System.Data.OracleClient.Oci/OciSessionHandle.cs
+++ b/mcs/class/System.Data.OracleClient/System.Data.OracleClient.Oci/OciSessionHandle.cs
@@ -62,27 +62,13 @@ namespace System.Data.OracleClient.Oci {
#region Methods
- [DllImport ("oci")]
- public static extern int OCISessionBegin (IntPtr svchp,
- IntPtr errhp,
- IntPtr usrhp,
- [MarshalAs (UnmanagedType.U4)] OciCredentialType credt,
- [MarshalAs (UnmanagedType.U4)] OciSessionMode mode);
-
- [DllImport ("oci")]
- public static extern int OCISessionEnd (IntPtr svchp,
- IntPtr errhp,
- IntPtr usrhp,
- uint mode);
-
-
public bool BeginSession (OciCredentialType credentialType, OciSessionMode mode, OciErrorHandle error)
{
errorHandle = error;
int status = 0;
- status = OciGlue.OCIAttrSetString (this,
+ status = OciCalls.OCIAttrSetString (this,
OciHandleType.Session,
username,
(uint) username.Length,
@@ -92,7 +78,7 @@ namespace System.Data.OracleClient.Oci {
if (status != 0)
return false;
- status = OciGlue.OCIAttrSetString (this,
+ status = OciCalls.OCIAttrSetString (this,
OciHandleType.Session,
password,
(uint) password.Length,
@@ -102,7 +88,7 @@ namespace System.Data.OracleClient.Oci {
if (status != 0)
return false;
- status = OCISessionBegin (Service,
+ status = OciCalls.OCISessionBegin (Service,
errorHandle,
Handle,
credentialType,
@@ -120,7 +106,7 @@ namespace System.Data.OracleClient.Oci {
{
if (!begun)
return;
- OCISessionEnd (Service, error, this, 0);
+ OciCalls.OCISessionEnd (Service, error, this, 0);
}
protected override void Dispose (bool disposing)
diff --git a/mcs/class/System.Data.OracleClient/System.Data.OracleClient.Oci/OciStatementHandle.cs b/mcs/class/System.Data.OracleClient/System.Data.OracleClient.Oci/OciStatementHandle.cs
index f9557a5ea85..2a4054a1fa5 100644
--- a/mcs/class/System.Data.OracleClient/System.Data.OracleClient.Oci/OciStatementHandle.cs
+++ b/mcs/class/System.Data.OracleClient/System.Data.OracleClient.Oci/OciStatementHandle.cs
@@ -66,44 +66,7 @@ namespace System.Data.OracleClient.Oci {
#endregion // Properties
#region Methods
-
- [DllImport ("oci")]
- static extern int OCIDescriptorFree (IntPtr descp,
- [MarshalAs (UnmanagedType.U4)] OciHandleType type);
-
- [DllImport ("oci")]
- static extern int OCIParamGet (IntPtr hndlp,
- [MarshalAs (UnmanagedType.U4)] OciHandleType htype,
- IntPtr errhp,
- out IntPtr parmdpp,
- [MarshalAs (UnmanagedType.U4)] int pos);
-
- [DllImport ("oci")]
- static extern int OCIStmtExecute (IntPtr svchp,
- IntPtr stmthp,
- IntPtr errhp,
- [MarshalAs (UnmanagedType.U4)] bool iters,
- uint rowoff,
- IntPtr snap_in,
- IntPtr snap_out,
- [MarshalAs (UnmanagedType.U4)] OciExecuteMode mode);
-
- [DllImport ("oci")]
- public static extern int OCIStmtFetch (IntPtr stmtp,
- IntPtr errhp,
- uint nrows,
- ushort orientation,
- uint mode);
-
-
- [DllImport ("oci")]
- public static extern int OCIStmtPrepare (IntPtr stmthp,
- IntPtr errhp,
- string stmt,
- [MarshalAs (UnmanagedType.U4)] int stmt_length,
- [MarshalAs (UnmanagedType.U4)] OciStatementLanguage language,
- [MarshalAs (UnmanagedType.U4)] OciStatementMode mode);
-
+
protected override void Dispose (bool disposing)
{
if (!disposed) {
@@ -117,7 +80,7 @@ namespace System.Data.OracleClient.Oci {
IntPtr handle = IntPtr.Zero;
int status = 0;
- status = OCIParamGet (this,
+ status = OciCalls.OCIParamGet (this,
OciHandleType.Statement,
ErrorHandle,
out handle,
@@ -165,15 +128,20 @@ namespace System.Data.OracleClient.Oci {
columnCount = 0;
moreResults = false;
- status = OCIStmtExecute (Service,
- Handle,
- ErrorHandle,
- nonQuery,
- 0,
- IntPtr.Zero,
- IntPtr.Zero,
- OciExecuteMode.Default);
+ if (this.disposed)
+ {
+ throw new InvalidOperationException ("StatementHandle is already disposed.");
+ }
+ status = OciCalls.OCIStmtExecute (Service,
+ Handle,
+ ErrorHandle,
+ nonQuery,
+ 0,
+ IntPtr.Zero,
+ IntPtr.Zero,
+ OciExecuteMode.Default);
+
switch (status) {
case OciGlue.OCI_DEFAULT:
if (!nonQuery) {
@@ -184,6 +152,8 @@ namespace System.Data.OracleClient.Oci {
break;
case OciGlue.OCI_NO_DATA:
break;
+ case OciGlue.OCI_INVALID_HANDLE:
+ throw new OracleException (0, "Invalid handle.");
default:
OciErrorInfo info = ErrorHandle.HandleError ();
throw new OracleException (info.ErrorCode, info.ErrorMessage);
@@ -204,12 +174,18 @@ namespace System.Data.OracleClient.Oci {
public bool Fetch ()
{
int status = 0;
- status = OCIStmtFetch (Handle,
- ErrorHandle.Handle,
- 1,
- 2,
- 0);
+ if (this.disposed)
+ {
+ throw new InvalidOperationException ("StatementHandle is already disposed.");
+ }
+
+ status = OciCalls.OCIStmtFetch (Handle,
+ ErrorHandle.Handle,
+ 1,
+ 2,
+ 0);
+
switch (status) {
case OciGlue.OCI_NO_DATA:
moreResults = false;
@@ -229,12 +205,19 @@ namespace System.Data.OracleClient.Oci {
{
int status = 0;
- status = OCIStmtPrepare (this,
- ErrorHandle,
- commandText,
- commandText.Length,
- OciStatementLanguage.NTV,
- OciStatementMode.Default);
+ if (this.disposed) {
+ throw new InvalidOperationException ("StatementHandle is already disposed.");
+ }
+
+ byte [] buffer = System.Text.Encoding.UTF8.GetBytes (commandText + "\0");
+
+ status = OciCalls.OCIStmtPrepare (this,
+ ErrorHandle,
+ buffer,
+ buffer.Length,
+ OciStatementLanguage.NTV,
+ OciStatementMode.Default);
+
if (status != 0) {
OciErrorInfo info = ErrorHandle.HandleError ();
throw new OracleException (info.ErrorCode, info.ErrorMessage);
diff --git a/mcs/class/System.Data.OracleClient/System.Data.OracleClient.Oci/OciTransactionHandle.cs b/mcs/class/System.Data.OracleClient/System.Data.OracleClient.Oci/OciTransactionHandle.cs
index 21dd0358d50..4308a389883 100644
--- a/mcs/class/System.Data.OracleClient/System.Data.OracleClient.Oci/OciTransactionHandle.cs
+++ b/mcs/class/System.Data.OracleClient/System.Data.OracleClient.Oci/OciTransactionHandle.cs
@@ -54,26 +54,10 @@ namespace System.Data.OracleClient.Oci {
#region Methods
- [DllImport ("oci")]
- public static extern int OCITransCommit (IntPtr svchp,
- IntPtr errhp,
- uint flags);
-
- [DllImport ("oci")]
- public static extern int OCITransRollback (IntPtr svchp,
- IntPtr errhp,
- uint flags);
-
- [DllImport ("oci")]
- public static extern int OCITransStart (IntPtr svchp,
- IntPtr errhp,
- uint timeout,
- [MarshalAs (UnmanagedType.U4)] OciTransactionFlags flags);
-
public void AttachToServiceContext ()
{
int status = 0;
- status = OciGlue.OCIAttrSet (Service,
+ status = OciCalls.OCIAttrSet (Service,
OciHandleType.Service,
this,
0,
@@ -85,13 +69,29 @@ namespace System.Data.OracleClient.Oci {
}
}
+ public void DetachFromServiceContext ()
+ {
+ int status = 0;
+ status = OciCalls.OCIAttrSet (Service,
+ OciHandleType.Service,
+ IntPtr.Zero,
+ 0,
+ OciAttributeType.Transaction,
+ ErrorHandle);
+ if (status != 0)
+ {
+ OciErrorInfo info = ErrorHandle.HandleError ();
+ throw new OracleException (info.ErrorCode, info.ErrorMessage);
+ }
+ }
+
public void Begin ()
{
int status = 0;
AttachToServiceContext ();
- status = OCITransStart (Service,
+ status = OciCalls.OCITransStart (Service,
ErrorHandle,
60,
OciTransactionFlags.New);
@@ -106,11 +106,17 @@ namespace System.Data.OracleClient.Oci {
{
int status = 0;
AttachToServiceContext ();
- status = OCITransCommit (Service, ErrorHandle, 0);
-
- if (status != 0) {
- OciErrorInfo info = ErrorHandle.HandleError ();
- throw new OracleException (info.ErrorCode, info.ErrorMessage);
+ try {
+ status = OciCalls.OCITransCommit (Service, ErrorHandle, 0);
+
+ if (status != 0)
+ {
+ OciErrorInfo info = ErrorHandle.HandleError ();
+ throw new OracleException (info.ErrorCode, info.ErrorMessage);
+ }
+ }
+ finally {
+ DetachFromServiceContext ();
}
}
@@ -124,13 +130,18 @@ namespace System.Data.OracleClient.Oci {
public void Rollback ()
{
- int status = 0;
- AttachToServiceContext ();
- status = OCITransRollback (Service, ErrorHandle, 0);
-
- if (status != 0) {
- OciErrorInfo info = ErrorHandle.HandleError ();
- throw new OracleException (info.ErrorCode, info.ErrorMessage);
+ try {
+ int status = 0;
+ AttachToServiceContext ();
+ status = OciCalls.OCITransRollback (Service, ErrorHandle, 0);
+
+ if (status != 0) {
+ OciErrorInfo info = ErrorHandle.HandleError ();
+ throw new OracleException (info.ErrorCode, info.ErrorMessage);
+ }
+ }
+ finally {
+ DetachFromServiceContext ();
}
}
diff --git a/mcs/class/System.Data.OracleClient/System.Data.OracleClient.dll.sources b/mcs/class/System.Data.OracleClient/System.Data.OracleClient.dll.sources
index 2d2fe391af2..0e3bcf24bb5 100755
--- a/mcs/class/System.Data.OracleClient/System.Data.OracleClient.dll.sources
+++ b/mcs/class/System.Data.OracleClient/System.Data.OracleClient.dll.sources
@@ -1,5 +1,6 @@
System.Data.OracleClient.Oci/OciAttributeType.cs
System.Data.OracleClient.Oci/OciBindHandle.cs
+System.Data.OracleClient.Oci/OciCalls.cs
System.Data.OracleClient.Oci/OciColumnInfo.cs
System.Data.OracleClient.Oci/OciCredentialType.cs
System.Data.OracleClient.Oci/OciDataType.cs
diff --git a/mcs/class/System.Data.OracleClient/System.Data.OracleClient/OciGlue.cs b/mcs/class/System.Data.OracleClient/System.Data.OracleClient/OciGlue.cs
index 291cc256350..5c7f31e26a7 100755
--- a/mcs/class/System.Data.OracleClient/System.Data.OracleClient/OciGlue.cs
+++ b/mcs/class/System.Data.OracleClient/System.Data.OracleClient/OciGlue.cs
@@ -73,34 +73,10 @@ namespace System.Data.OracleClient.Oci {
#region Methods
- [DllImport ("oci", EntryPoint = "OCIAttrSet")]
- public static extern int OCIAttrSet (IntPtr trgthndlp,
- [MarshalAs (UnmanagedType.U4)] OciHandleType trghndltyp,
- IntPtr attributep,
- uint size,
- [MarshalAs (UnmanagedType.U4)] OciAttributeType attrtype,
- IntPtr errhp);
-
- [DllImport ("oci", EntryPoint = "OCIAttrSet")]
- public static extern int OCIAttrSetString (IntPtr trgthndlp,
- [MarshalAs (UnmanagedType.U4)] OciHandleType trghndltyp,
- string attributep,
- uint size,
- [MarshalAs (UnmanagedType.U4)] OciAttributeType attrtype,
- IntPtr errhp);
-
- [DllImport ("oci")]
- public static extern int OCIErrorGet (IntPtr hndlp,
- uint recordno,
- IntPtr sqlstate,
- out int errcodep,
- IntPtr bufp,
- uint bufsize,
- [MarshalAs (UnmanagedType.U4)] OciHandleType type);
-
public void CreateConnection (OracleConnectionInfo conInfo)
{
- environment = new OciEnvironmentHandle (OciEnvironmentMode.NoUserCallback);
+ environment = new OciEnvironmentHandle (OciEnvironmentMode.Threaded | OciEnvironmentMode.NoUserCallback);
+
if (environment.Handle == IntPtr.Zero)
throw new OracleException (0, "Could not allocate the Oracle environment.");
diff --git a/mcs/class/System.Data.OracleClient/System.Data.OracleClient/OracleCommand.cs b/mcs/class/System.Data.OracleClient/System.Data.OracleClient/OracleCommand.cs
index 63efa3f7a06..3aba07142a1 100755
--- a/mcs/class/System.Data.OracleClient/System.Data.OracleClient/OracleCommand.cs
+++ b/mcs/class/System.Data.OracleClient/System.Data.OracleClient/OracleCommand.cs
@@ -27,7 +27,6 @@ namespace System.Data.OracleClient {
{
#region Fields
- bool disposed = false;
CommandBehavior behavior;
string commandText;
CommandType commandType;
@@ -212,8 +211,7 @@ namespace System.Data.OracleClient {
statement.ExecuteNonQuery ();
int rowsAffected = statement.GetAttributeInt32 (OciAttributeType.RowCount, ErrorHandle);
-
- statement.Dispose ();
+
return rowsAffected;
}
@@ -226,7 +224,13 @@ namespace System.Data.OracleClient {
if (Transaction != null)
Transaction.AttachToServiceContext ();
- return ExecuteNonQueryInternal (GetStatementHandle ());
+ OciStatementHandle statement = GetStatementHandle ();
+ try {
+ return ExecuteNonQueryInternal (statement);
+ }
+ finally {
+ SafeDisposeHandle (statement);
+ }
}
public int ExecuteOracleNonQuery (out OracleString rowid)
@@ -240,14 +244,19 @@ namespace System.Data.OracleClient {
OciStatementHandle statement = GetStatementHandle ();
- int retval = ExecuteNonQueryInternal (statement);
+ try {
+ int retval = ExecuteNonQueryInternal (statement);
- OciRowIdDescriptor descriptor = (OciRowIdDescriptor) Environment.Allocate (OciHandleType.RowId);
- descriptor.SetHandle (statement.GetAttributeIntPtr (OciAttributeType.RowId, ErrorHandle));
+ OciRowIdDescriptor descriptor = (OciRowIdDescriptor) Environment.Allocate (OciHandleType.RowId);
+ descriptor.SetHandle (statement.GetAttributeIntPtr (OciAttributeType.RowId, ErrorHandle));
- rowid = new OracleString (descriptor.GetRowId (ErrorHandle));
+ rowid = new OracleString (descriptor.GetRowId (ErrorHandle));
- return retval;
+ return retval;
+ }
+ finally {
+ SafeDisposeHandle (statement);
+ }
}
[MonoTODO]
@@ -268,17 +277,28 @@ namespace System.Data.OracleClient {
AssertCommandTextIsSet ();
AssertNoDataReader ();
- if (Transaction != null)
+ if (Transaction != null)
Transaction.AttachToServiceContext ();
-
+
OciStatementHandle statement = GetStatementHandle ();
+ OracleDataReader rd = null;
+ try {
+ if (preparedStatement == null)
+ statement.Prepare (CommandText);
+ else
+ preparedStatement = null; // OracleDataReader releases the statement handle
- if (preparedStatement == null)
- statement.Prepare (CommandText);
- BindParameters (statement);
- statement.ExecuteQuery ();
+ BindParameters (statement);
+ statement.ExecuteQuery ();
- return new OracleDataReader (this, statement);
+ rd = new OracleDataReader (this, statement);
+ }
+ finally {
+ if (statement != null && rd == null)
+ statement.Dispose();
+ }
+
+ return rd;
}
public object ExecuteScalar ()
@@ -293,16 +313,21 @@ namespace System.Data.OracleClient {
Transaction.AttachToServiceContext ();
OciStatementHandle statement = GetStatementHandle ();
- if (preparedStatement == null)
- statement.Prepare (CommandText);
- BindParameters (statement);
+ try {
+ if (preparedStatement == null)
+ statement.Prepare (CommandText);
+ BindParameters (statement);
- statement.ExecuteQuery ();
+ statement.ExecuteQuery ();
- if (statement.Fetch ())
- output = ((OciDefineHandle) statement.Values [0]).GetValue ();
- else
- output = DBNull.Value;
+ if (statement.Fetch ())
+ output = ((OciDefineHandle) statement.Values [0]).GetValue ();
+ else
+ output = DBNull.Value;
+ }
+ finally {
+ SafeDisposeHandle (statement);
+ }
return output;
}
@@ -319,6 +344,12 @@ namespace System.Data.OracleClient {
return h;
}
+ private void SafeDisposeHandle (OciStatementHandle h)
+ {
+ if (h != null && h != preparedStatement)
+ h.Dispose();
+ }
+
IDbDataParameter IDbCommand.CreateParameter ()
{
return CreateParameter ();
diff --git a/mcs/class/System.Data.OracleClient/System.Data.OracleClient/OracleDataReader.cs b/mcs/class/System.Data.OracleClient/System.Data.OracleClient/OracleDataReader.cs
index c848d9891cd..b2316f5a47e 100644
--- a/mcs/class/System.Data.OracleClient/System.Data.OracleClient/OracleDataReader.cs
+++ b/mcs/class/System.Data.OracleClient/System.Data.OracleClient/OracleDataReader.cs
@@ -34,7 +34,6 @@ namespace System.Data.OracleClient {
bool disposed = false;
bool isClosed;
bool hasRows;
- bool moreResults;
DataTable schemaTable;
int recordsAffected = -1;
@@ -57,7 +56,7 @@ namespace System.Data.OracleClient {
~OracleDataReader ()
{
- Dispose ();
+ Dispose (false);
}
#endregion // Constructors
@@ -103,6 +102,7 @@ namespace System.Data.OracleClient {
public void Close ()
{
+ statement.Dispose();
if (!isClosed)
command.CloseDataReader ();
isClosed = true;
diff --git a/mcs/class/System.Data.OracleClient/System.Data.OracleClient/OracleParameter.cs b/mcs/class/System.Data.OracleClient/System.Data.OracleClient/OracleParameter.cs
index ff4504d0df5..d8e6af20083 100644
--- a/mcs/class/System.Data.OracleClient/System.Data.OracleClient/OracleParameter.cs
+++ b/mcs/class/System.Data.OracleClient/System.Data.OracleClient/OracleParameter.cs
@@ -165,23 +165,6 @@ namespace System.Data.OracleClient {
#region Methods
- [DllImport ("oci")]
- static extern int OCIBindByName (IntPtr stmtp,
- out IntPtr bindpp,
- IntPtr errhp,
- string placeholder,
- int placeh_len,
- IntPtr valuep,
- int value_sz,
- [MarshalAs (UnmanagedType.U2)] OciDataType dty,
- int indp,
- IntPtr alenp,
- IntPtr rcodep,
- uint maxarr_len,
- IntPtr curelp,
- uint mode);
-
-
private void AssertSizeIsSet ()
{
if (!sizeSet)
@@ -214,7 +197,7 @@ namespace System.Data.OracleClient {
bindSize = value.ToString ().Length;
}
- status = OCIBindByName (statement,
+ status = OciCalls.OCIBindByName (statement,
out tmpHandle,
connection.ErrorHandle,
ParameterName,
diff --git a/mcs/class/System.Data.OracleClient/System.Data.OracleClient/OracleTransaction.cs b/mcs/class/System.Data.OracleClient/System.Data.OracleClient/OracleTransaction.cs
index 69d50480250..4c1af969f69 100644
--- a/mcs/class/System.Data.OracleClient/System.Data.OracleClient/OracleTransaction.cs
+++ b/mcs/class/System.Data.OracleClient/System.Data.OracleClient/OracleTransaction.cs
@@ -82,7 +82,10 @@ namespace System.Data.OracleClient {
{
if (!disposed) {
if (disposing) {
- Rollback ();
+ if (isOpen)
+ Rollback ();
+
+ transaction.Dispose();
}
disposed = true;
}
diff --git a/mcs/class/System.Data/.cvsignore b/mcs/class/System.Data/.cvsignore
index 0e3f75b9676..ac991a5f94b 100644
--- a/mcs/class/System.Data/.cvsignore
+++ b/mcs/class/System.Data/.cvsignore
@@ -1,6 +1,8 @@
.makefrag
.response
System.Data.dll
+System.Data_test.dll
+System.Data_test.pdb
library-deps.stamp
Temp
tmp
diff --git a/mcs/class/System.Data/ChangeLog b/mcs/class/System.Data/ChangeLog
index 2cf7120705e..17f4238745d 100644
--- a/mcs/class/System.Data/ChangeLog
+++ b/mcs/class/System.Data/ChangeLog
@@ -1,3 +1,11 @@
+2004-01-21 Atsushi Enomoto <atsushi@ximian.com>
+
+ * System.Data_test.dll.sources : Added TypedDataSetGeneratorTest.cs.
+
+2004-01-20 Atsushi Enomoto <atsushi@ximian.com>
+
+ * System.Data.dll.sources: Added missing TypedDataSetGenerator.cs.
+
2003-12-28 Tim Coleman <tim@timcoleman.com>
* System.Data.dll.sources:
Add new .NET 1.2 sources.
diff --git a/mcs/class/System.Data/System.Data.Common/ChangeLog b/mcs/class/System.Data/System.Data.Common/ChangeLog
index 1a63975d68e..543aaa6abff 100755
--- a/mcs/class/System.Data/System.Data.Common/ChangeLog
+++ b/mcs/class/System.Data/System.Data.Common/ChangeLog
@@ -1,3 +1,12 @@
+2004-01-10 Atsushi Enomoto <atsushi@ximian.com>
+
+ * DbDataPermission.cs : tiny fix to pass OleDbPermission.
+
+2004-01-09 Atsushi Enomoto <atsushi@ximian.com>
+
+ * DbDataPermission.cs : .ctor(PermissionState state) should not call
+ obsolete .ctor(state, allowBlankPassword). csc reports an error.
+
2003-12-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* DbDataAdapter.cs: handle MissingShemaAction.AddWithKey, call
diff --git a/mcs/class/System.Data/System.Data.Common/DbDataAdapter.cs b/mcs/class/System.Data/System.Data.Common/DbDataAdapter.cs
index ba31c526d66..0e3c91269ac 100644
--- a/mcs/class/System.Data/System.Data.Common/DbDataAdapter.cs
+++ b/mcs/class/System.Data/System.Data.Common/DbDataAdapter.cs
@@ -699,13 +699,21 @@ namespace System.Data.Common {
parameter.Value = row [dsColumnName, rowVersion];
}
}
-
+
+ CommandBehavior commandBehavior = CommandBehavior.Default;
if (command.Connection.State == ConnectionState.Closed)
+ {
command.Connection.Open ();
+ commandBehavior |= CommandBehavior.CloseConnection;
+ }
+ IDataReader reader = null;
try
{
- int tmp = command.ExecuteNonQuery ();
+ // use ExecuteReader because we want to use the commandbehavior parameter.
+ // so the connection will be closed if needed.
+ reader = command.ExecuteReader (commandBehavior);
+ int tmp = reader.RecordsAffected;
// if the execute does not effect any rows we throw an exception.
if (tmp == 0)
throw new DBConcurrencyException("Concurrency violation: the " + commandName +"Command affected 0 records.");
@@ -720,6 +728,11 @@ namespace System.Data.Common {
else
throw e;
}
+ finally
+ {
+ if (reader != null)
+ reader.Close ();
+ }
}
return updateCount;
diff --git a/mcs/class/System.Data/System.Data.Common/DbDataPermission.cs b/mcs/class/System.Data/System.Data.Common/DbDataPermission.cs
index 963503068b0..57d953e2abd 100644
--- a/mcs/class/System.Data/System.Data.Common/DbDataPermission.cs
+++ b/mcs/class/System.Data/System.Data.Common/DbDataPermission.cs
@@ -42,14 +42,19 @@ namespace System.Data.Common {
#endif
protected DBDataPermission (PermissionState state)
- : this (state, false)
+ : this (state, false, false)
{
}
#if NET_1_2
[Obsolete ("use DBDataPermission (PermissionState.None)", true)]
#endif
- public DBDataPermission (PermissionState state, bool allowBlankPassword)
+ public DBDataPermission (PermissionState state, bool allowBlankPassword)
+ : this (state, allowBlankPassword, true)
+ {
+ }
+
+ internal DBDataPermission (PermissionState state, bool allowBlankPassword, bool dummyArg)
{
this.state = state;
this.allowBlankPassword = allowBlankPassword;
diff --git a/mcs/class/System.Data/System.Data.OleDb/ChangeLog b/mcs/class/System.Data/System.Data.OleDb/ChangeLog
index fe6597ab02d..82385062f29 100644
--- a/mcs/class/System.Data/System.Data.OleDb/ChangeLog
+++ b/mcs/class/System.Data/System.Data.OleDb/ChangeLog
@@ -1,3 +1,7 @@
+2004-01-10 Atsushi Enomoto <atsushi@ximian.com>
+
+ * OleDbPermission.cs : NET_1_2 fix not to call obsolete .ctor.
+
2002-11-01 Daniel Morgan <danmorg@sc.rr.com>
* OleDbDataReader.cs: implemented
diff --git a/mcs/class/System.Data/System.Data.OleDb/OleDbPermission.cs b/mcs/class/System.Data/System.Data.OleDb/OleDbPermission.cs
index 2bf95972a5e..280ad261851 100644
--- a/mcs/class/System.Data/System.Data.OleDb/OleDbPermission.cs
+++ b/mcs/class/System.Data/System.Data.OleDb/OleDbPermission.cs
@@ -22,19 +22,21 @@ namespace System.Data.OleDb
#region Constructors
[MonoTODO]
- public OleDbPermission ()
+ public OleDbPermission () : base (PermissionState.None)
{
throw new NotImplementedException ();
}
[MonoTODO]
public OleDbPermission (PermissionState state)
+ : base (state)
{
throw new NotImplementedException ();
}
[MonoTODO]
public OleDbPermission (PermissionState state, bool allowBlankPassword)
+ : base (state, allowBlankPassword, true)
{
throw new NotImplementedException ();
}
diff --git a/mcs/class/System.Data/System.Data.Sql/ChangeLog b/mcs/class/System.Data/System.Data.Sql/ChangeLog
index 406c50596fa..6022cf0b333 100755
--- a/mcs/class/System.Data/System.Data.Sql/ChangeLog
+++ b/mcs/class/System.Data/System.Data.Sql/ChangeLog
@@ -1,3 +1,7 @@
+2004-01-10 Atsushi Enomoto <atsushi@ximian.com>
+
+ * ISqlParameterCollection.cs : Obsolete attribute requires usingdecl.
+
2003-12-19 Tim Coleman <tim@timcoleman.com>
* DataAccessKind.cs Format.cs IBinarySerialize.cs
* InvalidUdtException.cs ISqlCommand.cs ISqlConnection.cs
diff --git a/mcs/class/System.Data/System.Data.Sql/ISqlParameterCollection.cs b/mcs/class/System.Data/System.Data.Sql/ISqlParameterCollection.cs
index b506ecc4103..6d43f9b87a5 100644
--- a/mcs/class/System.Data/System.Data.Sql/ISqlParameterCollection.cs
+++ b/mcs/class/System.Data/System.Data.Sql/ISqlParameterCollection.cs
@@ -9,6 +9,7 @@
#if NET_1_2
+using System.Runtime.InteropServices;
using System.Collections;
namespace System.Data.Sql {
diff --git a/mcs/class/System.Data/System.Data.SqlClient/ChangeLog b/mcs/class/System.Data/System.Data.SqlClient/ChangeLog
index 152f2ca603a..6b03f50d700 100755
--- a/mcs/class/System.Data/System.Data.SqlClient/ChangeLog
+++ b/mcs/class/System.Data/System.Data.SqlClient/ChangeLog
@@ -1,3 +1,8 @@
+2004-01-10 Atsushi Enomoto <atsushi@ximian.com>
+
+ * SqlClientPermission.cs : Fixed NET_1_2 build related to
+ obsolete attribute problem (see DbDataPermission.cs)
+
2003-12-28 Tim Coleman <tim@timcoleman.com>
* SqlResultSet.cs:
Stubbed out this class.
diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlClientPermission.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlClientPermission.cs
index 1a4bb408e30..453db5efb82 100644
--- a/mcs/class/System.Data/System.Data.SqlClient/SqlClientPermission.cs
+++ b/mcs/class/System.Data/System.Data.SqlClient/SqlClientPermission.cs
@@ -55,7 +55,7 @@ namespace System.Data.SqlClient {
protected override DBDataPermission CreateInstance ()
{
- return (DBDataPermission) new SqlClientPermission ();
+ return (DBDataPermission) new SqlClientPermission (PermissionState.None);
}
#endregion // Methods
diff --git a/mcs/class/System.Data/System.Data.dll.sources b/mcs/class/System.Data/System.Data.dll.sources
index 9a9d32a983f..74a8a603597 100755
--- a/mcs/class/System.Data/System.Data.dll.sources
+++ b/mcs/class/System.Data/System.Data.dll.sources
@@ -108,6 +108,7 @@ System.Data/StatementType.cs
System.Data/StrongTypingException.cs
System.Data/SyntaxErrorException.cs
System.Data/TODOAttribute.cs
+System.Data/TypedDataSetGenerator.cs
System.Data/TypeDataSetGeneratorException.cs
System.Data/UniqueConstraint.cs
System.Data/UpdateOptions.cs
diff --git a/mcs/class/System.Data/System.Data/ChangeLog b/mcs/class/System.Data/System.Data/ChangeLog
index 05334b290ef..1c8219543e1 100644
--- a/mcs/class/System.Data/System.Data/ChangeLog
+++ b/mcs/class/System.Data/System.Data/ChangeLog
@@ -1,3 +1,61 @@
+2004-01-26 Eran Domb <erand@mainsoft.com>
+
+ * XmlConstants.cs : Added some constants.
+ * DataColumn.cs : Added a method to retrive AutoIncrement value.
+ * XmlDataLoader.cs : Set the value of the foriegn key column, according to the value of the
+ parent table column.
+ * XmlDiffLoader.cs : Convert the value comming from the xml.
+ * XmlSchemaMapper.cs (Read) : Set the DataSet namespace.
+ (ReadXmlSchemaSequence) : Change the logic that decides if this element is a column or a table.
+ (ReadXmlSchemaElement) : Set the locale of the dataset.
+ (ReadColumn) : Set the column type. Find if the column is AutoIncrement.
+ (GetColumnType) : New method to get the column type from the attribute value.
+ (ReadXmlSchemaUnique) : Improve parsing of XPath. Set the constraint as a PK if needed,
+ and add the constraint to the table.
+ (ReadXmlSchemaKeyref) : Improve parsing of XPath. Create the FK constraint and add it to
+ the table.
+ * DataSet.cs : Improving writing of unique constraints, and foriegn key constraint. Givving them the correct names.
+ Writing more information to the schema for interoperability with ms.net.
+ Improve diffgarm writing mode.
+
+
+2004-01-21 Atsushi Enomoto <atsushi@ximian.com>
+
+ * TypedDataSetGenerator.cs : Implemented GenerateIdName().
+
+2004-01-21 Eran Domb <erand@mainsoft.com>
+
+ * XmlDataLoader.cs (AddRowToTable) : Give thre new relation correct name.
+ Do not set the child column to be AutoIncrement.
+ Create the new column for the relation as MappingType.Hidden so they will not be serialized
+ when writing the dataset to xml.
+
+2004-01-20 Atsushi Enomoto <atsushi@ximian.com>
+
+ * Added missing TypedDataSetGenerator.cs.
+
+2004-01-08 Eran Domb <erand@mainsoft.com>
+
+ * XmlSchemaMapper.cs : Fix a bug. Check if table already in DataSet before adding it.
+ * DataSet.cs (ReadXml) : Fix bugs. Read correctly the xml file with XmlReadMode of DiffGram,
+ InferSchema, ReadSchema and IgnoreSchema.
+ * XmlDataLoader.cs : All modes use the same logic.
+ * XmlDiffLoader.cs : Adding BuildXmlDocument method to the class.
+
+2004-01-06 Eran Domb <erand@mainsoft.com>
+
+ * DataRelationCollection.cs : Use IndexOf in indexer.
+ * DataSet.cs : Adding support for WriteXml with diffgram. Code style changes.
+ * XmlDataLoader.cs : Set the DataSet.enforceConstraints to false before loading the tables.
+ * XmlDiffLoader.cs : Reading nested tables.
+ * XmlSchemaMapper.cs : Reading the relation.
+ * XmlConstants.cs : Adding some constants.
+
+2004-01-05 Jackson Harper <jackson@ximian.com>
+
+ * DataView.cs: Set readonly property of property descriptor. This
+ fixes bug #52598.
+
2004-01-01 Sanjay Gupta <gsanjay@novell.com>
* DataRelationCollection.cs : Fixed incorrect generation of default
diff --git a/mcs/class/System.Data/System.Data/DataColumn.cs b/mcs/class/System.Data/System.Data/DataColumn.cs
index 792f972140b..dcf6f15b6c9 100644
--- a/mcs/class/System.Data/System.Data/DataColumn.cs
+++ b/mcs/class/System.Data/System.Data/DataColumn.cs
@@ -231,6 +231,11 @@ namespace System.Data {
return currentValue;
}
+ internal long GetAutoIncrementValue ()
+ {
+ return _nextAutoIncrementValue;
+ }
+
internal bool DataHasBeenSet {
get {
return dataHasBeenSet;
diff --git a/mcs/class/System.Data/System.Data/DataRelationCollection.cs b/mcs/class/System.Data/System.Data/DataRelationCollection.cs
index 62bcbdc6551..9974494f777 100644
--- a/mcs/class/System.Data/System.Data/DataRelationCollection.cs
+++ b/mcs/class/System.Data/System.Data/DataRelationCollection.cs
@@ -71,7 +71,7 @@ namespace System.Data {
/// </summary>
/// <param name="relation">The relation to check.</param>
protected override void AddCore (DataRelation relation)
- {
+ {
base.AddCore (relation);
if (relation.ChildTable.DataSet != this.dataSet || relation.ParentTable.DataSet != this.dataSet)
throw new DataException ();
@@ -178,9 +178,8 @@ namespace System.Data {
public override DataRelation this [string name]
{
get {
- foreach (DataRelation dataRelation in List)
- if (dataRelation.RelationName == name) return dataRelation;
- return null;
+ int index = IndexOf (name, true);
+ return index < 0 ? null : (DataRelation) list[index];
}
}
diff --git a/mcs/class/System.Data/System.Data/DataRow.cs b/mcs/class/System.Data/System.Data/DataRow.cs
index 9f60c265f86..d20bf7d1028 100644
--- a/mcs/class/System.Data/System.Data/DataRow.cs
+++ b/mcs/class/System.Data/System.Data/DataRow.cs
@@ -268,6 +268,9 @@ namespace System.Data {
if (v == null)
{
+ if (col.DataType.ToString().Equals("System.Guid"))
+ throw new ArgumentException("Cannot set column to be null, Please use DBNull instead");
+
if(col.DefaultValue != DBNull.Value)
{
newval = col.DefaultValue;
@@ -957,7 +960,7 @@ namespace System.Data {
public bool IsNull (DataColumn column)
{
object o = this[column];
- return (o == null || o == DBNull.Value);
+ return (o == DBNull.Value);
}
/// <summary>
@@ -967,7 +970,7 @@ namespace System.Data {
public bool IsNull (int columnIndex)
{
object o = this[columnIndex];
- return (o == null || o == DBNull.Value);
+ return (o == DBNull.Value);
}
/// <summary>
@@ -976,7 +979,7 @@ namespace System.Data {
public bool IsNull (string columnName)
{
object o = this[columnName];
- return (o == null || o == DBNull.Value);
+ return (o == DBNull.Value);
}
/// <summary>
@@ -986,7 +989,7 @@ namespace System.Data {
public bool IsNull (DataColumn column, DataRowVersion version)
{
object o = this[column, version];
- return (o == null || o == DBNull.Value);
+ return (o == DBNull.Value);
}
/// <summary>
diff --git a/mcs/class/System.Data/System.Data/DataSet.cs b/mcs/class/System.Data/System.Data/DataSet.cs
index 756a4bafec2..23694fbd857 100644
--- a/mcs/class/System.Data/System.Data/DataSet.cs
+++ b/mcs/class/System.Data/System.Data/DataSet.cs
@@ -31,7 +31,8 @@ namespace System.Data {
[DefaultProperty ("DataSetName")]
[Serializable]
public class DataSet : MarshalByValueComponent, IListSource,
- ISupportInitialize, ISerializable, IXmlSerializable {
+ ISupportInitialize, ISerializable, IXmlSerializable
+ {
private string dataSetName;
private string _namespace = "";
private string prefix;
@@ -43,9 +44,10 @@ namespace System.Data {
private DataViewManager defaultView;
private CultureInfo locale = System.Threading.Thread.CurrentThread.CurrentCulture;
-#region Constructors
+ #region Constructors
- public DataSet () : this ("NewDataSet") {
+ public DataSet () : this ("NewDataSet")
+ {
}
public DataSet (string name)
@@ -60,7 +62,8 @@ namespace System.Data {
}
[MonoTODO]
- protected DataSet (SerializationInfo info, StreamingContext context) : this () {
+ protected DataSet (SerializationInfo info, StreamingContext context) : this ()
+ {
throw new NotImplementedException ();
}
@@ -138,8 +141,7 @@ namespace System.Data {
public bool HasErrors {
[MonoTODO]
get {
- for (int i = 0; i < Tables.Count; i++)
- {
+ for (int i = 0; i < Tables.Count; i++) {
if (Tables[i].HasErrors)
return true;
}
@@ -364,8 +366,7 @@ namespace System.Data {
//demands these values. instead changing the DataRelation constructor and behaviour the
//parameters are pre-configured and sent to the most general constructor
- foreach (DataRelation MyRelation in this.Relations)
- {
+ foreach (DataRelation MyRelation in this.Relations) {
string pTable = MyRelation.ParentTable.TableName;
string cTable = MyRelation.ChildTable.TableName;
DataColumn[] P_DC = new DataColumn[MyRelation.ParentColumns.Length];
@@ -421,8 +422,7 @@ namespace System.Data {
IEnumerator rowEnumerator = origTable.Rows.GetEnumerator ();
while (rowEnumerator.MoveNext ()) {
DataRow row = (DataRow)rowEnumerator.Current;
- if (row.IsRowChanged (rowStates))
- {
+ if (row.IsRowChanged (rowStates)) {
DataRow newRow = copyTable.NewRow ();
copyTable.Rows.Add (newRow);
row.CopyValuesToRow (newRow);
@@ -646,35 +646,30 @@ namespace System.Data {
if (writePI && (writer.WriteState == WriteState.Start))
writer.WriteStartDocument (true);
- ((XmlTextWriter)writer).Formatting = Formatting.Indented;
- WriteStartElement (writer, mode, Namespace, Prefix, XmlConvert.EncodeName (DataSetName));
+ ((XmlTextWriter)writer).Formatting = Formatting.Indented;
+
+ if (mode == XmlWriteMode.DiffGram) {
+ SetRowsID();
+ WriteDiffGramElement(writer);
+ }
- if (mode == XmlWriteMode.WriteSchema)
- {
+ WriteStartElement (writer, mode, Namespace, Prefix, XmlConvert.EncodeName (DataSetName));
+ if (mode == XmlWriteMode.WriteSchema) {
DoWriteXmlSchema (writer);
}
- //Write out each table in order, providing it is not
- //part of another table structure via a nested parent relationship
- foreach (DataTable table in Tables)
- {
- bool isTopLevel = true;
- foreach (DataRelation rel in table.ParentRelations)
- {
- if (rel.Nested)
- {
- isTopLevel = false;
- break;
- }
- }
-
- if (isTopLevel)
- {
- WriteTable ( writer, table, mode);
+ WriteTables (writer, mode, Tables, DataRowVersion.Default);
+ if (mode == XmlWriteMode.DiffGram) {
+ writer.WriteEndElement (); //DataSet name
+ if (HasChanges(DataRowState.Modified | DataRowState.Deleted)) {
+
+ DataSet beforeDS = GetChanges (DataRowState.Modified | DataRowState.Deleted);
+ WriteStartElement (writer, XmlWriteMode.DiffGram, XmlConstants.DiffgrNamespace, XmlConstants.DiffgrPrefix, "before");
+ WriteTables (writer, mode, beforeDS.Tables, DataRowVersion.Original);
+ writer.WriteEndElement ();
}
}
-
- writer.WriteEndElement ();
+ writer.WriteEndElement (); // DataSet name or diffgr:diffgram
}
public void WriteXmlSchema (Stream stream)
@@ -700,7 +695,7 @@ namespace System.Data {
public void WriteXmlSchema (XmlWriter writer)
{
- ((XmlTextWriter)writer).Formatting = Formatting.Indented;
+ ((XmlTextWriter)writer).Formatting = Formatting.Indented;
//Create a skeleton doc and then write the schema
//proper which is common to the WriteXml method in schema mode
writer.WriteStartDocument ();
@@ -755,28 +750,45 @@ namespace System.Data {
// FIXME: somekinda exception?
if (!r.Read ())
return XmlReadMode.Auto; // FIXME
+
+ // Check if the curent element is the process instruction (PI).
+ // if it is move to next element.
+ if (r.LocalName == "xml")
+ r.MoveToContent();
/*\
* If document is diffgram we will use diffgram
\*/
if (r.LocalName == "diffgram")
return ReadXml (r, XmlReadMode.DiffGram);
-
- /*\
- * If we already have a schema, or the document
- * contains an in-line schema, sets XmlReadMode to ReadSchema.
- \*/
-
- // FIXME: is this always true: "if we have tables we have to have schema also"
- if (Tables.Count > 0)
- return ReadXml (r, XmlReadMode.ReadSchema);
-
- /*\
- * If we dont have a schema yet and document
- * contains no inline-schema mode is XmlReadMode.InferSchema
- \*/
-
- return ReadXml (r, XmlReadMode.InferSchema);
+
+ // Get the DataSet name.
+ string dataSetName = XmlConvert.DecodeName (r.LocalName);
+ DataSetName = dataSetName;
+
+ r.ReadStartElement ();
+ r.MoveToContent();
+
+ bool schemaRead = false;
+ // Check if the current element is the schema
+ if (r.LocalName == "schema") {
+ ReadXmlSchema (r);
+ r.MoveToContent();
+ schemaRead = true;
+ }
+
+ if (r.LocalName == "diffgram") {
+ return ReadXml (r, XmlReadMode.DiffGram);
+ }
+
+ // If the schema has been read we should read the rest of the document
+ if (schemaRead) {
+ ReadXml (r, XmlReadMode.IgnoreSchema, false);
+ return XmlReadMode.ReadSchema;
+ }
+
+ // Read with inferschema.
+ return ReadXml (r, XmlReadMode.InferSchema, false);
}
@@ -798,21 +810,56 @@ namespace System.Data {
[MonoTODO]
public XmlReadMode ReadXml (XmlReader reader, XmlReadMode mode)
{
+ // we have to initiate the reader.
+ if (reader.ReadState == ReadState.Initial)
+ reader.Read();
+
+ // Check if the curent element is the process instruction (PI).
+ // if it is move to next element.
+ if (reader.LocalName == "xml")
+ reader.MoveToContent();
+
XmlReadMode Result = XmlReadMode.Auto;
if (mode == XmlReadMode.DiffGram) {
+ if (reader.LocalName != "diffgram"){
+ reader.MoveToContent ();
+ reader.ReadStartElement (); // <DataSet>
+
+ reader.MoveToContent ();
+ if (reader.LocalName == "schema")
+ ReadXmlSchema (reader);
+
+ reader.MoveToContent ();
+ }
XmlDiffLoader DiffLoader = new XmlDiffLoader (this);
DiffLoader.Load (reader);
Result = XmlReadMode.DiffGram;
}
- else {
- XmlDataLoader Loader = new XmlDataLoader (this);
- Result = Loader.LoadData (reader, mode);
- }
+ else
+ Result = ReadXml(reader, mode, true);
return Result;
}
+ private XmlReadMode ReadXml (XmlReader r, XmlReadMode mode, bool readDataSet) {
+
+ if (readDataSet) {
+ string dataSetName = XmlConvert.DecodeName (r.LocalName);
+ DataSetName = dataSetName;
+ // get the Namespace of the DataSet.
+ string tmp = r.GetAttribute("xmlns");
+ if (tmp != null)
+ Namespace = tmp;
+
+ r.ReadStartElement ();
+ r.MoveToContent();
+ }
+
+ XmlDataLoader Loader = new XmlDataLoader (this);
+ return Loader.LoadData (r, mode);
+ }
+
#endregion // Public Methods
#region Public Events
@@ -881,14 +928,8 @@ namespace System.Data {
void IXmlSerializable.ReadXml (XmlReader reader)
{
- reader.MoveToContent ();
- reader.ReadStartElement (); // <DataSet>
-
- reader.MoveToContent ();
- ReadXmlSchema (reader);
- reader.MoveToContent ();
- ReadXml (reader, XmlReadMode.IgnoreSchema);
+ ReadXmlSerializable(reader);
// the XmlSerializationReader does this lines!!!
//reader.MoveToContent ();
@@ -898,7 +939,7 @@ namespace System.Data {
void IXmlSerializable.WriteXml (XmlWriter writer)
{
DoWriteXmlSchema (writer);
- WriteXml (writer, XmlWriteMode.IgnoreSchema, true);
+ WriteXml (writer, XmlWriteMode.DiffGram, true);
}
protected virtual bool ShouldSerializeRelations ()
@@ -940,50 +981,70 @@ namespace System.Data {
#region Private Xml Serialisation
- private string WriteObjectXml (object o) {
+ private string WriteObjectXml (object o)
+ {
switch (Type.GetTypeCode (o.GetType ())) {
- case TypeCode.Boolean:
- return XmlConvert.ToString ((Boolean) o);
- case TypeCode.Byte:
- return XmlConvert.ToString ((Byte) o);
- case TypeCode.Char:
- return XmlConvert.ToString ((Char) o);
- case TypeCode.DateTime:
- return XmlConvert.ToString ((DateTime) o);
- case TypeCode.Decimal:
- return XmlConvert.ToString ((Decimal) o);
- case TypeCode.Double:
- return XmlConvert.ToString ((Double) o);
- case TypeCode.Int16:
- return XmlConvert.ToString ((Int16) o);
- case TypeCode.Int32:
- return XmlConvert.ToString ((Int32) o);
- case TypeCode.Int64:
- return XmlConvert.ToString ((Int64) o);
- case TypeCode.SByte:
- return XmlConvert.ToString ((SByte) o);
- case TypeCode.Single:
- return XmlConvert.ToString ((Single) o);
- case TypeCode.UInt16:
- return XmlConvert.ToString ((UInt16) o);
- case TypeCode.UInt32:
- return XmlConvert.ToString ((UInt32) o);
- case TypeCode.UInt64:
- return XmlConvert.ToString ((UInt64) o);
+ case TypeCode.Boolean:
+ return XmlConvert.ToString ((Boolean) o);
+ case TypeCode.Byte:
+ return XmlConvert.ToString ((Byte) o);
+ case TypeCode.Char:
+ return XmlConvert.ToString ((Char) o);
+ case TypeCode.DateTime:
+ return XmlConvert.ToString ((DateTime) o);
+ case TypeCode.Decimal:
+ return XmlConvert.ToString ((Decimal) o);
+ case TypeCode.Double:
+ return XmlConvert.ToString ((Double) o);
+ case TypeCode.Int16:
+ return XmlConvert.ToString ((Int16) o);
+ case TypeCode.Int32:
+ return XmlConvert.ToString ((Int32) o);
+ case TypeCode.Int64:
+ return XmlConvert.ToString ((Int64) o);
+ case TypeCode.SByte:
+ return XmlConvert.ToString ((SByte) o);
+ case TypeCode.Single:
+ return XmlConvert.ToString ((Single) o);
+ case TypeCode.UInt16:
+ return XmlConvert.ToString ((UInt16) o);
+ case TypeCode.UInt32:
+ return XmlConvert.ToString ((UInt32) o);
+ case TypeCode.UInt64:
+ return XmlConvert.ToString ((UInt64) o);
}
if (o is TimeSpan) return XmlConvert.ToString ((TimeSpan) o);
if (o is Guid) return XmlConvert.ToString ((Guid) o);
return o.ToString ();
}
-
- private void WriteTable (XmlWriter writer, DataTable table, XmlWriteMode mode)
+
+ private void WriteTables (XmlWriter writer, XmlWriteMode mode, DataTableCollection tableCollection, DataRowVersion version)
+ {
+ //Write out each table in order, providing it is not
+ //part of another table structure via a nested parent relationship
+ foreach (DataTable table in tableCollection) {
+ bool isTopLevel = true;
+ foreach (DataRelation rel in table.ParentRelations) {
+ if (rel.Nested) {
+ isTopLevel = false;
+ break;
+ }
+ }
+
+ if (isTopLevel) {
+ WriteTable ( writer, table, mode, version);
+ }
+ }
+ }
+
+ private void WriteTable (XmlWriter writer, DataTable table, XmlWriteMode mode, DataRowVersion version)
{
DataRow[] rows = new DataRow [table.Rows.Count];
table.Rows.CopyTo (rows, 0);
- WriteTable (writer, rows, mode);
+ WriteTable (writer, rows, mode, version);
}
- private void WriteTable (XmlWriter writer, DataRow[] rows, XmlWriteMode mode)
+ private void WriteTable (XmlWriter writer, DataRow[] rows, XmlWriteMode mode, DataRowVersion version)
{
//The columns can be attributes, hidden, elements, or simple content
//There can be 0-1 simple content cols or 0-* elements
@@ -994,17 +1055,18 @@ namespace System.Data {
if (rows.Length == 0) return;
DataTable table = rows[0].Table;
SplitColumns (table, out atts, out elements, out simple);
+ //sort out the namespacing
+ string nspc = table.Namespace.Length > 0 ? table.Namespace : Namespace;
- foreach (DataRow row in rows)
- {
- //sort out the namespacing
- string nspc = table.Namespace.Length > 0 ? table.Namespace : Namespace;
-
+ foreach (DataRow row in rows) {
+ if (!row.HasVersion(version))
+ continue;
+
// First check are all the rows null. If they are we just write empty element
bool AllNulls = true;
foreach (DataColumn dc in table.Columns) {
- if (row [dc.ColumnName] != DBNull.Value) {
+ if (row [dc.ColumnName, version] != DBNull.Value) {
AllNulls = false;
break;
}
@@ -1015,43 +1077,25 @@ namespace System.Data {
writer.WriteElementString (table.TableName, "");
continue;
}
-
- WriteStartElement (writer, mode, nspc, table.Prefix, table.TableName);
- foreach (DataColumn col in atts)
- {
- WriteAttributeString (writer, mode, col.Namespace, col.Prefix, col.ColumnName, row[col].ToString ());
- }
+ WriteTableElement (writer, mode, table, row, version);
- if (simple != null)
- {
- writer.WriteString (WriteObjectXml (row[simple]));
+ foreach (DataColumn col in atts) {
+ WriteColumnAsAttribute (writer, mode, col, row, version);
}
- else
- {
- foreach (DataColumn col in elements)
- {
- string colnspc = nspc;
- object rowObject = row [col];
-
- if (rowObject == null || rowObject == DBNull.Value)
- continue;
-
- if (col.Namespace != null)
- {
- colnspc = col.Namespace;
- }
- //TODO check if I can get away with write element string
- WriteStartElement (writer, mode, colnspc, col.Prefix, col.ColumnName);
- writer.WriteString (WriteObjectXml (rowObject));
- writer.WriteEndElement ();
+ if (simple != null) {
+ writer.WriteString (WriteObjectXml (row[simple, version]));
+ }
+ else {
+ foreach (DataColumn col in elements) {
+ WriteColumnAsElement (writer, mode, nspc, col, row, version);
}
}
foreach (DataRelation relation in table.ChildRelations) {
if (relation.Nested) {
- WriteTable (writer, row.GetChildRows (relation), mode);
+ WriteTable (writer, row.GetChildRows (relation), mode, version);
}
}
@@ -1059,46 +1103,95 @@ namespace System.Data {
}
}
+
+ private void WriteColumnAsElement (XmlWriter writer, XmlWriteMode mode, string nspc, DataColumn col, DataRow row, DataRowVersion version)
+ {
+ string colnspc = nspc;
+ object rowObject = row [col, version];
+
+ if (rowObject == null || rowObject == DBNull.Value)
+ return;
+
+ if (col.Namespace != null) {
+ colnspc = col.Namespace;
+ }
+
+ //TODO check if I can get away with write element string
+ WriteStartElement (writer, mode, colnspc, col.Prefix, col.ColumnName);
+ writer.WriteString (WriteObjectXml (rowObject));
+ writer.WriteEndElement ();
+ }
+
+ private void WriteColumnAsAttribute (XmlWriter writer, XmlWriteMode mode, DataColumn col, DataRow row, DataRowVersion version)
+ {
+ WriteAttributeString (writer, mode, col.Namespace, col.Prefix, col.ColumnName, row[col, version].ToString ());
+ }
+
+ private void WriteTableElement (XmlWriter writer, XmlWriteMode mode, DataTable table, DataRow row, DataRowVersion version)
+ {
+ //sort out the namespacing
+ string nspc = table.Namespace.Length > 0 ? table.Namespace : Namespace;
+
+ WriteStartElement (writer, mode, nspc, table.Prefix, table.TableName);
+
+ if (mode == XmlWriteMode.DiffGram) {
+ WriteAttributeString (writer, mode, XmlConstants.DiffgrNamespace, XmlConstants.DiffgrPrefix, "id", table.TableName + (row.XmlRowID + 1));
+ WriteAttributeString (writer, mode, XmlConstants.MsdataNamespace, XmlConstants.MsdataPrefix, "rowOrder", row.XmlRowID.ToString());
+ string modeName = null;
+ if (row.RowState == DataRowState.Modified)
+ modeName = "modified";
+ else if (row.RowState == DataRowState.Added)
+ modeName = "inserted";
+
+ if (version != DataRowVersion.Original && modeName != null)
+ WriteAttributeString (writer, mode, XmlConstants.DiffgrNamespace, XmlConstants.DiffgrPrefix, "hasChanges", modeName);
+ }
+ }
private void WriteStartElement (XmlWriter writer, XmlWriteMode mode, string nspc, string prefix, string name)
{
- switch ( mode)
- {
- case XmlWriteMode.WriteSchema:
- if (nspc == null || nspc == "")
- {
- writer.WriteStartElement (name);
- }
- else if (prefix != null)
- {
- writer.WriteStartElement (prefix, name, nspc);
- }
- else
- {
- writer.WriteStartElement (writer.LookupPrefix (nspc), name, nspc);
- }
- break;
- case XmlWriteMode.DiffGram:
- throw new NotImplementedException ();
- default:
+ switch ( mode) {
+ case XmlWriteMode.WriteSchema:
+ if (nspc == null || nspc == "") {
writer.WriteStartElement (name);
- break;
- };
+ }
+ else if (prefix != null) {
+ writer.WriteStartElement (prefix, name, nspc);
+ }
+ else {
+ writer.WriteStartElement (writer.LookupPrefix (nspc), name, nspc);
+ }
+ break;
+ case XmlWriteMode.DiffGram:
+ if (nspc == null || nspc == "") {
+ writer.WriteStartElement (name);
+ }
+ else if (prefix != null) {
+ writer.WriteStartElement (prefix, name, nspc);
+ }
+ else {
+ writer.WriteStartElement (writer.LookupPrefix (nspc), name, nspc);
+ }
+ break;
+ default:
+ writer.WriteStartElement (name);
+ break;
+ };
}
private void WriteAttributeString (XmlWriter writer, XmlWriteMode mode, string nspc, string prefix, string name, string stringValue)
{
- switch ( mode)
- {
- case XmlWriteMode.WriteSchema:
- writer.WriteAttributeString (prefix, name, nspc);
- break;
- case XmlWriteMode.DiffGram:
- throw new NotImplementedException ();
- default:
- writer.WriteAttributeString (name, stringValue);
- break;
- };
+ switch ( mode) {
+ case XmlWriteMode.WriteSchema:
+ writer.WriteAttributeString (prefix, name, nspc);
+ break;
+ case XmlWriteMode.DiffGram:
+ writer.WriteAttributeString (prefix, name, nspc,stringValue);
+ break;
+ default:
+ writer.WriteAttributeString (name, stringValue);
+ break;
+ };
}
XmlSchema IXmlSerializable.GetSchema ()
@@ -1108,14 +1201,31 @@ namespace System.Data {
XmlSchema BuildSchema ()
{
+ string constraintPrefix = "";
XmlSchema schema = new XmlSchema ();
- schema.AttributeFormDefault = XmlSchemaForm.Qualified;
+ schema.Namespaces.Add("xs", XmlSchema.Namespace);
+ schema.Namespaces.Add(XmlConstants.MsdataPrefix, XmlConstants.MsdataNamespace);
+
+ if (Namespace != "" && Namespace != null) {
+ schema.AttributeFormDefault = XmlSchemaForm.Qualified;
+ schema.ElementFormDefault = XmlSchemaForm.Qualified;
+ schema.TargetNamespace = Namespace;
+ schema.Namespaces.Add(XmlConstants.TnsPrefix, Namespace);
+ constraintPrefix = XmlConstants.TnsPrefix + ":";
+ }
+
+ // set the schema id
+ schema.Id = DataSetName;
+ XmlDocument doc = new XmlDocument ();
+ XmlAttribute xmlnsAttr = doc.CreateAttribute("xmlns");
+ xmlnsAttr.Value = Namespace;
+
+ schema.UnhandledAttributes = new XmlAttribute[] {xmlnsAttr};
+
XmlSchemaElement elem = new XmlSchemaElement ();
elem.Name = XmlConvert.EncodeName (DataSetName);
- XmlDocument doc = new XmlDocument ();
-
XmlAttribute[] atts = new XmlAttribute [2];
atts[0] = doc.CreateAttribute (XmlConstants.MsdataPrefix, XmlConstants.IsDataSet, XmlConstants.MsdataNamespace);
atts[0].Value = "true";
@@ -1148,87 +1258,110 @@ namespace System.Data {
}
}
- bool nameModifier = true;
+ AddConstraintsToSchema (elem, constraintPrefix);
+ return schema;
+ }
+
+ // Add all constraints in all tables to the schema.
+ private void AddConstraintsToSchema (XmlSchemaElement elem, string constraintPrefix)
+ {
+ // first add all unique constraints.
+ Hashtable uniqueNames = AddUniqueConstraints (elem, constraintPrefix);
+ // Add all foriegn key constraints.
+ AddForeignKeys (uniqueNames, elem, constraintPrefix);
+ }
+
+ // Add unique constaraints to the schema.
+ // return hashtable with the names of all XmlSchemaUnique elements we created.
+ private Hashtable AddUniqueConstraints (XmlSchemaElement elem, string constraintPrefix)
+ {
+ XmlDocument doc = new XmlDocument();
+ Hashtable uniqueNames = new Hashtable();
+ foreach (DataTable table in Tables) {
+
+ foreach (Constraint constaint in table.Constraints) {
+
+ if (constaint is UniqueConstraint) {
+ ArrayList attrs = new ArrayList ();
+ XmlAttribute attrib;
+ UniqueConstraint uqConst = (UniqueConstraint)constaint;
+ XmlSchemaUnique uniq = new XmlSchemaUnique ();
+
+ // if constaraint name do not exist in the hashtable we can use it.
+ if (!uniqueNames.ContainsKey (uqConst.ConstraintName)) {
+ uniq.Name = uqConst.ConstraintName;
+ }
+ // generate new constraint name for the XmlSchemaUnique element.
+ else {
+ uniq.Name = uqConst.Table.TableName + "_" + uqConst.ConstraintName;
+ attrib = doc.CreateAttribute (XmlConstants.MsdataPrefix, XmlConstants.ConstraintName, XmlConstants.MsdataNamespace);
+ attrib.Value = uqConst.ConstraintName;
+ attrs.Add (attrib);
+ }
+ if (uqConst.IsPrimaryKey) {
+ attrib = doc.CreateAttribute (XmlConstants.MsdataPrefix, XmlConstants.PrimaryKey, XmlConstants.MsdataNamespace);
+ attrib.Value = "true";
+ attrs.Add (attrib);
+ }
+
+ uniq.UnhandledAttributes = (XmlAttribute[])attrs.ToArray (typeof (XmlAttribute));
+
+ uniq.Selector = new XmlSchemaXPath();
+ uniq.Selector.XPath = ".//"+constraintPrefix + uqConst.Table.TableName;
+ XmlSchemaXPath field;
+ foreach (DataColumn column in uqConst.Columns) {
+ field = new XmlSchemaXPath();
+ field.XPath = constraintPrefix+column.ColumnName;
+ uniq.Fields.Add(field);
+ }
+
+ elem.Constraints.Add (uniq);
+ uniqueNames.Add (uniq.Name, null);
+ }
+ }
+ }
+ return uniqueNames;
+ }
+
+ // Add the foriegn keys to the schema.
+ private void AddForeignKeys (Hashtable uniqueNames, XmlSchemaElement elem, string constraintPrefix)
+ {
+ XmlDocument doc = new XmlDocument();
foreach (DataRelation rel in Relations) {
- XmlSchemaUnique uniq = new XmlSchemaUnique();
+
+ ArrayList attrs = new ArrayList ();
+ XmlAttribute attrib;
XmlSchemaKeyref keyRef = new XmlSchemaKeyref();
+ keyRef.Name = rel.RelationName;
ForeignKeyConstraint fkConst = rel.ChildKeyConstraint;
UniqueConstraint uqConst = rel.ParentKeyConstraint;
-
- if (nameModifier) {
- uniq.Name = uqConst.ConstraintName;
- keyRef.Name = fkConst.ConstraintName;
- keyRef.Refer = new XmlQualifiedName(uniq.Name);
- XmlAttribute[] attrib = null;
- if (rel.Nested){
- attrib = new XmlAttribute [2];
- attrib [0] = doc.CreateAttribute (XmlConstants.MsdataPrefix, XmlConstants.IsNested, XmlConstants.MsdataNamespace);
- attrib [0].Value = "true";
-
- attrib [1] = doc.CreateAttribute (XmlConstants.MsdataPrefix, XmlConstants.RelationName, XmlConstants.MsdataNamespace);
- attrib [1].Value = rel.RelationName;
- }
- else {
- attrib = new XmlAttribute [1];
- attrib[0] = doc.CreateAttribute (XmlConstants.MsdataPrefix, XmlConstants.RelationName, XmlConstants.MsdataNamespace);
- attrib[0].Value = rel.RelationName;
-
- }
- keyRef.UnhandledAttributes = attrib;
- nameModifier = false;
+
+ string concatName = rel.ParentTable.TableName + "_" + uqConst.ConstraintName;
+ // first try to find the concatenated name. If we didn't find it - use constraint name.
+ if (uniqueNames.ContainsKey (concatName)) {
+ keyRef.Refer = new XmlQualifiedName(concatName);
}
else {
- uniq.Name = rel.ParentTable.TableName+"_"+uqConst.ConstraintName;
- keyRef.Name = rel.ChildTable.TableName+"_"+fkConst.ConstraintName;
- keyRef.Refer = new XmlQualifiedName(uniq.Name);
- XmlAttribute[] attrib;
- if (rel.Nested) {
- attrib = new XmlAttribute [3];
- attrib [0] = doc.CreateAttribute (XmlConstants.MsdataPrefix, XmlConstants.ConstraintName, XmlConstants.MsdataNamespace);
- attrib [0].Value = fkConst.ConstraintName;
- attrib [1] = doc.CreateAttribute (XmlConstants.MsdataPrefix, XmlConstants.IsNested, XmlConstants.MsdataNamespace);
- attrib [1].Value = "true";
-
- attrib [2] = doc.CreateAttribute (XmlConstants.MsdataPrefix, XmlConstants.RelationName, XmlConstants.MsdataNamespace);
- attrib [2].Value = rel.RelationName;
- }
- else {
- attrib = new XmlAttribute [2];
- attrib [0] = doc.CreateAttribute (XmlConstants.MsdataPrefix, XmlConstants.ConstraintName, XmlConstants.MsdataNamespace);
- attrib [0].Value = fkConst.ConstraintName;
- attrib [1] = doc.CreateAttribute (XmlConstants.MsdataPrefix, XmlConstants.RelationName, XmlConstants.MsdataNamespace);
- attrib [1].Value = rel.RelationName;
-
- }
- keyRef.UnhandledAttributes = attrib;
- attrib = new XmlAttribute [1];
- attrib [0] = doc.CreateAttribute (XmlConstants.MsdataPrefix, XmlConstants.ConstraintName, XmlConstants.MsdataNamespace);
- attrib [0].Value = uqConst.ConstraintName;
- uniq.UnhandledAttributes = attrib;
+ keyRef.Refer = new XmlQualifiedName(uqConst.ConstraintName);
}
- uniq.Selector = new XmlSchemaXPath();
- uniq.Selector.XPath = ".//"+rel.ParentTable.TableName;
- XmlSchemaXPath field;
- foreach (DataColumn column in rel.ParentColumns) {
- field = new XmlSchemaXPath();
- field.XPath = column.ColumnName;
- uniq.Fields.Add(field);
+ if (rel.Nested) {
+ attrib = doc.CreateAttribute (XmlConstants.MsdataPrefix, XmlConstants.IsNested, XmlConstants.MsdataNamespace);
+ attrib.Value = "true";
+ attrs.Add (attrib);
}
-
+
keyRef.Selector = new XmlSchemaXPath();
- keyRef.Selector.XPath = ".//"+rel.ChildTable.TableName;
+ keyRef.Selector.XPath = ".//" + constraintPrefix + rel.ChildTable.TableName;
+ XmlSchemaXPath field;
foreach (DataColumn column in rel.ChildColumns) {
field = new XmlSchemaXPath();
- field.XPath = column.ColumnName;
+ field.XPath = constraintPrefix+column.ColumnName;
keyRef.Fields.Add(field);
}
-
- elem.Constraints.Add (uniq);
+ keyRef.UnhandledAttributes = (XmlAttribute[])attrs.ToArray (typeof (XmlAttribute));
elem.Constraints.Add (keyRef);
}
-
- return schema;
}
private XmlSchemaElement GetTableSchema (XmlDocument doc, DataTable table)
@@ -1246,11 +1379,9 @@ namespace System.Data {
elem.SchemaType = complex;
//TODO - what about the simple content?
- if (elements.Count == 0)
- {
+ if (elements.Count == 0) {
}
- else
- {
+ else {
//A sequence of element types or a simple content node
//<xs:sequence>
XmlSchemaSequence seq = new XmlSchemaSequence ();
@@ -1259,19 +1390,40 @@ namespace System.Data {
foreach (DataColumn col in elements) {
//<xs:element name=ColumnName type=MappedType Ordinal=index>
XmlSchemaElement colElem = new XmlSchemaElement ();
+ ArrayList xattrs = new ArrayList();
+ XmlAttribute xattr;
colElem.Name = col.ColumnName;
- if (col.ColumnName != col.Caption && col.Caption != string.Empty) {
- XmlAttribute[] xatts = new XmlAttribute[1];
- xatts[0] = doc.CreateAttribute (XmlConstants.MsdataPrefix, XmlConstants.Caption, XmlConstants.MsdataNamespace);
- xatts[0].Value = col.Caption;
- colElem.UnhandledAttributes = xatts;
+ if (col.ColumnName != col.Caption && col.Caption != String.Empty) {
+ xattr = doc.CreateAttribute (XmlConstants.MsdataPrefix, XmlConstants.Caption, XmlConstants.MsdataNamespace);
+ xattr.Value = col.Caption;
+ xattrs.Add (xattr);
}
- if (col.DefaultValue.ToString () != string.Empty)
- colElem.DefaultValue = col.DefaultValue.ToString ();
+ if (col.AutoIncrement == true) {
+ xattr = doc.CreateAttribute (XmlConstants.MsdataPrefix, XmlConstants.AutoIncrement, XmlConstants.MsdataNamespace);
+ xattr.Value = "true";
+ xattrs.Add (xattr);
+ }
- colElem.SchemaTypeName = MapType (col.DataType);
+ if (col.AutoIncrementSeed != 0) {
+ xattr = doc.CreateAttribute (XmlConstants.MsdataPrefix, XmlConstants.AutoIncrementSeed, XmlConstants.MsdataNamespace);
+ xattr.Value = col.AutoIncrementSeed.ToString();
+ xattrs.Add (xattr);
+ }
+
+ if (col.DefaultValue.ToString () != String.Empty)
+ colElem.DefaultValue = col.DefaultValue.ToString ();
+
+ if (col.MaxLength < 0)
+ colElem.SchemaTypeName = MapType (col.DataType);
+
+ if (colElem.SchemaTypeName == XmlConstants.QnString && col.DataType != typeof (string)
+ && col.DataType != typeof (char)) {
+ xattr = doc.CreateAttribute (XmlConstants.MsdataPrefix, XmlConstants.DataType, XmlConstants.MsdataNamespace);
+ xattr.Value = col.DataType.ToString();
+ xattrs.Add (xattr);
+ }
if (col.AllowDBNull) {
colElem.MinOccurs = 0;
@@ -1286,7 +1438,8 @@ namespace System.Data {
if (col.MaxLength > -1) {
colElem.SchemaType = GetTableSimpleType (doc, col);
}
-
+
+ colElem.UnhandledAttributes = (XmlAttribute[])xattrs.ToArray(typeof (XmlAttribute));
seq.Items.Add (colElem);
}
@@ -1306,6 +1459,7 @@ namespace System.Data {
att.SchemaTypeName = MapType (col.DataType);
complex.Attributes.Add (att);
}
+
return elem;
}
@@ -1322,7 +1476,8 @@ namespace System.Data {
XmlSchemaMaxLengthFacet max = new XmlSchemaMaxLengthFacet ();
max.Value = XmlConvert.ToString (col.MaxLength);
restriction.Facets.Add (max);
-
+
+ simple.Content = restriction;
return simple;
}
@@ -1336,9 +1491,9 @@ namespace System.Data {
/// content
/// </summary>
private void SplitColumns (DataTable table,
- out ArrayList atts,
- out ArrayList elements,
- out DataColumn simple)
+ out ArrayList atts,
+ out ArrayList elements,
+ out DataColumn simple)
{
//The columns can be attributes, hidden, elements, or simple content
//There can be 0-1 simple content cols or 0-* elements
@@ -1348,8 +1503,7 @@ namespace System.Data {
//Sort out the columns
foreach (DataColumn col in table.Columns) {
- switch (col.ColumnMapping)
- {
+ switch (col.ColumnMapping) {
case MappingType.Attribute:
atts.Add (col);
break;
@@ -1357,8 +1511,7 @@ namespace System.Data {
elements.Add (col);
break;
case MappingType.SimpleContent:
- if (simple != null)
- {
+ if (simple != null) {
throw new System.InvalidOperationException ("There may only be one simple content element");
}
simple = col;
@@ -1369,18 +1522,35 @@ namespace System.Data {
}
}
}
+
+ private void WriteDiffGramElement(XmlWriter writer)
+ {
+ WriteStartElement (writer, XmlWriteMode.DiffGram, XmlConstants.DiffgrNamespace, XmlConstants.DiffgrPrefix, "diffgram");
+ WriteAttributeString(writer, XmlWriteMode.DiffGram, null, "xmlns", XmlConstants.MsdataPrefix, XmlConstants.MsdataNamespace);
+ }
+
+ private void SetRowsID()
+ {
+ foreach (DataTable Table in Tables) {
+ int dataRowID = 0;
+ foreach (DataRow Row in Table.Rows) {
+ Row.XmlRowID = dataRowID;
+ dataRowID++;
+ }
+ }
+ }
+
private XmlQualifiedName MapType (Type type)
{
- switch (Type.GetTypeCode (type))
- {
+ switch (Type.GetTypeCode (type)) {
case TypeCode.String: return XmlConstants.QnString;
case TypeCode.Int16: return XmlConstants.QnShort;
case TypeCode.Int32: return XmlConstants.QnInt;
case TypeCode.Int64: return XmlConstants.QnLong;
case TypeCode.Boolean: return XmlConstants.QnBoolean;
case TypeCode.Byte: return XmlConstants.QnUnsignedByte;
- case TypeCode.Char: return XmlConstants.QnChar;
+ //case TypeCode.Char: return XmlConstants.QnChar;
case TypeCode.DateTime: return XmlConstants.QnDateTime;
case TypeCode.Decimal: return XmlConstants.QnDecimal;
case TypeCode.Double: return XmlConstants.QnDouble;
diff --git a/mcs/class/System.Data/System.Data/DataView.cs b/mcs/class/System.Data/System.Data/DataView.cs
index 91c578bd704..1e4461893b9 100644
--- a/mcs/class/System.Data/System.Data/DataView.cs
+++ b/mcs/class/System.Data/System.Data/DataView.cs
@@ -542,7 +542,8 @@ namespace System.Data
dataColumn.ColumnName, col, null);
descriptor.SetComponentType (typeof (System.Data.DataRowView));
descriptor.SetPropertyType (dataColumn.DataType);
-
+ descriptor.SetReadOnly (dataColumn.ReadOnly);
+
descriptors[col] = descriptor;
}
diff --git a/mcs/class/System.Data/System.Data/TypedDataSetGenerator.cs b/mcs/class/System.Data/System.Data/TypedDataSetGenerator.cs
new file mode 100755
index 00000000000..c93c9cf723d
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/TypedDataSetGenerator.cs
@@ -0,0 +1,69 @@
+//
+// TypedDataSetGenerator.cs
+//
+// Author:
+// Atsushi Enomoto <atsushi@ximian.com>
+//
+// (C)2004 Novell Inc.
+//
+using System;
+using System.CodeDom;
+using System.CodeDom.Compiler;
+using System.Collections;
+using System.Data;
+using System.Text;
+
+namespace System.Data
+{
+ public class TypedDataSetGenerator
+ {
+ public TypedDataSetGenerator ()
+ {
+ }
+
+ [MonoTODO]
+ public static void Generate (DataSet dataSet,
+ CodeNamespace codeNamespace,
+ ICodeGenerator codeGen)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public static string GenerateIdName (string name, ICodeGenerator codeGen)
+ {
+ if (name == null || codeGen == null)
+ throw new NullReferenceException ();
+
+ name = codeGen.CreateValidIdentifier (name);
+ // ... however, in fact this method is so insufficient
+ // that we have to modify the name.
+
+ if (name.Length == 0)
+ return "_";
+
+ StringBuilder sb = null;
+ if (!Char.IsLetter (name, 0) && name [0] != '_') {
+ sb = new StringBuilder ();
+ sb.Append ('_');
+ }
+
+ int start = 0;
+ for (int i = 0; i < name.Length; i++) {
+ if (!Char.IsLetterOrDigit (name, i)) {
+ if (sb == null)
+ sb = new StringBuilder ();
+ sb.Append (name, start, i - start);
+ sb.Append ('_');
+ start = i + 1;
+ }
+ }
+
+ if (sb != null) {
+ sb.Append (name, start, name.Length - start);
+ return sb.ToString ();
+ }
+ else
+ return name;
+ }
+ }
+}
diff --git a/mcs/class/System.Data/System.Data/XmlConstants.cs b/mcs/class/System.Data/System.Data/XmlConstants.cs
index 52dc134410d..87c930d3f8d 100755
--- a/mcs/class/System.Data/System.Data/XmlConstants.cs
+++ b/mcs/class/System.Data/System.Data/XmlConstants.cs
@@ -53,10 +53,15 @@ internal class XmlConstants
public const string Caption = "Caption";
public const string Base = "base";
public const string Value = "value";
+ public const string DataType = "DataType";
+ public const string AutoIncrement = "AutoIncrement";
+ public const string AutoIncrementSeed = "AutoIncrementSeed";
//ms schema objects
public const string MsdataPrefix = "msdata";
public const string MsdataNamespace = "urn:schemas-microsoft-com:xml-msdata";
+ public const string DiffgrPrefix = "diffgr";
+ public const string DiffgrNamespace = "urn:schemas-microsoft-com:xml-diffgram-v1";
public const string TnsPrefix = "mstns";
public const string IsDataSet = "IsDataSet";
public const string Locale = "Locale";
@@ -64,6 +69,7 @@ internal class XmlConstants
public const string IsNested = "IsNested";
public const string RelationName = "RelationName";
public const string ConstraintName = "ConstraintName";
+ public const string PrimaryKey = "PrimaryKey";
public static XmlQualifiedName QnString = new XmlQualifiedName ("string", XmlSchema.Namespace);
public static XmlQualifiedName QnShort = new XmlQualifiedName ("short", XmlSchema.Namespace);
diff --git a/mcs/class/System.Data/System.Data/XmlDataLoader.cs b/mcs/class/System.Data/System.Data/XmlDataLoader.cs
index dd2ca2cbbc3..07caddd116f 100644
--- a/mcs/class/System.Data/System.Data/XmlDataLoader.cs
+++ b/mcs/class/System.Data/System.Data/XmlDataLoader.cs
@@ -22,7 +22,7 @@ using System.Xml.XPath;
using System.Collections;
using System.Globalization;
-namespace System.Data
+namespace System.Data
{
internal class XmlDataLoader
@@ -40,22 +40,15 @@ namespace System.Data
{
XmlReadMode Result = XmlReadMode.Auto;
- switch (mode)
- {
+ switch (mode) {
case XmlReadMode.Fragment:
break;
case XmlReadMode.ReadSchema:
- Result = XmlReadMode.ReadSchema;
- ReadModeSchema (reader, false);
- break;
case XmlReadMode.IgnoreSchema:
- Result = XmlReadMode.IgnoreSchema;
- ReadModeSchema (reader, true);
- break;
case XmlReadMode.InferSchema:
- Result = XmlReadMode.InferSchema;
- ReadModeInferSchema (reader);
+ Result = mode;
+ ReadModeSchema (reader, mode);
break;
default:
break;
@@ -66,99 +59,54 @@ namespace System.Data
#region reading
- // XmlReadMode.InferSchema
- [MonoTODO]
- private void ReadModeInferSchema (XmlReader reader)
+ // Read information from the reader.
+ private void ReadModeSchema (XmlReader reader, XmlReadMode mode)
{
- // first load an XmlDocument from the reader.
- XmlDocument doc = new XmlDocument();
- doc.Load(reader);
+ bool inferSchema = mode == XmlReadMode.InferSchema ? true : false;
+ //check if the current element is schema.
+ if (String.Compare (reader.LocalName, "schema", true) == 0) {
+
+ if (mode == XmlReadMode.InferSchema || mode == XmlReadMode.IgnoreSchema)
+ reader.Skip(); // skip the schema node.
+ else
+ DSet.ReadXmlSchema(reader);
+
+ reader.MoveToContent();
+ }
+ // load an XmlDocument from the reader.
+ XmlDocument doc = BuildXmlDocument(reader);
// set EnforceConstraint to false - we do not want any validation during
// load time.
bool origEnforceConstraint = DSet.EnforceConstraints;
DSet.EnforceConstraints = false;
-
- // first element is the DataSet.
- XmlElement elem = doc.DocumentElement;
- DSet.DataSetName = XmlConvert.DecodeName (elem.LocalName);
-
- // get the Namespace of the DataSet.
- if (elem.HasAttribute("xmlns"))
- DSet.Namespace = elem.Attributes["xmlns"].Value;
// The childs are tables.
- XmlNodeList nList = elem.ChildNodes;
+ XmlNodeList nList = doc.DocumentElement.ChildNodes;
- for (int i = 0; i < nList.Count; i++)
- {
+ for (int i = 0; i < nList.Count; i++) {
XmlNode node = nList[i];
- AddRowToTable(node, null);
+ AddRowToTable(node, null, inferSchema);
}
// set the EnforceConstraints to original value;
DSet.EnforceConstraints = origEnforceConstraint;
}
- // Read Xmldocument. XmlReadMode.ReadSchema and XmlReadMode.IgnoreSchema
- [MonoTODO]
- private void ReadModeSchema (XmlReader reader, bool IgnoreSchema)
- {
- /*\
- * Reads any inline schema, but an exception is thrown
- * if any tables in the inline schema already exist in the DataSet.
- \*/
-
- reader.MoveToContent ();
- reader.ReadStartElement ();
- reader.MoveToContent ();
-
- while (reader.NodeType != XmlNodeType.EndElement)
- {
- if (reader.NodeType == XmlNodeType.Element)
- {
- // FIXME: possible inline-schema should be readed here
- if (String.Compare (reader.LocalName, "schema", true) == 0)
- {
- if (!IgnoreSchema)
- DSet.ReadXmlSchema (reader);
- }
-
- // find table
- if (DSet.Tables.Contains (reader.LocalName))
- {
- DataTable table = DSet.Tables [reader.LocalName];
- DataRow row = table.NewRow ();
-
- reader.ReadStartElement ();
- ReadColumns (reader, row, table, reader.LocalName);
- reader.ReadEndElement ();
-
- table.Rows.Add (row);
- }
- }
- reader.MoveToContent ();
- }
- }
-
#endregion // reading
#region Private helper methods
private void ReadColumns (XmlReader reader, DataRow row, DataTable table, string TableName)
{
- do
- {
- if (reader.NodeType == XmlNodeType.Element)
- {
+ do {
+ if (reader.NodeType == XmlNodeType.Element) {
DataColumn col = table.Columns [reader.LocalName];
- if (col != null)
- {
- reader.Read ();
+ if (col != null) {
row [col] = StringToObject (col.DataType, reader.Value);
}
+ reader.Read ();
}
- else
- {
+ else {
reader.Read ();
}
@@ -170,8 +118,7 @@ namespace System.Data
{
if (type == null) return value;
- switch (Type.GetTypeCode (type))
- {
+ switch (Type.GetTypeCode (type)) {
case TypeCode.Boolean: return XmlConvert.ToBoolean (value);
case TypeCode.Byte: return XmlConvert.ToByte (value);
case TypeCode.Char: return (char)XmlConvert.ToInt32 (value);
@@ -186,15 +133,15 @@ namespace System.Data
case TypeCode.UInt16: return XmlConvert.ToUInt16 (value);
case TypeCode.UInt32: return XmlConvert.ToUInt32 (value);
case TypeCode.UInt64: return XmlConvert.ToUInt64 (value);
- }
-
- if (type == typeof (TimeSpan)) return XmlConvert.ToTimeSpan (value);
- if (type == typeof (byte[])) return Convert.FromBase64String (value);
+ }
+
+ if (type == typeof (TimeSpan)) return XmlConvert.ToTimeSpan (value);
+ if (type == typeof (byte[])) return Convert.FromBase64String (value);
return Convert.ChangeType (value, type);
}
- private void AddRowToTable(XmlNode tableNode, DataColumn relationColumn)
+ private void AddRowToTable(XmlNode tableNode, DataColumn relationColumn, bool inferSchema)
{
Hashtable rowValue = new Hashtable();
DataTable table;
@@ -202,57 +149,67 @@ namespace System.Data
// Check if the table exists in the DataSet. If not create one.
if (DSet.Tables.Contains(tableNode.LocalName))
table = DSet.Tables[tableNode.LocalName];
- else
- {
+ else if (inferSchema) {
table = new DataTable(tableNode.LocalName);
DSet.Tables.Add(table);
}
+ else
+ return;
// Get the child nodes of the table. Any child can be one of the following tow:
// 1. DataTable - if there was a relation with another table..
// 2. DataColumn - column of the current table.
XmlNodeList childList = tableNode.ChildNodes;
- for (int i = 0; i < childList.Count; i++)
- {
+ for (int i = 0; i < childList.Count; i++) {
XmlNode childNode = childList[i];
// The child node is a table if:
// 1. He has attributes it means that it is a table OR
// 2. He has more then one child nodes. Columns has only one child node
// which is a Text node type that has the column value.
- if (childNode.ChildNodes.Count > 1 || childNode.Attributes.Count > 0)
- {
- // We need to create new column for the relation between the current
- // table and the new table we found (the child table).
- string newRelationColumnName = table.TableName + "_Id";
- if (!table.Columns.Contains(newRelationColumnName))
- {
- DataColumn newRelationColumn = new DataColumn(newRelationColumnName, typeof(int));
- newRelationColumn.AutoIncrement = true;
- table.Columns.Add(newRelationColumn);
+ if (childNode.ChildNodes.Count > 1 || childNode.Attributes.Count > 0) {
+
+ if (inferSchema) {
+ // We need to create new column for the relation between the current
+ // table and the new table we found (the child table).
+ string newRelationColumnName = table.TableName + "_Id";
+ if (!table.Columns.Contains(newRelationColumnName)) {
+ DataColumn newRelationColumn = new DataColumn(newRelationColumnName, typeof(int));
+ newRelationColumn.AutoIncrement = true;
+ // we do not want to serialize this column so MappingType is Hidden.
+ newRelationColumn.ColumnMapping = MappingType.Hidden;
+ table.Columns.Add(newRelationColumn);
+ }
+ // Add a row to the new table we found.
+ AddRowToTable(childNode, table.Columns[newRelationColumnName], inferSchema);
}
- // Add a row to the new table we found.
- AddRowToTable(childNode, table.Columns[newRelationColumnName]);
+ else
+ AddRowToTable(childNode, null, inferSchema);
+
}
- else //Child node is a column.
- {
- if (!table.Columns.Contains(childNode.LocalName))
+ else { //Child node is a column.
+ object val = null;
+ if (childNode.FirstChild != null)
+ val = childNode.FirstChild.Value;
+ else
+ val = "";
+ if (table.Columns.Contains(childNode.LocalName))
+ rowValue.Add(childNode.LocalName, val);
+ else if (inferSchema) {
table.Columns.Add(childNode.LocalName);
-
- rowValue.Add(childNode.LocalName, childNode.FirstChild.Value);
+ rowValue.Add(childNode.LocalName, val);
+ }
}
}
// Column can be attribute of the table element.
XmlAttributeCollection aCollection = tableNode.Attributes;
- for (int i = 0; i < aCollection.Count; i++)
- {
+ for (int i = 0; i < aCollection.Count; i++) {
XmlAttribute attr = aCollection[i];
//the atrribute can be the namespace.
if (attr.Prefix.Equals("xmlns"))
table.Namespace = attr.Value;
- else // the attribute is a column.
- {
+ else { // the attribute is a column.
if (!table.Columns.Contains(attr.LocalName))
table.Columns.Add(attr.LocalName);
table.Columns[attr.LocalName].Namespace = table.Namespace;
@@ -263,15 +220,18 @@ namespace System.Data
// If the current table is a child table we need to add a new column for the relation
// and add a new relation to the DataSet.
- if (relationColumn != null)
- {
- if (!table.Columns.Contains(relationColumn.ColumnName))
- {
+ if (relationColumn != null) {
+ if (!table.Columns.Contains(relationColumn.ColumnName)) {
DataColumn dc = new DataColumn(relationColumn.ColumnName, typeof(int));
- dc.AutoIncrement = true;
+ // we do not want to serialize this column so MappingType is Hidden.
+ dc.ColumnMapping = MappingType.Hidden;
table.Columns.Add(dc);
- DSet.Relations.Add(relationColumn, dc);
+ // Convention of relation name is: ParentTableName_ChildTableName
+ DataRelation dr = new DataRelation(relationColumn.Table.TableName + "_" + dc.Table.TableName, relationColumn, dc);
+ dr.Nested = true;
+ DSet.Relations.Add(dr);
}
+ rowValue.Add (relationColumn.ColumnName, relationColumn.GetAutoIncrementValue());
}
// Create new row and add all values to the row.
@@ -279,14 +239,32 @@ namespace System.Data
DataRow row = table.NewRow ();
IDictionaryEnumerator enumerator = rowValue.GetEnumerator ();
- while (enumerator.MoveNext ())
- {
- row [enumerator.Key.ToString ()] = enumerator.Value.ToString ();
+ while (enumerator.MoveNext ()) {
+ row [enumerator.Key.ToString ()] = StringToObject (table.Columns[enumerator.Key.ToString ()].DataType, enumerator.Value.ToString ());
}
table.Rows.Add (row);
}
+
+ // bulid the document from the reader.
+ private XmlDocument BuildXmlDocument(XmlReader reader)
+ {
+ XmlDocument doc = new XmlDocument();
+ // Create the root element. This is the DataSet element.
+ XmlElement dataSetElement = doc.CreateElement(DSet.DataSetName);
+
+ do {
+ XmlNode n = doc.ReadNode (reader);
+ if(n == null) break;
+ // Add the table nodes to the DataSet node.
+ dataSetElement.AppendChild (n);
+ } while (reader.IsStartElement());
+
+ // Add the DataSet element to the document.
+ doc.AppendChild(dataSetElement);
+ return doc;
+ }
#endregion // Private helper methods
diff --git a/mcs/class/System.Data/System.Data/XmlDiffLoader.cs b/mcs/class/System.Data/System.Data/XmlDiffLoader.cs
index dc25262b65e..e81ef3a7fbe 100644
--- a/mcs/class/System.Data/System.Data/XmlDiffLoader.cs
+++ b/mcs/class/System.Data/System.Data/XmlDiffLoader.cs
@@ -21,12 +21,12 @@ using System.Globalization;
namespace System.Data {
- internal class XmlDiffLoader
+ internal class XmlDiffLoader
{
- #region Fields
-
- private DataSet DSet;
+ #region Fields
+ enum LoadType {CURRENT, BEFORE, ERROR};
+ private DataSet DSet;
private Hashtable DiffGrRows = new Hashtable ();
private Hashtable ErrorRows = new Hashtable ();
@@ -34,7 +34,7 @@ namespace System.Data {
#region ctors
- public XmlDiffLoader (DataSet DSet)
+ public XmlDiffLoader (DataSet DSet)
{
this.DSet = DSet;
}
@@ -43,24 +43,25 @@ namespace System.Data {
#region Public methods
- public void Load (XmlReader Reader)
+ public void Load (XmlReader Reader)
{
- XmlTextReader TextReader = new XmlTextReader (Reader.BaseURI);
- XmlDocument Document = new XmlDocument ();
- Document.Load (TextReader);
- TextReader.Close ();
+ XmlDocument Document = BuildXmlDocument(Reader);
+
XPathNavigator Navigator = Document.CreateNavigator ();
+ bool origEnforceConstraint = DSet.EnforceConstraints;
+ DSet.EnforceConstraints = false;
LoadBefore (Navigator);
LoadCurrent (Navigator);
LoadErrors (Navigator);
+ DSet.EnforceConstraints = origEnforceConstraint;
}
#endregion // Public methods
#region Private methods
- private void LoadCurrent (XPathNavigator Navigator)
+ private void LoadCurrent (XPathNavigator Navigator)
{
Navigator.MoveToRoot ();
@@ -71,51 +72,19 @@ namespace System.Data {
if (Navigator.MoveToFirstChild ()) {
if (Navigator.MoveToFirstChild ()) {
-
- if (DSet.Tables.Contains (Navigator.LocalName)) {
-
- DataTable Table = DSet.Tables [Navigator.LocalName];
- DataRow Row = null;
- bool NewRow = false;
- bool HasErrors = false;
- string id = "";
-
- if (Navigator.MoveToFirstAttribute ()) {
-
- do {
- // Find out was there same row in 'before' section
- if (Navigator.LocalName == "id") {
- id = Navigator.Value;
- if (DiffGrRows.Contains (id))
- Row = (DataRow)DiffGrRows [id];
-
- }
- else if (Navigator.LocalName == "hasErrors" && String.Compare (Navigator.Value, "true", true) == 0)
- HasErrors = true;
- } while (Navigator.MoveToNextAttribute ());
-
- // back to business
- Navigator.MoveToParent ();
- }
-
- if (Row == null) {
-
- Row = Table.NewRow ();
- NewRow = true;
- }
-
- LoadColumns (Table, Row, Navigator, NewRow);
-
- if (HasErrors) // If row had errors add row to hashtable for later use
- ErrorRows.Add (id, Row);
- }
+ do {
+ if (DSet.Tables.Contains (Navigator.LocalName))
+ LoadCurrentTable(Navigator);
+ else
+ throw new DataException (Locale.GetText ("Cannot load diffGram. Table '" + Navigator.LocalName + "' is missing in the destination dataset"));
+ }while (Navigator.MoveToNext());
}
}
}
}
}
- private void LoadBefore (XPathNavigator Navigator)
+ private void LoadBefore (XPathNavigator Navigator)
{
Navigator.MoveToRoot ();
@@ -136,37 +105,17 @@ namespace System.Data {
if (Navigator.MoveToFirstChild ()) {
do {
- if (DSet.Tables.Contains (Navigator.LocalName)) {
-
- String id = null;
- DataTable Table = DSet.Tables [Navigator.LocalName];
- DataRow Row = Table.NewRow ();
-
- if (Navigator.MoveToFirstAttribute ()) {
-
- do {
- if (Navigator.Name == "diffgr:id")
- id = Navigator.Value;
-
- } while (Navigator.MoveToNextAttribute ());
-
- Navigator.MoveToParent ();
- }
-
- LoadColumns (Table, Row, Navigator, true);
- DiffGrRows.Add (id, Row); // for later use
- Row.AcceptChanges ();
- }
- else {
+ if (DSet.Tables.Contains (Navigator.LocalName))
+ LoadBeforeTable(Navigator);
+ else
throw new DataException (Locale.GetText ("Cannot load diffGram. Table '" + Navigator.LocalName + "' is missing in the destination dataset"));
- }
} while (Navigator.MoveToNext ());
}
}
}
- private void LoadErrors (XPathNavigator Navigator)
+ private void LoadErrors (XPathNavigator Navigator)
{
Navigator.MoveToRoot ();
@@ -225,13 +174,19 @@ namespace System.Data {
}
}
- private void LoadColumns (DataTable Table, DataRow Row, XPathNavigator Navigator, bool NewRow)
+ private void LoadColumns (DataTable Table, DataRow Row, XPathNavigator Navigator, bool NewRow, LoadType loadType)
{
if (Navigator.MoveToFirstChild ()) {
do {
if (Table.Columns.Contains (Navigator.LocalName))
- Row [Navigator.LocalName] = Navigator.Value;
+ Row [Navigator.LocalName] = XmlDataLoader.StringToObject(Table.Columns[Navigator.LocalName].DataType, Navigator.Value);
+ else if (DSet.Tables.Contains (Navigator.LocalName)){
+ if (loadType == LoadType.BEFORE)
+ LoadBeforeTable(Navigator);
+ else if (loadType == LoadType.CURRENT)
+ LoadCurrentTable(Navigator);
+ }
} while (Navigator.MoveToNext ());
@@ -240,6 +195,88 @@ namespace System.Data {
}
}
+ private void LoadBeforeTable (XPathNavigator Navigator)
+ {
+
+ String id = null;
+ DataTable Table = DSet.Tables [Navigator.LocalName];
+ DataRow Row = Table.NewRow ();
+
+ if (Navigator.MoveToFirstAttribute ()) {
+
+ do {
+ if (Navigator.Name == "diffgr:id")
+ id = Navigator.Value;
+
+ } while (Navigator.MoveToNextAttribute ());
+
+ Navigator.MoveToParent ();
+ }
+
+ LoadColumns (Table, Row, Navigator, true, LoadType.BEFORE);
+ DiffGrRows.Add (id, Row); // for later use
+ Row.AcceptChanges ();
+ }
+
+ private void LoadCurrentTable (XPathNavigator Navigator)
+ {
+
+ DataTable Table = DSet.Tables [Navigator.LocalName];
+ DataRow Row = null;
+ bool NewRow = false;
+ bool HasErrors = false;
+ string id = "";
+
+ if (Navigator.MoveToFirstAttribute ()) {
+
+ do {
+ // Find out was there same row in 'before' section
+ if (Navigator.LocalName == "id") {
+ id = Navigator.Value;
+ if (DiffGrRows.Contains (id))
+ Row = (DataRow)DiffGrRows [id];
+
+ }
+ else if (Navigator.LocalName == "hasErrors" && String.Compare (Navigator.Value, "true", true) == 0)
+ HasErrors = true;
+ } while (Navigator.MoveToNextAttribute ());
+
+ // back to business
+ Navigator.MoveToParent ();
+ }
+
+ if (Row == null) {
+ Row = Table.NewRow ();
+ NewRow = true;
+ }
+
+ LoadColumns (Table, Row, Navigator, NewRow, LoadType.CURRENT);
+
+ // back to business
+ Navigator.MoveToParent();
+
+ if (HasErrors) // If row had errors add row to hashtable for later use
+ ErrorRows.Add (id, Row);
+
+ }
+
+ private static XmlDocument BuildXmlDocument(XmlReader reader)
+ {
+ string endinglocalName = reader.LocalName;
+
+ XmlDocument doc = new XmlDocument();
+
+ // create all contents with use of ReadNode()
+ do
+ {
+ XmlNode n = doc.ReadNode (reader);
+ if(n == null) break;
+ doc.AppendChild (n);
+ } while (reader.LocalName == endinglocalName);
+
+ return doc;
+ }
+
#endregion // Private methods
}
diff --git a/mcs/class/System.Data/System.Data/XmlSchemaMapper.cs b/mcs/class/System.Data/System.Data/XmlSchemaMapper.cs
index c42c8f6bc3f..2999246c442 100644
--- a/mcs/class/System.Data/System.Data/XmlSchemaMapper.cs
+++ b/mcs/class/System.Data/System.Data/XmlSchemaMapper.cs
@@ -12,7 +12,6 @@
//
// (C) 2002 Ville Palo
//
-// TODO: Relations
//
using System;
@@ -49,7 +48,8 @@ namespace System.Data {
public void Read (XmlReader Reader)
{
XmlSchema Schema = XmlSchema.Read (Reader, new ValidationEventHandler (OnXmlSchemaValidation));
-
+ DSet.Namespace = Schema.TargetNamespace;
+
// read items
foreach (XmlSchemaObject Item in Schema.Items)
ReadXmlSchemaItem (Item);
@@ -77,10 +77,15 @@ namespace System.Data {
private void ReadXmlSchemaSequence (XmlSchemaSequence Sequence, DataTable Table)
{
foreach (XmlSchemaObject TempObj in Sequence.Items) {
-
- if (TempObj is XmlSchemaElement)
- ReadXmlSchemaElement (TempObj as XmlSchemaElement, ElementType.ELEMENT_COLUMN, Table);
-
+ if (TempObj is XmlSchemaElement){
+ XmlSchemaElement schemaElement = (XmlSchemaElement)TempObj;
+ // the element can be a Column or a Table
+ // tables do not have a type.
+ if (schemaElement.SchemaTypeName.Name.Length > 0 || (schemaElement.SchemaType is XmlSchemaSimpleType))
+ ReadXmlSchemaElement (schemaElement, ElementType.ELEMENT_COLUMN, Table);
+ else
+ ReadXmlSchemaElement (schemaElement, ElementType.ELEMENT_TABLE, Table);
+ }
}
}
@@ -88,10 +93,9 @@ namespace System.Data {
{
XmlSchemaObject SchemaObject;
foreach (XmlSchemaObject TempObject in Choice.Items) {
-
if ((SchemaObject = TempObject as XmlSchemaElement) != null)
ReadXmlSchemaElement ((XmlSchemaElement)SchemaObject, ElementType.ELEMENT_TABLE);
- }
+ }
}
private void ReadXmlSchemaElement (XmlSchemaElement Element)
@@ -109,10 +113,14 @@ namespace System.Data {
Hashtable Attributes = ReadUnhandledAttributes (Element.UnhandledAttributes);
DataTable Table2 = null;
- if (Attributes.Contains ("IsDataSet")) { // DataSet -elemt
-
- if (String.Compare (Attributes ["IsDataSet"].ToString (), "true", true) == 0)
+ if (Attributes.Contains (XmlConstants.IsDataSet)) { // DataSet -elemt
+ if (String.Compare (Attributes [XmlConstants.IsDataSet].ToString (), "true", true) == 0)
DSet.DataSetName = Element.Name;
+
+ if (Attributes.Contains (XmlConstants.Locale)) {
+ DSet.Locale = new CultureInfo((String)Attributes [XmlConstants.Locale]);
+ }
+
}
else if (Element.SchemaTypeName != null && Element.SchemaTypeName.Namespace != XmlConstants.SchemaNamespace
&& Element.SchemaTypeName.Name != String.Empty) {
@@ -137,9 +145,12 @@ namespace System.Data {
ReadXmlSchemaElement ((XmlSchemaElement)ElementCollection [Element.RefName.Name], ElementType.ELEMENT_TABLE);
}
else if (ElementType.ELEMENT_UNDEFINED != ElType) {
-
- if (ElType == ElementType.ELEMENT_TABLE)
+
+ if (ElType == ElementType.ELEMENT_TABLE){
ReadTable (Element);
+ // we have to return else all child element of the table will be computed again.
+ return;
+ }
else if (ElType == ElementType.ELEMENT_COLUMN && Table != null)
ReadColumn (Element, Table);
}
@@ -153,37 +164,45 @@ namespace System.Data {
ReadXmlSchemaType (Element.SchemaType);
// Read possible constraints
- if (Element.Constraints != null && Element.Constraints.Count > 0)
+ if (Element.Constraints != null && Element.Constraints.Count > 0){
ReadXmlSchemaConstraints (Element.Constraints);
+ }
}
private void ReadTable (XmlSchemaElement Element)
{
- DataTable TempTable = new DataTable (Element.Name);
- DSet.Tables.Add (TempTable);
- ReadXmlSchemaType (Element.SchemaType, TempTable);
+ DataTable TempTable = null;
+ // Add the table to the DataSet only if it is not already in there.
+ if (!DSet.Tables.Contains(Element.Name)) {
+ TempTable = new DataTable (Element.Name);
+ DSet.Tables.Add (TempTable);
+ ReadXmlSchemaType (Element.SchemaType, TempTable);
+ }
}
private void ReadColumn (XmlSchemaElement Element, DataTable Table)
{
DataColumn Column = new DataColumn (Element.Name);
+ Column.DataType = GetColumnType(Element.SchemaTypeName.Name);
Table.Columns.Add (Column);
if (Element.UnhandledAttributes != null) {
-
+
foreach (XmlAttribute Attr in Element.UnhandledAttributes) {
-
switch (Attr.LocalName) {
- case "Caption":
+ case XmlConstants.Caption:
Column.Caption = Attr.Value;
break;
- case "DataType":
+ case XmlConstants.DataType:
Column.DataType = Type.GetType (Attr.Value);
break;
- case "type":
- // FIXME:
- break;
+ case XmlConstants.AutoIncrement:
+ Column.AutoIncrement = bool.Parse(Attr.Value);
+ break;
+ case XmlConstants.AutoIncrementSeed:
+ Column.AutoIncrementSeed = int.Parse(Attr.Value);
+ break;
default:
break;
}
@@ -203,6 +222,69 @@ namespace System.Data {
// If Element have type
if (Element.SchemaType != null)
ReadXmlSchemaType (Element.SchemaType, Column);
+
+ }
+
+ private Type GetColumnType (String typeName)
+ {
+ if (typeName == null || typeName.Length == 0)
+ return typeof (string);
+ Type t;
+ switch (typeName) {
+ case "char":
+ t = typeof (char);
+ break;
+ case "int" :
+ t = typeof (int);
+ break;
+ case "unsignedInt" :
+ t = typeof (uint);
+ break;
+ case "unsignedByte" :
+ t = typeof (byte);
+ break;
+ case "byte" :
+ t = typeof (sbyte);
+ break;
+ case "short" :
+ t = typeof (short);
+ break;
+ case "usignedShort" :
+ t = typeof (ushort);
+ break;
+ case "long" :
+ t = typeof (long);
+ break;
+ case "unsignedLong" :
+ t = typeof (ulong);
+ break;
+ case "boolean" :
+ t = typeof (bool);
+ break;
+ case "float" :
+ t = typeof (float);
+ break;
+ case "double" :
+ t = typeof (double);
+ break;
+ case "decimal" :
+ t = typeof (decimal);
+ break;
+ case "dateTime" :
+ t = typeof (DateTime);
+ break;
+ case "duration" :
+ t = typeof (TimeSpan);
+ break;
+ case "base64Binary" :
+ t = typeof (byte[]);
+ break;
+ default :
+ t = typeof (string);
+ break;
+ }
+
+ return t;
}
// Makes new Hashtable of the attributes.
@@ -223,9 +305,10 @@ namespace System.Data {
private void ReadXmlSchemaConstraints (XmlSchemaObjectCollection Constraints)
{
foreach (XmlSchemaObject Constraint in Constraints) {
-
if (Constraint is XmlSchemaUnique)
ReadXmlSchemaUnique ((XmlSchemaUnique)Constraint);
+ if (Constraint is XmlSchemaKeyref)
+ ReadXmlSchemaKeyref ((XmlSchemaKeyref)Constraint, Constraints);
}
}
@@ -233,30 +316,136 @@ namespace System.Data {
private void ReadXmlSchemaUnique (XmlSchemaUnique Unique)
{
// FIXME: Parsing XPath
-
string TableName = Unique.Selector.XPath;
- if (TableName.StartsWith (".//"))
+ int index = TableName.IndexOf(':');
+ if (index != -1)
+ TableName = TableName.Substring (index + 1);
+ else if(TableName.StartsWith (".//"))
TableName = TableName.Substring (3);
DataColumn [] Columns;
if (DSet.Tables.Contains (TableName)) {
-
DataTable Table = DSet.Tables [TableName];
Columns = new DataColumn [Unique.Fields.Count];
int i = 0;
foreach (XmlSchemaXPath Field in Unique.Fields) {
+ string columnName = Field.XPath;
+ index = columnName.IndexOf (':');
+ if (index != -1)
+ columnName = columnName.Substring (index + 1);
+ if (Table.Columns.Contains (columnName)) {
+ Columns [i] = Table.Columns [columnName];
+ i++;
+ }
+ }
+
+ bool isPK = false;
+ // find if there is an attribute with the constraint name
+ // if not use the XmlSchemaUnique name.
+ string constraintName = Unique.Name;
+ if (Unique.UnhandledAttributes != null){
+ foreach (XmlAttribute attr in Unique.UnhandledAttributes){
+ if (attr.LocalName == "ConstraintName"){
+ constraintName = attr.Value;
+ }
+ else if (attr.LocalName == XmlConstants.PrimaryKey){
+ isPK = bool.Parse(attr.Value);
+ }
- if (Table.Columns.Contains (Field.XPath)) {
- Table.Columns [Field.XPath].Unique = true;
- Columns [i] = Table.Columns [Field.XPath];
+ }
+ }
+ UniqueConstraint Constraint = new UniqueConstraint (constraintName, Columns, isPK);
+ Table.Constraints.Add (Constraint);
+ }
+ }
+
+ [MonoTODO()]
+ private void ReadXmlSchemaKeyref (XmlSchemaKeyref KeyRef, XmlSchemaObjectCollection collection) {
+
+ string TableName = KeyRef.Selector.XPath;
+ int index = TableName.IndexOf(':');
+ if (index != -1)
+ TableName = TableName.Substring (index + 1);
+ else if (TableName.StartsWith (".//"))
+ TableName = TableName.Substring (3);
+ DataColumn [] Columns;
+ if (DSet.Tables.Contains (TableName)) {
+ DataTable Table = DSet.Tables [TableName];
+ Columns = new DataColumn [KeyRef.Fields.Count];
+ int i = 0;
+ foreach (XmlSchemaXPath Field in KeyRef.Fields) {
+ string columnName = Field.XPath;
+ index = columnName.IndexOf (':');
+ if (index != -1)
+ columnName = columnName.Substring (index + 1);
+ if (Table.Columns.Contains (columnName)) {
+ Columns [i] = Table.Columns [columnName];
i++;
}
}
+ string name = KeyRef.Refer.Name;
+ // get the unique constraint for the releation
+ UniqueConstraint constraint = GetDSConstraint(name, collection);
+ // generate the FK.
+ ForeignKeyConstraint fkConstraint = new ForeignKeyConstraint(constraint.Columns, Columns);
+ Table.Constraints.Add (fkConstraint);
+ // generate the relation.
+ DataRelation relation = new DataRelation(KeyRef.Name, constraint.Columns, Columns, false);
+ if (KeyRef.UnhandledAttributes != null){
+ foreach (XmlAttribute attr in KeyRef.UnhandledAttributes){
+ if (attr.LocalName == "IsNested"){
+ if (attr.Value == "true")
+ relation.Nested = true;
+ }
+ }
+ }
+
+ DSet.Relations.Add(relation);
+ }
+ }
+
+ // get the unique constraint for the relation.
+ // name - the name of the XmlSchemaUnique element
+ private UniqueConstraint GetDSConstraint(string name, XmlSchemaObjectCollection collection)
+ {
+ // find the element in the constraint collection.
+ foreach (XmlSchemaObject shemaObj in collection){
+ if (shemaObj is XmlSchemaUnique){
+ XmlSchemaUnique unique = (XmlSchemaUnique) shemaObj;
+ if (unique.Name == name){
+ string tableName = unique.Selector.XPath;
+ int index = tableName.IndexOf (':');
+ if (index != -1)
+ tableName = tableName.Substring (index + 1);
+ else if (tableName.StartsWith (".//"))
+ tableName = tableName.Substring (3);
+
+ // find the table in the dataset.
+ if (DSet.Tables.Contains(tableName)){
+
+ DataTable table = DSet.Tables[tableName];
+ string constraintName = unique.Name;
+ // find if there is an attribute with the constraint name
+ // if not use the XmlSchemaUnique name.
+ if (unique.UnhandledAttributes != null){
+ foreach (XmlAttribute attr in unique.UnhandledAttributes){
+ if (attr.LocalName == "ConstraintName"){
+ constraintName = attr.Value;
+ break;
+ }
+ }
+ }
+ if (table.Constraints.Contains(constraintName))
+ return (UniqueConstraint)table.Constraints[constraintName];
+ }
- UniqueConstraint Constraint = new UniqueConstraint (Unique.Name, Columns);
+ }
+ }
}
+ return null;
}
+
#endregion // Private methods
#region Private listeners
@@ -299,7 +488,7 @@ namespace System.Data {
#region TypeReaderHelppers
private void ReadXmlSchemaSimpleType (XmlSchemaSimpleType SimpleType, DataColumn Column)
- {
+ {
// Read Contents
if (SimpleType.Content is XmlSchemaSimpleTypeRestriction)
ReadXmlSchemaSimpleTypeRestriction ((XmlSchemaSimpleTypeRestriction)SimpleType.Content, Column);
diff --git a/mcs/class/System.Data/System.Data_test.dll.sources b/mcs/class/System.Data/System.Data_test.dll.sources
index 39f66e30f27..bbd3e1f0ca3 100644
--- a/mcs/class/System.Data/System.Data_test.dll.sources
+++ b/mcs/class/System.Data/System.Data_test.dll.sources
@@ -23,4 +23,5 @@ System.Data/DataSetTest.cs
System.Data/DataTableTest.cs
System.Data/DataViewTest.cs
System.Data/ForeignKeyConstraintTest.cs
+System.Data/TypedDataSetGeneratorTest.cs
System.Data/UniqueConstraintTest.cs
diff --git a/mcs/class/System.Data/Test/System.Data/ChangeLog b/mcs/class/System.Data/Test/System.Data/ChangeLog
index c0a409e6fe9..91874858b75 100644
--- a/mcs/class/System.Data/Test/System.Data/ChangeLog
+++ b/mcs/class/System.Data/Test/System.Data/ChangeLog
@@ -1,3 +1,7 @@
+2004-01-21 Atsushi Enomoto <atsushi@ximian.com>
+
+ * Added TypedDataSetGeneratorTest.cs.
+
2003-12-18 Jackson Harper <jackson@ximian.com>
* DataViewTest.cs: Add some tests for new methods.
diff --git a/mcs/class/System.Data/Test/System.Data/TypedDataSetGeneratorTest.cs b/mcs/class/System.Data/Test/System.Data/TypedDataSetGeneratorTest.cs
new file mode 100755
index 00000000000..11a9eef0102
--- /dev/null
+++ b/mcs/class/System.Data/Test/System.Data/TypedDataSetGeneratorTest.cs
@@ -0,0 +1,59 @@
+//
+// TypedDataSetGeneratorTest.cs
+//
+// Author:
+// Atsushi Enomoto <atsushi@ximian.com>
+//
+// (C)2004 Novell inc.
+//
+using System;
+using System.CodeDom.Compiler;
+using System.Data;
+using NUnit.Framework;
+using Microsoft.CSharp;
+
+namespace MonoTests.System.Data
+{
+ public class TypedDataSetGeneratorTest : Assertion
+ {
+ private ICodeGenerator gen;
+
+ public TypedDataSetGeneratorTest ()
+ {
+ gen = new CSharpCodeProvider ().CreateGenerator ();
+ }
+
+ [Test]
+ [ExpectedException (typeof (NullReferenceException))]
+ public void TestGenerateIdNameNullName ()
+ {
+ TypedDataSetGenerator.GenerateIdName (null, gen);
+ }
+
+ [Test]
+ [ExpectedException (typeof (NullReferenceException))]
+ public void TestGenerateIdNameNullProvider ()
+ {
+ TypedDataSetGenerator.GenerateIdName ("a", null);
+ }
+
+ [Test]
+ public void TestGenerateIdName ()
+ {
+
+ AssertEquals ("a", TypedDataSetGenerator.GenerateIdName ("a", gen));
+ AssertEquals ("_int", TypedDataSetGenerator.GenerateIdName ("int", gen));
+ AssertEquals ("_", TypedDataSetGenerator.GenerateIdName ("_", gen));
+ AssertEquals ("1", TypedDataSetGenerator.GenerateIdName ("1", gen));
+ AssertEquals ("1a", TypedDataSetGenerator.GenerateIdName ("1a", gen));
+ AssertEquals ("1*2", TypedDataSetGenerator.GenerateIdName ("1*2", gen));
+ AssertEquals ("-", TypedDataSetGenerator.GenerateIdName ("-", gen));
+ AssertEquals ("+", TypedDataSetGenerator.GenerateIdName ("+", gen));
+ AssertEquals ("", TypedDataSetGenerator.GenerateIdName ("", gen));
+ AssertEquals ("--", TypedDataSetGenerator.GenerateIdName ("--", gen));
+ AssertEquals ("++", TypedDataSetGenerator.GenerateIdName ("++", gen));
+ AssertEquals ("\u3042", TypedDataSetGenerator.GenerateIdName ("\u3042", gen));
+ }
+
+ }
+}
diff --git a/mcs/class/System.DirectoryServices/Assembly/AssemblyInfo.cs b/mcs/class/System.DirectoryServices/Assembly/AssemblyInfo.cs
new file mode 100644
index 00000000000..3797639fd78
--- /dev/null
+++ b/mcs/class/System.DirectoryServices/Assembly/AssemblyInfo.cs
@@ -0,0 +1,44 @@
+//
+// AssemblyInfo.cs
+//
+// Author:
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+//
+// (C) 2004 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Reflection;
+using System.Resources;
+using System.Security;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about the System.DirectoryServices assembly
+
+#if (NET_1_0)
+ [assembly: AssemblyVersion("1.0.3300.0")]
+ [assembly: SatelliteContractVersion("1.0.3300.0")]
+#endif
+#if (NET_1_1)
+ [assembly: AssemblyVersion("1.0.5000.0")]
+ [assembly: SatelliteContractVersion("1.0.5000.0")]
+#endif
+
+[assembly: AssemblyTitle("System.DirectoryServices.dll")]
+[assembly: AssemblyDescription("System.DirectoryServices.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.DirectoryServices.dll")]
+[assembly: AssemblyInformationalVersion("0.0.0.1")]
+[assembly: NeutralResourcesLanguage("en-US")]
+
+[assembly: ComVisible(false)]
+
+//[assembly: AssemblyDelaySign(true)]
+//[assembly: AssemblyKeyFile("")] \ No newline at end of file
diff --git a/mcs/class/System.DirectoryServices/Assembly/ChangeLog b/mcs/class/System.DirectoryServices/Assembly/ChangeLog
new file mode 100644
index 00000000000..aa3dea19297
--- /dev/null
+++ b/mcs/class/System.DirectoryServices/Assembly/ChangeLog
@@ -0,0 +1,6 @@
+2004-01-15 Andreas Nahr <ClassDevelopment@A-SoftTech.com>
+
+ * Locale.cs: Added
+ * Consts.cs: Added
+ * AssemblyInfo.cs: Added
+ * ChangeLog: Added \ No newline at end of file
diff --git a/mcs/class/System.DirectoryServices/Assembly/Consts.cs b/mcs/class/System.DirectoryServices/Assembly/Consts.cs
new file mode 100644
index 00000000000..629ec4cf8b0
--- /dev/null
+++ b/mcs/class/System.DirectoryServices/Assembly/Consts.cs
@@ -0,0 +1,50 @@
+//
+// Consts.cs
+//
+// Author:
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+//
+// (C) 2003 Andreas Nahr
+//
+// NOTE:
+// Ensure that every constant is defined for every version symbol!
+//
+
+// This class contains constants that are dependent on the defined symbols
+// Use it to shorten and make code more maintainable in situations like:
+//
+//#if (NET_1_0)
+// [Designer ("System.Diagnostics.Design.ProcessDesigner, System.Design, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof (IDesigner))]
+//#endif
+//#if (NET_1_1)
+// [Designer ("System.Diagnostics.Design.ProcessDesigner, System.Design, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof (IDesigner))]
+//#endif
+//
+// by changing them into:
+//
+// [Designer ("System.Diagnostics.Design.ProcessDesigner, " + Consts.AssemblySystem_Design, typeof (IDesigner))]
+//
+
+internal sealed class Consts
+{
+
+ private Consts ()
+ {
+ }
+
+#if (NET_1_0)
+
+ public const string AssemblySystem_Design = "System.Design, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a";
+ public const string AssemblySystem_Drawing = "System.Drawing, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a";
+
+//#elif (NET_1_1)
+#else
+ // NET_1_1 is seen as default if somebody 'forgets' to specify any of the symbols
+ // to ensure we are not breaking the build in this case
+
+ public const string AssemblySystem_Design = "System.Design, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a";
+ public const string AssemblySystem_Drawing = "System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a";
+
+#endif
+
+} \ No newline at end of file
diff --git a/mcs/class/System.DirectoryServices/Assembly/Locale.cs b/mcs/class/System.DirectoryServices/Assembly/Locale.cs
new file mode 100644
index 00000000000..a456449296f
--- /dev/null
+++ b/mcs/class/System.DirectoryServices/Assembly/Locale.cs
@@ -0,0 +1,24 @@
+//
+// Locale.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+//
+// (C) 2001 - 2003 Ximian, Inc (http://www.ximian.com)
+//
+
+internal sealed class Locale {
+
+ private Locale ()
+ {
+ }
+
+ /// <summary>
+ /// Returns the translated message for the current locale
+ /// </summary>
+ public static string GetText (string msg)
+ {
+ return msg;
+ }
+}
diff --git a/mcs/class/System.DirectoryServices/ChangeLog b/mcs/class/System.DirectoryServices/ChangeLog
index ea87b4d845f..4f470d48cbe 100644
--- a/mcs/class/System.DirectoryServices/ChangeLog
+++ b/mcs/class/System.DirectoryServices/ChangeLog
@@ -1,3 +1,7 @@
+2004-01-15 Andreas Nahr <ClassDevelopment@A-SoftTech.com>
+
+ * System.DirectoryServices.dll.sources: Added lots of files, sorted existing
+
2003-07-02 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* System.DirectoryServices.build: New file.
diff --git a/mcs/class/System.DirectoryServices/System.DirectoryServices.Design/ChangeLog b/mcs/class/System.DirectoryServices/System.DirectoryServices.Design/ChangeLog
new file mode 100644
index 00000000000..7568b7e457a
--- /dev/null
+++ b/mcs/class/System.DirectoryServices/System.DirectoryServices.Design/ChangeLog
@@ -0,0 +1,4 @@
+2004-01-15 Andreas Nahr <ClassDevelopment@A-SoftTech.com>
+
+ * DirectoryEntryConverter.cs: Added, stubbed minimal version
+ * ChangeLog: Added \ No newline at end of file
diff --git a/mcs/class/System.DirectoryServices/System.DirectoryServices.Design/DirectoryEntryConverter.cs b/mcs/class/System.DirectoryServices/System.DirectoryServices.Design/DirectoryEntryConverter.cs
new file mode 100644
index 00000000000..97de92c453e
--- /dev/null
+++ b/mcs/class/System.DirectoryServices/System.DirectoryServices.Design/DirectoryEntryConverter.cs
@@ -0,0 +1,24 @@
+//
+// System.DirectoryServices.Design.DirectoryEntryConverter.cs
+//
+// Author:
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+//
+// (C) 2004 Andreas Nahr
+//
+//
+
+using System.ComponentModel;
+
+namespace System.DirectoryServices.Design
+{
+
+ internal class DirectoryEntryConverter : TypeConverter
+ {
+
+ //TODO IMPLEMENT
+ public DirectoryEntryConverter ()
+ {
+ }
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System.DirectoryServices/System.DirectoryServices.dll.sources b/mcs/class/System.DirectoryServices/System.DirectoryServices.dll.sources
index 8b3e8cc79d8..5c3d5b75f64 100755
--- a/mcs/class/System.DirectoryServices/System.DirectoryServices.dll.sources
+++ b/mcs/class/System.DirectoryServices/System.DirectoryServices.dll.sources
@@ -1,15 +1,21 @@
-System.DirectoryServices/AssemblyInfo.cs
-System.DirectoryServices/DirectoryEntry.cs
-System.DirectoryServices/DirectoryEntries.cs
-System.DirectoryServices/SchemaNameCollection.cs
+Assembly/AssemblyInfo.cs
+Assembly/Consts.cs
+Assembly/Locale.cs
System.DirectoryServices/AuthenticationTypes.cs
+System.DirectoryServices/DirectoryEntries.cs
+System.DirectoryServices/DirectoryEntry.cs
+System.DirectoryServices/DirectorySearcher.cs
+System.DirectoryServices/DirectoryServicesPermissionAccess.cs
+System.DirectoryServices/DSDescriptionAttribute.cs
System.DirectoryServices/PropertyCollection.cs
System.DirectoryServices/PropertyValueCollection.cs
-System.DirectoryServices/DirectorySearcher.cs
System.DirectoryServices/ReferralChasingOption.cs
-System.DirectoryServices/SearchScope.cs
-System.DirectoryServices/SortDirection.cs
-System.DirectoryServices/ResultPropertyValueCollection.cs
System.DirectoryServices/ResultPropertyCollection.cs
-System.DirectoryServices/SearchResultCollection.cs
+System.DirectoryServices/ResultPropertyValueCollection.cs
+System.DirectoryServices/SchemaNameCollection.cs
System.DirectoryServices/SearchResult.cs
+System.DirectoryServices/SearchResultCollection.cs
+System.DirectoryServices/SearchScope.cs
+System.DirectoryServices/SortDirection.cs
+System.DirectoryServices/SortOption.cs
+System.DirectoryServices.Design/DirectoryEntryConverter.cs
diff --git a/mcs/class/System.DirectoryServices/System.DirectoryServices/AssemblyInfo.cs b/mcs/class/System.DirectoryServices/System.DirectoryServices/AssemblyInfo.cs
deleted file mode 100644
index 7209991e9f9..00000000000
--- a/mcs/class/System.DirectoryServices/System.DirectoryServices/AssemblyInfo.cs
+++ /dev/null
@@ -1,82 +0,0 @@
-/******************************************************************************
-* The MIT License
-* Copyright (c) 2003 Novell Inc., www.novell.com
-*
-* Permission is hereby granted, free of charge, to any person obtaining a copy
-* of this software and associated documentation files (the Software), to deal
-* in the Software without restriction, including without limitation the rights
-* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-* copies of the Software, and to permit persons to whom the Software is
-* furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in
-* all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-* SOFTWARE.
-*******************************************************************************/
-using System;
-using System.Reflection;
-using System.Runtime.CompilerServices;
-
-//
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-//
-[assembly: AssemblyTitle("")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("")]
-[assembly: AssemblyCopyright("")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-[assembly: CLSCompliant(true)]
-
-//
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Revision and Build Numbers
-// by using the '*' as shown below:
-
-[assembly: AssemblyVersion("1.0.*")]
-
-//
-// In order to sign your assembly you must specify a key to use. Refer to the
-// Microsoft .NET Framework documentation for more information on assembly signing.
-//
-// Use the attributes below to control which key is used for signing.
-//
-// Notes:
-// (*) If no key is specified, the assembly is not signed.
-// (*) KeyName refers to a key that has been installed in the Crypto Service
-// Provider (CSP) on your machine. KeyFile refers to a file which contains
-// a key.
-// (*) If the KeyFile and the KeyName values are both specified, the
-// following processing occurs:
-// (1) If the KeyName can be found in the CSP, that key is used.
-// (2) If the KeyName does not exist and the KeyFile does exist, the key
-// in the KeyFile is installed into the CSP and used.
-// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
-// When specifying the KeyFile, the location of the KeyFile should be
-// relative to the project output directory which is
-// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
-// located in the project directory, you would specify the AssemblyKeyFile
-// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
-// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
-// documentation for more information on this.
-//
-[assembly: AssemblyDelaySign(false)]
-[assembly: AssemblyKeyFile("")]
-[assembly: AssemblyKeyName("")]
diff --git a/mcs/class/System.DirectoryServices/System.DirectoryServices/ChangeLog b/mcs/class/System.DirectoryServices/System.DirectoryServices/ChangeLog
new file mode 100644
index 00000000000..fcf5629ac05
--- /dev/null
+++ b/mcs/class/System.DirectoryServices/System.DirectoryServices/ChangeLog
@@ -0,0 +1,9 @@
+2004-01-15 Andreas Nahr <ClassDevelopment@A-SoftTech.com>
+
+ * ChangeLog: Added
+ * AssemblyInfo.cs: Removed
+ * DirectoryEntry.cs: Added attributes, fixed warning, stubbed missing
+ * DirectorySearcher.cs: Added attributes, stubbed missing
+ * DirectoryServicesPermissionAccess.cs: Added, implemented
+ * DSDescriptionAttribute.cs: Added, implemented
+ * DSDescriptionAttribute.cs, Added implemented \ No newline at end of file
diff --git a/mcs/class/System.DirectoryServices/System.DirectoryServices/DSDescriptionAttribute.cs b/mcs/class/System.DirectoryServices/System.DirectoryServices/DSDescriptionAttribute.cs
new file mode 100644
index 00000000000..4cadddef2e4
--- /dev/null
+++ b/mcs/class/System.DirectoryServices/System.DirectoryServices/DSDescriptionAttribute.cs
@@ -0,0 +1,29 @@
+//
+// System.DirectoryServices.DSDescriptionAttribute.cs
+//
+// Author:
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+//
+// (C) 2004 Andreas Nahr
+//
+//
+
+using System.ComponentModel;
+
+namespace System.DirectoryServices {
+
+ [AttributeUsage (AttributeTargets.All)]
+ public class DSDescriptionAttribute : DescriptionAttribute
+ {
+
+ public DSDescriptionAttribute (String description)
+ : base (description)
+ {
+ }
+
+ public override String Description {
+ get { return base.Description; }
+ }
+ }
+}
+
diff --git a/mcs/class/System.DirectoryServices/System.DirectoryServices/DirectoryEntry.cs b/mcs/class/System.DirectoryServices/System.DirectoryServices/DirectoryEntry.cs
index 55ab8c0fbd3..7f38b1efd41 100644
--- a/mcs/class/System.DirectoryServices/System.DirectoryServices/DirectoryEntry.cs
+++ b/mcs/class/System.DirectoryServices/System.DirectoryServices/DirectoryEntry.cs
@@ -24,8 +24,9 @@
//
// System.DirectoryServices.DirectoryEntry.cs
//
-// Author:
+// Authors:
// Sunil Kumar (sunilk@novell.com)
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
//
// (C) Novell Inc.
//
@@ -34,6 +35,7 @@ using System.ComponentModel;
using Novell.Directory.Ldap;
using Novell.Directory.Ldap.Utilclass;
using System.Globalization;
+using System.DirectoryServices.Design;
namespace System.DirectoryServices
{
@@ -41,19 +43,21 @@ namespace System.DirectoryServices
/// <summary>
///Encapsulates a node or object in the Ldap Directory hierarchy.
/// </summary>
- public class DirectoryEntry : Component
+ [DesignerCategory ("Component")]
+ [TypeConverter (typeof (DirectoryEntryConverter))]
+ public class DirectoryEntry : Component
{
private LdapConnection _conn = null;
- private AuthenticationTypes _AuthenticationType=AuthenticationTypes.None;
- private DirectoryEntries _Children;
+ private AuthenticationTypes _AuthenticationType=AuthenticationTypes.None;
+ private DirectoryEntries _Children;
private string _Fdn = null;
private string _Path="";
private string _Name=null;
private DirectoryEntry _Parent=null;
private string _Username="";
private string _Password="";
- private string _Nativeguid;
+ //private string _Nativeguid;
private PropertyCollection _Properties = null;
private string _SchemaClassName=null;
private bool _Nflag = false;
@@ -231,6 +235,8 @@ namespace System.DirectoryServices
/// <summary>
/// Returns Type of authentication to use while Binding to Ldap server
/// </summary>
+ [DSDescription ("Type of authentication to use while Binding to Ldap server")]
+ [DefaultValue (AuthenticationTypes.None)]
public AuthenticationTypes AuthenticationType
{
get
@@ -261,6 +267,9 @@ namespace System.DirectoryServices
/// example, you might want to use a schema titled "Computer" to add
/// new computers to the hierarchy.
/// </remarks>
+ [DSDescription ("Child entries of this node")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [Browsable (false)]
public DirectoryEntries Children
{
get
@@ -277,6 +286,9 @@ namespace System.DirectoryServices
/// <remarks>
/// Not implemented yet.
/// </remarks>
+ [DSDescription ("A globally unique identifier for this DirectoryEntry")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [Browsable (false)]
public Guid Guid
{
get
@@ -295,6 +307,9 @@ namespace System.DirectoryServices
/// <remarks>This name, along with SchemaClassName, distinguishes this
/// entry from its siblings and must be unique amongst its siblings
/// in each instance of DirectoryEntry.</remarks>
+ [DSDescription ("The name of the object as named with the underlying directory")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [Browsable (false)]
public string Name
{
get {
@@ -312,6 +327,9 @@ namespace System.DirectoryServices
/// Gets this entry's parent in the Ldap Directory hierarchy.
/// </summary>
/// <value>This entry's parent in the Active Directory hierarc</value>
+ [DSDescription ("This entry's parent in the Ldap Directory hierarchy.")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [Browsable (false)]
public DirectoryEntry Parent
{
get {
@@ -336,6 +354,9 @@ namespace System.DirectoryServices
/// <remarks>
/// Not implemented yet.
/// </remarks>
+ [DSDescription ("The globally unique identifier of the DirectoryEntry, as returned from the provider")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [Browsable (false)]
public string NativeGuid
{
get {
@@ -348,6 +369,9 @@ namespace System.DirectoryServices
/// </summary>
/// <remarks>
/// Not implemented yet
+ [DSDescription ("The native Active Directory Service Interfaces (ADSI) object.")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [Browsable (false)]
public object NativeObject
{
get {
@@ -356,6 +380,23 @@ namespace System.DirectoryServices
}
/// <summary>
+ /// Determines if a cache should be used.
+ /// </summary>
+ [DSDescription ("Determines if a cache should be used.")]
+ [DefaultValue (true)]
+ public bool UsePropertyCache
+ {
+ get
+ {
+ throw new NotImplementedException();
+ }
+ set
+ {
+ throw new NotImplementedException();
+ }
+ }
+
+ /// <summary>
/// Gets or sets the password to use when authenticating the client.
/// </summary>
/// <value>
@@ -368,6 +409,9 @@ namespace System.DirectoryServices
/// example, through Children) are automatically created with the same
/// alternate credentials.
/// </remarks>
+ [DSDescription ("The password to use when authenticating the client.")]
+ [DefaultValue (null)]
+ [Browsable (false)]
public string Password
{
get {
@@ -392,6 +436,10 @@ namespace System.DirectoryServices
/// example, through Children) are automatically created with the same
/// alternate
/// </remarks>
+ [DSDescription ("The user name to use when authenticating the client.")]
+ [DefaultValue (null)]
+ [Browsable (false)]
+ [TypeConverter ("System.Diagnostics.Design.StringValueConverter, " + Consts.AssemblySystem_Design)]
public string Username
{
get {
@@ -424,6 +472,10 @@ namespace System.DirectoryServices
/// Currently we Support only Ldap provider.
/// e.g Ldap://[hostname]:[port number]/[ObjectFDN]
/// </remarks>
+ [DSDescription ("The path for this DirectoryEntry.")]
+ [DefaultValue ("")]
+ [RecommendedAsConfigurable (true)]
+ [TypeConverter ("System.Diagnostics.Design.StringValueConverter, " + Consts.AssemblySystem_Design)]
public string Path
{
get {
@@ -441,6 +493,9 @@ namespace System.DirectoryServices
/// <value>
/// A PropertyCollection of properties set on this object.
/// </value>
+ [DSDescription ("Properties set on this object.")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [Browsable (false)]
public PropertyCollection Properties
{
get {
@@ -496,7 +551,9 @@ namespace System.DirectoryServices
/// <value>
/// The name of the schema used for this DirectoryEntry.
/// </value>
- ///
+ [DSDescription ("The name of the schema used for this DirectoryEntry.")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [Browsable (false)]
public string SchemaClassName
{
get {
@@ -508,6 +565,21 @@ namespace System.DirectoryServices
}
/// <summary>
+ /// Gets the current schema directory entry.
+ /// </summary>
+ /// <remarks>
+ /// Not implemented yet
+ [DSDescription ("The current schema directory entry.")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [Browsable (false)]
+ public DirectoryEntry SchemaEntry
+ {
+ get {
+ throw new NotImplementedException();
+ }
+ }
+
+ /// <summary>
/// Searches an entry in the Ldap directory and returns the attribute value
/// </summary>
/// <param name="attrName">attribute whose value is required</param>
diff --git a/mcs/class/System.DirectoryServices/System.DirectoryServices/DirectorySearcher.cs b/mcs/class/System.DirectoryServices/System.DirectoryServices/DirectorySearcher.cs
index b4fbc7b1e68..0595936a5fd 100644
--- a/mcs/class/System.DirectoryServices/System.DirectoryServices/DirectorySearcher.cs
+++ b/mcs/class/System.DirectoryServices/System.DirectoryServices/DirectorySearcher.cs
@@ -24,8 +24,9 @@
//
// System.DirectoryServices.DirectorySearcher.cs
//
-// Author:
+// Authors:
// Sunil Kumar (sunilk@novell.com)
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
//
// (C) Novell Inc.
//
@@ -41,7 +42,8 @@ namespace System.DirectoryServices
/// <summary>
///Performs queries against Ldap directory.
/// </summary>
- public class DirectorySearcher : Component
+ [DesignerCategory ("Component")]
+ public class DirectorySearcher : Component
{
private DirectoryEntry _SearchRoot=null;
@@ -87,25 +89,6 @@ namespace System.DirectoryServices
_conn.Bind(SearchRoot.Username,SearchRoot.Password);
}
- /// <summary>
- /// Gets or sets the node in the Ldap Directory hierarchy where the
- /// search starts.
- /// </summary>
- /// <value>
- /// The DirectoryEntry in the Ldap Directory hierarchy where the
- /// search starts. The default is a null reference
- /// </value>
- public DirectoryEntry SearchRoot
- {
- get
- {
- return _SearchRoot;
- }
- set
- {
- _SearchRoot = value;
- }
- }
/// <summary>
/// Gets or sets a value indicating whether the result is
@@ -119,6 +102,8 @@ namespace System.DirectoryServices
/// If the search returns a large result set, it is better to set
/// this property to false.
/// </remarks>
+ [DSDescription ("The cacheability of results.")]
+ [DefaultValue (true)]
public bool CacheResults
{
get
@@ -147,6 +132,7 @@ namespace System.DirectoryServices
/// the server returns its results and the client stops waiting. The
/// maximum server time limit is 120 seconds.
/// </remarks>
+ [DSDescription ("The maximum amount of time that the client waits for the server to return results.")]
public TimeSpan ClientTimeout
{
get
@@ -179,6 +165,10 @@ namespace System.DirectoryServices
/// Anotherexampleis"(&(objectClass=printer)(|(building=42)
/// (building=43)))".
/// </remarks>
+ [DSDescription ("The Lightweight Directory Access Protocol (Ldap) format filter string.")]
+ [DefaultValue ("(objectClass=*)")]
+ [RecommendedAsConfigurable (true)]
+ [TypeConverter ("System.Diagnostics.Design.StringValueConverter, " + Consts.AssemblySystem_Design)]
public string Filter
{
get
@@ -204,6 +194,8 @@ namespace System.DirectoryServices
/// requests more data, the server will restart the search where it
/// left off.
/// </remarks>
+ [DSDescription ("The page size in a paged search.")]
+ [DefaultValue (0)]
public int PageSize
{
get
@@ -228,6 +220,9 @@ namespace System.DirectoryServices
/// before you begin the search. For example, searcher.
/// PropertiesToLoad.Add("phone");.
/// </remarks>
+ [DSDescription ("The set of properties retrieved during the search.")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ [Editor ("System.Windows.Forms.Design.StringCollectionEditor, " + Consts.AssemblySystem_Design, "System.Drawing.Design.UITypeEditor, " + Consts.AssemblySystem_Drawing)]
public StringCollection PropertiesToLoad
{
get
@@ -245,6 +240,8 @@ namespace System.DirectoryServices
/// values have been assigned; false if the search obtains the names
/// and values for all the requested attributes. The default is false.
/// </value>
+ [DSDescription ("A value indicating whether the search retrieves only the names of attributes to which values have been assigned.")]
+ [DefaultValue (false)]
public bool PropertyNamesOnly
{
get
@@ -270,6 +267,8 @@ namespace System.DirectoryServices
/// domain), the server sends a referral message to the client that
/// the client can choose to ignore or chase.
/// </remarks>
+ [DSDescription ("How referrals are chased.")]
+ [DefaultValue (ReferralChasingOption.External)]
public ReferralChasingOption ReferralChasing
{
get
@@ -283,12 +282,37 @@ namespace System.DirectoryServices
}
/// <summary>
+ /// Gets or sets the node in the Ldap Directory hierarchy where the
+ /// search starts.
+ /// </summary>
+ /// <value>
+ /// The DirectoryEntry in the Ldap Directory hierarchy where the
+ /// search starts. The default is a null reference
+ /// </value>
+ [DSDescription ("The node in the Ldap Directory hierarchy where the search starts.")]
+ [DefaultValue (null)]
+ public DirectoryEntry SearchRoot
+ {
+ get
+ {
+ return _SearchRoot;
+ }
+ set
+ {
+ _SearchRoot = value;
+ }
+ }
+
+ /// <summary>
/// Gets or sets the scope of the search that is observed by the
/// server.
/// </summary>
/// <value>
/// One of the SearchScope values. The default is Subtree.
/// </value>
+ [DSDescription ("The scope of the search that is observed by the server.")]
+ [DefaultValue (SearchScope.Subtree)]
+ [RecommendedAsConfigurable (true)]
public SearchScope SearchScope
{
get
@@ -319,6 +343,7 @@ namespace System.DirectoryServices
/// Note: This property only applies to searches where PageSize
/// is set to a value that is not the default of -1.
/// </remarks>
+ [DSDescription ("The time limit the server should observe to search an individual page of results.")]
public TimeSpan ServerPageTimeLimit
{
get
@@ -332,6 +357,29 @@ namespace System.DirectoryServices
}
/// <summary>
+ /// Gets or sets the time limit the server should observe to search.
+ /// </summary>
+ /// <value>
+ /// A TimeSpan that represents the amount of time the server should
+ /// observe to search.
+ /// </value>
+ /// <remarks>
+ /// Not implemented
+ /// </remarks>
+ [DSDescription ("The time limit the server should observe to search.")]
+ public TimeSpan ServerTimeLimit
+ {
+ get
+ {
+ throw new NotImplementedException();
+ }
+ set
+ {
+ throw new NotImplementedException();
+ }
+ }
+
+ /// <summary>
/// Gets or sets the maximum number of objects the server returns in
/// a search.
/// </summary>
@@ -347,6 +395,8 @@ namespace System.DirectoryServices
/// than the server-determined default of 1000 entries, the
/// server-determined default is used.
/// </remarks>
+ [DSDescription ("The maximum number of objects the server returns in a search.")]
+ [DefaultValue (0)]
public int SizeLimit
{
get
@@ -359,6 +409,21 @@ namespace System.DirectoryServices
}
}
+ [DSDescription ("An object that defines how the data should be sorted.")]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
+ [TypeConverter (typeof (ExpandableObjectConverter))]
+ public SortOption Sort
+ {
+ get
+ {
+ throw new NotImplementedException();
+ }
+ set
+ {
+ throw new NotImplementedException();
+ }
+ }
+
/// <summary>
/// Initializes a new instance of the DirectorySearcher class with
/// SearchRoot, Filter, PropertiesToLoad, and SearchScope set to the
diff --git a/mcs/class/System.DirectoryServices/System.DirectoryServices/DirectoryServicesPermissionAccess.cs b/mcs/class/System.DirectoryServices/System.DirectoryServices/DirectoryServicesPermissionAccess.cs
new file mode 100644
index 00000000000..09b46974381
--- /dev/null
+++ b/mcs/class/System.DirectoryServices/System.DirectoryServices/DirectoryServicesPermissionAccess.cs
@@ -0,0 +1,22 @@
+//
+// System.DirectoryServices.DirectoryServicesPermissionAccess.cs
+//
+// Author:
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+//
+// (C) 2004 Andreas Nahr
+//
+//
+
+namespace System.DirectoryServices {
+
+ [Serializable]
+ [Flags]
+ public enum DirectoryServicesPermissionAccess
+ {
+ None = 0,
+ Browse = 2,
+ Write = 6
+ }
+}
+
diff --git a/mcs/class/System.DirectoryServices/System.DirectoryServices/SortOption.cs b/mcs/class/System.DirectoryServices/System.DirectoryServices/SortOption.cs
new file mode 100644
index 00000000000..a49622a18a7
--- /dev/null
+++ b/mcs/class/System.DirectoryServices/System.DirectoryServices/SortOption.cs
@@ -0,0 +1,46 @@
+//
+// System.DirectoryServices.SortOption.cs
+//
+// Author:
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+//
+// (C) 2004 Andreas Nahr
+//
+//
+
+using System.ComponentModel;
+
+namespace System.DirectoryServices {
+
+ [TypeConverter (typeof (ExpandableObjectConverter))]
+ public class SortOption
+ {
+ private String propertyName;
+ private SortDirection direction;
+
+ public SortOption ()
+ {
+ }
+
+ public SortOption (String propertyName, SortDirection direction)
+ {
+ this.propertyName = propertyName;
+ this.direction = direction;
+ }
+
+ public String PropertyName {
+ get { return propertyName; }
+ set {
+ if (value == null)
+ throw new ArgumentNullException ("value");
+ propertyName = value;
+ }
+ }
+
+ public SortDirection Direction {
+ get { return direction; }
+ set { direction = value; }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Drawing/ChangeLog b/mcs/class/System.Drawing/ChangeLog
index fc4aa862440..eb1cd4874e5 100644
--- a/mcs/class/System.Drawing/ChangeLog
+++ b/mcs/class/System.Drawing/ChangeLog
@@ -1,5 +1,18 @@
-2003-11-13 Andreas Nahr <ClassDevelopment@A-SoftTech.com>
+2004-01-26 Ravindra <rkumar@novell.com>
+ * System.Drawing.dll.sources: Added TextureBrush.cs.
+
+2004-01-26 Ravindra <rkumar@novell.com>
+ * System.Drawing_test.dll.sources: Added to create
+ System.Drawing_test.dll.
+
+2004-01-23 Ravindra <rkumar@novell.com>
+ * System.Drawing.dll.sources: Removed TextureBrush.cs.
+ Was added by mistake during last check-in.
+2004-01-19 Ravindra <rkumar@novell.com>
+ * System.Drawing.dll.sources: Added Encoder.cs.
+
+2003-11-13 Andreas Nahr <ClassDevelopment@A-SoftTech.com>
* System.Drawing.dll.sources: MetafileHeader added (was missing), Consts.cs added
2003-10-14 Bernie Solomon <bernard@ugsolutions.com>
@@ -13,7 +26,6 @@
Add gdi+ implementation
2003-09-21 Miguel de Icaza <miguel@ximian.com>
-
* System.Drawing.dll.sources: Remove xr implementation.
2003-09-21 Alexandre Pigolkine <pigolkine@gmx.de>
diff --git a/mcs/class/System.Drawing/Makefile b/mcs/class/System.Drawing/Makefile
index 99122d5b3ad..0bc6a503564 100644
--- a/mcs/class/System.Drawing/Makefile
+++ b/mcs/class/System.Drawing/Makefile
@@ -1,10 +1,6 @@
thisdir = class/System.Drawing
include ../../build/rules.make
-ifeq ($(PLATFORM),win32)
SUBDIRS =
-else
-SUBDIRS = gdiplus
-endif
# to use JPEG decoder add -r ./cdeclRedirector/cdeclCallback.dll
# and remove -define:DECLARE_CDECL_DELEGATES
diff --git a/mcs/class/System.Drawing/System.Drawing.Drawing2D/ChangeLog b/mcs/class/System.Drawing/System.Drawing.Drawing2D/ChangeLog
index 779cfdf7312..dd2ee377583 100644
--- a/mcs/class/System.Drawing/System.Drawing.Drawing2D/ChangeLog
+++ b/mcs/class/System.Drawing/System.Drawing.Drawing2D/ChangeLog
@@ -1,3 +1,37 @@
+2004-01-30 Duncan Mak <duncan@ximian.com>
+
+ * GraphicsPath.cs (AddPie): Corrected arguments sent to
+ P/Invoke. This fixes the strange NaNs we were getting when we
+ tried to draw Paths with a Pie figure.
+
+2004-01-24 Duncan Mak <duncan@ximian.com>
+
+ * GraphicsPath.cs (AddEllipse): Added.
+
+2004-01-19 Duncan Mak <duncan@ximian.com>
+
+ * GraphicsPath.cs: Implemented. Still needs testing, though.
+ Particular the PathPoints property, I ran into a P/Invoke problem,
+ I need to first fix that before I can go on with the rest of the testing.
+
+2004-01-13 Ravindra <rkumar@novell.com>
+
+ * Matrix.cs: Made the Matrix(IntPtr) constructor internal.
+ Because default access is private, that makes it unusable
+ by other classes.
+
+2004-01-11 Duncan Mak <duncan@ximian.com>
+
+ * Matrix.cs (Matrix): Removed reference to GpRect/GpRectF.
+
+2004-01-10 Ravindra <rkumar@novell.com>
+
+ * All Enums: Made serializable.
+
+ * GraphicsPathIterator.cs: Implements IDisposable.
+
+ * GraphicsState.cs: Inherits MarshalByRefObject.
+
2003-12-25 Duncan Mak <duncan@ximian.com>
* Matrix.cs (ToString): Cache the elements inside a local variable
diff --git a/mcs/class/System.Drawing/System.Drawing.Drawing2D/CombineMode.cs b/mcs/class/System.Drawing/System.Drawing.Drawing2D/CombineMode.cs
index 1cc760c02bc..1f1dcfcb9fd 100644
--- a/mcs/class/System.Drawing/System.Drawing.Drawing2D/CombineMode.cs
+++ b/mcs/class/System.Drawing/System.Drawing.Drawing2D/CombineMode.cs
@@ -13,6 +13,7 @@ namespace System.Drawing.Drawing2D {
/// <summary>
/// Summary description for CombineMode.
/// </summary>
+ [Serializable]
public enum CombineMode
{
Complement = 5,
diff --git a/mcs/class/System.Drawing/System.Drawing.Drawing2D/CompostingMode.cs b/mcs/class/System.Drawing/System.Drawing.Drawing2D/CompostingMode.cs
index 45b14c10098..e354ff4d615 100644
--- a/mcs/class/System.Drawing/System.Drawing.Drawing2D/CompostingMode.cs
+++ b/mcs/class/System.Drawing/System.Drawing.Drawing2D/CompostingMode.cs
@@ -13,6 +13,7 @@ namespace System.Drawing.Drawing2D {
/// <summary>
/// Summary description for CompostingMode.
/// </summary>
+ [Serializable]
public enum CompositingMode {
SourceCopy = 1,
SourceOver = 0
diff --git a/mcs/class/System.Drawing/System.Drawing.Drawing2D/CompostingQuality.cs b/mcs/class/System.Drawing/System.Drawing.Drawing2D/CompostingQuality.cs
index 43d27c94376..75f86a548d1 100644
--- a/mcs/class/System.Drawing/System.Drawing.Drawing2D/CompostingQuality.cs
+++ b/mcs/class/System.Drawing/System.Drawing.Drawing2D/CompostingQuality.cs
@@ -13,6 +13,7 @@ namespace System.Drawing.Drawing2D {
/// <summary>
/// Summary description for CompostingQuality.
/// </summary>
+ [Serializable]
public enum CompositingQuality {
AssumeLinear = 4,
Default = 0,
diff --git a/mcs/class/System.Drawing/System.Drawing.Drawing2D/CoordinateSpace.cs b/mcs/class/System.Drawing/System.Drawing.Drawing2D/CoordinateSpace.cs
index 09697c9ccdb..c13d9221dc8 100644
--- a/mcs/class/System.Drawing/System.Drawing.Drawing2D/CoordinateSpace.cs
+++ b/mcs/class/System.Drawing/System.Drawing.Drawing2D/CoordinateSpace.cs
@@ -13,6 +13,7 @@ namespace System.Drawing.Drawing2D {
/// <summary>
/// Summary description for CoordinateSpace.
/// </summary>
+ [Serializable]
public enum CoordinateSpace {
Device = 2,
Page = 1,
diff --git a/mcs/class/System.Drawing/System.Drawing.Drawing2D/DashCap.cs b/mcs/class/System.Drawing/System.Drawing.Drawing2D/DashCap.cs
index d816261eb2d..79d2f105d3d 100644
--- a/mcs/class/System.Drawing/System.Drawing.Drawing2D/DashCap.cs
+++ b/mcs/class/System.Drawing/System.Drawing.Drawing2D/DashCap.cs
@@ -13,6 +13,7 @@ namespace System.Drawing.Drawing2D {
/// <summary>
/// Summary description for DashCap.
/// </summary>
+ [Serializable]
public enum DashCap {
Flat,
Round,
diff --git a/mcs/class/System.Drawing/System.Drawing.Drawing2D/DashStyle.cs b/mcs/class/System.Drawing/System.Drawing.Drawing2D/DashStyle.cs
index b3ec37dff71..2ba84b5ed7d 100644
--- a/mcs/class/System.Drawing/System.Drawing.Drawing2D/DashStyle.cs
+++ b/mcs/class/System.Drawing/System.Drawing.Drawing2D/DashStyle.cs
@@ -13,6 +13,7 @@ namespace System.Drawing.Drawing2D
/// <summary>
/// Summary description for DashStyle.
/// </summary>
+ [Serializable]
public enum DashStyle {
Custom = 5,
Dash = 1,
diff --git a/mcs/class/System.Drawing/System.Drawing.Drawing2D/FillMode.cs b/mcs/class/System.Drawing/System.Drawing.Drawing2D/FillMode.cs
index dbefe2f2fec..73140c8ac71 100644
--- a/mcs/class/System.Drawing/System.Drawing.Drawing2D/FillMode.cs
+++ b/mcs/class/System.Drawing/System.Drawing.Drawing2D/FillMode.cs
@@ -14,6 +14,7 @@ namespace System.Drawing.Drawing2D {
/// <summary>
/// Summary description for FillMode.
/// </summary>
+ [Serializable]
public enum FillMode {
Alternate = 0,
Winding = 1
diff --git a/mcs/class/System.Drawing/System.Drawing.Drawing2D/FlushIntention.cs b/mcs/class/System.Drawing/System.Drawing.Drawing2D/FlushIntention.cs
index 245d5b1831e..ce0d1deadb9 100644
--- a/mcs/class/System.Drawing/System.Drawing.Drawing2D/FlushIntention.cs
+++ b/mcs/class/System.Drawing/System.Drawing.Drawing2D/FlushIntention.cs
@@ -13,6 +13,7 @@ namespace System.Drawing.Drawing2D {
/// <summary>
/// Summary description for FlushIntention.
/// </summary>
+ [Serializable]
public enum FlushIntention {
Flush = 0,
Sync = 1
diff --git a/mcs/class/System.Drawing/System.Drawing.Drawing2D/GraphicsContainer.cs b/mcs/class/System.Drawing/System.Drawing.Drawing2D/GraphicsContainer.cs
index 97c2a42b507..001d4033dbe 100644
--- a/mcs/class/System.Drawing/System.Drawing.Drawing2D/GraphicsContainer.cs
+++ b/mcs/class/System.Drawing/System.Drawing.Drawing2D/GraphicsContainer.cs
@@ -14,8 +14,26 @@ namespace System.Drawing.Drawing2D {
/// Summary description for GraphicsContainer.
/// </summary>
public sealed class GraphicsContainer : MarshalByRefObject {
+
+ internal int nativeState = 0;
+
private GraphicsContainer ()
- {
+ {
+
}
+
+ internal GraphicsContainer (int state)
+ {
+ nativeState = state;
+ }
+
+ internal int NativeObject{
+ get{
+ return nativeState;
+ }
+ set {
+ nativeState = value;
+ }
+ }
}
}
diff --git a/mcs/class/System.Drawing/System.Drawing.Drawing2D/GraphicsPath.cs b/mcs/class/System.Drawing/System.Drawing.Drawing2D/GraphicsPath.cs
index 96d28c46794..1a79ee730ea 100644
--- a/mcs/class/System.Drawing/System.Drawing.Drawing2D/GraphicsPath.cs
+++ b/mcs/class/System.Drawing/System.Drawing.Drawing2D/GraphicsPath.cs
@@ -4,83 +4,343 @@
// Authors:
//
// Miguel de Icaza (miguel@ximian.com)
+// Duncan Mak (duncan@ximian.com)
//
-// (C) 2003 Ximian, Inc
+// (C) 2004 Novell, Inc
//
+
using System;
using System.Drawing;
using System.Runtime.InteropServices;
namespace System.Drawing.Drawing2D
{
+ public sealed class GraphicsPath : MarshalByRefObject, ICloneable, IDisposable {
-public sealed class GraphicsPath : MarshalByRefObject, ICloneable, IDisposable {
+ internal IntPtr nativePath;
- public GraphicsPath ()
- {
- }
-
- public object Clone ()
- {
- throw new NotImplementedException ();
- }
-
- public void Dispose ()
- {
- Dispose (true);
- System.GC.SuppressFinalize (this);
- }
-
- ~GraphicsPath ()
- {
- Dispose (false);
- }
+ GraphicsPath (IntPtr ptr)
+ {
+ nativePath = ptr;
+ }
+
+ public GraphicsPath ()
+ {
+ GDIPlus.GdipCreatePath (FillMode.Alternate, out nativePath);
+ }
- void Dispose (bool disposing)
- {
+ public object Clone ()
+ {
+ IntPtr clone;
+
+ GDIPlus.GdipClonePath (nativePath, out clone);
+
+ return new GraphicsPath (clone);
+ }
+
+ public void Dispose ()
+ {
+ Dispose (true);
+ System.GC.SuppressFinalize (this);
+ }
+
+ ~GraphicsPath ()
+ {
+ Dispose (false);
+ }
+
+ void Dispose (bool disposing)
+ {
- }
-
- //
- // AddArc
- //
- public void AddArc (Rectangle rect, float start_angle, float sweep_angle)
- {
- }
-
- public void AddArc (RectangleF rect, float start_angle, float sweep_angle)
- {
- }
-
- public void AddArc (int x, int y, int width, int height, float start_angle, float sweep_angle)
- {
- }
-
- public void AddArc (float x, float y, float width, float height, float start_angle, float sweep_angle)
- {
- }
-
- //
- // AddLine
- //
- public void AddLine (Point a, Point b)
- {
- }
-
- public void AddLine (PointF a, PointF b)
- {
- }
-
- public void AddLine (int x1, int y1, int x2, int y2)
- {
- }
-
- public void AddLine (float x1, float y1, float x2, float y2)
- {
- }
+ }
-
-
-}
+ public FillMode FillMode {
+ get {
+
+ FillMode mode;
+ GDIPlus.GdipGetPathFillMode (nativePath, out mode);
+ return mode;
+ }
+
+ set {
+ GDIPlus.GdipSetPathFillMode (nativePath, value);
+ }
+ }
+
+ public PathData PathData {
+
+ get {
+ IntPtr tmp;
+ GDIPlus.GdipGetPathData (nativePath, out tmp);
+
+ throw new Exception ();
+ }
+ }
+
+ public PointF [] PathPoints {
+
+ get {
+ int count;
+
+ GDIPlus.GdipGetPointCount (nativePath, out count);
+
+ PointF [] points = new PointF [count];
+
+ GDIPlus.GdipGetPathPoints (nativePath, points, count);
+
+ return points;
+ }
+ }
+
+ public byte [] PathTypes {
+
+ get {
+ int count;
+ GDIPlus.GdipGetPointCount (nativePath, out count);
+
+ byte [] types = new byte [count];
+ GDIPlus.GdipGetPathTypes (nativePath, types, count);
+
+ return types;
+ }
+ }
+
+ public int PathCount {
+
+ get {
+ int count;
+
+ GDIPlus.GdipGetPointCount (nativePath, out count);
+
+ return count;
+ }
+ }
+
+ internal IntPtr NativeObject{
+
+ get{
+ return nativePath;
+ }
+ set {
+ nativePath = value;
+ }
+ }
+
+ //
+ // AddArc
+ //
+ public void AddArc (Rectangle rect, float start_angle, float sweep_angle)
+ {
+ GDIPlus.GdipAddPathArcI (nativePath, rect.X, rect.Y, rect.Width, rect.Height, start_angle, sweep_angle);
+ }
+
+ public void AddArc (RectangleF rect, float start_angle, float sweep_angle)
+ {
+ GDIPlus.GdipAddPathArc (nativePath, rect.X, rect.Y, rect.Width, rect.Height, start_angle, sweep_angle);
+ }
+
+ public void AddArc (int x, int y, int width, int height, float start_angle, float sweep_angle)
+ {
+ GDIPlus.GdipAddPathArcI (nativePath, x, y, width, height, start_angle, sweep_angle);
+ }
+
+ public void AddArc (float x, float y, float width, float height, float start_angle, float sweep_angle)
+ {
+ GDIPlus.GdipAddPathArc (nativePath, x, y, width, height, start_angle, sweep_angle);
+ }
+
+ //
+ // AddBezier
+ //
+ public void AddBezier (Point pt1, Point pt2, Point pt3, Point pt4)
+ {
+ GDIPlus.GdipAddPathBezierI (nativePath, pt1.X, pt1.Y,
+ pt2.X, pt2.Y, pt3.X, pt3.Y, pt4.X, pt4.Y);
+ }
+
+ public void AddBezier (PointF pt1, PointF pt2, PointF pt3, PointF pt4)
+ {
+ GDIPlus.GdipAddPathBezier (nativePath, pt1.X, pt1.Y,
+ pt2.X, pt2.Y, pt3.X, pt3.Y, pt4.X, pt4.Y);
+ }
+
+ public void AddBezier (int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4)
+ {
+ GDIPlus.GdipAddPathBezierI (nativePath, x1, y1, x2, y2, x3, y3, x4, y4);
+ }
+
+ public void AddBezier (float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4)
+ {
+ GDIPlus.GdipAddPathBezier (nativePath, x1, y1, x2, y2, x3, y3, x4, y4);
+ }
+
+ //
+ // AddBeziers
+ //
+ public void AddBeziers (Point [] pts)
+ {
+ GDIPlus.GdipAddPathBeziersI (nativePath, pts, pts.Length);
+ }
+
+ public void AddBeziers (PointF [] pts)
+ {
+ GDIPlus.GdipAddPathBeziers (nativePath, pts, pts.Length);
+ }
+
+ //
+ // AddEllipse
+ //
+ public void AddEllipse (RectangleF r)
+ {
+ GDIPlus.GdipAddPathEllipse (nativePath, r.X, r.Y, r.Width, r.Height);
+ }
+
+ public void AddEllipse (float x, float y, float width, float height)
+ {
+ GDIPlus.GdipAddPathEllipse (nativePath, x, y, width, height);
+ }
+
+ public void AddEllipse (Rectangle r)
+ {
+ GDIPlus.GdipAddPathEllipseI (nativePath, r.X, r.Y, r.Width, r.Height);
+ }
+
+ public void AddEllipse (int x, int y, int width, int height)
+ {
+ GDIPlus.GdipAddPathEllipseI (nativePath, x, y, width, height);
+ }
+
+
+ //
+ // AddLine
+ //
+ public void AddLine (Point a, Point b)
+ {
+ GDIPlus.GdipAddPathLineI (nativePath, a.X, a.Y, b.X, b.Y);
+ }
+
+ public void AddLine (PointF a, PointF b)
+ {
+ GDIPlus.GdipAddPathLine (nativePath, a.X, a.Y, b.X,
+ b.Y);
+ }
+
+ public void AddLine (int x1, int y1, int x2, int y2)
+ {
+ GDIPlus.GdipAddPathLineI (nativePath, x1, y1, x2, y2);
+ }
+
+ public void AddLine (float x1, float y1, float x2, float y2)
+ {
+ GDIPlus.GdipAddPathLine (nativePath, x1, y1, x2,
+ y2);
+ }
+
+ //
+ // AddLines
+ //
+ public void AddLines (Point [] points)
+ {
+ int length = points.Length;
+
+ for (int i = 0; i < length - 2; i += 2) {
+ int j = i + 1;
+ GDIPlus.GdipAddPathLineI (nativePath, points [i].X, points [i].Y, points [j].X, points [j].Y);
+ }
+ }
+
+ public void AddLines (PointF [] points)
+ {
+ int length = points.Length;
+
+ for (int i = 0; i < length - 2; i += 2) {
+ int j = i + 1;
+ GDIPlus.GdipAddPathLine (nativePath, points [i].X, points [i].Y, points [j].X, points [j].Y);
+ }
+ }
+
+ //
+ // AddPie
+ //
+ public void AddPie (Rectangle rect, float startAngle, float sweepAngle)
+ {
+ GDIPlus.GdipAddPathPie (nativePath, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle);
+ }
+
+ public void AddPie (int x, int y, int width, int height, float startAngle, float sweepAngle)
+ {
+ GDIPlus.GdipAddPathPie (nativePath, x, y, width, height, startAngle, sweepAngle);
+ }
+
+ public void AddPie (float x, float y, float width, float height, float startAngle, float sweepAngle)
+ {
+ GDIPlus.GdipAddPathPie (nativePath, x, y, width, height, startAngle, sweepAngle);
+ }
+
+ //
+ // AddPolygon
+ //
+ public void AddPolygon (Point [] points)
+ {
+
+ GDIPlus.GdipAddPathPolygonI (nativePath, points, points.Length);
+ }
+
+ public void AddPolygon (PointF [] points)
+ {
+ GDIPlus.GdipAddPathPolygon (nativePath, points, points.Length);
+ }
+
+ //
+ // AddRectangle
+ //
+ public void AddRectangle (Rectangle rect)
+ {
+ GDIPlus.GdipAddPathRectangleI (nativePath, rect.X, rect.Y, rect.Width, rect.Height);
+ }
+
+ public void AddRectangle (RectangleF rect)
+ {
+ GDIPlus.GdipAddPathRectangle (nativePath, rect.X, rect.Y, rect.Width, rect.Height);
+ }
+
+ //
+ // AddRectangles
+ //
+ public void AddRectangles (Rectangle [] rects)
+ {
+ GDIPlus.GdipAddPathRectanglesI (nativePath, rects, rects.Length);
+ }
+
+ public void AddRectangles (RectangleF [] rects)
+ {
+ GDIPlus.GdipAddPathRectangles (nativePath, rects, rects.Length);
+ }
+
+ public PointF GetLastPoint ()
+ {
+ PointF pt;
+ GDIPlus.GdipGetPathLastPoint (nativePath, out pt);
+
+ return pt;
+ }
+
+ public void Reset ()
+ {
+ GDIPlus.GdipResetPath (nativePath);
+ }
+
+ public void Reverse ()
+ {
+ GDIPlus.GdipReversePath (nativePath);
+ }
+
+ public void Transform (Matrix matrix)
+ {
+ GDIPlus.GdipTransformPath (nativePath, matrix.nativeMatrix);
+ }
+ }
}
+
+
diff --git a/mcs/class/System.Drawing/System.Drawing.Drawing2D/GraphicsPathIterator.cs b/mcs/class/System.Drawing/System.Drawing.Drawing2D/GraphicsPathIterator.cs
index 5087bf22a7b..8847749254e 100644
--- a/mcs/class/System.Drawing/System.Drawing.Drawing2D/GraphicsPathIterator.cs
+++ b/mcs/class/System.Drawing/System.Drawing.Drawing2D/GraphicsPathIterator.cs
@@ -14,7 +14,7 @@ namespace System.Drawing.Drawing2D {
/// </summary>
///
- public sealed class GraphicsPathIterator : MarshalByRefObject {
+ public sealed class GraphicsPathIterator : MarshalByRefObject, IDisposable {
GraphicsPath path;
diff --git a/mcs/class/System.Drawing/System.Drawing.Drawing2D/GraphicsState.cs b/mcs/class/System.Drawing/System.Drawing.Drawing2D/GraphicsState.cs
index f3230adc8ac..bbd09698f39 100644
--- a/mcs/class/System.Drawing/System.Drawing.Drawing2D/GraphicsState.cs
+++ b/mcs/class/System.Drawing/System.Drawing.Drawing2D/GraphicsState.cs
@@ -12,7 +12,8 @@ namespace System.Drawing.Drawing2D {
/// <summary>
/// Summary description for GraphicsState.
/// </summary>
- public sealed class GraphicsState {
+ public sealed class GraphicsState : MarshalByRefObject
+ {
//All members inherited
internal Matrix matrix;
internal uint nativeState;
diff --git a/mcs/class/System.Drawing/System.Drawing.Drawing2D/HatchStyle.cs b/mcs/class/System.Drawing/System.Drawing.Drawing2D/HatchStyle.cs
index 45a7faf5548..4fd855c7e15 100644
--- a/mcs/class/System.Drawing/System.Drawing.Drawing2D/HatchStyle.cs
+++ b/mcs/class/System.Drawing/System.Drawing.Drawing2D/HatchStyle.cs
@@ -14,6 +14,7 @@ namespace System.Drawing.Drawing2D {
/// <summary>
/// Summary description for HatchStyle.
/// </summary>
+ [Serializable]
public enum HatchStyle {
BackwardDiagonal = 3,
Cross = 4,
diff --git a/mcs/class/System.Drawing/System.Drawing.Drawing2D/InterpolationMode.cs b/mcs/class/System.Drawing/System.Drawing.Drawing2D/InterpolationMode.cs
index 00f9b0ca783..ef6b9505335 100644
--- a/mcs/class/System.Drawing/System.Drawing.Drawing2D/InterpolationMode.cs
+++ b/mcs/class/System.Drawing/System.Drawing.Drawing2D/InterpolationMode.cs
@@ -13,6 +13,7 @@ namespace System.Drawing.Drawing2D {
/// <summary>
/// Summary description for InterpolationMode.
/// </summary>
+ [Serializable]
public enum InterpolationMode {
Bicubic = 4,
Bilinear = 3,
diff --git a/mcs/class/System.Drawing/System.Drawing.Drawing2D/LineCap.cs b/mcs/class/System.Drawing/System.Drawing.Drawing2D/LineCap.cs
index 1641defc20e..ad069201be7 100644
--- a/mcs/class/System.Drawing/System.Drawing.Drawing2D/LineCap.cs
+++ b/mcs/class/System.Drawing/System.Drawing.Drawing2D/LineCap.cs
@@ -13,6 +13,7 @@ namespace System.Drawing.Drawing2D {
/// <summary>
/// Summary description for LineCap.
/// </summary>
+ [Serializable]
public enum LineCap {
AnchorMask = 240,
ArrowAnchor = 20,
diff --git a/mcs/class/System.Drawing/System.Drawing.Drawing2D/LineJoin.cs b/mcs/class/System.Drawing/System.Drawing.Drawing2D/LineJoin.cs
index 711f172a7c8..dac947e3e21 100644
--- a/mcs/class/System.Drawing/System.Drawing.Drawing2D/LineJoin.cs
+++ b/mcs/class/System.Drawing/System.Drawing.Drawing2D/LineJoin.cs
@@ -13,6 +13,7 @@ namespace System.Drawing.Drawing2D {
/// <summary>
/// Summary description for LineJoin.
/// </summary>
+ [Serializable]
public enum LineJoin {
Bevel = 1,
Miter = 0,
diff --git a/mcs/class/System.Drawing/System.Drawing.Drawing2D/LinearGradientMode.cs b/mcs/class/System.Drawing/System.Drawing.Drawing2D/LinearGradientMode.cs
index d23de6fdc73..9a645bd32f7 100644
--- a/mcs/class/System.Drawing/System.Drawing.Drawing2D/LinearGradientMode.cs
+++ b/mcs/class/System.Drawing/System.Drawing.Drawing2D/LinearGradientMode.cs
@@ -13,6 +13,7 @@ namespace System.Drawing.Drawing2D {
/// <summary>
/// Summary description for LinearGradientMode.
/// </summary>
+ [Serializable]
public enum LinearGradientMode {
BackwardDiagonal = 3,
ForwardDiagonal = 2,
diff --git a/mcs/class/System.Drawing/System.Drawing.Drawing2D/Matrix.cs b/mcs/class/System.Drawing/System.Drawing.Drawing2D/Matrix.cs
index 74e467018a3..0721def0124 100644
--- a/mcs/class/System.Drawing/System.Drawing.Drawing2D/Matrix.cs
+++ b/mcs/class/System.Drawing/System.Drawing.Drawing2D/Matrix.cs
@@ -15,12 +15,12 @@ using System.Runtime.InteropServices;
namespace System.Drawing.Drawing2D
{
- public sealed class Matrix : MarshalByRefObject, IDisposable
+ public sealed class Matrix : MarshalByRefObject, IDisposable
{
internal IntPtr nativeMatrix;
// constructors
- Matrix (IntPtr ptr)
+ internal Matrix (IntPtr ptr)
{
nativeMatrix = ptr;
}
@@ -32,16 +32,12 @@ namespace System.Drawing.Drawing2D
public Matrix (Rectangle rect , Point[] plgpts)
{
- GpRect rectangle = new GpRect (rect);
-
- GDIPlus.GdipCreateMatrix3I (rectangle, plgpts, out nativeMatrix);
+ GDIPlus.GdipCreateMatrix3I (rect, plgpts, out nativeMatrix);
}
public Matrix (RectangleF rect , PointF[] pa)
{
- GpRectF rectangle = new GpRectF (rect);
-
- GDIPlus.GdipCreateMatrix3 (rectangle, pa, out nativeMatrix);
+ GDIPlus.GdipCreateMatrix3 (rect, pa, out nativeMatrix);
}
public Matrix (float m11, float m12, float m21, float m22, float dx, float dy)
@@ -52,12 +48,11 @@ namespace System.Drawing.Drawing2D
// properties
public float[] Elements {
get {
- IntPtr tmp = Marshal.AllocHGlobal (8 * 6);
+ IntPtr tmp = Marshal.AllocHGlobal (Marshal.SizeOf (typeof (float)) * 6);
+ float [] retval = new float [6];
Status s = GDIPlus.GdipGetMatrixElements (nativeMatrix, tmp);
- float [] retval = new float [6];
-
Marshal.Copy (tmp, retval, 0, 6);
Marshal.FreeHGlobal (tmp);
diff --git a/mcs/class/System.Drawing/System.Drawing.Drawing2D/MatrixOrder.cs b/mcs/class/System.Drawing/System.Drawing.Drawing2D/MatrixOrder.cs
index 9ea63ce69e7..a06fca48236 100644
--- a/mcs/class/System.Drawing/System.Drawing.Drawing2D/MatrixOrder.cs
+++ b/mcs/class/System.Drawing/System.Drawing.Drawing2D/MatrixOrder.cs
@@ -13,6 +13,7 @@ namespace System.Drawing.Drawing2D {
/// <summary>
/// Summary description for MatrixOrder.
/// </summary>
+ [Serializable]
public enum MatrixOrder {
Append = 1,
Prepend = 0
diff --git a/mcs/class/System.Drawing/System.Drawing.Drawing2D/PathPointType.cs b/mcs/class/System.Drawing/System.Drawing.Drawing2D/PathPointType.cs
index 80d24fc72d2..54ba78654a0 100644
--- a/mcs/class/System.Drawing/System.Drawing.Drawing2D/PathPointType.cs
+++ b/mcs/class/System.Drawing/System.Drawing.Drawing2D/PathPointType.cs
@@ -13,6 +13,7 @@ namespace System.Drawing.Drawing2D {
/// <summary>
/// Summary description for PathPointType.
/// </summary>
+ [Serializable]
public enum PathPointType {
Bezier = 3,
Bezier3 = 3,
diff --git a/mcs/class/System.Drawing/System.Drawing.Drawing2D/PenAlignment.cs b/mcs/class/System.Drawing/System.Drawing.Drawing2D/PenAlignment.cs
index 5b08d755218..94e83a337e8 100755
--- a/mcs/class/System.Drawing/System.Drawing.Drawing2D/PenAlignment.cs
+++ b/mcs/class/System.Drawing/System.Drawing.Drawing2D/PenAlignment.cs
@@ -11,6 +11,7 @@ using System;
namespace System.Drawing.Drawing2D {
+ [Serializable]
public enum PenAlignment {
Center = 0,
Inset = 1,
diff --git a/mcs/class/System.Drawing/System.Drawing.Drawing2D/PenType.cs b/mcs/class/System.Drawing/System.Drawing.Drawing2D/PenType.cs
index 0250e28f3f2..34430cf6472 100644
--- a/mcs/class/System.Drawing/System.Drawing.Drawing2D/PenType.cs
+++ b/mcs/class/System.Drawing/System.Drawing.Drawing2D/PenType.cs
@@ -12,6 +12,7 @@ namespace System.Drawing.Drawing2D
/// <summary>
/// Summary description for PenType.
/// </summary>
+ [Serializable]
public enum PenType {
HatchFill = 1,
LinearGradient = 4,
diff --git a/mcs/class/System.Drawing/System.Drawing.Drawing2D/PixelOffsetMode.cs b/mcs/class/System.Drawing/System.Drawing.Drawing2D/PixelOffsetMode.cs
index c8a3221a14b..61968bb473d 100644
--- a/mcs/class/System.Drawing/System.Drawing.Drawing2D/PixelOffsetMode.cs
+++ b/mcs/class/System.Drawing/System.Drawing.Drawing2D/PixelOffsetMode.cs
@@ -13,6 +13,7 @@ namespace System.Drawing.Drawing2D {
/// <summary>
/// Summary description for PixelOffsetMode.
/// </summary>
+ [Serializable]
public enum PixelOffsetMode {
Default = 0,
Half = 4,
diff --git a/mcs/class/System.Drawing/System.Drawing.Drawing2D/QualityMode.cs b/mcs/class/System.Drawing/System.Drawing.Drawing2D/QualityMode.cs
index 8c986092e4d..f92179859b8 100644
--- a/mcs/class/System.Drawing/System.Drawing.Drawing2D/QualityMode.cs
+++ b/mcs/class/System.Drawing/System.Drawing.Drawing2D/QualityMode.cs
@@ -13,6 +13,7 @@ namespace System.Drawing.Drawing2D {
/// <summary>
/// Summary description for QualityMode.
/// </summary>
+ [Serializable]
public enum QualityMode {
Default = 0,
High = 2,
diff --git a/mcs/class/System.Drawing/System.Drawing.Drawing2D/SmoothingMode.cs b/mcs/class/System.Drawing/System.Drawing.Drawing2D/SmoothingMode.cs
index c3a8a12721a..761a0242cb4 100644
--- a/mcs/class/System.Drawing/System.Drawing.Drawing2D/SmoothingMode.cs
+++ b/mcs/class/System.Drawing/System.Drawing.Drawing2D/SmoothingMode.cs
@@ -13,6 +13,7 @@ namespace System.Drawing.Drawing2D {
/// <summary>
/// Summary description for SmoothingMode.
/// </summary>
+ [Serializable]
public enum SmoothingMode {
AntiAlias = 4,
Default = 0,
diff --git a/mcs/class/System.Drawing/System.Drawing.Drawing2D/WarpMode.cs b/mcs/class/System.Drawing/System.Drawing.Drawing2D/WarpMode.cs
index b6c5777139c..e92d43b36f0 100644
--- a/mcs/class/System.Drawing/System.Drawing.Drawing2D/WarpMode.cs
+++ b/mcs/class/System.Drawing/System.Drawing.Drawing2D/WarpMode.cs
@@ -13,6 +13,7 @@ namespace System.Drawing.Drawing2D {
/// <summary>
/// Summary description for WarpMode.
/// </summary>
+ [Serializable]
public enum WarpMode {
Bilinear = 1,
Perspective = 0
diff --git a/mcs/class/System.Drawing/System.Drawing.Drawing2D/WrapMode.cs b/mcs/class/System.Drawing/System.Drawing.Drawing2D/WrapMode.cs
index 2962d2b5bc9..cd3976842dd 100644
--- a/mcs/class/System.Drawing/System.Drawing.Drawing2D/WrapMode.cs
+++ b/mcs/class/System.Drawing/System.Drawing.Drawing2D/WrapMode.cs
@@ -13,6 +13,7 @@ namespace System.Drawing.Drawing2D {
/// <summary>
/// Summary description for WrapMode.
/// </summary>
+ [Serializable]
public enum WrapMode {
Clamp,
Tile,
diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/BitmapData.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/BitmapData.cs
index c393a0d43c1..799c4afeadb 100755
--- a/mcs/class/System.Drawing/System.Drawing.Imaging/BitmapData.cs
+++ b/mcs/class/System.Drawing/System.Drawing.Imaging/BitmapData.cs
@@ -9,15 +9,28 @@
using System;
using System.Runtime.InteropServices;
+using System.IO;
namespace System.Drawing.Imaging
{
[StructLayout(LayoutKind.Sequential)]
public sealed class BitmapData {
- int width, height, stride;
- PixelFormat pixel_format;
- IntPtr address;
- int reserved;
+ internal int width, height, stride;
+ internal PixelFormat pixel_format;
+ internal bool own_scan0;
+ internal IntPtr address;
+ internal int reserved;
+ private bool bAllocated = false;
+
+ ~BitmapData()
+ {
+ if (bAllocated)
+ Marshal.FreeHGlobal(address);
+ }
+
+ internal bool Allocated {
+ set {bAllocated = value;}
+ }
public int Height {
get {
@@ -41,6 +54,7 @@ namespace System.Drawing.Imaging
public PixelFormat PixelFormat {
get {
+
return pixel_format;
}
@@ -65,6 +79,13 @@ namespace System.Drawing.Imaging
}
set {
+
+ if (bAllocated)
+ {
+ Marshal.FreeHGlobal(address);
+ bAllocated = false;
+ }
+
address = value;
}
}
diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/BmpCodec.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/BmpCodec.cs
index ad3d64daa0c..9463f6b4bb7 100644
--- a/mcs/class/System.Drawing/System.Drawing.Imaging/BmpCodec.cs
+++ b/mcs/class/System.Drawing/System.Drawing.Imaging/BmpCodec.cs
@@ -3,6 +3,7 @@
//
// Author:
// Alexandre Pigolkine (pigolkine@gmx.de)
+// Jordi Mas i Hernàndez (jmas@softcatala.org>, 2004
// BITMAPINFOHEADER,Decode functions implemented using code/ideas from
// CxImage (c) 07/Aug/2001 <ing.davide.pizzolato@libero.it>
//
@@ -14,6 +15,7 @@ namespace System.Drawing.Imaging {
using System.IO;
using System.Drawing.Imaging;
using System.Runtime.InteropServices;
+
internal struct BITMAPFILEHEADER { // File info header
public ushort bfType; // Specifies the type of file. This member must be BM.
@@ -37,6 +39,7 @@ namespace System.Drawing.Imaging {
BI_BITFIELDS = 3
}
+
[StructLayout(LayoutKind.Sequential)]
internal struct BITMAPINFOHEADER_FLAT {
internal int biSize;
@@ -105,11 +108,14 @@ namespace System.Drawing.Imaging {
biYPelsPerMeter = 0;
biClrUsed = 0;
biClrImportant = 0;
+
}
}
internal class BMPCodec {
+ static int BITMAPINFOHEADER_SIZE = 40;
+
internal BMPCodec() {
}
@@ -169,7 +175,7 @@ namespace System.Drawing.Imaging {
bmih.biClrImportant = bs.ReadInt32();
// Currently only BITMAPINFOHEADER
- if (bmih.biSize != 40) return false;
+ if (bmih.biSize != BITMAPINFOHEADER_SIZE) return false;
bmih.FixBitmapInfo();
@@ -195,9 +201,8 @@ namespace System.Drawing.Imaging {
}
internal bool Decode (Image image, Stream stream, BitmapData info)
- {
-#if false
- if (stream.Length < 14 + 40/* sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER)*/)
+ {
+ if (stream.Length < 14 + BITMAPINFOHEADER_SIZE/* sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER)*/)
return false;
long startPosition = stream.Position;
@@ -225,13 +230,30 @@ namespace System.Drawing.Imaging {
switch (bmih.biBitCount) {
case 24:
+ Console.WriteLine ("BmpCodec: 24 bits bitmap", bmih.biSizeImage);
info.PixelFormat = PixelFormat.Format24bppRgb;
if (bmfh.bfOffBits != 0L)
stream.Seek (startPosition + bmfh.bfOffBits,SeekOrigin.Begin);
if (bmih.biCompression == (uint)BitmapCompression.BI_RGB) {
- info.RawImageBytes = new byte[bmih.biSizeImage];
- stream.Read(info.RawImageBytes, 0, (int)bmih.biSizeImage);
+
+ IntPtr lfBuffer = Marshal.AllocHGlobal(bmih.biSizeImage);
+ byte[] bt = new byte[info.Stride];
+ int offset = (info.Height-1) * info.Stride;
+ int baseadr = lfBuffer.ToInt32();
+
+ // DIB are stored upside down. That means that the uppest row which
+ // appears on the screen actually is the lowest row stored in the bitmap
+ while(offset>=0){
+ stream.Read(bt, 0, info.Stride);
+ Marshal.Copy (bt, 0, (IntPtr)( baseadr + offset), info.Stride);
+ offset -= info.Stride;
+ }
+
+ Console.WriteLine ("BmpCodec: 24 bits bitmap", bmih.biSizeImage);
+ info.Scan0 = lfBuffer;
+ info.Allocated=true;
+
} else {
//
// FIXME
@@ -241,11 +263,27 @@ namespace System.Drawing.Imaging {
break;
case 32:
info.PixelFormat = PixelFormat.Format32bppArgb;
+ Console.WriteLine ("BmpCodec: 32 bits bitmap", bmih.biSizeImage);
if (bmfh.bfOffBits != 0L)
stream.Seek (startPosition + bmfh.bfOffBits,SeekOrigin.Begin);
if (bmih.biCompression == (uint)BitmapCompression.BI_RGB) {
- info.RawImageBytes = new byte[bmih.biSizeImage];
- stream.Read(info.RawImageBytes, 0, (int)bmih.biSizeImage);
+
+ IntPtr lfBuffer = Marshal.AllocHGlobal(bmih.biSizeImage);
+ byte[] bt = new byte[info.Stride];
+ int offset = (info.Height-1) * info.Stride;
+ int baseadr = lfBuffer.ToInt32();
+
+ // DIB are stored upside down. That means that the uppest row which
+ // appears on the screen actually is the lowest row stored in the bitmap
+ while(offset>=0){
+ stream.Read(bt, 0, info.Stride);
+ Marshal.Copy (bt, 0, (IntPtr)( baseadr + offset), info.Stride);
+ offset -= info.Stride;
+ }
+
+ info.Scan0 = lfBuffer;
+ info.Allocated=true;
+
} else {
//
// FIXME
@@ -256,7 +294,7 @@ namespace System.Drawing.Imaging {
default:
throw new NotImplementedException(String.Format("This format is not yet supported : {0} bpp", bmih.biBitCount));
}
-#endif
+
return true;
}
@@ -274,7 +312,7 @@ namespace System.Drawing.Imaging {
BITMAPFILEHEADER bmfh = new BITMAPFILEHEADER();
bmfh.bfReserved1 = bmfh.bfReserved2 = 0;
bmfh.bfType = (ushort)BitmapFileType.BFT_BITMAP;
- bmfh.bfOffBits = (uint)(14 + 40 + image.Palette.Entries.Length * 4);
+ bmfh.bfOffBits = (uint)(14 + BITMAPINFOHEADER_SIZE + image.Palette.Entries.Length * 4);
int line_size = info.Stride;
bmfh.bfSize = (uint)(bmfh.bfOffBits + info.Height * line_size);
@@ -299,15 +337,30 @@ namespace System.Drawing.Imaging {
bw.Write(bmih.biClrUsed);
bw.Write(bmih.biClrImportant);
Console.WriteLine ("FIXME: BmpCodec: Write palette here");
+
+ Console.WriteLine ("biWidth ->" + bmih.biWidth);
+ Console.WriteLine ("Height->" + bmih.biHeight);
+ Console.WriteLine ("LineSize ->" + line_size);
+ Console.WriteLine ("Address ->" + info.Scan0.ToInt32());
+ Console.WriteLine ("Stride ->" + info.Stride);
+ Console.WriteLine ("Planes ->" + bmih.biPlanes);
byte [] line_buffer = new byte [line_size];
int stride = info.Stride;
- int start = 0;
- for (int line = 0; line < info.Height; line++){
+ int offset = (info.Height-1) * stride;
+ int baseadr = info.Scan0.ToInt32();
+
+ Console.WriteLine ("Offset ->" + offset);
+
+ // DIB are stored upside down. That means that the uppest row which
+ // appears on the screen actually is the lowest row stored in the
+ // bitmap.
+ while(offset>=0){
//FIXME: not an optimal way to specify starting address
- Marshal.Copy ((IntPtr)( info.Scan0.ToInt32() + start), line_buffer, 0, line_size);
+ //FIXME: Bitmaps are stored in DWORD alignments
+ Marshal.Copy ((IntPtr)( baseadr + offset), line_buffer, 0, line_size);
stream.Write(line_buffer, 0, line_size);
- start += stride;
+ offset -= stride;
}
return true;
}
diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/ChangeLog b/mcs/class/System.Drawing/System.Drawing.Imaging/ChangeLog
index 5533dfdb7cb..d2cdb76af97 100644
--- a/mcs/class/System.Drawing/System.Drawing.Imaging/ChangeLog
+++ b/mcs/class/System.Drawing/System.Drawing.Imaging/ChangeLog
@@ -1,3 +1,19 @@
+2004-01-21 Jordi Mas i Hernàdez <jmas@softcatala.org>
+ * BmpBitmap.cs: fixed encoding and decoding problems
+ * ImageAttributes.cs: implemented
+
+2004-01-19 Ravindra <rkumar@novell.com>
+
+ * Encoder.cs: Implemented.
+
+2004-01-10 Ravindra <rkumar@novell.com>
+
+ * All Enums: Made serializable.
+
+ * ImageAttributes.cs: Implements ICloneable.
+
+ * Metafile.cs: Made serializable and invisible to COM.
+
2003-11-13 Andreas Nahr <ClassDevelopment@A-SoftTech.com>
* ColorMap.cs: Implemented
diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/ColorAdjustType.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/ColorAdjustType.cs
index d445a9b5afe..6f0805be6e4 100644
--- a/mcs/class/System.Drawing/System.Drawing.Imaging/ColorAdjustType.cs
+++ b/mcs/class/System.Drawing/System.Drawing.Imaging/ColorAdjustType.cs
@@ -7,6 +7,7 @@
using System;
namespace System.Drawing.Imaging
{
+ [Serializable]
public enum ColorAdjustType {
Any = 6,
Bitmap = 1,
diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/ColorChannelFlag.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/ColorChannelFlag.cs
index 82f07834b68..be941a69158 100644
--- a/mcs/class/System.Drawing/System.Drawing.Imaging/ColorChannelFlag.cs
+++ b/mcs/class/System.Drawing/System.Drawing.Imaging/ColorChannelFlag.cs
@@ -7,6 +7,7 @@
using System;
namespace System.Drawing.Imaging
{
+ [Serializable]
public enum ColorChannelFlag {
ColorChannelC = 0,
ColorChannelK = 3,
diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/ColorMapType.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/ColorMapType.cs
index 0943f290da2..74e1835d456 100644
--- a/mcs/class/System.Drawing/System.Drawing.Imaging/ColorMapType.cs
+++ b/mcs/class/System.Drawing/System.Drawing.Imaging/ColorMapType.cs
@@ -7,6 +7,7 @@
using System;
namespace System.Drawing.Imaging
{
+ [Serializable]
public enum ColorMapType{//check
Brush = 1,
Default = 0
diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/ColorMatrixFlag.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/ColorMatrixFlag.cs
index f244e02447f..c49941e2218 100644
--- a/mcs/class/System.Drawing/System.Drawing.Imaging/ColorMatrixFlag.cs
+++ b/mcs/class/System.Drawing/System.Drawing.Imaging/ColorMatrixFlag.cs
@@ -7,6 +7,7 @@
using System;
namespace System.Drawing.Imaging
{
+ [Serializable]
public enum ColorMatrixFlag{
AltGrays = 2,
Default = 0,
diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/ColorMode.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/ColorMode.cs
index 91872fa6247..727b6b6d431 100644
--- a/mcs/class/System.Drawing/System.Drawing.Imaging/ColorMode.cs
+++ b/mcs/class/System.Drawing/System.Drawing.Imaging/ColorMode.cs
@@ -7,6 +7,7 @@
using System;
namespace System.Drawing.Imaging
{
+ [Serializable]
public enum ColorMode {
Argb32Mode = 0,
Argb64Mode = 1
diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/EmfPlusRecordType.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/EmfPlusRecordType.cs
index 9f883462bb7..fc9a4ff4b33 100644
--- a/mcs/class/System.Drawing/System.Drawing.Imaging/EmfPlusRecordType.cs
+++ b/mcs/class/System.Drawing/System.Drawing.Imaging/EmfPlusRecordType.cs
@@ -7,6 +7,7 @@
using System;
namespace System.Drawing.Imaging
{
+ [Serializable]
public enum EmfPlusRecordType {
BeginContainer = 16423,
BeginContainerNoParams = 16424,
diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/EmfType.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/EmfType.cs
index f02a42f4923..fd48c0e7065 100644
--- a/mcs/class/System.Drawing/System.Drawing.Imaging/EmfType.cs
+++ b/mcs/class/System.Drawing/System.Drawing.Imaging/EmfType.cs
@@ -7,6 +7,7 @@
using System;
namespace System.Drawing.Imaging
{
+ [Serializable]
public enum EmfType {
EmfOnly = 3,
EmfPlusDual = 5,
diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/Encoder.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/Encoder.cs
new file mode 100644
index 00000000000..0e9f2677f5d
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Imaging/Encoder.cs
@@ -0,0 +1,56 @@
+//
+// System.Drawing.Imaging.Encoder.cs
+//
+// (C) 2004 Novell, Inc. http://www.novell.com
+// Author: Ravindra (rkumar@novell.com)
+//
+
+using System;
+
+namespace System.Drawing.Imaging
+{
+ public sealed class Encoder
+ {
+ Guid guid;
+
+ public static readonly Encoder ChrominanceTable;
+ public static readonly Encoder ColorDepth;
+ public static readonly Encoder Compression;
+ public static readonly Encoder LuminanceTable;
+ public static readonly Encoder Quality;
+ public static readonly Encoder RenderMethod;
+ public static readonly Encoder SaveFlag;
+ public static readonly Encoder ScanMethod;
+ public static readonly Encoder Transformation;
+ public static readonly Encoder Version;
+
+ static Encoder ()
+ {
+ // GUID values are taken from my windows machine.
+ ChrominanceTable = new Encoder ("f2e455dc-09b3-4316-8260-676ada32481c");
+ ColorDepth = new Encoder ("66087055-ad66-4c7c-9a18-38a2310b8337");
+ Compression = new Encoder ("e09d739d-ccd4-44ee-8eba-3fbf8be4fc58");
+ LuminanceTable = new Encoder ("edb33bce-0266-4a77-b904-27216099e717");
+ Quality = new Encoder ("1d5be4b5-fa4a-452d-9cdd-5db35105e7eb");
+ RenderMethod = new Encoder ("6d42c53a-229a-4825-8bb7-5c99e2b9a8b8");
+ SaveFlag = new Encoder ("292266fc-ac40-47bf-8cfc-a85b89a655de");
+ ScanMethod = new Encoder ("3a4e2661-3109-4e56-8536-42c156e7dcfa");
+ Transformation = new Encoder ("8d0eb2d1-a58e-4ea8-aa14-108074b7b6f9");
+ Version = new Encoder ("24d18c76-814a-41a4-bf53-1c219cccf797");
+ }
+
+ internal Encoder (String guid) {
+ this.guid = new Guid (guid);
+ }
+
+ public Encoder (Guid guid) {
+ this.guid = guid;
+ }
+
+ public Guid Guid {
+ get {
+ return guid;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/EncoderParameterValueType.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/EncoderParameterValueType.cs
index 6a0071ad20d..6ec6e7e8f8e 100644
--- a/mcs/class/System.Drawing/System.Drawing.Imaging/EncoderParameterValueType.cs
+++ b/mcs/class/System.Drawing/System.Drawing.Imaging/EncoderParameterValueType.cs
@@ -7,6 +7,7 @@
using System;
namespace System.Drawing.Imaging
{
+ [Serializable]
public enum EncoderParameterValueType {
ValueTypeAscii = 2,
ValueTypeByte = 1,
diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/EncoderValue.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/EncoderValue.cs
index 0e51a47031e..e9d0358b13a 100644
--- a/mcs/class/System.Drawing/System.Drawing.Imaging/EncoderValue.cs
+++ b/mcs/class/System.Drawing/System.Drawing.Imaging/EncoderValue.cs
@@ -7,6 +7,7 @@
using System;
namespace System.Drawing.Imaging
{
+ [Serializable]
public enum EncoderValue {
ColorTypeCMYK = 0,
ColorTypeYCCK = 1,
diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/ImageAttributes.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/ImageAttributes.cs
index 69abf831ed3..4315145b338 100644
--- a/mcs/class/System.Drawing/System.Drawing.Imaging/ImageAttributes.cs
+++ b/mcs/class/System.Drawing/System.Drawing.Imaging/ImageAttributes.cs
@@ -2,8 +2,9 @@
// System.Drawing.Imaging.ImageAttributes.cs
//
// Author:
-// Dennis Hayes (dennish@raytek.com)
-// (C) 2002 Ximian, Inc. http://www.ximian.com
+// Dennis Hayes (dennish@raytek.com) (stubbed out)
+// Jordi Mas i Hernàndez (jmas@softcatala.org)
+// (C) 2002-4 Ximian, Inc. http://www.ximian.com
//
using System;
@@ -14,36 +15,100 @@ namespace System.Drawing.Imaging
/// <summary>
/// Summary description for ImageAttributes.
/// </summary>
- public sealed class ImageAttributes : IDisposable {
- public ImageAttributes() {
+ public sealed class ImageAttributes : ICloneable, IDisposable {
+
+ private IntPtr nativeImageAttr = IntPtr.Zero;
+
+ internal IntPtr NativeObject{
+ get{
+ return nativeImageAttr;
+ }
+ }
+
+ public ImageAttributes() {
+
+
+ Status status = GDIPlus.GdipCreateImageAttributes(out nativeImageAttr);
+
+ if (status != Status.Ok)
+ throw new Exception ("Error calling GDIPlus.GdipCreateImageAttributes:" +status);
+
+ Console.WriteLine("ImageAttributes().ImageAttributes()" + nativeImageAttr);
}
//Clears the color keys for all GDI+ objects
- public void ClearColorKey(){
+ public void ClearColorKey(){
+
+ Status status = GDIPlus.GdipSetImageAttributesColorKeys(nativeImageAttr, ColorAdjustType.Default, false, 0,0);
+
+ if (status != Status.Ok)
+ throw new Exception ("Error calling GDIPlus.ClearColorKey:" +status);
}
//Sets the color keys for all GDI+ objects
public void SetColorKey(Color colorLow, Color colorHigh){
+
+ Status status = GDIPlus.GdipSetImageAttributesColorKeys(nativeImageAttr,
+ ColorAdjustType.Default, true, colorLow.ToArgb(), colorHigh.ToArgb());
+ if (status != Status.Ok)
+ throw new Exception ("Error calling GDIPlus.GdipSetImageAttributesColorKeys:" +status);
}
public void SetColorMatrix(ColorMatrix colorMatrix) {
- throw new NotImplementedException();
+
+ Status status = GDIPlus.GdipSetImageAttributesColorMatrix(nativeImageAttr, ColorAdjustType.Default,
+ true, colorMatrix, (ColorMatrix)null, ColorMatrixFlag.Default);
+ if (status != Status.Ok)
+ throw new Exception ("Error calling GDIPlus.SetColorMatrix:" +status);
}
public void SetColorMatrix(ColorMatrix colorMatrix, ColorMatrixFlag colorMatrixFlag) {
- throw new NotImplementedException();
+
+ Status status = GDIPlus.GdipSetImageAttributesColorMatrix(nativeImageAttr, ColorAdjustType.Default,
+ true, colorMatrix, (ColorMatrix)null, colorMatrixFlag);
+ if (status != Status.Ok)
+ throw new Exception ("Error calling GDIPlus.SetColorMatrix:" +status);
+
}
public void SetColorMatrix(ColorMatrix colorMatrix, ColorMatrixFlag colorMatrixFlag, ColorAdjustType colorAdjustType) {
- throw new NotImplementedException();
+
+ Status status = GDIPlus.GdipSetImageAttributesColorMatrix(nativeImageAttr,colorAdjustType,
+ true, colorMatrix, (ColorMatrix)null, colorMatrixFlag);
+
+ if (status != Status.Ok)
+ throw new Exception ("Error calling GDIPlus.SetColorMatrix:" +status);
+ }
+
+ void Dispose (bool disposing)
+ {
+ if (!disposing) return;
+
+ Status status = GDIPlus.GdipDisposeImageAttributes(nativeImageAttr);
+
+ if (status != Status.Ok)
+ throw new Exception ("Error calling GDIPlus.GdipDisposeImageAttributes:" +status);
+ else
+ nativeImageAttr = IntPtr.Zero;
}
+
public void Dispose() {
+
+ Dispose (true);
+ System.GC.SuppressFinalize (this);
}
~ImageAttributes() {
+
+ Dispose (false);
+ }
+
+ [MonoTODO]
+ object ICloneable.Clone()
+ {
+ throw new NotImplementedException ();
}
-
}
}
diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/ImageCodecFlags.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/ImageCodecFlags.cs
index c656f5ba073..6ecb6d97862 100644
--- a/mcs/class/System.Drawing/System.Drawing.Imaging/ImageCodecFlags.cs
+++ b/mcs/class/System.Drawing/System.Drawing.Imaging/ImageCodecFlags.cs
@@ -8,6 +8,7 @@ using System;
namespace System.Drawing.Imaging
{
[Flags]
+ [Serializable]
public enum ImageCodecFlags {
BlockingDecode = 32,
Builtin = 65536,
diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/ImageFlags.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/ImageFlags.cs
index 39e22e49d9f..e70d3a5dcb8 100644
--- a/mcs/class/System.Drawing/System.Drawing.Imaging/ImageFlags.cs
+++ b/mcs/class/System.Drawing/System.Drawing.Imaging/ImageFlags.cs
@@ -8,6 +8,7 @@ using System;
namespace System.Drawing.Imaging
{
[Flags]
+ [Serializable]
public enum ImageFlags {
Caching = 131072,
ColorSpaceCmyk = 32,
diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/ImageLockMode.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/ImageLockMode.cs
index 14b720acb2b..13b51df4d7f 100644
--- a/mcs/class/System.Drawing/System.Drawing.Imaging/ImageLockMode.cs
+++ b/mcs/class/System.Drawing/System.Drawing.Imaging/ImageLockMode.cs
@@ -7,6 +7,7 @@
using System;
namespace System.Drawing.Imaging
{
+ [Serializable]
public enum ImageLockMode {
ReadOnly = 1,
ReadWrite = 3,
diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/Metafile.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/Metafile.cs
index 578d0f0cdce..08c49dfecc0 100644
--- a/mcs/class/System.Drawing/System.Drawing.Imaging/Metafile.cs
+++ b/mcs/class/System.Drawing/System.Drawing.Imaging/Metafile.cs
@@ -9,9 +9,12 @@
using System;
using System.IO;
using System.Reflection;
+using System.Runtime.InteropServices;
namespace System.Drawing.Imaging {
+ [Serializable]
+ [ComVisible (false)]
public sealed class Metafile : Image {
// constructors
diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/MetafileFrameUnit.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/MetafileFrameUnit.cs
index 97d59c6c0c1..cde52ba329d 100644
--- a/mcs/class/System.Drawing/System.Drawing.Imaging/MetafileFrameUnit.cs
+++ b/mcs/class/System.Drawing/System.Drawing.Imaging/MetafileFrameUnit.cs
@@ -7,6 +7,7 @@
using System;
namespace System.Drawing.Imaging
{
+ [Serializable]
public enum MetafileFrameUnit {
Document = 5,
GdiCompatible = 7,
diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/MetafileType.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/MetafileType.cs
index 7c234ce5259..5e198e130a6 100644
--- a/mcs/class/System.Drawing/System.Drawing.Imaging/MetafileType.cs
+++ b/mcs/class/System.Drawing/System.Drawing.Imaging/MetafileType.cs
@@ -9,6 +9,7 @@
namespace System.Drawing.Imaging
{
+ [Serializable]
public enum MetafileType
{
Invalid = 0,
diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/PaletteFlags.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/PaletteFlags.cs
index 007313d0622..5b5b9b3fbf0 100644
--- a/mcs/class/System.Drawing/System.Drawing.Imaging/PaletteFlags.cs
+++ b/mcs/class/System.Drawing/System.Drawing.Imaging/PaletteFlags.cs
@@ -7,6 +7,7 @@
using System;
namespace System.Drawing.Imaging
{
+ [Serializable]
public enum PaletteFlags {
GrayScale = 2,
Halftone = 4,
diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/PixelFormat.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/PixelFormat.cs
index abc675c4739..01e7a27f9a4 100644
--- a/mcs/class/System.Drawing/System.Drawing.Imaging/PixelFormat.cs
+++ b/mcs/class/System.Drawing/System.Drawing.Imaging/PixelFormat.cs
@@ -11,6 +11,7 @@
//
namespace System.Drawing.Imaging {
+ [Serializable]
public enum PixelFormat {
Alpha = 262144,
Canonical = 2097152,
diff --git a/mcs/class/System.Drawing/System.Drawing.Text/FontCollection.cs b/mcs/class/System.Drawing/System.Drawing.Text/FontCollection.cs
index ec668e46352..6ad1500218a 100644
--- a/mcs/class/System.Drawing/System.Drawing.Text/FontCollection.cs
+++ b/mcs/class/System.Drawing/System.Drawing.Text/FontCollection.cs
@@ -1,36 +1,93 @@
-//
-// System.Drawing.Text.FontCollection.cs
-//
-// (C) 2002 Ximian, Inc. http://www.ximian.com
-// Author: Everaldo Canuto everaldo.canuto@bol.com.br
-//
-using System;
-
-namespace System.Drawing.Text {
-
- public abstract class FontCollection : IDisposable {
- internal IFontCollection implementation;
-
- // methods
- [MonoTODO]
- public void Dispose()
- {
- throw new NotImplementedException ();
- }
-
- [MonoTODO]
- protected virtual void Dispose (bool disposing)
- {
- throw new NotImplementedException ();
- }
-
- // properties
- [MonoTODO]
- public FontFamily[] Families
- {
- get { return implementation.Families; }
- }
-
- }
-
-}
+//
+// System.Drawing.Text.FontCollection.cs
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+// Author: Everaldo Canuto everaldo.canuto@bol.com.br
+// Sanjay Gupta (gsanjay@novell.com)
+//
+using System;
+using System.Drawing;
+using System.Runtime.InteropServices;
+
+namespace System.Drawing.Text {
+
+ public abstract class FontCollection : IDisposable {
+
+ internal IntPtr nativeFontCollection = IntPtr.Zero;
+ internal FontFamily[] families;
+
+ internal FontCollection ()
+ {
+ }
+
+ internal FontCollection ( IntPtr ptr )
+ {
+ nativeFontCollection = ptr;
+ }
+
+ // methods
+ public void Dispose()
+ {
+ //Dispose ( true );
+ if ( families != null ) {
+ int length = families.Length;
+ Status status;
+ for ( int i = 0; i < length; i++){
+ status = GDIPlus.GdipDeleteFontFamily ( families[i].NativeObject );
+ if ( status != Status.Ok )
+ families[i].NativeObject = IntPtr.Zero;
+ }
+ }
+ System.GC.SuppressFinalize ( this );
+ }
+
+ [MonoTODO]
+ protected virtual void Dispose ( bool disposing )
+ {
+ //Nothing for now
+ }
+
+ // properties
+ public FontFamily[] Families
+ {
+ get {
+ int found;
+ int returned;
+ Status status;
+
+ status = GDIPlus.GdipGetFontCollectionFamilyCount ( nativeFontCollection, out found );
+ if ( status != Status.Ok ) {
+ throw new Exception ( "Error calling GDIPlus.GdipGetFontCollectionFamilyCount: " + status );
+ }
+
+ int nSize = Marshal.SizeOf ( IntPtr.Zero );
+ IntPtr dest = Marshal.AllocHGlobal ( nSize * found );
+
+ status = GDIPlus.GdipGetFontCollectionFamilyList( nativeFontCollection, found, dest, out returned );
+ if ( status != Status.Ok ) {
+ throw new Exception ( "Error calling GDIPlus.GdipGetFontCollectionFamilyList: " + status );
+ }
+
+ IntPtr[] ptrAr = new IntPtr [ returned ];
+ int pos = dest.ToInt32 ();
+ for ( int i = 0; i < returned ; i++, pos+=nSize )
+ ptrAr[i] = (IntPtr)Marshal.PtrToStructure ( (IntPtr)pos, typeof(IntPtr) );
+
+ Marshal.FreeHGlobal ( dest );
+
+ families = new FontFamily [ returned ];
+ for ( int i = 0; i < returned; i++ )
+ families[i] = new FontFamily ( ptrAr[i] );
+
+ return families;
+ }
+ }
+
+ ~FontCollection()
+ {
+ Dispose ( false );
+ }
+
+ }
+
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Text/GenericFontFamilies.cs b/mcs/class/System.Drawing/System.Drawing.Text/GenericFontFamilies.cs
index 63431403f62..45ccf6b1c26 100644
--- a/mcs/class/System.Drawing/System.Drawing.Text/GenericFontFamilies.cs
+++ b/mcs/class/System.Drawing/System.Drawing.Text/GenericFontFamilies.cs
@@ -7,6 +7,7 @@
using System;
namespace System.Drawing.Text
{
+ [Serializable]
public enum GenericFontFamilies {
Monospace = 2,
SansSerif = 1,
diff --git a/mcs/class/System.Drawing/System.Drawing.Text/HotkeyPrefix.cs b/mcs/class/System.Drawing/System.Drawing.Text/HotkeyPrefix.cs
index 3f493dc1873..79eaf73551f 100644
--- a/mcs/class/System.Drawing/System.Drawing.Text/HotkeyPrefix.cs
+++ b/mcs/class/System.Drawing/System.Drawing.Text/HotkeyPrefix.cs
@@ -7,6 +7,7 @@
using System;
namespace System.Drawing.Text
{
+ [Serializable]
public enum HotkeyPrefix {
Hide = 2,
None = 0,
diff --git a/mcs/class/System.Drawing/System.Drawing.Text/InstalledFontCollection.cs b/mcs/class/System.Drawing/System.Drawing.Text/InstalledFontCollection.cs
index cb7eb67a737..828bd34dfda 100644
--- a/mcs/class/System.Drawing/System.Drawing.Text/InstalledFontCollection.cs
+++ b/mcs/class/System.Drawing/System.Drawing.Text/InstalledFontCollection.cs
@@ -4,6 +4,7 @@
// (C) 2002 Ximian, Inc. http://www.ximian.com
// Author: Everaldo Canuto everaldo.canuto@bol.com.br
// Alexandre Pigolkine ( pigolkine@gmx.de)
+// Sanjay Gupta (gsanjay@novell.com)
//
using System;
using System.Drawing;
@@ -11,12 +12,19 @@ using System.Drawing;
namespace System.Drawing.Text {
public sealed class InstalledFontCollection : FontCollection {
- //internal static IFontCollectionFactory factory = Factories.GetFontCollectionFactory();
+
+ internal InstalledFontCollection ( IntPtr ptr ): base ( ptr )
+ {}
- // constructors
- [MonoTODO]
- public InstalledFontCollection() {
- //implementation = factory.InstalledFontCollection();
+ public InstalledFontCollection ()
+ {
+ Status status = GDIPlus.GdipNewInstalledFontCollection( out nativeFontCollection );
+
+ if ( status != Status.Ok ) {
+ nativeFontCollection = IntPtr.Zero;
+ throw new Exception ( "Error calling GDIPlus.GdipNewInstalledFontCollection: " + status );
+ }
}
}
}
+
diff --git a/mcs/class/System.Drawing/System.Drawing.Text/PrivateFontCollection.cs b/mcs/class/System.Drawing/System.Drawing.Text/PrivateFontCollection.cs
index 64f18fe261a..f38d8c1a33d 100644
--- a/mcs/class/System.Drawing/System.Drawing.Text/PrivateFontCollection.cs
+++ b/mcs/class/System.Drawing/System.Drawing.Text/PrivateFontCollection.cs
@@ -3,8 +3,11 @@
//
// (C) 2002 Ximian, Inc. http://www.ximian.com
// Author: Everaldo Canuto everaldo.canuto@bol.com.br
+// Sanjay Gupta (gsanjay@novell.com)
//
using System;
+using System.IO;
+using System.Drawing;
using System.Runtime.InteropServices;
namespace System.Drawing.Text {
@@ -13,24 +16,40 @@ namespace System.Drawing.Text {
public sealed class PrivateFontCollection : FontCollection {
// constructors
- [MonoTODO]
- public PrivateFontCollection() {
- throw new NotImplementedException ();
+ internal PrivateFontCollection ( IntPtr ptr ): base ( ptr )
+ {}
+
+ public PrivateFontCollection ()
+ {
+ Status status = GDIPlus.GdipNewPrivateFontCollection( out nativeFontCollection );
+ if ( status != Status.Ok ){
+ nativeFontCollection = IntPtr.Zero;
+ throw new Exception ( "Error calling GDIPlus.GdipNewPrivateFontCollection: " + status );
+ }
}
// methods
- [MonoTODO]
[ComVisible(false)]
- public void AddFontFile(string filename) {
- throw new NotImplementedException ();
+ public void AddFontFile( string filename )
+ {
+ if ( filename == null )
+ throw new Exception ( "Value cannot be null, Parameter name : filename" );
+ bool exists = File.Exists( filename );
+ if ( !exists )
+ throw new Exception ( "The path is not of a legal form" );
+
+ Status status = GDIPlus.GdipPrivateAddFontFile ( nativeFontCollection, filename );
+ if ( status != Status.Ok )
+ throw new Exception ( "Error calling GDIPlus.GdipPrivateAddFontFile: " + status );
}
- [MonoTODO]
[ComVisible(false)]
- public void AddMemoryFont(IntPtr memory, int length) {
- throw new NotImplementedException ();
+ public void AddMemoryFont ( IntPtr memory, int length )
+ {
+ Status status = GDIPlus.GdipPrivateAddMemoryFont ( nativeFontCollection, memory, length );
+ if ( status != Status.Ok )
+ throw new Exception ( "Error calling GDIPlus.GdipPrivateAddFontFile: " + status );
}
-
}
-
}
+
diff --git a/mcs/class/System.Drawing/System.Drawing.Text/TextRenderingHint.cs b/mcs/class/System.Drawing/System.Drawing.Text/TextRenderingHint.cs
index 58609faa1ac..2f197885622 100644
--- a/mcs/class/System.Drawing/System.Drawing.Text/TextRenderingHint.cs
+++ b/mcs/class/System.Drawing/System.Drawing.Text/TextRenderingHint.cs
@@ -7,6 +7,7 @@
using System;
namespace System.Drawing.Text
{
+ [Serializable]
public enum TextRenderingHint {
AntiAlias = 4,
AntiAliasGridFit = 3,
diff --git a/mcs/class/System.Drawing/System.Drawing.Text/changelog b/mcs/class/System.Drawing/System.Drawing.Text/changelog
index f5dbfdb6614..dcdb72618ba 100644
--- a/mcs/class/System.Drawing/System.Drawing.Text/changelog
+++ b/mcs/class/System.Drawing/System.Drawing.Text/changelog
@@ -1,3 +1,21 @@
+2004-01-29 Sanjay Gupta <gsanjay@novell.com>
+ * FontCollection.cs: Implemented Dispose method.
+ * InstalledFontCollection.cs: Removed Console.WriteLine calls.
+ * PrivateFontCollection.cs: Implemented AddMemoryFont method.
+
+2004-01-28 Jordi Mas <jordi@ximian.com>
+ * FontCollection.cs: fixed marshalling issues
+
+2004-01-28 Sanjay Gupta <gsanjay@novell.com>
+
+ * FontCollection.cs: Implemented missing functionalities.
+ * InstalledFontCollection.css: Implemented missing functionalities.
+ * PrivateFontCollection.cs: Implemented few methods.
+
+2004-01-10 Ravindra <rkumar@novell.com>
+
+ * All Enums: Made serializable.
+
2003-10-12 Alexandre Pigolkine <pigolkine@gmx.de>
* InstalledFontCollection.cs factory removed
diff --git a/mcs/class/System.Drawing/System.Drawing.dll.sources b/mcs/class/System.Drawing/System.Drawing.dll.sources
index 57c0816e0b8..2ffa2577b15 100755
--- a/mcs/class/System.Drawing/System.Drawing.dll.sources
+++ b/mcs/class/System.Drawing/System.Drawing.dll.sources
@@ -116,6 +116,7 @@ System.Drawing.Imaging/ColorMode.cs
System.Drawing.Imaging/ColorPalette.cs
System.Drawing.Imaging/EmfPlusRecordType.cs
System.Drawing.Imaging/EmfType.cs
+System.Drawing.Imaging/Encoder.cs
System.Drawing.Imaging/EncoderParameterValueType.cs
System.Drawing.Imaging/EncoderValue.cs
System.Drawing.Imaging/FrameDimension.cs
@@ -167,6 +168,7 @@ System.Drawing.Printing/QueryPageSettingsEventArgs.cs
System.Drawing.Printing/QueryPageSettingsEventHandler.cs
System.Drawing.Printing/StandardPrintController.cs
System.Drawing.Text/FontCollection.cs
+System.Drawing.Text/PrivateFontCollection.cs
System.Drawing.Text/GenericFontFamilies.cs
System.Drawing.Text/HotkeyPrefix.cs
System.Drawing.Text/InstalledFontCollection.cs
diff --git a/mcs/class/System.Drawing/System.Drawing/Bitmap.cs b/mcs/class/System.Drawing/System.Drawing/Bitmap.cs
index b14d837f947..57e71a9b2c0 100755
--- a/mcs/class/System.Drawing/System.Drawing/Bitmap.cs
+++ b/mcs/class/System.Drawing/System.Drawing/Bitmap.cs
@@ -7,6 +7,7 @@
// Alexandre Pigolkine (pigolkine@gmx.de)
// Christian Meyer (Christian.Meyer@cs.tum.edu)
// Miguel de Icaza (miguel@ximian.com)
+// Jordi Mas i Hernàdez (jmas@softcatala.org)
//
using System;
using System.IO;
@@ -21,21 +22,24 @@ namespace System.Drawing {
[ComVisible (true)]
[Editor ("System.Drawing.Design.BitmapEditor, " + Consts.AssemblySystem_Drawing_Design, typeof (System.Drawing.Design.UITypeEditor))]
public sealed class Bitmap : Image {
- //
- // This one holds the actual memory buffer at the PixelFormat/height/width
- //
- IntPtr buffer;
-
+
#region constructors
// constructors
+ internal Bitmap (IntPtr ptr)
+ {
+ nativeObject = ptr;
+ }
+
public Bitmap (int width, int height) : this (width, height, PixelFormat.Format32bppArgb)
{
+ raw_format = ImageFormat.Bmp;
}
public Bitmap (int width, int height, Graphics g)
{
+ raw_format = ImageFormat.Bmp;
image_size = new Size(width, height);
- int bmp = 0;
+ IntPtr bmp;
Status s = GDIPlus.GdipCreateBitmapFromGraphics (width, height, g.nativeObject, out bmp);
if (s != Status.Ok)
throw new Exception ("Could not create Bitmap from Graphics: " + s);
@@ -45,18 +49,21 @@ namespace System.Drawing {
public Bitmap (int width, int height, PixelFormat format)
{
+ raw_format = ImageFormat.Bmp;
image_size = new Size(width, height);
pixel_format = format;
int bpp = 32;
int stride = ((bpp * width) / 8);
stride = (stride + 3) & ~3;
- int bmp_size = stride * height;
+ int bmp_size = stride * height;
- buffer = Marshal.AllocHGlobal (bmp_size);
- int bmp = 0;
- Status s = GDIPlus.GdipCreateBitmapFromScan0 (width, height, stride, PixelFormat.Format32bppArgb, buffer, out bmp);
+ IntPtr bmp;
+ Status s = GDIPlus.GdipCreateBitmapFromScan0 (width, height, stride, PixelFormat.Format32bppArgb, IntPtr.Zero,
+ out bmp);
+
if (s != Status.Ok)
throw new ArgumentException ("Could not allocate the GdiPlus image: " + s);
+
nativeObject = (IntPtr)bmp;
}
@@ -68,13 +75,38 @@ namespace System.Drawing {
public Bitmap (string filename) : this (filename, false) {}
- public Bitmap (Image original, Size newSize)
+ public Bitmap (Image original, Size newSize)
+ {
+ raw_format = ImageFormat.Bmp;
+ BitmapFromImage(original, newSize);
+ }
+
+ internal Bitmap (int width, int height, PixelFormat pixel, IntPtr bmp)
+ {
+ image_size = new Size(width, height);
+ nativeObject = (IntPtr)bmp;
+ pixel_format = pixel;
+ raw_format = ImageFormat.Bmp;
+ }
+
+ internal Bitmap (float width, float height, PixelFormat pixel, IntPtr bmp)
{
+ image_size = new Size((int)width, (int)height);
+ nativeObject = (IntPtr)bmp;
+ pixel_format = pixel;
+ raw_format = ImageFormat.Bmp;
+ }
+
+ internal void BitmapFromImage(Image original, Size newSize){
+
if (original is Bitmap) {
+
+ if (nativeObject!=IntPtr.Zero) Dispose();
+
Bitmap bmpOriginal = (Bitmap) original;
image_size = bmpOriginal.Size;
pixel_format = bmpOriginal.pixel_format;
- int bmp = 0;
+ IntPtr bmp;
Status s = GDIPlus.GdipCloneBitmapAreaI (0, 0, newSize.Width, newSize.Height, bmpOriginal.PixelFormat, bmpOriginal.nativeObject, out bmp);
if (s != Status.Ok)
throw new ArgumentException ("Could not allocate the GdiPlus image: " + s);
@@ -87,6 +119,8 @@ namespace System.Drawing {
void InitFromStream (Stream stream)
{
+ Console.WriteLine("Bitmap.InitFromStream");
+
BitmapData bd = Decode (stream);
if (bd == null)
throw new ArgumentException ("Stream could not be decoded");
@@ -94,8 +128,7 @@ namespace System.Drawing {
image_size = new Size (bd.Width, bd.Height);
pixel_format = bd.PixelFormat;
- int bmp = 0;
- buffer = bd.Scan0;
+ IntPtr bmp;
Console.WriteLine ("Stride: {0} ", bd.Stride);
Console.WriteLine ("Scan0: {0:x}" , (long) bd.Scan0);
Status s = GDIPlus.GdipCreateBitmapFromScan0 (bd.Width, bd.Height, bd.Stride, bd.PixelFormat, bd.Scan0, out bmp);
@@ -122,14 +155,28 @@ namespace System.Drawing {
throw new NotImplementedException ();
}
- public Bitmap (Image original, int width, int heigth)
+ public Bitmap (Image original, int width, int heigth)
{
- throw new NotImplementedException ();
+ Size newSize = new Size();
+ newSize.Height=heigth;
+ newSize.Width=width;
+
+ BitmapFromImage(original,newSize);
}
public Bitmap (int width, int height, int stride, PixelFormat format, IntPtr scan0)
- {
- throw new NotImplementedException ();
+ {
+ IntPtr bmp;
+
+ Status status = GDIPlus.GdipCreateBitmapFromScan0 (width, height, stride, format, scan0, out bmp);
+
+ if (status != Status.Ok)
+ throw new ArgumentException ("Could not allocate the GdiPlus image: " + status);
+
+ nativeObject = (IntPtr)bmp;
+ pixel_format = format;
+ raw_format = ImageFormat.Bmp;
+ image_size = new Size(width, height);
}
private Bitmap (SerializationInfo info, StreamingContext context)
@@ -139,102 +186,173 @@ namespace System.Drawing {
#endregion
// methods
public Color GetPixel (int x, int y) {
- throw new NotImplementedException ();
+
+ int argb;
+
+ Status s = GDIPlus.GdipBitmapGetPixel(nativeObject, x, y, out argb);
+
+ if (s != Status.Ok)
+ throw new Exception ("Unable to GetPixel: " + x +":" +y + ";status: " + s);
+
+ return Color.FromArgb(argb);
}
public void SetPixel (int x, int y, Color color)
- {
- throw new NotImplementedException ();
+ {
+ Status s = GDIPlus.GdipBitmapSetPixel(nativeObject, x, y, color.ToArgb());
+
+ if (s != Status.Ok)
+ throw new Exception ("Unable to SetPixel: " + x +":" +y + ";status: " + s);
}
public Bitmap Clone (Rectangle rect,PixelFormat format)
- {
- throw new NotImplementedException ();
- }
+ {
+ IntPtr bmp;
+ Status status = GDIPlus.GdipCloneBitmapAreaI(rect.X, rect.Top, rect.Width, rect.Height,
+ PixelFormat, nativeObject, out bmp);
+
+ if (status != Status.Ok)
+ throw new Exception ("Error calling GdipBitmapUnlockBits " +status);
+
+ Bitmap bmpnew = new Bitmap (rect.Width, rect.Height, PixelFormat, (IntPtr) bmp);
+ return bmpnew;
+ }
public Bitmap Clone (RectangleF rect, PixelFormat format)
{
- throw new NotImplementedException ();
+ IntPtr bmp;
+ Status status = GDIPlus.GdipCloneBitmapArea(rect.X, rect.Top, rect.Width, rect.Height,
+ PixelFormat, nativeObject, out bmp);
+
+ if (status != Status.Ok)
+ throw new Exception ("Error calling GdipBitmapUnlockBits " +status);
+
+ Bitmap bmpnew = new Bitmap (rect.Width, rect.Height, PixelFormat, (IntPtr) bmp);
+ return bmpnew;
}
- public static Bitmap FromHicon (IntPtr hicon)
- {
- throw new NotImplementedException ();
+ public static Bitmap FromHicon (IntPtr hicon) //TODO: Untested
+ {
+ IntPtr bitmap;
+
+ Status status = GDIPlus.GdipCreateBitmapFromHICON(hicon, out bitmap);
+
+ if (status != Status.Ok)
+ throw new Exception ("Error calling GdipCreateBitmapFromHICON " +status);
+
+
+ return new Bitmap (0,0, PixelFormat.Format32bppArgb, bitmap); // FIXME
}
- public static Bitmap FromResource (IntPtr hinstance, string bitmapName)
+ public static Bitmap FromResource (IntPtr hinstance, string bitmapName) //TODO: Untested
{
- throw new NotImplementedException ();
+ IntPtr bitmap;
+
+ Status status = GDIPlus.GdipCreateBitmapFromResource(hinstance, bitmapName, out bitmap);
+
+ if (status != Status.Ok)
+ throw new Exception ("Error calling GdipCreateBitmapFromResource " +status);
+
+ return new Bitmap (0,0, PixelFormat.Format32bppArgb, bitmap); // FIXME
}
public IntPtr GetHbitmap ()
{
- throw new NotImplementedException ();
+ return GetHbitmap(Color.Gray);
}
public IntPtr GetHbitmap (Color background)
{
- throw new NotImplementedException ();
+ IntPtr HandleBmp;
+
+ Status status = GDIPlus.GdipCreateHBITMAPFromBitmap(nativeObject, out HandleBmp, background.ToArgb());
+
+ if (status != Status.Ok)
+ throw new Exception ("GdipCreateHBITMAPFromBitmap " +status);
+
+ return HandleBmp;
}
public IntPtr GetHicon ()
{
- throw new NotImplementedException ();
+ IntPtr HandleIcon;
+
+ Status status = GDIPlus.GdipCreateHICONFromBitmap(nativeObject, out HandleIcon);
+
+ if (status != Status.Ok)
+ throw new Exception ("GdipCreateHICONFromBitmap " +status);
+
+ return HandleIcon;
}
public BitmapData LockBits (Rectangle rect, ImageLockMode flags, PixelFormat format)
{
- GpRect rc = new GpRect ();
- rc.left = rect.Left;
- rc.right = rect.Right;
- rc.top = rect.Top;
- rc.bottom = rect.Bottom;
+ Console.WriteLine("Bitmap.LockBits");
BitmapData result = new BitmapData();
- //
- // What follows is a workaround until we fix 50083
- //
- int w = 0, h = 0, s = 0, f = 0, res = 0;
- IntPtr sc = (IntPtr) 0xdeadcafe;
-
if (nativeObject == (IntPtr) 0)
- throw new Exception ("nativeObject is null");
+ throw new Exception ("nativeObject is null");
+
+ IntPtr lfBuffer = Marshal.AllocHGlobal(Marshal.SizeOf(result));
+ Marshal.StructureToPtr(result, lfBuffer, false);
+
+ Status status = GDIPlus.GdipBitmapLockBits (nativeObject, ref rect, flags, format, lfBuffer);
- Status status = GDIPlus.____BitmapLockBits (nativeObject, ref rc, flags, format, ref w, ref h, ref s, ref f, ref res, ref sc);
- result.Width = w;
- result.Height = h;
- result.Stride = s;
- result.PixelFormat = (PixelFormat) f;
- result.Reserved = res;
- result.Scan0 = sc;
+ result = (BitmapData) Marshal.PtrToStructure(lfBuffer, typeof(BitmapData));
+ Marshal.FreeHGlobal (lfBuffer);
+ //NOTE: scan0 points to piece of memory allocated in the unmanaged space
if (status != Status.Ok)
throw new Exception ("Could not lock bits: " + status);
- return result;
+
+ Console.WriteLine("Bitmap.LockBits->height "+ result.height+ " scan"+ result.address);
+
+ return result;
}
public void MakeTransparent ()
{
- throw new NotImplementedException ();
+ Color clr = GetPixel(0,0);
+ MakeTransparent (clr);
}
public void MakeTransparent (Color transparentColor)
- {
- throw new NotImplementedException ();
+ {
+ Bitmap bmp = new Bitmap(Width, Height, PixelFormat);
+ Graphics gr = Graphics.FromImage(bmp);
+ Rectangle destRect = new Rectangle(0,0, Width, Height);
+ ImageAttributes imageAttr = new ImageAttributes();
+
+ gr.Clear(Color.Transparent);
+
+ imageAttr.SetColorKey(transparentColor, transparentColor);
+
+ gr.DrawImage (this, destRect, 0, 0, Width, Height, GraphicsUnit.Pixel, imageAttr);
+
+ Size newSize = new Size();
+ newSize.Height=Height;
+ newSize.Width=Width;
+ BitmapFromImage(bmp,newSize);
+
+ gr.Dispose();
+ bmp.Dispose();
}
public void SetResolution (float xDpi, float yDpi)
{
- throw new NotImplementedException ();
+ Status status = GDIPlus.GdipBitmapSetResolution(nativeObject, xDpi, yDpi);
+
+ if (status != Status.Ok)
+ throw new Exception ("Error calling GdipBitmapSetResolution " +status);
}
public void UnlockBits (BitmapData bitmap_data)
{
- Status s = GDIPlus.GdipBitmapUnlockBits (nativeObject, bitmap_data);
+ Status status = GDIPlus.GdipBitmapUnlockBits (nativeObject, bitmap_data);
- if (s != Status.Ok)
- throw new Exception ("Could not unlock bits: " + s);
+ if (status != Status.Ok)
+ throw new Exception ("Error calling GdipBitmapUnlockBits " +status);
}
// properties
@@ -243,10 +361,7 @@ namespace System.Drawing {
protected override void DisposeResources ()
{
base.DisposeResources ();
- if (buffer != (IntPtr) 0){
- Marshal.FreeHGlobal (buffer);
- buffer = (IntPtr) 0;
- }
+
}
}
}
diff --git a/mcs/class/System.Drawing/System.Drawing/Brush.cs b/mcs/class/System.Drawing/System.Drawing/Brush.cs
index 081b045c4ac..dcabb39625b 100755
--- a/mcs/class/System.Drawing/System.Drawing/Brush.cs
+++ b/mcs/class/System.Drawing/System.Drawing/Brush.cs
@@ -24,6 +24,16 @@ namespace System.Drawing {
{
nativeObject = ptr;
}
+
+ internal IntPtr NativeObject{
+ get{
+ return nativeObject;
+ }
+ set {
+ nativeObject = value;
+ }
+ }
+
internal Brush CreateBrush (IntPtr brush, System.Drawing.BrushType type)
{
diff --git a/mcs/class/System.Drawing/System.Drawing/ChangeLog b/mcs/class/System.Drawing/System.Drawing/ChangeLog
index 8868e4cb394..633c1679771 100644
--- a/mcs/class/System.Drawing/System.Drawing/ChangeLog
+++ b/mcs/class/System.Drawing/System.Drawing/ChangeLog
@@ -1,3 +1,148 @@
+2004-01-30 Ravindra <rkumar@novell.com>
+
+ * TextureBrush.cs: Added more methods to complete it.
+ * gdipFunctions.cs: Added methods for TextureBrush class.
+
+2004-01-30 Ravindra <rkumar@novell.com>
+
+ * gdipFunctions.cs: Added methods for TextureBrush class.
+
+2004-01-30 Ravindra <rkumar@novell.com>
+
+ * Pen.cs: Modified to handle TextureBrush also.
+ * Bitmap.cs: Added one internal constructor.
+ * TextureBrush.cs: Implemented.
+
+2004-01-29 Duncan Mak <duncan@ximian.com>
+
+ * gdipFunctions.cs
+ * Graphics.cs: Indentation fixes, removed long dangling lines and
+ extra spaces.
+
+ * Graphics.cs (IsVisible): Renamed variable to not use hungarian
+ notation.
+
+2004-01-29 Sanjay Gupta <gsanjay@novell.com>
+
+ * FontFamily.cs: Implemented few methods and a constructor
+
+2004-01-28 Sanjay Gupta <gsanjay@novell.com>
+
+ * gdipFunctions.cs: Added FontFamily and FontCollection functions.
+ * FontFamily.cs: Implemented missing functionalities.
+
+2004-01-24 Duncan Mak <duncan@ximian.com>
+
+ * Graphics.cs (DrawPath): Implemented.
+
+2004-01-23 Ravindra <rkumar@novell.com>
+
+ * Point.cs: ToString modified.
+ * PointF.cs: ToString modified.
+ * Size.cs: ToString modified.
+ * SizeF.cs: ToString modified. ToPoint and ToSize methods
+ are added.
+
+2004-01-21 Jordi Mas i Hernàndez
+ * Bitmap.cs: Several new methods added.
+
+2004-01-21 Duncan Mak <duncan@ximian.com>
+
+ * gdipFunctions.cs (GdipGetPathTypes, GdipGetPathPoints): Add
+ OutAttribute to the array argument. This fixes the PathPoints
+ property in System.Drawing.Drawing2D.GraphicsPath.
+
+2004-01-20 Ravindra <rkumar@novell.com>
+
+ * Pen.cs: Fixed bug #52811 in Pen.Transform property. Setting
+ this property was hanging and getting was throwing a NullRef
+ Exception. Earlier we were passing Matrix object to and fro
+ which was causing the problem. Now, we are using IntPtr.
+ Thanks to Duncan for helping me.
+ Also, .NET behavior is to maintain Pen.Color and Pen.Brush
+ together. If color is set, a SolidBrush automatically gets
+ set with the same color, Pen loses the old brush object.
+ If a SolidBrush is set, Pen.Color gets the value same as that
+ of brush color losing the old value. Pen shows this behavior
+ now.
+ * gdipFunctions.cs: Changed the signature of GdipGetPenTransform
+ and GdipSetPenTransform methods to use IntPtr instead of Matrix.
+
+2004-01-19 Duncan Mak <duncan@ximian.com>
+
+ * gdipFunctions.cs: Import functions for GraphicsPath.
+
+2004-01-14 Ravindra <rkumar@novell.com>
+
+ * SolidBrush.cs: Made SolidBrush to initialize its color
+ from IntPtr.
+
+ * gdipFunctions.cs: Added call to GdipGetSolidFillColor GDI+ API.
+
+2004-01-11 Duncan Mak <duncan@ximian.com>
+
+ * Bitmap.cs (LockBits):
+ * Graphics.cs (DrawString): Removed reference to GpRectF.
+
+2004-01-09 Duncan Mak <duncan@ximian.com>
+
+ * gdipStructs.cs (GpRectF, GpRect, GpPointF, GpPoint):
+ Removed. Didn't know that structs are laid out sequentially by
+ default. We don't need these anymore.
+
+2004-01-12 Ben Maurer <bmaurer@users.sourceforge.net>
+
+ * Color.cs: Keep KnownColors in an array so that we avoid ht lookup.
+
+2004-01-11 Daniel Morgan <danielmorgan@verizon.net>
+
+ * Graphics.cs: fix compile error on Windows builds for out
+ parameter state in call to GdipSaveGraphics
+
+2004-01-10 Ravindra <rkumar@novell.com>
+
+ * All Enums: Made serializable.
+
+ * Image.cs: Corrected signature of Dispose(bool) method.
+
+ * Pen.cs, SolidBrush.cs, SystemPens.cs, SystemBrushes.cs:
+ Corrected coding style mistakes of my previous commit.
+
+ * PointConverter.cs, RectangleConverter.cs: Inherit TypeConverter.
+
+ * PointF.cs, RectangleF.cs, SizeF.cs: Made serializable.
+
+ * StringFormat.cs: Inherits MarshalByRefObject.
+
+ * ToolboxBitmapAttribute.cs: Added missing attribute [AttributeUsage].
+
+2004-01-08 Ravindra <rkumar@novell.com>
+
+ * Pen.cs: Added isModifiable (bool) variable. It is required to
+ make Pens created by SystemPens.cs unmodifiable. All property
+ setters are modified for this.
+
+ * SolidBrush.cs: Added isModifiable variable (bool). It is
+ required to make Brushes created by SystemBrushes.cs unmodifiable.
+ All property setters are modified for this.
+
+ * SystemBrushes.cs: Modified all the properties as per the .NET
+ specs, so that Brushes are not created every time. Also, missing
+ properties are added.
+
+ * SystemPens.cs: Modified all the properties as per the .NET
+ specs, so that Brushes are not created every time. Also, missing
+ properties are added.
+
+2003-12-12 Miguel de Icaza <miguel@ximian.com>
+
+ * Rectangle.cs: Patch from Bryan Bulten, fixes Inflate and makes
+ it serializable
+
+2004-01-06 Duncan Mak <duncan@ximian.com>
+
+ * gdipFunctions.cs: Import GraphicsPath functions from GDI+.
+
2003-12-21 Duncan Mak <duncan@ximian.com>
* Graphics.cs (DrawArc): Fixed the method signature and hooked it
diff --git a/mcs/class/System.Drawing/System.Drawing/Color.cs b/mcs/class/System.Drawing/System.Drawing/Color.cs
index 7d66bcabd4d..4af7381fe89 100644
--- a/mcs/class/System.Drawing/System.Drawing/Color.cs
+++ b/mcs/class/System.Drawing/System.Drawing/Color.cs
@@ -27,6 +27,8 @@ namespace System.Drawing
{
private static Hashtable namedColors;
private static Hashtable systemColors;
+ static Color [] knownColors;
+
// Private transparancy (A) and R,G,B fields.
byte a;
byte r;
@@ -123,11 +125,21 @@ namespace System.Drawing
return FromArgb ((argb >> 24) & 0x0FF, (argb >> 16) & 0x0FF, (argb >> 8) & 0x0FF, argb & 0x0FF);
}
- public static Color FromKnownColor (KnownColor knownColorToConvert)
+ public static Color FromKnownColor (KnownColor c)
{
- Color c = FromName (knownColorToConvert.ToString ());
- c.knownColor = knownColorToConvert;
- return c;
+ if (knownColors == null)
+ FillColorNames ();
+
+ if (c < KnownColor.ActiveBorder || c > KnownColor.YellowGreen) {
+ // This is what it returns!
+ Color d = FromArgb (0, 0, 0, 0);
+ d.myname = c.ToString ();
+ d.isnamedcolor = true;
+ d.knownColor = c;
+ return d;
+ }
+
+ return knownColors [(int) c];
}
private static Hashtable GetColorHashtableFromType (Type type)
@@ -143,8 +155,12 @@ namespace System.Drawing
MethodInfo getget = prop.GetGetMethod ();
if (getget == null || getget.IsStatic == false)
continue;
-
- colorHash.Add (prop.Name, prop.GetValue (null, null));
+
+ object o = prop.GetValue (null, null);
+ colorHash.Add (prop.Name, o);
+
+ Color c = (Color) o;
+ knownColors [(int) c.knownColor] = c;
}
return colorHash;
}
@@ -158,6 +174,8 @@ namespace System.Drawing
if (systemColors != null)
return;
+ knownColors = new Color [(int)KnownColor.YellowGreen + 1];
+
Hashtable colorHash = GetColorHashtableFromType (typeof (Color));
namedColors = colorHash;
diff --git a/mcs/class/System.Drawing/System.Drawing/ContentAlignment.cs b/mcs/class/System.Drawing/System.Drawing/ContentAlignment.cs
index 3227fbb2670..04913bab787 100644
--- a/mcs/class/System.Drawing/System.Drawing/ContentAlignment.cs
+++ b/mcs/class/System.Drawing/System.Drawing/ContentAlignment.cs
@@ -10,6 +10,7 @@ using System.ComponentModel;
namespace System.Drawing
{
+ [Serializable]
[Editor ("System.Drawing.Design.ContentAlignmentEditor, " + Consts.AssemblySystem_Drawing_Design, typeof (System.Drawing.Design.UITypeEditor))]
public enum ContentAlignment {
TopLeft = 0x001,
diff --git a/mcs/class/System.Drawing/System.Drawing/Font.cs b/mcs/class/System.Drawing/System.Drawing/Font.cs
index 99a259a26cf..22dda721417 100644
--- a/mcs/class/System.Drawing/System.Drawing/Font.cs
+++ b/mcs/class/System.Drawing/System.Drawing/Font.cs
@@ -10,6 +10,8 @@ namespace System.Drawing {
[TypeConverter(typeof(FontConverter))]
public sealed class Font : MarshalByRefObject, ISerializable, ICloneable, IDisposable
{
+ IntPtr fontObject = IntPtr.Zero;
+
private Font (SerializationInfo info, StreamingContext context)
{
}
@@ -20,6 +22,11 @@ namespace System.Drawing {
public void Dispose ()
{
+ if (fontObject!=IntPtr.Zero)
+ {
+ GDIPlus.GdipDeleteFont(fontObject);
+ GC.SuppressFinalize(this);
+ }
}
public static Font FromHfont(IntPtr font)
@@ -67,9 +74,10 @@ namespace System.Drawing {
: this(family, emSize, style, unit, charSet, false)
{
}
-
+
public Font(FontFamily family, float emSize, FontStyle style, GraphicsUnit unit, byte charSet, bool isVertical)
- {
+ {
+ GDIPlus.GdipCreateFont(family.NativeObject, emSize, style, unit, out fontObject);
}
public Font(string familyName, float emSize)
@@ -92,16 +100,27 @@ namespace System.Drawing {
{
}
- public Font(string familyName, float emSize, FontStyle style, GraphicsUnit unit, byte charSet, bool isVertical)
+ public Font(string familyName, float emSize, FontStyle style, GraphicsUnit unit, byte charSet, bool isVertical)
{
- //throw new NotImplementedException ();
+ FontFamily family = new FontFamily(familyName);
+ GDIPlus.GdipCreateFont(family.NativeObject, emSize, style, unit, out fontObject);
}
+
object ICloneable.Clone()
{
throw new NotImplementedException ();
}
+ internal IntPtr NativeObject{
+ get{
+ return fontObject;
+ }
+ set {
+ fontObject = value;
+ }
+ }
+
private bool _bold;
public bool Bold {
get {
diff --git a/mcs/class/System.Drawing/System.Drawing/FontFamily.cs b/mcs/class/System.Drawing/System.Drawing/FontFamily.cs
index 9a4ddd8d34d..f2e637a9112 100644
--- a/mcs/class/System.Drawing/System.Drawing/FontFamily.cs
+++ b/mcs/class/System.Drawing/System.Drawing/FontFamily.cs
@@ -12,79 +12,276 @@ using System.Drawing.Text;
namespace System.Drawing {
- public sealed class FontFamily : MarshalByRefObject, IDisposable {
+ public sealed class FontFamily : MarshalByRefObject, IDisposable
+ {
static FontFamily genericMonospace;
static FontFamily genericSansSerif;
static FontFamily genericSerif;
string name;
+
+ internal IntPtr nativeFontFamily = IntPtr.Zero;
+
+ internal FontFamily ( IntPtr ptr )
+ {
+ nativeFontFamily = ptr;
+ }
- public FontFamily(GenericFontFamilies genericFamily) {
+ //Need to come back here, is Arial the right thing to do
+ internal FontFamily () : this ( "Arial", null )
+ {
+ //FIXME
+ }
+
+ internal IntPtr NativeObject
+ {
+ get
+ {
+ return nativeFontFamily;
+ }
+ set
+ {
+ nativeFontFamily = value;
+ }
+ }
+
+ public FontFamily ( GenericFontFamilies genericFamily )
+ {
+ IntPtr generic = IntPtr.Zero;
+ Status status;
+ switch ( genericFamily )
+ {
+ case GenericFontFamilies.Monospace :
+ status = GDIPlus.GdipGetGenericFontFamilyMonospace ( out generic );
+ if ( status != Status.Ok )
+ {
+ generic = IntPtr.Zero;
+ throw new Exception ( "Error calling GDIPlus.GdipGetGenericFontFamilyMonospace: " + status );
+ }
+ nativeFontFamily = generic ;
+ name = "Courier New";
+ break;
+ case GenericFontFamilies.SansSerif :
+ status = GDIPlus.GdipGetGenericFontFamilySansSerif ( out generic );
+ if ( status != Status.Ok )
+ {
+ generic = IntPtr.Zero;
+ throw new Exception ( "Error calling GDIPlus.GdipGetGenericFontFamilySansSerif: " + status );
+ }
+ nativeFontFamily = generic ;
+ name = "Sans Serif";
+ break;
+ case GenericFontFamilies.Serif :
+ status = GDIPlus.GdipGetGenericFontFamilySerif ( out generic );
+ if ( status != Status.Ok )
+ {
+ generic = IntPtr.Zero;
+ throw new Exception ( "Error calling GDIPlus.GdipGetGenericFontFamilySerif: " + status );
+ }
+ nativeFontFamily = generic ;
+ name = "Times New Roman";
+ break;
+ }
}
- public FontFamily(string familyName) {
- name = familyName;
+ public FontFamily ( string familyName ) : this( familyName, null )
+ {
}
- public FontFamily(string familyName, FontCollection collection) {
+ public FontFamily ( string familyName, FontCollection collection )
+ {
+ Status status;
+ if ( collection != null )
+ status = GDIPlus.GdipCreateFontFamilyFromName( familyName, collection.nativeFontCollection, out nativeFontFamily );
+ else
+ status = GDIPlus.GdipCreateFontFamilyFromName( familyName, IntPtr.Zero, out nativeFontFamily );
+
+ if ( status != Status.Ok )
+ {
+ nativeFontFamily = IntPtr.Zero;
+ throw new Exception ( "Error calling GDIPlus.GdipCreateFontFamilyFromName: " + status );
+ }
name = familyName;
}
- public string Name {
- get {
+ public string Name
+ {
+ get
+ {
return name;
}
}
- public static FontFamily GenericMonospace {
- get {
- if( genericMonospace == null) {
- genericMonospace = new FontFamily(GenericFontFamilies.Monospace);
+ public static FontFamily GenericMonospace
+ {
+ get
+ {
+ if ( genericMonospace == null )
+ {
+ IntPtr generic = IntPtr.Zero;
+ Status status = GDIPlus.GdipGetGenericFontFamilyMonospace ( out generic );
+ if ( status != Status.Ok )
+ {
+ generic = IntPtr.Zero;
+ throw new Exception ( "Error calling GDIPlus.GdipGetGenericFontFamilyMonospace: " + status );
+ }
+ genericMonospace = new FontFamily ( generic );
+ genericMonospace.name = "Courier New";
}
return genericMonospace;
}
}
- public static FontFamily GenericSansSerif {
- get {
- if( genericSansSerif == null) {
- genericSansSerif = new FontFamily(GenericFontFamilies.SansSerif);
+ public static FontFamily GenericSansSerif
+ {
+ get
+ {
+ if ( genericSansSerif == null )
+ {
+ IntPtr generic = IntPtr.Zero;
+ Status status = GDIPlus.GdipGetGenericFontFamilySansSerif ( out generic );
+ if ( status != Status.Ok )
+ {
+ generic = IntPtr.Zero;
+ throw new Exception ( "Error calling GDIPlus.GdipGetGenericFontFamilySansSerif: " + status );
+ }
+ genericSansSerif = new FontFamily ( generic );
+ genericSansSerif.name = "Sans Serif";
}
return genericSansSerif;
}
}
- public static FontFamily GenericSerif {
- get {
- if( genericSerif == null) {
- genericSerif = new FontFamily(GenericFontFamilies.Serif);
+ public static FontFamily GenericSerif
+ {
+ get
+ {
+ if ( genericSerif == null )
+ {
+ IntPtr generic = IntPtr.Zero;
+ Status status = GDIPlus.GdipGetGenericFontFamilySerif ( out generic );
+ if ( status != Status.Ok )
+ {
+ generic = IntPtr.Zero;
+ throw new Exception ( "Error calling GDIPlus.GdipGetGenericFontFamilySerif: " + status );
+ }
+ genericSerif = new FontFamily ( generic );
+ genericSerif.name = "Times New Roman";
}
return genericSerif;
}
}
- public int GetCellAscent (FontStyle style) {
- throw new NotImplementedException ();
+ //[MONO TODO]
+ //Need to check how to get the Flags attribute to read
+ //bitwise value of the enumeration
+ internal int GetStyleCheck ( FontStyle style )
+ {
+ int styleCheck = 0 ;
+ switch ( style) {
+ case FontStyle.Bold :
+ styleCheck = 1;
+ break;
+ case FontStyle.Italic :
+ styleCheck = 2;
+ break;
+ case FontStyle.Regular :
+ styleCheck = 0;
+ break;
+ case FontStyle.Strikeout :
+ styleCheck = 8;
+ break;
+ case FontStyle.Underline :
+ styleCheck = 4;
+ break;
+ }
+ return styleCheck;
+ }
+
+ public int GetCellAscent ( FontStyle style )
+ {
+ Status status;
+ uint outProperty;
+ int styleCheck = GetStyleCheck ( style ) ;
+ status = GDIPlus.GdipGetCellAscent ( nativeFontFamily, styleCheck, out outProperty );
+ if ( status != Status.Ok )
+ throw new Exception ( "Error calling GDIPlus.GdipGetCellAscent: " + status );
+ return (int)outProperty;
}
- public int GetCellDescent (FontStyle style) {
- throw new NotImplementedException ();
+ public int GetCellDescent ( FontStyle style )
+ {
+ Status status;
+ uint outProperty;
+ int styleCheck = GetStyleCheck ( style ) ;
+ status = GDIPlus.GdipGetCellDescent ( nativeFontFamily, styleCheck, out outProperty );
+ if ( status != Status.Ok )
+ throw new Exception ( "Error calling GDIPlus.GdipGetCellAscent: " + status );
+ return (int)outProperty;
}
- public int GetEmHeight (FontStyle style) {
- throw new NotImplementedException ();
+ public int GetEmHeight ( FontStyle style )
+ {
+ Status status;
+ uint outProperty;
+ int styleCheck = GetStyleCheck ( style ) ;
+ status = GDIPlus.GdipGetEmHeight ( nativeFontFamily, styleCheck, out outProperty );
+ if ( status != Status.Ok )
+ throw new Exception ( "Error calling GDIPlus.GdipGetCellAscent: " + status );
+ return (int)outProperty;
}
- public int GetLineSpacing (FontStyle style) {
- throw new NotImplementedException ();
+ public int GetLineSpacing ( FontStyle style )
+ {
+ Status status;
+ uint outProperty;
+ int styleCheck = GetStyleCheck ( style ) ;
+ status = GDIPlus.GdipGetLineSpacing ( nativeFontFamily, styleCheck, out outProperty );
+ if ( status != Status.Ok )
+ throw new Exception ( "Error calling GDIPlus.GdipGetCellAscent: " + status );
+ return (int)outProperty;
}
- public bool IsStyleAvailable (FontStyle style){
- throw new NotImplementedException ();
+ public bool IsStyleAvailable ( FontStyle style )
+ {
+ Status status;
+ bool outProperty;
+ int styleCheck = GetStyleCheck ( style ) ;
+ status = GDIPlus.GdipIsStyleAvailable ( nativeFontFamily, styleCheck, out outProperty );
+ if ( status != Status.Ok )
+ throw new Exception ( "Error calling GDIPlus.GdipGetCellAscent: " + status );
+ return outProperty;
}
- public void Dispose() {
+ public void Dispose()
+ {
+ Status status;
+ if ( genericSerif != null ) {
+ status = GDIPlus.GdipDeleteFontFamily ( genericSerif.nativeFontFamily );
+ if ( status != Status.Ok )
+ genericSerif.nativeFontFamily = IntPtr.Zero;
+ }
+
+ if ( genericSansSerif != null )
+ {
+ status = GDIPlus.GdipDeleteFontFamily ( genericSansSerif.nativeFontFamily );
+ if ( status != Status.Ok )
+ genericSansSerif.nativeFontFamily = IntPtr.Zero;
+ }
+
+ if ( genericMonospace != null )
+ {
+ status = GDIPlus.GdipDeleteFontFamily ( genericMonospace.nativeFontFamily );
+ if ( status != Status.Ok )
+ genericMonospace.nativeFontFamily = IntPtr.Zero;
+ }
+
+ status = GDIPlus.GdipDeleteFontFamily ( nativeFontFamily );
+ if ( status != Status.Ok )
+ nativeFontFamily = IntPtr.Zero;
+
}
}
}
+
diff --git a/mcs/class/System.Drawing/System.Drawing/FontStyle.cs b/mcs/class/System.Drawing/System.Drawing/FontStyle.cs
index ab019be9ee9..5d360431278 100644
--- a/mcs/class/System.Drawing/System.Drawing/FontStyle.cs
+++ b/mcs/class/System.Drawing/System.Drawing/FontStyle.cs
@@ -10,6 +10,7 @@ using System;
namespace System.Drawing
{
[Flags]
+ [Serializable]
public enum FontStyle {
Regular = 0,
Bold = 1,
diff --git a/mcs/class/System.Drawing/System.Drawing/Graphics.cs b/mcs/class/System.Drawing/System.Drawing/Graphics.cs
index 2ce65ef975c..9f6aa688668 100755
--- a/mcs/class/System.Drawing/System.Drawing/Graphics.cs
+++ b/mcs/class/System.Drawing/System.Drawing/Graphics.cs
@@ -6,19 +6,21 @@
// Authors:
// Gonzalo Paniagua Javier (gonzalo@ximian.com) (stubbed out)
// Alexandre Pigolkine(pigolkine@gmx.de)
+// Jordi Mas i Hernandez (jordi@ximian.com)
//
using System;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.Drawing.Text;
using System.Runtime.InteropServices;
+using System.Text;
namespace System.Drawing
{
[ComVisible(false)]
public sealed class Graphics : MarshalByRefObject, IDisposable
{
- internal IntPtr nativeObject;
+ internal IntPtr nativeObject = IntPtr.Zero;
public delegate bool EnumerateMetafileProc (EmfPlusRecordType recordType,
int flags,
@@ -32,6 +34,16 @@ namespace System.Drawing
{
nativeObject = nativeGraphics;
}
+
+ internal IntPtr NativeObject {
+ get{
+ return nativeObject;
+ }
+
+ set {
+ nativeObject = value;
+ }
+ }
[MonoTODO]
public void AddMetafileComment (byte [] data)
@@ -39,28 +51,39 @@ namespace System.Drawing
throw new NotImplementedException ();
}
- [MonoTODO]
+
public GraphicsContainer BeginContainer ()
{
- throw new NotImplementedException ();
- }
+ int state;
- [MonoTODO]
+ GDIPlus.GdipBeginContainer2 (nativeObject, out state);
+
+ return new GraphicsContainer(state);
+ }
+
public GraphicsContainer BeginContainer (Rectangle dstrect, Rectangle srcrect, GraphicsUnit unit)
{
- throw new NotImplementedException ();
+ int state;
+
+ GDIPlus.GdipBeginContainerI (nativeObject, dstrect, srcrect, unit, out state);
+
+ return new GraphicsContainer (state);
}
- [MonoTODO]
+
public GraphicsContainer BeginContainer (RectangleF dstrect, RectangleF srcrect, GraphicsUnit unit)
{
- throw new NotImplementedException ();
+ int state;
+
+ GDIPlus.GdipBeginContainer (nativeObject, dstrect, srcrect, unit, out state);
+
+ return new GraphicsContainer (state);
}
- [MonoTODO]
+
public void Clear (Color color)
- {
- throw new NotImplementedException ();
+ {
+ GDIPlus.GdipGraphicsClear(nativeObject, color.ToArgb());
}
[MonoTODO]
@@ -68,46 +91,49 @@ namespace System.Drawing
{
}
- [MonoTODO]
+
public void DrawArc (Pen pen, Rectangle rect, float startAngle, float sweepAngle)
{
DrawArc (pen, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle);
}
- [MonoTODO]
+
public void DrawArc (Pen pen, RectangleF rect, float startAngle, float sweepAngle)
{
DrawArc (pen, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle);
}
- [MonoTODO]
+
public void DrawArc (Pen pen, float x, float y, float width, float height, float startAngle, float sweepAngle)
{
GDIPlus.GdipDrawArc (nativeObject, pen.nativeObject,
- x, y, width, height, startAngle, sweepAngle);
+ x, y, width, height, startAngle, sweepAngle);
}
public void DrawArc (Pen pen, int x, int y, int width, int height, float startAngle, float sweepAngle)
- {
+ {
GDIPlus.GdipDrawArcI (nativeObject, pen.nativeObject,
x, y, width, height, startAngle, sweepAngle);
+
}
public void DrawBezier (Pen pen, PointF pt1, PointF pt2, PointF pt3, PointF pt4)
{
GDIPlus.GdipDrawBezier (nativeObject, pen.nativeObject,
- pt1.X, pt1.Y, pt2.X, pt2.Y, pt3.X, pt3.Y, pt4.X, pt4.Y);
+ pt1.X, pt1.Y, pt2.X, pt2.Y, pt3.X, pt3.Y, pt4.X, pt4.Y);
+
}
public void DrawBezier (Pen pen, Point pt1, Point pt2, Point pt3, Point pt4)
{
GDIPlus.GdipDrawBezierI (nativeObject, pen.nativeObject,
- pt1.X, pt1.Y, pt2.X, pt2.Y, pt3.X, pt3.Y, pt4.X, pt4.Y);
+ pt1.X, pt1.Y, pt2.X, pt2.Y, pt3.X, pt3.Y, pt4.X, pt4.Y);
+
}
public void DrawBezier (Pen pen, float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4)
{
- GDIPlus.GdipDrawBezier (nativeObject, pen.nativeObject, x1, y1, x2, y2, x3, y3, x4, y4);
+ GDIPlus.GdipDrawBezier (nativeObject, pen.nativeObject, x1, y1, x2, y2, x3, y3, x4, y4);
}
[MonoTODO]
@@ -150,70 +176,67 @@ namespace System.Drawing
}
}
- [MonoTODO]
+
public void DrawClosedCurve (Pen pen, PointF [] points)
{
- throw new NotImplementedException ();
+ GDIPlus.GdipDrawClosedCurve (nativeObject, pen.nativeObject, points, points.Length);
}
-
- [MonoTODO]
+
public void DrawClosedCurve (Pen pen, Point [] points)
{
- throw new NotImplementedException ();
+ GDIPlus.GdipDrawClosedCurveI (nativeObject, pen.nativeObject, points, points.Length);
}
-
- [MonoTODO]
+
public void DrawClosedCurve (Pen pen, Point [] points, float tension, FillMode fillmode)
{
- throw new NotImplementedException ();
+ GDIPlus.GdipDrawClosedCurve2I (nativeObject, pen.nativeObject, points, points.Length, tension);
}
-
- [MonoTODO]
+
public void DrawClosedCurve (Pen pen, PointF [] points, float tension, FillMode fillmode)
{
- throw new NotImplementedException ();
+ GDIPlus.GdipDrawClosedCurve2 (nativeObject, pen.nativeObject, points, points.Length, tension);
}
-
- [MonoTODO]
+
public void DrawCurve (Pen pen, Point [] points)
{
- throw new NotImplementedException ();
+ GDIPlus.GdipDrawCurveI (nativeObject, pen.nativeObject, points, points.Length);
}
-
- [MonoTODO]
+
public void DrawCurve (Pen pen, PointF [] points)
{
- throw new NotImplementedException ();
+ GDIPlus.GdipDrawCurve (nativeObject, pen.nativeObject, points, points.Length);
+
}
-
- [MonoTODO]
+
public void DrawCurve (Pen pen, PointF [] points, float tension)
- {
- throw new NotImplementedException ();
+ {
+ GDIPlus.GdipDrawCurve2 (nativeObject, pen.nativeObject, points, points.Length, tension);
+
}
-
- [MonoTODO]
+
public void DrawCurve (Pen pen, Point [] points, float tension)
{
- throw new NotImplementedException ();
+ GDIPlus.GdipDrawCurve2I (nativeObject, pen.nativeObject, points, points.Length, tension);
+
}
-
+
[MonoTODO]
public void DrawCurve (Pen pen, PointF [] points, int offset, int numberOfSegments)
{
- throw new NotImplementedException ();
+
}
- [MonoTODO]
public void DrawCurve (Pen pen, Point [] points, int offset, int numberOfSegments, float tension)
{
- throw new NotImplementedException ();
+ GDIPlus.GdipDrawCurve3I (nativeObject, pen.nativeObject, points, points.Length,
+ offset, numberOfSegments, tension);
}
- [MonoTODO]
+
public void DrawCurve (Pen pen, PointF [] points, int offset, int numberOfSegments, float tension)
{
- throw new NotImplementedException ();
+ GDIPlus.GdipDrawCurve3 (nativeObject, pen.nativeObject, points, points.Length,
+ offset, numberOfSegments, tension);
}
public void DrawEllipse (Pen pen, Rectangle rect)
@@ -253,53 +276,53 @@ namespace System.Drawing
{
throw new NotImplementedException ();
}
-
- [MonoTODO]
+
public void DrawImage (Image image, RectangleF rect)
{
- throw new NotImplementedException ();
+ GDIPlus.GdipDrawImageRect(nativeObject, image.NativeObject, rect.X, rect.Y,
+ rect.Width, rect.Height);
}
- [MonoTODO]
+
public void DrawImage (Image image, PointF point)
{
- throw new NotImplementedException ();
+ GDIPlus.GdipDrawImage (nativeObject, image.NativeObject, point.X, point.Y);
}
- [MonoTODO]
+
public void DrawImage (Image image, Point [] destPoints)
{
- throw new NotImplementedException ();
+ GDIPlus.GdipDrawImagePointsI (nativeObject, image.NativeObject, destPoints, destPoints.Length);
}
- [MonoTODO]
+
public void DrawImage (Image image, Point point)
{
- throw new NotImplementedException ();
+ DrawImage (image, point.X, point.Y);
}
- [MonoTODO]
+
public void DrawImage (Image image, Rectangle rect)
{
- throw new NotImplementedException ();
+ DrawImage(image, rect.X, rect.Y, rect.Width, rect.Height);
}
- [MonoTODO]
+
public void DrawImage (Image image, PointF [] destPoints)
{
- throw new NotImplementedException ();
+ GDIPlus.GdipDrawImagePoints (nativeObject, image.NativeObject, destPoints, destPoints.Length);
}
- [MonoTODO]
+
public void DrawImage (Image image, int x, int y)
{
- throw new NotImplementedException ();
+ GDIPlus.GdipDrawImageI (nativeObject, image.NativeObject, x, y);
}
- [MonoTODO]
+
public void DrawImage (Image image, float x, float y)
{
- throw new NotImplementedException ();
+ GDIPlus.GdipDrawImage (nativeObject, image.NativeObject, x, y);
}
[MonoTODO]
@@ -327,19 +350,21 @@ namespace System.Drawing
}
[MonoTODO]
- public void DrawImage (Image image, Point [] destPoints, Rectangle srcRect, GraphicsUnit srcUnit, ImageAttributes imageAttr)
+ public void DrawImage (Image image, Point [] destPoints, Rectangle srcRect, GraphicsUnit srcUnit,
+ ImageAttributes imageAttr)
{
throw new NotImplementedException ();
}
-
- [MonoTODO]
+
public void DrawImage (Image image, float x, float y, float width, float height)
{
- throw new NotImplementedException ();
+ GDIPlus.GdipDrawImageRect(nativeObject, image.NativeObject, x, y,
+ width, height);
}
[MonoTODO]
- public void DrawImage (Image image, PointF [] destPoints, RectangleF srcRect, GraphicsUnit srcUnit, ImageAttributes imageAttr)
+ public void DrawImage (Image image, PointF [] destPoints, RectangleF srcRect, GraphicsUnit srcUnit,
+ ImageAttributes imageAttr)
{
throw new NotImplementedException ();
}
@@ -349,113 +374,121 @@ namespace System.Drawing
{
throw new NotImplementedException ();
}
-
- [MonoTODO]
+
public void DrawImage (Image image, int x, int y, int width, int height)
{
GDIPlus.GdipDrawImageRectI (nativeObject, image.nativeObject, x, y, width, height);
}
- [MonoTODO]
public void DrawImage (Image image, float x, float y, RectangleF srcRect, GraphicsUnit srcUnit)
{
- throw new NotImplementedException ();
+ GDIPlus.GdipDrawImagePointRect(nativeObject, image.nativeObject, x, y, srcRect.X, srcRect.Y, srcRect.Width, srcRect.Height, srcUnit);
}
[MonoTODO]
- public void DrawImage (Image image, PointF [] destPoints, RectangleF srcRect, GraphicsUnit srcUnit, ImageAttributes imageAttr, DrawImageAbort callback)
+ public void DrawImage (Image image, PointF [] destPoints, RectangleF srcRect, GraphicsUnit srcUnit,
+ ImageAttributes imageAttr, DrawImageAbort callback)
{
throw new NotImplementedException ();
}
[MonoTODO]
- public void DrawImage (Image image, Point [] destPoints, Rectangle srcRect, GraphicsUnit srcUnit, ImageAttributes imageAttr, DrawImageAbort callback)
+ public void DrawImage (Image image, Point [] destPoints, Rectangle srcRect, GraphicsUnit srcUnit,
+ ImageAttributes imageAttr, DrawImageAbort callback)
{
throw new NotImplementedException ();
}
[MonoTODO]
- public void DrawImage (Image image, Point [] destPoints, Rectangle srcRect, GraphicsUnit srcUnit, ImageAttributes imageAttr, DrawImageAbort callback, int callbackData)
+ public void DrawImage (Image image, Point [] destPoints, Rectangle srcRect, GraphicsUnit srcUnit,
+ ImageAttributes imageAttr, DrawImageAbort callback, int callbackData)
{
throw new NotImplementedException ();
}
[MonoTODO]
- public void DrawImage (Image image, Rectangle destRect, float srcX, float srcY, float srcWidth, float srcHeight, GraphicsUnit srcUnit)
+ public void DrawImage (Image image, Rectangle destRect, float srcX, float srcY, float srcWidth, float srcHeight,
+ GraphicsUnit srcUnit)
{
throw new NotImplementedException ();
}
[MonoTODO]
- public void DrawImage (Image image, PointF [] destPoints, RectangleF srcRect, GraphicsUnit srcUnit, ImageAttributes imageAttr, DrawImageAbort callback, int callbackData)
+ public void DrawImage (Image image, PointF [] destPoints, RectangleF srcRect, GraphicsUnit srcUnit,
+ ImageAttributes imageAttr, DrawImageAbort callback, int callbackData)
{
throw new NotImplementedException ();
}
[MonoTODO]
- public void DrawImage (Image image, Rectangle destRect, int srcX, int srcY, int srcWidth, int srcHeight, GraphicsUnit srcUnit)
+ public void DrawImage (Image image, Rectangle destRect, int srcX, int srcY, int srcWidth, int srcHeight,
+ GraphicsUnit srcUnit)
{
throw new NotImplementedException ();
}
[MonoTODO]
- public void DrawImage (Image image, Rectangle destRect, float srcX, float srcY, float srcWidth, float srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttrs)
+ public void DrawImage (Image image, Rectangle destRect, float srcX, float srcY, float srcWidth, float srcHeight,
+ GraphicsUnit srcUnit, ImageAttributes imageAttrs)
{
throw new NotImplementedException ();
}
-
- [MonoTODO]
- public void DrawImage (Image image, Rectangle destRect, int srcX, int srcY, int srcWidth, int srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttr)
- {
- throw new NotImplementedException ();
+
+ public void DrawImage (Image image, Rectangle destRect, int srcX, int srcY, int srcWidth, int srcHeight,
+ GraphicsUnit srcUnit, ImageAttributes imageAttr)
+ {
+ GDIPlus.GdipDrawImageRectRectI (nativeObject, image.NativeObject,
+ destRect.X, destRect.Y, destRect.Width, destRect.Height,
+ srcX, srcY, srcWidth, srcHeight, srcUnit, imageAttr.NativeObject, IntPtr.Zero, 0);
+
}
[MonoTODO]
- public void DrawImage (Image image, Rectangle destRect, int srcX, int srcY, int srcWidth, int srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttr, DrawImageAbort callback)
+ public void DrawImage (Image image, Rectangle destRect, int srcX, int srcY, int srcWidth, int srcHeight,
+ GraphicsUnit srcUnit, ImageAttributes imageAttr, DrawImageAbort callback)
{
throw new NotImplementedException ();
}
[MonoTODO]
- public void DrawImage (Image image, Rectangle destRect, float srcX, float srcY, float srcWidth, float srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttrs, DrawImageAbort callback)
+ public void DrawImage (Image image, Rectangle destRect, float srcX, float srcY, float srcWidth, float srcHeight,
+ GraphicsUnit srcUnit, ImageAttributes imageAttrs, DrawImageAbort callback)
{
throw new NotImplementedException ();
}
[MonoTODO]
- public void DrawImage (Image image, Rectangle destRect, float srcX, float srcY, float srcWidth, float srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttrs, DrawImageAbort callback, IntPtr callbackData)
+ public void DrawImage (Image image, Rectangle destRect, float srcX, float srcY, float srcWidth, float srcHeight,
+ GraphicsUnit srcUnit, ImageAttributes imageAttrs, DrawImageAbort callback, IntPtr callbackData)
{
throw new NotImplementedException ();
}
[MonoTODO]
- public void DrawImage (Image image, Rectangle destRect, int srcX, int srcY, int srcWidth, int srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttrs, DrawImageAbort callback, IntPtr callbackData)
+ public void DrawImage (Image image, Rectangle destRect, int srcX, int srcY, int srcWidth, int srcHeight,
+ GraphicsUnit srcUnit, ImageAttributes imageAttrs, DrawImageAbort callback, IntPtr callbackData)
{
throw new NotImplementedException ();
- }
-
- [MonoTODO]
+ }
+
public void DrawImageUnscaled (Image image, Point point)
{
- throw new NotImplementedException ();
+ DrawImage(image, point.X, point.Y);
}
-
- [MonoTODO]
+
public void DrawImageUnscaled (Image image, Rectangle rect)
{
- throw new NotImplementedException ();
+ DrawImage(image, rect.X, rect.Y, rect.Width, rect.Height);
}
-
- [MonoTODO]
+
public void DrawImageUnscaled (Image image, int x, int y)
{
- throw new NotImplementedException ();
+ DrawImage(image, x, y);
}
- [MonoTODO]
public void DrawImageUnscaled (Image image, int x, int y, int width, int height)
{
- throw new NotImplementedException ();
+ DrawImage(image, x, y, width, height);
}
public void DrawLine (Pen pen, PointF pt1, PointF pt2)
@@ -463,62 +496,58 @@ namespace System.Drawing
GDIPlus.GdipDrawLine (
nativeObject, pen.nativeObject,
pt1.X, pt1.Y,
- pt2.X, pt2.Y);
+ pt2.X, pt2.Y);
+
}
public void DrawLine (Pen pen, Point pt1, Point pt2)
{
- GDIPlus.GdipDrawLine (
+ GDIPlus.GdipDrawLineI (
nativeObject, pen.nativeObject,
pt1.X, pt1.Y,
- pt2.X, pt2.Y);
- }
+ pt2.X, pt2.Y);
+ }
public void DrawLine (Pen pen, int x1, int y1, int x2, int y2)
{
- GDIPlus.GdipDrawLineI (nativeObject, pen.nativeObject, x1, y1, x2, y2);
+ GDIPlus.GdipDrawLineI (nativeObject, pen.nativeObject, x1, y1, x2, y2);
}
public void DrawLine (Pen pen, float x1, float y1, float x2, float y2)
{
- GDIPlus.GdipDrawLine (nativeObject, pen.nativeObject, x1, y1, x2, y2);
+ GDIPlus.GdipDrawLine (nativeObject, pen.nativeObject, x1, y1, x2, y2);
}
public void DrawLines (Pen pen, PointF [] points)
{
- GDIPlus.GdipDrawLines (nativeObject, pen.nativeObject, points, points.Length);
+ GDIPlus.GdipDrawLines (nativeObject, pen.nativeObject, points, points.Length);
}
public void DrawLines (Pen pen, Point [] points)
{
- GDIPlus.GdipDrawLinesI (nativeObject, pen.nativeObject, points, points.Length);
+ GDIPlus.GdipDrawLinesI (nativeObject, pen.nativeObject, points, points.Length);
}
- [MonoTODO]
public void DrawPath (Pen pen, GraphicsPath path)
{
- throw new NotImplementedException ();
+ GDIPlus.GdipDrawPath (nativeObject, pen.nativeObject, path.nativePath);
}
-
- [MonoTODO]
+
public void DrawPie (Pen pen, Rectangle rect, float startAngle, float sweepAngle)
{
DrawPie (pen, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle);
}
-
- [MonoTODO]
+
public void DrawPie (Pen pen, RectangleF rect, float startAngle, float sweepAngle)
{
DrawPie (pen, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle);
}
-
- [MonoTODO]
+
public void DrawPie (Pen pen, float x, float y, float width, float height, float startAngle, float sweepAngle)
{
GDIPlus.GdipDrawPie (nativeObject, pen.nativeObject, x, y, width, height, startAngle, sweepAngle);
}
-
- [MonoTODO]
+
public void DrawPie (Pen pen, int x, int y, int width, int height, float startAngle, float sweepAngle)
{
GDIPlus.GdipDrawPieI (nativeObject, pen.nativeObject, x, y, width, height, startAngle, sweepAngle);
@@ -566,54 +595,41 @@ namespace System.Drawing
DrawRectangle(pen, rc.Left, rc.Top, rc.Width, rc.Height);
}
- [MonoTODO("Ignores the font")]
+
public void DrawString (string s, Font font, Brush brush, RectangleF layoutRectangle)
- {
- GpRectF rf = new GpRectF (layoutRectangle);
-
- GDIPlus.GdipDrawString (nativeObject, s, s.Length, IntPtr.Zero, ref rf, IntPtr.Zero, brush.nativeObject);
+ {
+ GDIPlus.GdipDrawString (nativeObject, s, s.Length, font.NativeObject, ref layoutRectangle, IntPtr.Zero, brush.nativeObject);
}
[MonoTODO("This ignores the font")]
public void DrawString (string s, Font font, Brush brush, PointF point)
{
- GpRectF rc = new GpRectF ();
- rc.left = point.X;
- rc.top = point.Y;
- rc.right = 0;
- rc.bottom = 0;
- GDIPlus.GdipDrawString (nativeObject, s, s.Length, IntPtr.Zero, ref rc, IntPtr.Zero, brush.nativeObject);
+ RectangleF rc = new RectangleF (point.X, point.Y, 0, 0);
+ GDIPlus.GdipDrawString (nativeObject, s, s.Length, font.NativeObject, ref rc, IntPtr.Zero, brush.nativeObject);
}
[MonoTODO ("This ignores the font and format")]
public void DrawString (string s, Font font, Brush brush, PointF point, StringFormat format)
{
- GpRectF rc = new GpRectF ();
- rc.left = point.X;
- rc.top = point.Y;
- rc.right = 0;
- rc.bottom = 0;
- GDIPlus.GdipDrawString (nativeObject, s, s.Length, IntPtr.Zero, ref rc, IntPtr.Zero, brush.nativeObject);
+ RectangleF rc = new RectangleF (point.X, point.Y, 0, 0);
+ GDIPlus.GdipDrawString (nativeObject, s, s.Length, font.NativeObject, ref rc, IntPtr.Zero, brush.nativeObject);
}
[MonoTODO ("This ignores the font and the format")]
public void DrawString (string s, Font font, Brush brush, RectangleF layoutRectangle, StringFormat format)
{
- GpRectF rect = new GpRectF (layoutRectangle);
-
- GDIPlus.GdipDrawString (nativeObject, s, s.Length, IntPtr.Zero, ref rect, IntPtr.Zero, brush.nativeObject);
-
+ GDIPlus.GdipDrawString (nativeObject, s, s.Length, font.NativeObject, ref layoutRectangle,
+ IntPtr.Zero, brush.nativeObject);
}
[MonoTODO("This ignores the font")]
public void DrawString (string s, Font font, Brush brush, float x, float y)
{
- GpRectF rc = new GpRectF ();
- rc.left = x;
- rc.top = y;
- rc.right = 0;
- rc.bottom = 0;
- GDIPlus.GdipDrawString (nativeObject, s, s.Length, IntPtr.Zero, ref rc, IntPtr.Zero, brush.nativeObject);
+ Console.WriteLine ("DrawString!");
+ RectangleF rc = new RectangleF (x, y, 0, 0);
+
+ GDIPlus.GdipDrawString (nativeObject, s, s.Length, font.NativeObject,
+ ref rc, IntPtr.Zero, brush.nativeObject);
}
[MonoTODO]
@@ -622,10 +638,10 @@ namespace System.Drawing
//throw new NotImplementedException ();
}
- [MonoTODO]
+
public void EndContainer (GraphicsContainer container)
{
- throw new NotImplementedException ();
+ GDIPlus.GdipEndContainer(nativeObject, container.NativeObject);
}
[MonoTODO]
@@ -843,11 +859,10 @@ namespace System.Drawing
{
throw new NotImplementedException ();
}
-
- [MonoTODO]
+
public void ExcludeClip (Rectangle rect)
{
- throw new NotImplementedException ();
+ GDIPlus.GdipSetClipRectI (nativeObject, rect.X, rect.Y, rect.Width, rect.Height, CombineMode.Exclude);
}
[MonoTODO]
@@ -856,40 +871,37 @@ namespace System.Drawing
throw new NotImplementedException ();
}
- [MonoTODO]
+
public void FillClosedCurve (Brush brush, PointF [] points)
{
- throw new NotImplementedException ();
+ GDIPlus.GdipFillClosedCurve (nativeObject, brush.NativeObject, points, points.Length);
}
- [MonoTODO]
+
public void FillClosedCurve (Brush brush, Point [] points)
{
- throw new NotImplementedException ();
+ GDIPlus.GdipFillClosedCurveI (nativeObject, brush.NativeObject, points, points.Length);
}
- [MonoTODO]
+
public void FillClosedCurve (Brush brush, PointF [] points, FillMode fillmode)
{
- throw new NotImplementedException ();
+ FillClosedCurve (brush, points, fillmode, 0.5f);
}
-
- [MonoTODO]
+
public void FillClosedCurve (Brush brush, Point [] points, FillMode fillmode)
{
- throw new NotImplementedException ();
+ FillClosedCurve (brush, points, fillmode, 0.5f);
}
- [MonoTODO]
public void FillClosedCurve (Brush brush, PointF [] points, FillMode fillmode, float tension)
{
- throw new NotImplementedException ();
+ GDIPlus.GdipFillClosedCurve2 (nativeObject, brush.NativeObject, points, points.Length, tension, fillmode);
}
- [MonoTODO]
public void FillClosedCurve (Brush brush, Point [] points, FillMode fillmode, float tension)
{
- throw new NotImplementedException ();
+ GDIPlus.GdipFillClosedCurve2I (nativeObject, brush.NativeObject, points, points.Length, tension, fillmode);
}
public void FillEllipse (Brush brush, Rectangle rect)
@@ -912,28 +924,25 @@ namespace System.Drawing
GDIPlus.GdipFillEllipseI (nativeObject, brush.nativeObject, x, y, width, height);
}
- [MonoTODO]
public void FillPath (Brush brush, GraphicsPath path)
{
- throw new NotImplementedException ();
+ GDIPlus.GdipFillPath (nativeObject, brush.NativeObject, path.NativeObject);
}
- [MonoTODO]
public void FillPie (Brush brush, Rectangle rect, float startAngle, float sweepAngle)
{
- throw new NotImplementedException ();
+ GDIPlus.GdipFillPie (nativeObject, brush.NativeObject, rect.X, rect.Y, rect.Width, rect.Height,
+ startAngle, sweepAngle);
}
- [MonoTODO]
public void FillPie (Brush brush, int x, int y, int width, int height, int startAngle, int sweepAngle)
{
- throw new NotImplementedException ();
+ GDIPlus.GdipFillPieI (nativeObject, brush.NativeObject, x, y, width, height, startAngle, sweepAngle);
}
- [MonoTODO]
public void FillPie (Brush brush, float x, float y, float width, float height, float startAngle, float sweepAngle)
{
- throw new NotImplementedException ();
+ GDIPlus.GdipFillPie (nativeObject, brush.NativeObject, x, y, width, height, startAngle, sweepAngle);
}
public void FillPolygon (Brush brush, PointF [] points)
@@ -997,7 +1006,7 @@ namespace System.Drawing
[MonoTODO]
public void Flush ()
{
- Flush(FlushIntention.Flush);
+ Flush (FlushIntention.Flush);
}
[MonoTODO]
@@ -1006,12 +1015,12 @@ namespace System.Drawing
throw new NotImplementedException ();
}
- [MonoTODO]
+
public static Graphics FromHdc (IntPtr hdc)
{
int graphics;
GDIPlus.GdipCreateFromHDC (hdc, out graphics);
- Graphics result = new Graphics ((IntPtr)graphics);
+ Graphics result = new Graphics ((IntPtr) graphics);
return result;
}
@@ -1026,12 +1035,14 @@ namespace System.Drawing
{
throw new NotImplementedException ();
}
-
- [MonoTODO]
+
public static Graphics FromHwnd (IntPtr hwnd)
{
- Graphics result = new Graphics(IntPtr.Zero);
- return result;
+ IntPtr graphics;
+
+ GDIPlus.GdipCreateFromHWND (hwnd, out graphics);
+
+ return new Graphics (graphics);
}
[MonoTODO]
@@ -1046,7 +1057,7 @@ namespace System.Drawing
if (image == null) throw new ArgumentException ();
int graphics;
GDIPlus.GdipGetImageGraphicsContext (image.nativeObject, out graphics);
- Graphics result = new Graphics ((IntPtr)graphics);
+ Graphics result = new Graphics ((IntPtr) graphics);
return result;
}
@@ -1061,13 +1072,16 @@ namespace System.Drawing
{
int hdc;
GDIPlus.GdipGetDC (nativeObject, out hdc);
- return (IntPtr)hdc;
+ return (IntPtr) hdc;
}
- [MonoTODO]
+
public Color GetNearestColor (Color color)
{
- throw new NotImplementedException ();
+ int argb;
+
+ GDIPlus.GdipGetNearestColor (nativeObject, out argb);
+ return Color.FromArgb (argb);
}
[MonoTODO]
@@ -1075,65 +1089,73 @@ namespace System.Drawing
{
throw new NotImplementedException ();
}
-
- [MonoTODO]
+
public void IntersectClip (RectangleF rect)
{
- throw new NotImplementedException ();
+ GDIPlus.GdipSetClipRect (nativeObject, rect.X, rect.Y, rect.Width, rect.Height, CombineMode.Intersect);
}
- [MonoTODO]
public void IntersectClip (Rectangle rect)
- {
- throw new NotImplementedException ();
+ {
+ GDIPlus.GdipSetClipRectI (nativeObject, rect.X, rect.Y, rect.Width, rect.Height, CombineMode.Intersect);
}
- [MonoTODO]
public bool IsVisible (Point point)
{
- throw new NotImplementedException ();
+ bool isVisible = false;
+
+ GDIPlus.GdipIsVisiblePointI (nativeObject, point.X, point.Y, out isVisible);
+
+ return isVisible;
}
- [MonoTODO]
+
public bool IsVisible (RectangleF rect)
{
- throw new NotImplementedException ();
+ bool isVisible = false;
+
+ GDIPlus.GdipIsVisibleRect (nativeObject, rect.X, rect.Y, rect.Width, rect.Height, out isVisible);
+
+ return isVisible;
}
- [MonoTODO]
public bool IsVisible (PointF point)
{
- throw new NotImplementedException ();
- }
+ bool isVisible = false;
- [MonoTODO]
+ GDIPlus.GdipIsVisiblePoint (nativeObject, point.X, point.Y, out isVisible);
+
+ return isVisible;
+ }
+
public bool IsVisible (Rectangle rect)
{
- throw new NotImplementedException ();
- }
+ bool isVisible = false;
- [MonoTODO]
+ GDIPlus.GdipIsVisibleRectI (nativeObject, rect.X, rect.Y, rect.Width, rect.Height, out isVisible);
+
+ return isVisible;
+ }
+
public bool IsVisible (float x, float y)
{
- throw new NotImplementedException ();
+ return IsVisible (new PointF (x, y));
}
-
- [MonoTODO]
+
public bool IsVisible (int x, int y)
{
- throw new NotImplementedException ();
+ return IsVisible (new Point (x, y));
}
-
- [MonoTODO]
+
public bool IsVisible (float x, float y, float width, float height)
{
- throw new NotImplementedException ();
+ return IsVisible (new RectangleF (x, y, width, height));
}
- [MonoTODO]
+
public bool IsVisible (int x, int y, int width, int height)
{
- throw new NotImplementedException ();
+ return IsVisible (new Rectangle (x, y, width, height));
}
[MonoTODO]
@@ -1179,7 +1201,8 @@ namespace System.Drawing
}
[MonoTODO]
- public SizeF MeasureString (string text, Font font, SizeF layoutArea, StringFormat stringFormat, out int charactersFitted, out int linesFilled)
+ public SizeF MeasureString (string text, Font font, SizeF layoutArea, StringFormat stringFormat,
+ out int charactersFitted, out int linesFilled)
{
throw new NotImplementedException ();
}
@@ -1193,8 +1216,7 @@ namespace System.Drawing
{
GDIPlus.GdipMultiplyWorldTransform (nativeObject, matrix.nativeMatrix, order);
}
-
- [MonoTODO]
+
public void ReleaseHdc (IntPtr hdc)
{
GDIPlus.GdipReleaseDC (nativeObject, hdc);
@@ -1206,10 +1228,10 @@ namespace System.Drawing
throw new NotImplementedException ();
}
- [MonoTODO]
+
public void ResetClip ()
{
- throw new NotImplementedException ();
+ GDIPlus.GdipResetClip(nativeObject);
}
public void ResetTransform ()
@@ -1242,8 +1264,10 @@ namespace System.Drawing
{
//return implementation.Save();
GraphicsState state = new GraphicsState();
- state.matrix = Transform.Clone();
- GDIPlus.GdipSaveGraphics (nativeObject, out state.nativeState);
+ state.matrix = Transform.Clone ();
+ uint saveState;
+ GDIPlus.GdipSaveGraphics (nativeObject, out saveState);
+ state.nativeState = saveState;
return state;
}
@@ -1257,82 +1281,90 @@ namespace System.Drawing
GDIPlus.GdipScaleWorldTransform (nativeObject, sx, sy, order);
}
- [MonoTODO]
+
public void SetClip (RectangleF rect)
{
- throw new NotImplementedException ();
+ SetClip (rect, CombineMode.Replace);
}
- [MonoTODO]
+
public void SetClip (GraphicsPath path)
{
- throw new NotImplementedException ();
+ SetClip (path, CombineMode.Replace);
}
- [MonoTODO]
+
public void SetClip (Rectangle rect)
{
- throw new NotImplementedException ();
+ SetClip (rect, CombineMode.Replace);
}
- [MonoTODO]
+
public void SetClip (Graphics g)
{
- throw new NotImplementedException ();
+ SetClip (g, CombineMode.Replace);
}
- [MonoTODO]
+
public void SetClip (Graphics g, CombineMode combineMode)
{
- throw new NotImplementedException ();
+ GDIPlus.GdipSetClipGraphics (nativeObject, g.NativeObject, combineMode);
}
- [MonoTODO]
+
public void SetClip (Rectangle rect, CombineMode combineMode)
{
- throw new NotImplementedException ();
+ GDIPlus.GdipSetClipRectI (nativeObject, rect.X, rect.Y, rect.Width, rect.Height, combineMode);
}
- [MonoTODO]
+
public void SetClip (RectangleF rect, CombineMode combineMode)
{
- throw new NotImplementedException ();
+ GDIPlus.GdipSetClipRect (nativeObject, rect.X, rect.Y, rect.Width, rect.Height, combineMode);
}
[MonoTODO]
public void SetClip (Region region, CombineMode combineMode)
{
- throw new NotImplementedException ();
+ //GDIPlus.GdipSetClipRegion(nativeObject, region.NativeObject, combineMode); //TODO: Region not implemented yet
}
- [MonoTODO]
+
public void SetClip (GraphicsPath path, CombineMode combineMode)
{
- throw new NotImplementedException ();
+ GDIPlus.GdipSetClipPath (nativeObject, path.NativeObject, combineMode);
}
- [MonoTODO]
+
public void TransformPoints (CoordinateSpace destSpace, CoordinateSpace srcSpace, PointF [] pts)
{
- throw new NotImplementedException ();
+ IntPtr ptrPt = GDIPlus.FromPointToUnManagedMemory (pts);
+
+ Status status = GDIPlus.GdipTransformPoints (nativeObject, destSpace, srcSpace, ptrPt, pts.Length);
+
+ GDIPlus.FromUnManagedMemoryToPoint (ptrPt, pts);
}
- [MonoTODO]
+
public void TransformPoints (CoordinateSpace destSpace, CoordinateSpace srcSpace, Point [] pts)
- {
- throw new NotImplementedException ();
+ {
+ IntPtr ptrPt = GDIPlus.FromPointToUnManagedMemoryI (pts);
+
+ Status status = GDIPlus.GdipTransformPointsI (nativeObject, destSpace, srcSpace, ptrPt, pts.Length);
+
+ GDIPlus.FromUnManagedMemoryToPointI (ptrPt, pts);
}
- [MonoTODO]
+
public void TranslateClip (int dx, int dy)
{
- throw new NotImplementedException ();
+ GDIPlus.GdipTranslateClipI (nativeObject, dx, dy);
}
- [MonoTODO]
+
public void TranslateClip (float dx, float dy)
{
- throw new NotImplementedException ();
+ GDIPlus.GdipTranslateClip (nativeObject, dx, dy);
}
public void TranslateTransform (float dx, float dy)
@@ -1340,10 +1372,9 @@ namespace System.Drawing
TranslateTransform (dx, dy, MatrixOrder.Prepend);
}
- [MonoTODO]
+
public void TranslateTransform (float dx, float dy, MatrixOrder order)
- {
- //transform.Translate(dx, dy, order);
+ {
GDIPlus.GdipTranslateWorldTransform (nativeObject, dx, dy, order);
}
@@ -1358,86 +1389,118 @@ namespace System.Drawing
public RectangleF ClipBounds {
get {
- throw new NotImplementedException ();
+ RectangleF rect = new RectangleF ();
+ GDIPlus.GdipGetClipBounds (nativeObject, out rect);
+ return rect;
}
}
public CompositingMode CompositingMode {
get {
- throw new NotImplementedException ();
+ CompositingMode mode;
+ GDIPlus.GdipGetCompositingMode (nativeObject, out mode);
+ return mode;
}
set {
- throw new NotImplementedException ();
+
+ GDIPlus.GdipSetCompositingMode (nativeObject, value);
}
}
public CompositingQuality CompositingQuality {
get {
- throw new NotImplementedException ();
+ CompositingQuality quality;
+
+ GDIPlus.GdipGetCompositingQuality (nativeObject, out quality);
+ return quality;
}
set {
- throw new NotImplementedException ();
+ GDIPlus.GdipSetCompositingQuality (nativeObject, value);
}
}
public float DpiX {
get {
- throw new NotImplementedException ();
+ float x;
+
+ GDIPlus.GdipGetDpiX (nativeObject, out x);
+ return x;
}
}
public float DpiY {
get {
- throw new NotImplementedException ();
+ float y;
+
+ GDIPlus.GdipGetDpiY (nativeObject, out y);
+ return y;
}
}
public InterpolationMode InterpolationMode {
- get {
- throw new NotImplementedException ();
+ get {
+ InterpolationMode imode = InterpolationMode.Invalid;
+ GDIPlus.GdipGetInterpolationMode (nativeObject, out imode);
+ return imode;
}
set {
- throw new NotImplementedException ();
+ GDIPlus.GdipSetInterpolationMode (nativeObject, value);
}
}
public bool IsClipEmpty {
get {
- throw new NotImplementedException ();
+ bool isEmpty = false;
+
+ GDIPlus.GdipIsClipEmpty (nativeObject, out isEmpty);
+ return isEmpty;
}
}
public bool IsVisibleClipEmpty {
get {
- throw new NotImplementedException ();
+ bool isEmpty = false;
+
+ GDIPlus.GdipIsVisibleClipEmpty (nativeObject, out isEmpty);
+ return isEmpty;
}
}
public float PageScale {
get {
- throw new NotImplementedException ();
+ float scale;
+
+ GDIPlus.GdipGetPageScale (nativeObject, out scale);
+ return scale;
}
set {
- throw new NotImplementedException ();
+ GDIPlus.GdipSetPageScale (nativeObject, value);
}
}
public GraphicsUnit PageUnit {
get {
- throw new NotImplementedException ();
+ GraphicsUnit unit;
+
+ GDIPlus.GdipGetPageUnit (nativeObject, out unit);
+ return unit;
}
set {
- throw new NotImplementedException ();
+ GDIPlus.GdipSetPageUnit (nativeObject, value);
}
}
public PixelOffsetMode PixelOffsetMode {
get {
- throw new NotImplementedException ();
+ PixelOffsetMode pixelOffset = PixelOffsetMode.Invalid;
+
+ GDIPlus.GdipGetPixelOffsetMode (nativeObject, out pixelOffset);
+
+ return pixelOffset;
}
set {
- throw new NotImplementedException ();
+ GDIPlus.GdipSetPixelOffsetMode (nativeObject, value);
}
}
@@ -1457,28 +1520,41 @@ namespace System.Drawing
public SmoothingMode SmoothingMode {
get {
- throw new NotImplementedException ();
+ SmoothingMode mode = SmoothingMode.Invalid;
+
+ GDIPlus.GdipGetSmoothingMode (nativeObject, out mode);
+
+ return mode;
}
+
set {
- throw new NotImplementedException ();
+ GDIPlus.GdipSetSmoothingMode (nativeObject, value);
}
}
public int TextContrast {
- get {
- throw new NotImplementedException ();
+ get {
+ int contrast;
+
+ GDIPlus.GdipGetTextContrast (nativeObject, out contrast);
+ return contrast;
}
- set {
- throw new NotImplementedException ();
+
+ set {
+ GDIPlus.GdipSetTextContrast (nativeObject, value);
}
}
public TextRenderingHint TextRenderingHint {
get {
- throw new NotImplementedException ();
+ TextRenderingHint hint;
+
+ GDIPlus.GdipGetTextRenderingHint (nativeObject, out hint);
+ return hint;
}
+
set {
- throw new NotImplementedException ();
+ GDIPlus.GdipSetTextRenderingHint (nativeObject, value);
}
}
@@ -1496,7 +1572,10 @@ namespace System.Drawing
public RectangleF VisibleClipBounds {
get {
- throw new NotImplementedException ();
+ RectangleF rect;
+
+ GDIPlus.GdipGetVisibleClipBounds (nativeObject, out rect);
+ return rect;
}
}
}
diff --git a/mcs/class/System.Drawing/System.Drawing/GraphicsUnit.cs b/mcs/class/System.Drawing/System.Drawing/GraphicsUnit.cs
index 0b8f239ebcb..1b9cc27f4aa 100644
--- a/mcs/class/System.Drawing/System.Drawing/GraphicsUnit.cs
+++ b/mcs/class/System.Drawing/System.Drawing/GraphicsUnit.cs
@@ -8,6 +8,7 @@
using System;
namespace System.Drawing
{
+ [Serializable]
public enum GraphicsUnit {
World = 0,
Display = 1,
diff --git a/mcs/class/System.Drawing/System.Drawing/Image.cs b/mcs/class/System.Drawing/System.Drawing/Image.cs
index 258d5177a07..13e6a06239a 100644
--- a/mcs/class/System.Drawing/System.Drawing/Image.cs
+++ b/mcs/class/System.Drawing/System.Drawing/Image.cs
@@ -32,7 +32,7 @@ public abstract class Image : MarshalByRefObject, IDisposable , ICloneable, ISer
protected PixelFormat pixel_format;
protected ColorPalette colorPalette;
- ImageFormat raw_format;
+ protected ImageFormat raw_format;
// constructor
public Image ()
@@ -44,6 +44,8 @@ public abstract class Image : MarshalByRefObject, IDisposable , ICloneable, ISer
private Image (SerializationInfo info, StreamingContext context)
{
}
+
+
void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
{
@@ -336,6 +338,15 @@ public abstract class Image : MarshalByRefObject, IDisposable , ICloneable, ISer
}
}
+ internal IntPtr NativeObject{
+ get{
+ return nativeObject;
+ }
+ set {
+ nativeObject = value;
+ }
+ }
+
public void Dispose ()
{
Dispose (true);
@@ -351,7 +362,7 @@ public abstract class Image : MarshalByRefObject, IDisposable , ICloneable, ISer
GDIPlus.GdipDisposeImage (nativeObject);
}
- void Dispose (bool disposing)
+ protected virtual void Dispose (bool disposing)
{
if (nativeObject != (IntPtr) 0){
DisposeResources ();
diff --git a/mcs/class/System.Drawing/System.Drawing/KnownColor.cs b/mcs/class/System.Drawing/System.Drawing/KnownColor.cs
index 53d325c3943..0ab320ee563 100644
--- a/mcs/class/System.Drawing/System.Drawing/KnownColor.cs
+++ b/mcs/class/System.Drawing/System.Drawing/KnownColor.cs
@@ -10,6 +10,7 @@
using System;
namespace System.Drawing
{
+ [Serializable]
public enum KnownColor {
ActiveBorder = 1,
ActiveCaption = 2,
diff --git a/mcs/class/System.Drawing/System.Drawing/Pen.cs b/mcs/class/System.Drawing/System.Drawing/Pen.cs
index aca3ccfd8b5..aed7b544571 100755
--- a/mcs/class/System.Drawing/System.Drawing/Pen.cs
+++ b/mcs/class/System.Drawing/System.Drawing/Pen.cs
@@ -17,6 +17,9 @@ namespace System.Drawing {
public sealed class Pen : MarshalByRefObject, ICloneable, IDisposable {
internal IntPtr nativeObject;
+ internal bool isModifiable = true;
+ internal Brush brush;
+ internal Color color;
internal Pen (IntPtr p)
{
@@ -36,6 +39,11 @@ namespace System.Drawing {
int pen;
GDIPlus.GdipCreatePen2 (brush.nativeObject, width, Unit.UnitWorld, out pen);
nativeObject = (IntPtr) pen;
+ this.brush = brush;
+ if (brush is SolidBrush) {
+ color = ((SolidBrush) brush).Color;
+ GDIPlus.GdipSetPenColor (nativeObject, color.ToArgb ());
+ }
}
public Pen (Color color, float width)
@@ -43,6 +51,9 @@ namespace System.Drawing {
int pen;
GDIPlus.GdipCreatePen1 (color.ToArgb (), width, Unit.UnitWorld, out pen);
nativeObject = (IntPtr)pen;
+ this.color = color;
+ brush = new SolidBrush (color);
+ GDIPlus.GdipSetPenBrushFill (nativeObject, brush.nativeObject);
}
//
@@ -57,35 +68,53 @@ namespace System.Drawing {
}
set {
- GDIPlus.GdipSetPenMode (nativeObject, value);
+ if (isModifiable)
+ GDIPlus.GdipSetPenMode (nativeObject, value);
+ else
+ throw new ArgumentException ("You may not change this Pen because it does not belong to you.");
+
}
}
public Brush Brush {
get {
- IntPtr retval;
- GDIPlus.GdipGetPenBrushFill (nativeObject, out retval);
- BrushType type;
- GDIPlus.GdipGetBrushType (retval, out type);
-
- return Brush.CreateBrush (retval, type);
+ return brush;
}
set {
- GDIPlus.GdipSetPenBrushFill (nativeObject, value.nativeObject);
+ if (isModifiable) {
+ if (value is SolidBrush) {
+ brush = value;
+ GDIPlus.GdipSetPenBrushFill (nativeObject, value.nativeObject);
+ color = ((SolidBrush) brush).Color;
+ GDIPlus.GdipSetPenColor (nativeObject, color.ToArgb ());
+ }
+ else {
+ // other brushes should clear the color property
+ GDIPlus.GdipSetPenBrushFill (nativeObject, value.nativeObject);
+ GDIPlus.GdipSetPenColor (nativeObject, 0);
+ color = Color.Empty;
+ }
+ }
+ else
+ throw new ArgumentException ("You may not change this Pen because it does not belong to you.");
}
}
public Color Color {
get {
- int argb;
- GDIPlus.GdipGetPenColor (nativeObject, out argb);
-
- return Color.FromArgb (argb);
+ return color;
}
set {
- GDIPlus.GdipSetPenColor (nativeObject, value.ToArgb ());
+ if (isModifiable) {
+ color = value;
+ GDIPlus.GdipSetPenColor (nativeObject, value.ToArgb ());
+ brush = new SolidBrush (color);
+ GDIPlus.GdipSetPenBrushFill (nativeObject, brush.nativeObject);
+ }
+ else
+ throw new ArgumentException ("You may not change this Pen because it does not belong to you.");
}
}
@@ -108,12 +137,16 @@ namespace System.Drawing {
set {
throw new NotImplementedException ();
+// if (isModifiable) {
// int length = value.Length;
// IntPtr tmp = Marshal.AllocHGlobal (8 * length);
// Marshal.Copy (value, 0, tmp, length);
// GDIPlus.GdipSetPenCompoundArray (nativeObject, tmp, length);
// Marshal.FreeHGlobal (tmp);
+// }
+// else
+// throw new ArgumentException ("You may not change this Pen because it does not belong to you.");
}
}
@@ -123,6 +156,7 @@ namespace System.Drawing {
throw new NotImplementedException ();
}
+ // do a check for isModifiable when implementing this property
set {
throw new NotImplementedException ();
}
@@ -135,6 +169,7 @@ namespace System.Drawing {
throw new NotImplementedException ();
}
+ // do a check for isModifiable when implementing this property
set {
throw new NotImplementedException ();
}
@@ -150,7 +185,10 @@ namespace System.Drawing {
}
set {
- GDIPlus.GdipSetPenDashCap (nativeObject, value);
+ if (isModifiable)
+ GDIPlus.GdipSetPenDashCap (nativeObject, value);
+ else
+ throw new ArgumentException ("You may not change this Pen because it does not belong to you.");
}
}
@@ -164,7 +202,10 @@ namespace System.Drawing {
}
set {
- GDIPlus.GdipSetPenDashOffset (nativeObject, value);
+ if (isModifiable)
+ GDIPlus.GdipSetPenDashOffset (nativeObject, value);
+ else
+ throw new ArgumentException ("You may not change this Pen because it does not belong to you.");
}
}
@@ -185,12 +226,16 @@ namespace System.Drawing {
}
set {
- int length = value.Length;
- IntPtr tmp = Marshal.AllocHGlobal (8 * length);
- Marshal.Copy (value, 0, tmp, length);
- GDIPlus.GdipSetPenDashArray (nativeObject, tmp, length);
-
- Marshal.FreeHGlobal (tmp);
+ if (isModifiable) {
+ int length = value.Length;
+ IntPtr tmp = Marshal.AllocHGlobal (8 * length);
+ Marshal.Copy (value, 0, tmp, length);
+ GDIPlus.GdipSetPenDashArray (nativeObject, tmp, length);
+
+ Marshal.FreeHGlobal (tmp);
+ }
+ else
+ throw new ArgumentException ("You may not change this Pen because it does not belong to you.");
}
}
@@ -203,7 +248,10 @@ namespace System.Drawing {
}
set {
- GDIPlus.GdipSetPenDashStyle (nativeObject, value);
+ if (isModifiable)
+ GDIPlus.GdipSetPenDashStyle (nativeObject, value);
+ else
+ throw new ArgumentException ("You may not change this Pen because it does not belong to you.");
}
}
@@ -218,7 +266,10 @@ namespace System.Drawing {
set {
throw new NotImplementedException ();
+// if (isModifiable)
// GDIPlus.GdipSetPenStartCap (nativeObject, value);
+// else
+// throw new ArgumentException ("You may not change this Pen because it does not belong to you.");
}
}
@@ -233,7 +284,10 @@ namespace System.Drawing {
set {
throw new NotImplementedException ();
+// if (isModifiable)
// GDIPlus.GdipSetPenEndCap (nativeObject, value);
+// else
+// throw new ArgumentException ("You may not change this Pen because it does not belong to you.");
}
}
@@ -246,7 +300,10 @@ namespace System.Drawing {
}
set {
- GDIPlus.GdipSetPenLineJoin (nativeObject, value);
+ if (isModifiable)
+ GDIPlus.GdipSetPenLineJoin (nativeObject, value);
+ else
+ throw new ArgumentException ("You may not change this Pen because it does not belong to you.");
}
}
@@ -260,7 +317,10 @@ namespace System.Drawing {
}
set {
- GDIPlus.GdipSetPenMiterLimit (nativeObject, value);
+ if (isModifiable)
+ GDIPlus.GdipSetPenMiterLimit (nativeObject, value);
+ else
+ throw new ArgumentException ("You may not change this Pen because it does not belong to you.");
}
}
@@ -268,13 +328,16 @@ namespace System.Drawing {
public Matrix Transform {
get {
- Matrix result;
- GDIPlus.GdipGetPenTransform (nativeObject, out result);
- return result;
+ IntPtr matrix;
+ GDIPlus.GdipGetPenTransform (nativeObject, out matrix);
+ return new Matrix (matrix);
}
set {
- GDIPlus.GdipSetPenTransform (nativeObject, value);
+ if (isModifiable)
+ GDIPlus.GdipSetPenTransform (nativeObject, value.nativeMatrix);
+ else
+ throw new ArgumentException ("You may not change this Pen because it does not belong to you.");
}
}
@@ -285,7 +348,10 @@ namespace System.Drawing {
return f;
}
set {
- GDIPlus.GdipSetPenWidth (nativeObject, value);
+ if (isModifiable)
+ GDIPlus.GdipSetPenWidth (nativeObject, value);
+ else
+ throw new ArgumentException ("You may not change this Pen because it does not belong to you.");
}
}
@@ -305,7 +371,10 @@ namespace System.Drawing {
void Dispose (bool disposing)
{
- GDIPlus.GdipDeletePen (nativeObject);
+ if (isModifiable)
+ GDIPlus.GdipDeletePen (nativeObject);
+ else
+ throw new ArgumentException ("You may not change this Pen because it does not belong to you.");
}
~Pen ()
@@ -350,6 +419,7 @@ namespace System.Drawing {
public void SetLineCap (LineCap startCap, LineCap endCap, DashCap dashCap)
{
+ // do a check for isModifiable when implementing this method
// GDIPlus.GdipSetLineCap197819 (nativeObject, startCap, endCap, dashCap);
}
diff --git a/mcs/class/System.Drawing/System.Drawing/Point.cs b/mcs/class/System.Drawing/System.Drawing/Point.cs
index de21009efeb..b517f17534c 100644
--- a/mcs/class/System.Drawing/System.Drawing/Point.cs
+++ b/mcs/class/System.Drawing/System.Drawing/Point.cs
@@ -337,7 +337,7 @@ namespace System.Drawing {
public override string ToString ()
{
- return String.Format ("[{0},{1}]", x, y);
+ return String.Format ("{{X={0}, Y={1}}}", x, y);
}
}
diff --git a/mcs/class/System.Drawing/System.Drawing/PointConverter.cs b/mcs/class/System.Drawing/System.Drawing/PointConverter.cs
index f9258ae15b5..9c1f64f9e33 100644
--- a/mcs/class/System.Drawing/System.Drawing/PointConverter.cs
+++ b/mcs/class/System.Drawing/System.Drawing/PointConverter.cs
@@ -7,13 +7,14 @@
// (C) 2002 Ximian, Inc
//
using System;
+using System.ComponentModel;
namespace System.Drawing
{
/// <summary>
/// Summary description for PointConverter.
/// </summary>
- public class PointConverter
+ public class PointConverter : TypeConverter
{
public PointConverter()
{
diff --git a/mcs/class/System.Drawing/System.Drawing/PointF.cs b/mcs/class/System.Drawing/System.Drawing/PointF.cs
index 1a6c0f9fd08..53a96deff40 100644
--- a/mcs/class/System.Drawing/System.Drawing/PointF.cs
+++ b/mcs/class/System.Drawing/System.Drawing/PointF.cs
@@ -12,6 +12,7 @@ using System.Runtime.InteropServices;
namespace System.Drawing {
+ [Serializable]
[ComVisible (true)]
public struct PointF {
@@ -199,7 +200,7 @@ namespace System.Drawing {
public override string ToString ()
{
- return String.Format ("[{0},{1}]", cx, cy);
+ return String.Format ("{{X={0}, Y={1}}}", cx, cy);
}
}
diff --git a/mcs/class/System.Drawing/System.Drawing/RectangleConverter.cs b/mcs/class/System.Drawing/System.Drawing/RectangleConverter.cs
index a6f60dcbe13..058e1f7a721 100644
--- a/mcs/class/System.Drawing/System.Drawing/RectangleConverter.cs
+++ b/mcs/class/System.Drawing/System.Drawing/RectangleConverter.cs
@@ -7,13 +7,14 @@
// (C) 2002 Ximian, Inc
//
using System;
+using System.ComponentModel;
namespace System.Drawing
{
/// <summary>
/// Summary description for RectangleConverter.
/// </summary>
- public class RectangleConverter
+ public class RectangleConverter : TypeConverter
{
public RectangleConverter()
{
diff --git a/mcs/class/System.Drawing/System.Drawing/RectangleF.cs b/mcs/class/System.Drawing/System.Drawing/RectangleF.cs
index cfe4a7313ed..cebcc3de470 100644
--- a/mcs/class/System.Drawing/System.Drawing/RectangleF.cs
+++ b/mcs/class/System.Drawing/System.Drawing/RectangleF.cs
@@ -11,6 +11,7 @@ using System;
namespace System.Drawing {
+ [Serializable]
public struct RectangleF {
// Private position and size fields.
diff --git a/mcs/class/System.Drawing/System.Drawing/RotateFlipType.cs b/mcs/class/System.Drawing/System.Drawing/RotateFlipType.cs
index 8ef9db44284..b2d2ca3f579 100644
--- a/mcs/class/System.Drawing/System.Drawing/RotateFlipType.cs
+++ b/mcs/class/System.Drawing/System.Drawing/RotateFlipType.cs
@@ -8,6 +8,7 @@
using System;
namespace System.Drawing
{
+ [Serializable]
public enum RotateFlipType {
RotateNoneFlipNone = 0,
Rotate180FlipXY = 0,
diff --git a/mcs/class/System.Drawing/System.Drawing/Size.cs b/mcs/class/System.Drawing/System.Drawing/Size.cs
index 441c4c8b3ba..33814146370 100644
--- a/mcs/class/System.Drawing/System.Drawing/Size.cs
+++ b/mcs/class/System.Drawing/System.Drawing/Size.cs
@@ -231,7 +231,7 @@ namespace System.Drawing {
public bool IsEmpty {
get {
- return ((Width == 0) && (Height == 0));
+ return ((width == 0) && (height == 0));
}
}
@@ -295,7 +295,7 @@ namespace System.Drawing {
public override int GetHashCode ()
{
- return Width^Height;
+ return width^height;
}
/// <summary>
@@ -308,7 +308,7 @@ namespace System.Drawing {
public override string ToString ()
{
- return String.Format ("[{0},{1}]", Width, Height);
+ return String.Format ("{{Width={0}, Height={1}}}", width, height);
}
}
diff --git a/mcs/class/System.Drawing/System.Drawing/SizeF.cs b/mcs/class/System.Drawing/System.Drawing/SizeF.cs
index 1e51b4fb650..2e35c0b68ac 100644
--- a/mcs/class/System.Drawing/System.Drawing/SizeF.cs
+++ b/mcs/class/System.Drawing/System.Drawing/SizeF.cs
@@ -12,6 +12,7 @@ using System.Runtime.InteropServices;
namespace System.Drawing {
+ [Serializable]
[ComVisible (true)]
public struct SizeF {
@@ -234,6 +235,22 @@ namespace System.Drawing {
return (int) wd ^ (int) ht;
}
+ public PointF ToPointF ()
+ {
+ return new PointF (wd, ht);
+ }
+
+ public Size ToSize ()
+ {
+ int w, h;
+ checked {
+ w = (int) wd;
+ h = (int) ht;
+ }
+
+ return new Size (w, h);
+ }
+
/// <summary>
/// ToString Method
/// </summary>
@@ -244,8 +261,7 @@ namespace System.Drawing {
public override string ToString ()
{
- return String.Format ("[{0},{1}]", wd, ht);
+ return String.Format ("{{Width={0}, Height={1}}}", wd, ht);
}
-
}
}
diff --git a/mcs/class/System.Drawing/System.Drawing/SolidBrush.cs b/mcs/class/System.Drawing/System.Drawing/SolidBrush.cs
index 213ae792580..fab8ae2a36f 100644
--- a/mcs/class/System.Drawing/System.Drawing/SolidBrush.cs
+++ b/mcs/class/System.Drawing/System.Drawing/SolidBrush.cs
@@ -13,11 +13,15 @@ namespace System.Drawing
{
public sealed class SolidBrush : Brush {
+ internal bool isModifiable = true;
Color color;
internal SolidBrush (IntPtr ptr)
: base (ptr)
{
+ int val;
+ GDIPlus.GdipGetSolidFillColor (ptr, out val);
+ color = Color.FromArgb (val);
}
public SolidBrush (Color color)
@@ -33,15 +37,25 @@ namespace System.Drawing
return color;
}
set {
- color = value;
+ if (isModifiable)
+ color = value;
+ else
+ throw new ArgumentException ("You may not change this Brush because it does not belong to you.");
}
}
public override object Clone()
{
- return new SolidBrush( color );
+ return new SolidBrush (color);
}
+ protected override void Dispose (bool disposing)
+ {
+ if (isModifiable)
+ GDIPlus.GdipDeleteBrush (nativeObject);
+ else
+ throw new ArgumentException ("You may not change this Brush because it does not belong to you.");
+ }
}
}
diff --git a/mcs/class/System.Drawing/System.Drawing/StringAligment.cs b/mcs/class/System.Drawing/System.Drawing/StringAligment.cs
index a3e4695bf71..b26e8ee429a 100644
--- a/mcs/class/System.Drawing/System.Drawing/StringAligment.cs
+++ b/mcs/class/System.Drawing/System.Drawing/StringAligment.cs
@@ -9,6 +9,7 @@
using System;
namespace System.Drawing
{
+ [Serializable]
public enum StringAlignment {
Center = 1,
Far = 2,
diff --git a/mcs/class/System.Drawing/System.Drawing/StringDigitSubstitute.cs b/mcs/class/System.Drawing/System.Drawing/StringDigitSubstitute.cs
index e15c748c8f7..63fe5b103e9 100644
--- a/mcs/class/System.Drawing/System.Drawing/StringDigitSubstitute.cs
+++ b/mcs/class/System.Drawing/System.Drawing/StringDigitSubstitute.cs
@@ -9,6 +9,7 @@
using System;
namespace System.Drawing
{
+ [Serializable]
public enum StringDigitSubstitute {
User = 0,
None = 1,
diff --git a/mcs/class/System.Drawing/System.Drawing/StringFormat.cs b/mcs/class/System.Drawing/System.Drawing/StringFormat.cs
index 7614b8f24bd..151aa93964a 100644
--- a/mcs/class/System.Drawing/System.Drawing/StringFormat.cs
+++ b/mcs/class/System.Drawing/System.Drawing/StringFormat.cs
@@ -16,7 +16,7 @@ namespace System.Drawing
/// <summary>
/// Summary description for StringFormat.
/// </summary>
- public sealed class StringFormat : IDisposable, ICloneable
+ public sealed class StringFormat : MarshalByRefObject, IDisposable, ICloneable
{
private static StringFormat genericDefault;
StringAlignment alignment;
diff --git a/mcs/class/System.Drawing/System.Drawing/StringFormatFlags.cs b/mcs/class/System.Drawing/System.Drawing/StringFormatFlags.cs
index 6a0f0adb711..16caecf1138 100644
--- a/mcs/class/System.Drawing/System.Drawing/StringFormatFlags.cs
+++ b/mcs/class/System.Drawing/System.Drawing/StringFormatFlags.cs
@@ -10,6 +10,7 @@ using System;
namespace System.Drawing
{
[Flags]
+ [Serializable]
public enum StringFormatFlags {
DirectionRightToLeft = 0x0001,
DirectionVertical = 0x0002,
diff --git a/mcs/class/System.Drawing/System.Drawing/StringTrimming.cs b/mcs/class/System.Drawing/System.Drawing/StringTrimming.cs
index 24274401ca6..30bb3de983b 100644
--- a/mcs/class/System.Drawing/System.Drawing/StringTrimming.cs
+++ b/mcs/class/System.Drawing/System.Drawing/StringTrimming.cs
@@ -9,6 +9,7 @@
using System;
namespace System.Drawing
{
+ [Serializable]
public enum StringTrimming {
None = 0,
Character = 1,
diff --git a/mcs/class/System.Drawing/System.Drawing/StringUnit.cs b/mcs/class/System.Drawing/System.Drawing/StringUnit.cs
index 2d5f95c98c5..78bca64fe3b 100644
--- a/mcs/class/System.Drawing/System.Drawing/StringUnit.cs
+++ b/mcs/class/System.Drawing/System.Drawing/StringUnit.cs
@@ -9,6 +9,7 @@
using System;
namespace System.Drawing
{
+ [Serializable]
public enum StringUnit{
World = 0x00,
Display = 0x01,
diff --git a/mcs/class/System.Drawing/System.Drawing/SystemBrushes.cs b/mcs/class/System.Drawing/System.Drawing/SystemBrushes.cs
index afde84a5225..dda60f68a7e 100644
--- a/mcs/class/System.Drawing/System.Drawing/SystemBrushes.cs
+++ b/mcs/class/System.Drawing/System.Drawing/SystemBrushes.cs
@@ -15,6 +15,28 @@ namespace System.Drawing
/// </summary>
public sealed class SystemBrushes
{
+ static SolidBrush active_border;
+ static SolidBrush active_caption;
+ static SolidBrush active_caption_text;
+ static SolidBrush app_workspace;
+ static SolidBrush control;
+ static SolidBrush control_dark;
+ static SolidBrush control_dark_dark;
+ static SolidBrush control_light;
+ static SolidBrush control_light_light;
+ static SolidBrush control_text;
+ static SolidBrush desktop;
+ static SolidBrush highlight;
+ static SolidBrush highlight_text;
+ static SolidBrush hot_track;
+ static SolidBrush inactive_border;
+ static SolidBrush inactive_caption;
+ static SolidBrush info;
+ static SolidBrush menu;
+ static SolidBrush scroll_bar;
+ static SolidBrush window;
+ static SolidBrush window_text;
+
private SystemBrushes()
{
}
@@ -22,94 +44,247 @@ namespace System.Drawing
public static Brush ActiveBorder
{
get {
- return new SolidBrush(SystemColors.ActiveBorder);
+ if (active_border == null) {
+ active_border = new SolidBrush (SystemColors.ActiveBorder);
+ active_border.isModifiable = false;
+ }
+
+ return active_border;
}
}
public static Brush ActiveCaption
{
get {
- return new SolidBrush(SystemColors.ActiveCaption);
+ if (active_caption == null) {
+ active_caption = new SolidBrush (SystemColors.ActiveCaption);
+ active_caption.isModifiable = false;
+ }
+
+ return active_caption;
}
}
public static Brush ActiveCaptionText
{
get {
- return new SolidBrush(SystemColors.ActiveCaptionText);
+ if (active_caption_text == null) {
+ active_caption_text = new SolidBrush (SystemColors.ActiveCaptionText);
+ active_caption_text.isModifiable = false;
+ }
+
+ return active_caption_text;
}
}
public static Brush AppWorkspace
{
get {
- return new SolidBrush(SystemColors.AppWorkspace);
+ if (app_workspace == null) {
+ app_workspace = new SolidBrush (SystemColors.AppWorkspace);
+ app_workspace.isModifiable = false;
+ }
+
+ return app_workspace;
}
}
public static Brush Control {
get {
- return new SolidBrush(SystemColors.Control);
+ if (control == null) {
+ control = new SolidBrush (SystemColors.Control);
+ control.isModifiable = false;
+ }
+
+ return control;
}
}
public static Brush ControlLight {
get {
- return new SolidBrush(SystemColors.ControlLight);
+ if (control_light == null) {
+ control_light = new SolidBrush (SystemColors.ControlLight);
+ control_light.isModifiable = false;
+ }
+
+ return control_light;
}
}
public static Brush ControlLightLight {
get {
- return new SolidBrush(SystemColors.ControlLightLight);
+ if (control_light_light == null) {
+ control_light_light = new SolidBrush (SystemColors.ControlLightLight);
+ control_light_light.isModifiable = false;
+ }
+
+ return control_light_light;
}
}
public static Brush ControlDark {
get {
- return new SolidBrush(SystemColors.ControlDark);
+ if (control_dark == null) {
+ control_dark = new SolidBrush (SystemColors.ControlDark);
+ control_dark.isModifiable = false;
+ }
+
+ return control_dark;
}
}
public static Brush ControlDarkDark {
get {
- return new SolidBrush(SystemColors.ControlDarkDark);
+ if (control_dark_dark == null) {
+ control_dark_dark = new SolidBrush (SystemColors.ControlDarkDark);
+ control_dark_dark.isModifiable = false;
+ }
+
+ return control_dark_dark;
}
}
public static Brush ControlText {
get {
- return new SolidBrush(SystemColors.ControlText);
+ if (control_text == null) {
+ control_text = new SolidBrush (SystemColors.ControlText);
+ control_text.isModifiable = false;
+ }
+
+ return control_text;
}
}
public static Brush Highlight {
get {
- return new SolidBrush(SystemColors.Highlight);
+ if (highlight == null) {
+ highlight = new SolidBrush (SystemColors.Highlight);
+ highlight.isModifiable = false;
+ }
+
+ return highlight;
}
}
public static Brush HighlightText {
get {
- return new SolidBrush(SystemColors.HighlightText);
+ if (highlight_text == null) {
+ highlight_text = new SolidBrush (SystemColors.HighlightText);
+ highlight_text.isModifiable = false;
+ }
+
+ return highlight_text;
}
}
public static Brush Window {
get {
- return new SolidBrush(SystemColors.Window);
+ if (window == null) {
+ window = new SolidBrush (SystemColors.Window);
+ window.isModifiable = false;
+ }
+
+ return window;
}
}
public static Brush WindowText {
get {
- return new SolidBrush(SystemColors.WindowText);
+ if (window_text == null) {
+ window_text = new SolidBrush (SystemColors.WindowText);
+ window_text.isModifiable = false;
+ }
+
+ return window_text;
}
}
- [MonoTODO]
+
public static Brush InactiveBorder {
get {
- throw new NotImplementedException ();
+ if (inactive_border == null) {
+ inactive_border = new SolidBrush (SystemColors.InactiveBorder);
+ inactive_border.isModifiable = false;
+ }
+
+ return inactive_border;
+ }
+ }
+
+ public static Brush Desktop {
+ get {
+ if (desktop == null) {
+ desktop = new SolidBrush (SystemColors.Desktop);
+ desktop.isModifiable = false;
+ }
+
+ return desktop;
+ }
+ }
+
+ public static Brush HotTrack {
+ get {
+ if (hot_track == null) {
+ hot_track = new SolidBrush (SystemColors.HotTrack);
+ hot_track.isModifiable = false;
+ }
+
+ return hot_track;
+ }
+ }
+
+ public static Brush InactiveCaption {
+ get {
+ if (inactive_caption == null) {
+ inactive_caption = new SolidBrush (SystemColors.InactiveCaption);
+ inactive_caption.isModifiable = false;
+ }
+
+ return inactive_caption;
+ }
+ }
+
+ public static Brush Info {
+ get {
+ if (info == null) {
+ info = new SolidBrush (SystemColors.Info);
+ info.isModifiable = false;
+ }
+
+ return info;
+ }
+ }
+
+ public static Brush Menu {
+ get {
+ if (menu == null) {
+ menu = new SolidBrush (SystemColors.Menu);
+ menu.isModifiable = false;
+ }
+
+ return menu;
}
}
+
+ public static Brush ScrollBar {
+ get {
+ if (scroll_bar == null) {
+ scroll_bar = new SolidBrush (SystemColors.ScrollBar);
+ scroll_bar.isModifiable = false;
+ }
+
+ return scroll_bar;
+ }
+ }
+
+ public static Brush FromSystemColor (Color c)
+ {
+ if (c.IsSystemColor) {
+ SolidBrush newBrush = new SolidBrush (c);
+ newBrush.isModifiable = false;
+ return newBrush;
+ }
+
+ String message = String.Format ("The color {0} is not a system color.", c);
+ throw new ArgumentException (message);
+ }
}
}
diff --git a/mcs/class/System.Drawing/System.Drawing/SystemPens.cs b/mcs/class/System.Drawing/System.Drawing/SystemPens.cs
index b748c094002..07293597fea 100644
--- a/mcs/class/System.Drawing/System.Drawing/SystemPens.cs
+++ b/mcs/class/System.Drawing/System.Drawing/SystemPens.cs
@@ -20,6 +20,7 @@ namespace System.Drawing
static Pen control_light_light;
static Pen control_text;
static Pen gray_text;
+ static Pen highlight;
static Pen highlight_text;
static Pen inactive_caption_text;
static Pen info_text;
@@ -34,20 +35,6 @@ namespace System.Drawing
//
// These happen to match my current theme, not right
//
- active_caption_text = new Pen (SystemColors.ActiveCaptionText);
- control = new Pen (SystemColors.Control);
- control_dark = new Pen (SystemColors.ControlDark);
- control_dark_dark = new Pen (SystemColors.ControlDarkDark);
- control_light = new Pen (SystemColors.ControlLight);
- control_light_light = new Pen (SystemColors.ControlLightLight);
- control_text = new Pen (SystemColors.ControlText);
- gray_text = new Pen (SystemColors.GrayText);
- highlight_text = new Pen (SystemColors.HighlightText);
- inactive_caption_text = new Pen (SystemColors.InactiveCaptionText);
- menu_text = new Pen (SystemColors.MenuText);
- window_frame = new Pen (SystemColors.WindowFrame);
- window_text = new Pen (SystemColors.WindowText);
- info_text = new Pen (SystemColors.InfoText);
}
private SystemPens ()
@@ -56,87 +43,180 @@ namespace System.Drawing
public static Pen ActiveCaptionText {
get {
+ if (active_caption_text == null) {
+ active_caption_text = new Pen (SystemColors.ActiveCaptionText);
+ active_caption_text.isModifiable = false;
+ }
+
return active_caption_text;
}
}
public static Pen Control {
get {
+ if (control == null) {
+ control = new Pen (SystemColors.Control);
+ control.isModifiable = false;
+ }
+
return control;
}
}
public static Pen ControlDark {
get {
+ if (control_dark == null) {
+ control_dark = new Pen (SystemColors.ControlDark);
+ control_dark.isModifiable = false;
+ }
+
return control_dark;
}
}
public static Pen ControlDarkDark {
get {
+ if (control_dark_dark == null) {
+ control_dark_dark = new Pen (SystemColors.ControlDarkDark);
+ control_dark_dark.isModifiable = false;
+ }
+
return control_dark_dark;
}
}
public static Pen ControlLight {
get {
+ if (control_light == null) {
+ control_light = new Pen (SystemColors.ControlLight);
+ control_light.isModifiable = false;
+ }
+
return control_light;
}
}
public static Pen ControlLightLight {
get {
+ if (control_light_light == null) {
+ control_light_light = new Pen (SystemColors.ControlLightLight);
+ control_light_light.isModifiable = false;
+ }
+
return control_light_light;
}
}
public static Pen ControlText {
get {
+ if (control_text == null) {
+ control_text = new Pen (SystemColors.ControlText);
+ control_text.isModifiable = false;
+ }
+
return control_text;
}
}
public static Pen GrayText {
get {
+ if (gray_text == null) {
+ gray_text = new Pen (SystemColors.GrayText);
+ gray_text.isModifiable = false;
+ }
+
return gray_text;
}
}
+ public static Pen Highlight {
+ get {
+ if (highlight == null) {
+ highlight = new Pen (SystemColors.Highlight);
+ highlight.isModifiable = false;
+ }
+
+ return highlight;
+ }
+ }
+
public static Pen HighlightText {
get {
+ if (highlight_text == null) {
+ highlight_text = new Pen (SystemColors.HighlightText);
+ highlight_text.isModifiable = false;
+ }
+
return highlight_text;
}
}
public static Pen InactiveCaptionText {
get {
+ if (inactive_caption_text == null) {
+ inactive_caption_text = new Pen (SystemColors.InactiveCaptionText);
+ inactive_caption_text.isModifiable = false;
+ }
+
return inactive_caption_text;
}
}
public static Pen InfoText {
get {
+ if (info_text == null) {
+ info_text = new Pen (SystemColors.InfoText);
+ info_text.isModifiable = false;
+ }
+
return info_text;
}
}
public static Pen MenuText {
get {
+ if (menu_text == null) {
+ menu_text = new Pen (SystemColors.MenuText);
+ menu_text.isModifiable = false;
+ }
+
return menu_text;
}
}
public static Pen WindowFrame {
get {
+ if (window_frame == null) {
+ window_frame = new Pen (SystemColors.WindowFrame);
+ window_frame.isModifiable = false;
+ }
+
return window_frame;
}
}
public static Pen WindowText {
get {
+ if (window_text == null) {
+ window_text = new Pen (SystemColors.WindowText);
+ window_text.isModifiable = false;
+ }
+
return window_text;
}
}
+ public static Pen FromSystemColor (Color c)
+ {
+ if (c.IsSystemColor) {
+ Pen newPen = new Pen (c);
+ newPen.isModifiable = false;
+ return newPen;
+ }
+
+ String message = String.Format ("The color {0} is not a system color.", c);
+ throw new ArgumentException (message);
+ }
+
}
}
diff --git a/mcs/class/System.Drawing/System.Drawing/TextureBrush.cs b/mcs/class/System.Drawing/System.Drawing/TextureBrush.cs
index 5da894ffa4f..1217e3c379f 100644
--- a/mcs/class/System.Drawing/System.Drawing/TextureBrush.cs
+++ b/mcs/class/System.Drawing/System.Drawing/TextureBrush.cs
@@ -3,10 +3,15 @@
//
// Author:
// Dennis Hayes (dennish@Raytek.com)
+// Ravindra (rkumar@novell.com)
//
// (C) 2002 Ximian, Inc
+// (C) 2004 Novell, Inc.
//
+
using System;
+using System.Drawing.Drawing2D;
+using System.Drawing.Imaging;
namespace System.Drawing
{
@@ -15,14 +20,256 @@ namespace System.Drawing
/// </summary>
public sealed class TextureBrush : Brush
{
- internal TextureBrush()
+ Image image;
+ Matrix matrix;
+
+ internal TextureBrush (IntPtr ptr) : base (ptr)
+ {
+ // get image from IntPtr
+ // image could be Bitmap or Metafile
+ IntPtr img;
+ Status status = GDIPlus.GdipGetTextureImage (nativeObject, out img);
+ if (status != Status.Ok)
+ throw GetException (status);
+ image = new Bitmap (img);
+ matrix = new Matrix ();
+ }
+
+ public TextureBrush (Image image) : this (image, WrapMode.Tile)
+ {
+ }
+
+ public TextureBrush (Image image, Rectangle dstRect)
+ {
+ this.image = image;
+ Status status = GDIPlus.GdipCreateTextureIAI (image.nativeObject, IntPtr.Zero, dstRect.X, dstRect.Y, dstRect.Width, dstRect.Height, out nativeObject);
+ if (status != Status.Ok)
+ throw GetException (status);
+
+ matrix = new Matrix ();
+ }
+
+ public TextureBrush (Image image, RectangleF dstRect)
+ {
+ this.image = image;
+ Status status = GDIPlus.GdipCreateTextureIA (image.nativeObject, IntPtr.Zero, dstRect.X, dstRect.Y, dstRect.Width, dstRect.Height, out nativeObject);
+ if (status != Status.Ok)
+ throw GetException (status);
+
+ matrix = new Matrix ();
+ }
+
+ public TextureBrush (Image image, WrapMode wrapMode)
+ {
+ this.image = image;
+ Status status = GDIPlus.GdipCreateTexture (image.nativeObject, wrapMode, out nativeObject);
+ if (status != Status.Ok)
+ throw GetException (status);
+
+ matrix = new Matrix ();
+ }
+
+ public TextureBrush (Image image, Rectangle dstRect, ImageAttributes imageAttr)
+ {
+ this.image = image;
+ Status status = GDIPlus.GdipCreateTextureIAI (image.nativeObject, imageAttr.NativeObject, dstRect.X, dstRect.Y, dstRect.Width, dstRect.Height, out nativeObject);
+ if (status != Status.Ok)
+ throw GetException (status);
+
+ matrix = new Matrix ();
+ }
+
+ public TextureBrush (Image image, RectangleF dstRect, ImageAttributes imageAttr)
+ {
+ this.image = image;
+ Status status = GDIPlus.GdipCreateTextureIA (image.nativeObject, imageAttr.NativeObject, dstRect.X, dstRect.Y, dstRect.Width, dstRect.Height, out nativeObject);
+ if (status != Status.Ok)
+ throw GetException (status);
+
+ matrix = new Matrix ();
+ }
+
+ public TextureBrush (Image image, WrapMode wrapMode, Rectangle dstRect)
+ {
+ this.image = image;
+ Status status = GDIPlus.GdipCreateTexture2I (image.nativeObject, wrapMode, dstRect.X, dstRect.Y, dstRect.Width, dstRect.Height, out nativeObject);
+ if (status != Status.Ok)
+ throw GetException (status);
+
+ matrix = new Matrix ();
+ }
+
+ public TextureBrush (Image image, WrapMode wrapMode, RectangleF dstRect)
+ {
+ this.image = image;
+ Status status = GDIPlus.GdipCreateTexture2 (image.nativeObject, wrapMode, dstRect.X, dstRect.Y, dstRect.Width, dstRect.Height, out nativeObject);
+ if (status != Status.Ok)
+ throw GetException (status);
+
+ matrix = new Matrix ();
+ }
+
+ // properties
+
+ public Image Image {
+ get {
+ if (image == null) {
+ IntPtr img;
+ Status status = GDIPlus.GdipGetTextureImage (nativeObject, out img);
+ if (status != Status.Ok)
+ throw GetException (status);
+ image = new Bitmap (img);
+ }
+ return image;
+ }
+ }
+
+ public Matrix Transform {
+ get {
+ if (matrix == null) {
+ IntPtr m;
+ Status status = GDIPlus.GdipGetTextureTransform (nativeObject, out m);
+ if (status == Status.Ok)
+ matrix = new Matrix (m);
+ else
+ throw GetException (status);
+ }
+ return matrix;
+ }
+ set {
+ Status status = GDIPlus.GdipSetTextureTransform (nativeObject, value.nativeMatrix);
+ if (status != Status.Ok)
+ throw GetException (status);
+ }
+ }
+
+ public WrapMode WrapMode {
+ get {
+ WrapMode mode = WrapMode.Tile;
+ Status status = GDIPlus.GdipGetTextureWrapMode (nativeObject, out mode);
+ if (status == Status.Ok)
+ return mode;
+ else
+ throw GetException (status);
+ }
+ set {
+ Status status = GDIPlus.GdipSetTextureWrapMode (nativeObject, value);
+ if (status != Status.Ok)
+ throw GetException (status);
+ }
+ }
+
+ // public methods
+
+ public override object Clone ()
+ {
+ return new TextureBrush (nativeObject);
+ }
+
+ public void MultiplyTransform (Matrix matrix)
+ {
+ MultiplyTransform (matrix, MatrixOrder.Prepend);
+ }
+
+ public void MultiplyTransform (Matrix matrix, MatrixOrder order)
+ {
+ Status status = GDIPlus.GdipMultiplyTextureTransform (nativeObject, matrix.nativeMatrix, order);
+ if (status != Status.Ok)
+ throw GetException (status);
+ }
+
+ public void ResetTransform ()
+ {
+ Status status = GDIPlus.GdipResetTextureTransform (nativeObject);
+ if (status != Status.Ok)
+ throw GetException (status);
+ }
+
+ public void RotateTransform (float angle)
+ {
+ RotateTransform (angle, MatrixOrder.Prepend);
+ }
+
+ public void RotateTransform (float angle, MatrixOrder order)
+ {
+ Status status = GDIPlus.GdipRotateTextureTransform (nativeObject, angle, order);
+ if (status != Status.Ok)
+ throw GetException (status);
+ }
+
+ public void ScaleTransform (float sx, float sy)
{
+ ScaleTransform (sx, sy, MatrixOrder.Prepend);
}
- [MonoTODO()]
- public override object Clone()
+ public void ScaleTransform (float sx, float sy, MatrixOrder order)
{
- throw new NotImplementedException ();
+ Status status = GDIPlus.GdipScaleTextureTransform (nativeObject, sx, sy, order);
+ if (status != Status.Ok)
+ throw GetException (status);
+ }
+
+ public void TranslateTransform (float dx, float dy)
+ {
+ TranslateTransform (dx, dy, MatrixOrder.Prepend);
+ }
+
+ public void TranslateTransform (float dx, float dy, MatrixOrder order)
+ {
+ Status status = GDIPlus.GdipTranslateTextureTransform (nativeObject, dx, dy, order);
+ if (status != Status.Ok)
+ throw GetException (status);
+ }
+
+ Exception GetException (Status status)
+ {
+ String message;
+
+ switch (status) {
+ // TODO: Test and add more status code mappings here
+ case Status.GenericError:
+ message = String.Format ("Generic Error.");
+ return new Exception (message);
+
+ case Status.InvalidParameter:
+ message = String.Format ("Invalid Parameter.");
+ return new ArgumentException (message);
+
+ case Status.OutOfMemory:
+ message = String.Format ("Out of memory.");
+ return new OutOfMemoryException (message);
+
+ case Status.ObjectBusy:
+ message = String.Format ("Object busy.");
+ return new MemberAccessException (message);
+
+ case Status.InsufficientBuffer:
+ message = String.Format ("Insufficient buffer.");
+ return new IO.InternalBufferOverflowException (message);
+
+ case Status.PropertyNotSupported:
+ message = String.Format ("Property not supported.");
+ return new NotSupportedException (message);
+
+ case Status.FileNotFound:
+ message = String.Format ("File not found.");
+ return new IO.FileNotFoundException (message);
+
+ case Status.AccessDenied:
+ message = String.Format ("Access denied.");
+ return new UnauthorizedAccessException (message);
+
+ case Status.UnknownImageFormat:
+ message = String.Format ("Unknown image format.");
+ return new NotSupportedException (message);
+
+ case Status.NotImplemented:
+ message = String.Format ("Feature not implemented.");
+ return new NotImplementedException (message);
+
+ default:
+ return new Exception ("Unknown Error.");
+ }
}
}
}
diff --git a/mcs/class/System.Drawing/System.Drawing/ToolboxBitmapAttribute.cs b/mcs/class/System.Drawing/System.Drawing/ToolboxBitmapAttribute.cs
index b02abf40324..1e0ba66c7f1 100644
--- a/mcs/class/System.Drawing/System.Drawing/ToolboxBitmapAttribute.cs
+++ b/mcs/class/System.Drawing/System.Drawing/ToolboxBitmapAttribute.cs
@@ -13,6 +13,7 @@ namespace System.Drawing
/// <summary>
/// Summary description for ToolboxBitmapAttribute.
/// </summary>
+ [AttributeUsage (AttributeTargets.Class)]
public class ToolboxBitmapAttribute : Attribute
{
public ToolboxBitmapAttribute(string imageFile)
diff --git a/mcs/class/System.Drawing/System.Drawing/gdipFunctions.cs b/mcs/class/System.Drawing/System.Drawing/gdipFunctions.cs
index 32908894137..02243cd6ac2 100644
--- a/mcs/class/System.Drawing/System.Drawing/gdipFunctions.cs
+++ b/mcs/class/System.Drawing/System.Drawing/gdipFunctions.cs
@@ -3,6 +3,8 @@
//
// Author:
// Alexandre Pigolkine (pigolkine@gmx.de)
+// Jordi Mas i Hernàndez (jordi@ximian.com)
+// Sanjay Gupta (gsanjay@novell.com)
//
using System;
@@ -10,6 +12,7 @@ using System.Runtime.InteropServices;
using System.Text;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
+using System.Drawing.Text;
namespace System.Drawing {
/// <summary>
@@ -32,6 +35,54 @@ namespace System.Drawing {
GdiplusStartupOutput output = GdiplusStartupOutput.MakeGdiplusStartupOutput();
GdiplusStartup (ref GdiPlusToken, ref input, ref output);
}
+
+ // Copies a Ptr to an array of Points and releases the memory
+ static public void FromUnManagedMemoryToPointI(IntPtr prt, Point [] pts)
+ {
+ int nPointSize = Marshal.SizeOf(pts[0]);
+ int pos = prt.ToInt32();
+ for (int i=0; i<pts.Length; i++, pos+=nPointSize)
+ pts[i] = (Point) Marshal.PtrToStructure((IntPtr)pos, typeof(Point));
+
+ Marshal.FreeHGlobal(prt);
+ }
+
+ // Copies an array of Points to unmanaged memory
+ static public IntPtr FromPointToUnManagedMemoryI(Point [] pts)
+ {
+ int nPointSize = Marshal.SizeOf(pts[0]);
+ IntPtr dest = Marshal.AllocHGlobal(nPointSize* pts.Length);
+ int pos = dest.ToInt32();
+
+ for (int i=0; i<pts.Length; i++, pos+=nPointSize)
+ Marshal.StructureToPtr(pts[i], (IntPtr)pos, false);
+
+ return dest;
+ }
+
+ // Copies a Ptr to an array of PointsF and releases the memory
+ static public void FromUnManagedMemoryToPoint(IntPtr prt, PointF [] pts)
+ {
+ int nPointSize = Marshal.SizeOf(pts[0]);
+ int pos = prt.ToInt32();
+ for (int i=0; i<pts.Length; i++, pos+=nPointSize)
+ pts[i] = (PointF) Marshal.PtrToStructure((IntPtr)pos, typeof(PointF));
+
+ Marshal.FreeHGlobal(prt);
+ }
+
+ // Copies an array of Points to unmanaged memory
+ static public IntPtr FromPointToUnManagedMemory(PointF [] pts)
+ {
+ int nPointSize = Marshal.SizeOf(pts[0]);
+ IntPtr dest = Marshal.AllocHGlobal(nPointSize* pts.Length);
+ int pos = dest.ToInt32();
+
+ for (int i=0; i<pts.Length; i++, pos+=nPointSize)
+ Marshal.StructureToPtr(pts[i], (IntPtr)pos, false);
+
+ return dest;
+ }
// Memory functions
[DllImport("gdiplus.dll")]
@@ -51,7 +102,41 @@ namespace System.Drawing {
// Solid brush functions
[DllImport("gdiplus.dll")]
static internal extern Status GdipCreateSolidFill (int color, out int brush);
+ [DllImport("gdiplus.dll")]
+ static internal extern Status GdipGetSolidFillColor (IntPtr brush, out int color);
+ // Texture brush functions
+ [DllImport("gdiplus.dll")]
+ static internal extern Status GdipGetTextureImage (IntPtr texture, out IntPtr image);
+ [DllImport("gdiplus.dll")]
+ static internal extern Status GdipCreateTexture (IntPtr image, WrapMode wrapMode, out IntPtr texture);
+ [DllImport("gdiplus.dll")]
+ static internal extern Status GdipCreateTextureIAI (IntPtr image, IntPtr imageAttributes, int x, int y, int width, int height, out IntPtr texture);
+ [DllImport("gdiplus.dll")]
+ static internal extern Status GdipCreateTextureIA (IntPtr image, IntPtr imageAttributes, float x, float y, float width, float height, out IntPtr texture);
+ [DllImport("gdiplus.dll")]
+ static internal extern Status GdipCreateTexture2I (IntPtr image, WrapMode wrapMode, int x, int y, int width, int height, out IntPtr texture);
+ [DllImport("gdiplus.dll")]
+ static internal extern Status GdipCreateTexture2 (IntPtr image, WrapMode wrapMode, float x, float y, float width, float height, out IntPtr texture);
+ [DllImport("gdiplus.dll")]
+ static internal extern Status GdipGetTextureTransform (IntPtr texture, out IntPtr matrix);
+ [DllImport("gdiplus.dll")]
+ static internal extern Status GdipSetTextureTransform (IntPtr texture, IntPtr matrix);
+ [DllImport("gdiplus.dll")]
+ static internal extern Status GdipGetTextureWrapMode (IntPtr texture, out WrapMode wrapMode);
+ [DllImport("gdiplus.dll")]
+ static internal extern Status GdipSetTextureWrapMode (IntPtr texture, WrapMode wrapMode);
+ [DllImport("gdiplus.dll")]
+ static internal extern Status GdipMultiplyTextureTransform (IntPtr texture, IntPtr matrix, MatrixOrder order);
+ [DllImport("gdiplus.dll")]
+ static internal extern Status GdipResetTextureTransform (IntPtr texture);
+ [DllImport("gdiplus.dll")]
+ static internal extern Status GdipRotateTextureTransform (IntPtr texture, float angle, MatrixOrder order);
+ [DllImport("gdiplus.dll")]
+ static internal extern Status GdipScaleTextureTransform (IntPtr texture, float sx, float sy, MatrixOrder order);
+ [DllImport("gdiplus.dll")]
+ static internal extern Status GdipTranslateTextureTransform (IntPtr texture, float dx, float dy, MatrixOrder order);
+
// Graphics functions
[DllImport("gdiplus.dll")]
static internal extern Status GdipCreateFromHDC(IntPtr hDC, out int graphics);
@@ -89,6 +174,8 @@ namespace System.Drawing {
[DllImport ("gdiplus.dll")]
static internal extern Status GdipDrawLinesI (IntPtr graphics, IntPtr pen, Point [] points, int count);
[DllImport ("gdiplus.dll")]
+ static internal extern Status GdipDrawPath (IntPtr graphics, IntPtr pen, IntPtr path);
+ [DllImport ("gdiplus.dll")]
static internal extern Status GdipDrawPie (IntPtr graphics, IntPtr pen, float x, float y, float width, float height, float startAngle, float sweepAngle);
[DllImport ("gdiplus.dll")]
static internal extern Status GdipDrawPieI (IntPtr graphics, IntPtr pen, int x, int y, int width, int height, float startAngle, float sweepAngle);
@@ -113,9 +200,9 @@ namespace System.Drawing {
[DllImport ("gdiplus.dll")]
static internal extern Status GdipFillPolygon2I (IntPtr graphics, IntPtr brush, Point [] points, int count);
[DllImport("gdiplus.dll")]
- static internal extern Status GdipFillRectangle (IntPtr graphics, IntPtr brush, float x1, float y1, float x2, float y2);
- [DllImport("gdiplus.dll")]
- static internal extern Status GdipDrawString (IntPtr graphics, string text, int len, IntPtr font, ref GpRectF rc, IntPtr format, IntPtr brush);
+ static internal extern Status GdipFillRectangle (IntPtr graphics, IntPtr brush, float x1, float y1, float x2, float y2);
+ [DllImport("gdiplus.dll", CharSet=CharSet.Unicode)]
+ static internal extern Status GdipDrawString (IntPtr graphics, string text, int len, IntPtr font, ref RectangleF rc, IntPtr format, IntPtr brush);
[DllImport("gdiplus.dll")]
static internal extern Status GdipGetDC (IntPtr graphics, out int hdc);
[DllImport("gdiplus.dll")]
@@ -127,7 +214,9 @@ namespace System.Drawing {
[DllImport ("gdiplus.dll")]
static internal extern Status GdipSetRenderingOrigin (IntPtr graphics, int x, int y);
[DllImport("gdiplus.dll")]
- internal static extern Status GdipCloneBitmapAreaI (int x, int y, int width, int height, PixelFormat format, IntPtr original, out int bitmap);
+ internal static extern Status GdipCloneBitmapArea (float x, float y, float width, float height, PixelFormat format, IntPtr original, out IntPtr bitmap);
+ [DllImport("gdiplus.dll")]
+ internal static extern Status GdipCloneBitmapAreaI (int x, int y, int width, int height, PixelFormat format, IntPtr original, out IntPtr bitmap);
[DllImport("gdiplus.dll")]
internal static extern Status GdipResetWorldTransform (IntPtr graphics);
[DllImport("gdiplus.dll")]
@@ -135,8 +224,148 @@ namespace System.Drawing {
[DllImport("gdiplus.dll")]
internal static extern Status GdipGetWorldTransform (IntPtr graphics, IntPtr matrix);
[DllImport("gdiplus.dll")]
- internal static extern Status GdipScaleWorldTransform (IntPtr graphics, float sx, float sy, MatrixOrder order);
+ internal static extern Status GdipScaleWorldTransform (IntPtr graphics, float sx, float sy, MatrixOrder order);
+ [DllImport("gdiplus.dll")]
+ internal static extern Status GdipGraphicsClear(IntPtr graphics, int argb);
+ [DllImport("gdiplus.dll")]
+ internal static extern Status GdipDrawClosedCurve(IntPtr graphics, IntPtr pen, PointF [] points, int count);
+ [DllImport("gdiplus.dll")]
+ internal static extern Status GdipDrawClosedCurveI(IntPtr graphics, IntPtr pen, Point [] points, int count);
+ [DllImport("gdiplus.dll")]
+ internal static extern Status GdipDrawClosedCurve2(IntPtr graphics, IntPtr pen, PointF [] points, int count, float tension);
+ [DllImport("gdiplus.dll")]
+ internal static extern Status GdipDrawClosedCurve2I(IntPtr graphics, IntPtr pen, Point [] points, int count, float tension);
+ [DllImport("gdiplus.dll")]
+ internal static extern Status GdipDrawCurve(IntPtr graphics, IntPtr pen, PointF [] points, int count);
+ [DllImport("gdiplus.dll")]
+ internal static extern Status GdipDrawCurveI(IntPtr graphics, IntPtr pen, Point [] points, int count);
+ [DllImport("gdiplus.dll")]
+ internal static extern Status GdipDrawCurve2(IntPtr graphics, IntPtr pen, PointF [] points, int count, float tension);
+ [DllImport("gdiplus.dll")]
+ internal static extern Status GdipDrawCurve2I(IntPtr graphics, IntPtr pen, Point [] points, int count, float tension);
+ [DllImport("gdiplus.dll")]
+ internal static extern Status GdipDrawCurve3(IntPtr graphics, IntPtr pen, PointF [] points, int count, int offset, int numberOfSegments, float tension);
+ [DllImport("gdiplus.dll")]
+ internal static extern Status GdipDrawCurve3I(IntPtr graphics, IntPtr pen, Point [] points, int count, int offset, int numberOfSegments, float tension);
+ [DllImport("gdiplus.dll")]
+ internal static extern Status GdipSetClipRect(IntPtr graphics, float x, float y, float width, float height, CombineMode combineMode);
+ [DllImport("gdiplus.dll")]
+ internal static extern Status GdipSetClipRectI(IntPtr graphics, int x, int y, int width, int height, CombineMode combineMode);
+ [DllImport("gdiplus.dll")]
+ internal static extern Status GdipSetClipPath(IntPtr graphics, IntPtr path, CombineMode combineMode);
+ [DllImport("gdiplus.dll")]
+ internal static extern Status GdipSetClipRegion(IntPtr graphics, IntPtr region, CombineMode combineMode);
+ [DllImport("gdiplus.dll")]
+ internal static extern Status GdipSetClipGraphics(IntPtr graphics, IntPtr srcgraphics, CombineMode combineMode);
+ [DllImport("gdiplus.dll")]
+ internal static extern Status GdipResetClip(IntPtr graphics);
+ [DllImport("gdiplus.dll")]
+ internal static extern Status GdipEndContainer(IntPtr graphics, int state);
+
+ [DllImport("gdiplus.dll")]
+ internal static extern Status GdipFillClosedCurve(IntPtr graphics, IntPtr brush, PointF[] points, int count);
+
+ [DllImport("gdiplus.dll")]
+ internal static extern Status GdipFillClosedCurveI(IntPtr graphics, IntPtr brush, Point[] points, int count);
+
+ [DllImport("gdiplus.dll")]
+ internal static extern Status GdipFillClosedCurve2(IntPtr graphics, IntPtr brush,
+ PointF[] points, int count, float tension, FillMode fillMode);
+
+ [DllImport("gdiplus.dll")]
+ internal static extern Status GdipFillClosedCurve2I(IntPtr graphics, IntPtr brush,
+ Point[] points, int count, float tension, FillMode fillMode);
+
+ [DllImport("gdiplus.dll")]
+ internal static extern Status GdipFillPie(IntPtr graphics, IntPtr brush, float x, float y,
+ float width, float height, float startAngle, float sweepAngle);
+
+ [DllImport("gdiplus.dll")]
+ internal static extern Status GdipFillPieI(IntPtr graphics, IntPtr brush, int x, int y,
+ int width, int height, float startAngle, float sweepAngle);
+
+ [DllImport("gdiplus.dll")]
+ internal static extern Status GdipFillPath(IntPtr graphics, IntPtr brush, IntPtr path);
+
+ [DllImport("gdiplus.dll")]
+ internal static extern Status GdipGetNearestColor(IntPtr graphics, out int argb);
+ [DllImport("gdiplus.dll")]
+ internal static extern Status GdipIsVisiblePoint(IntPtr graphics, float x, float y, out bool result);
+
+ [DllImport("gdiplus.dll")]
+ internal static extern Status GdipIsVisiblePointI(IntPtr graphics, int x, int y, out bool result);
+
+ [DllImport("gdiplus.dll")]
+ internal static extern Status GdipIsVisibleRect(IntPtr graphics, float x, float y,
+ float width, float height, out bool result);
+
+ [DllImport("gdiplus.dll")]
+ internal static extern Status GdipIsVisibleRectI(IntPtr graphics, int x, int y,
+ int width, int height, out bool result);
+
+ [DllImport("gdiplus.dll")]
+ internal static extern Status GdipTransformPoints(IntPtr graphics, CoordinateSpace destSpace,
+ CoordinateSpace srcSpace, IntPtr points, int count);
+
+ [DllImport("gdiplus.dll")]
+ internal static extern Status GdipTransformPointsI(IntPtr graphics, CoordinateSpace destSpace,
+ CoordinateSpace srcSpace, IntPtr points, int count);
+
+ [DllImport("gdiplus.dll")]
+ internal static extern Status GdipTranslateClip(IntPtr graphics, float dx, float dy);
+ [DllImport("gdiplus.dll")]
+ internal static extern Status GdipTranslateClipI(IntPtr graphics, int dx, int dy);
+ [DllImport("gdiplus.dll")]
+ internal static extern Status GdipGetClipBounds(IntPtr graphics, out RectangleF rect);
+ [DllImport("gdiplus.dll")]
+ internal static extern Status GdipSetCompositingMode(IntPtr graphics, CompositingMode compositingMode);
+ [DllImport("gdiplus.dll")]
+ internal static extern Status GdipGetCompositingMode(IntPtr graphics, out CompositingMode compositingMode);
+ [DllImport("gdiplus.dll")]
+ internal static extern Status GdipSetCompositingQuality(IntPtr graphics, CompositingQuality compositingQuality);
+ [DllImport("gdiplus.dll")]
+ internal static extern Status GdipGetCompositingQuality(IntPtr graphics, out CompositingQuality compositingQuality);
+ [DllImport("gdiplus.dll")]
+ internal static extern Status GdipSetInterpolationMode(IntPtr graphics, InterpolationMode interpolationMode);
+ [DllImport("gdiplus.dll")]
+ internal static extern Status GdipGetInterpolationMode(IntPtr graphics, out InterpolationMode interpolationMode);
+ [DllImport("gdiplus.dll")]
+ internal static extern Status GdipGetDpiX(IntPtr graphics, out float dpi);
+ [DllImport("gdiplus.dll")]
+ internal static extern Status GdipGetDpiY(IntPtr graphics, out float dpi);
+ [DllImport("gdiplus.dll")]
+ internal static extern Status GdipIsClipEmpty(IntPtr graphics, out bool result);
+ [DllImport("gdiplus.dll")]
+ internal static extern Status GdipIsVisibleClipEmpty(IntPtr graphics, out bool result);
+ [DllImport("gdiplus.dll")]
+ internal static extern Status GdipGetPageUnit(IntPtr graphics, out GraphicsUnit unit);
+ [DllImport("gdiplus.dll")]
+ internal static extern Status GdipGetPageScale(IntPtr graphics, out float scale);
+ [DllImport("gdiplus.dll")]
+ internal static extern Status GdipSetPageUnit(IntPtr graphics, GraphicsUnit unit);
+ [DllImport("gdiplus.dll")]
+ internal static extern Status GdipSetPageScale(IntPtr graphics, float scale);
+ [DllImport("gdiplus.dll")]
+ internal static extern Status GdipSetPixelOffsetMode(IntPtr graphics, PixelOffsetMode pixelOffsetMode);
+ [DllImport("gdiplus.dll")]
+ internal static extern Status GdipGetPixelOffsetMode(IntPtr graphics, out PixelOffsetMode pixelOffsetMode);
+ [DllImport("gdiplus.dll")]
+ internal static extern Status GdipSetSmoothingMode(IntPtr graphics, SmoothingMode smoothingMode);
+ [DllImport("gdiplus.dll")]
+ internal static extern Status GdipGetSmoothingMode(IntPtr graphics, out SmoothingMode smoothingMode);
+ [DllImport("gdiplus.dll")]
+ internal static extern Status GdipSetTextContrast(IntPtr graphics, int contrast);
+ [DllImport("gdiplus.dll")]
+ internal static extern Status GdipGetTextContrast(IntPtr graphics, out int contrast);
+ [DllImport("gdiplus.dll")]
+ internal static extern Status GdipSetTextRenderingHint(IntPtr graphics, TextRenderingHint mode);
+ [DllImport("gdiplus.dll")]
+ internal static extern Status GdipGetTextRenderingHint(IntPtr graphics, out TextRenderingHint mode);
+ [DllImport("gdiplus.dll")]
+ internal static extern Status GdipGetVisibleClipBounds(IntPtr graphics, out RectangleF rect);
+
+
// Pen functions
[DllImport("gdiplus.dll")]
internal static extern Status GdipCreatePen1(int argb, float width, Unit unit, out int pen);
@@ -205,9 +434,9 @@ namespace System.Drawing {
// [DllImport("gdiplus.dll")]
// internal static extern Status GdipGetPenEndCap (IntPtr pen, out LineCap endCap);
[DllImport("gdiplus.dll")]
- internal static extern Status GdipSetPenTransform (IntPtr pen, Matrix matrix);
+ internal static extern Status GdipSetPenTransform (IntPtr pen, IntPtr matrix);
[DllImport("gdiplus.dll")]
- internal static extern Status GdipGetPenTransform (IntPtr pen, out Matrix matrix);
+ internal static extern Status GdipGetPenTransform (IntPtr pen, out IntPtr matrix);
[DllImport("gdiplus.dll")]
internal static extern Status GdipSetPenWidth (IntPtr pen, float width);
[DllImport("gdiplus.dll")]
@@ -223,29 +452,92 @@ namespace System.Drawing {
internal static extern Status GdipScalePenTransform (IntPtr pen, float sx, float sy, MatrixOrder order);
[DllImport("gdiplus.dll")]
internal static extern Status GdipTranslatePenTransform (IntPtr pen, float dx, float dy, MatrixOrder order);
+
+ [DllImport("gdiplus.dll")]
+ internal static extern Status GdipCreateFromHWND (IntPtr hwnd, out IntPtr graphics);
// Bitmap functions
[DllImport("gdiplus.dll")]
- internal static extern Status GdipCreateBitmapFromScan0 (int width, int height, int stride, PixelFormat format, IntPtr scan0, out int bitmap);
+ internal static extern Status GdipCreateBitmapFromScan0 (int width, int height, int stride, PixelFormat format, IntPtr scan0, out IntPtr bmp);
[DllImport("gdiplus.dll")]
- internal static extern Status GdipCreateBitmapFromGraphics (int width, int height, IntPtr target, out int bitmap);
+ internal static extern Status GdipCreateBitmapFromGraphics (int width, int height, IntPtr target, out IntPtr bitmap);
[DllImport("gdiplus.dll")]
- internal static extern Status GdipBitmapLockBits (IntPtr bmp, ref GpRect rc, ImageLockMode flags, PixelFormat format, [In, Out] BitmapData bmpData);
+ internal static extern Status GdipBitmapLockBits (IntPtr bmp, ref Rectangle rc, ImageLockMode flags, PixelFormat format, [In, Out] IntPtr bmpData);
+
[DllImport("gdiplus.dll")]
- internal static extern Status ____BitmapLockBits (IntPtr bmp, ref GpRect rc, ImageLockMode flags, PixelFormat format, ref int width, ref int height, ref int stride, ref int format2, ref int reserved, ref IntPtr scan0);
+ internal static extern Status GdipBitmapSetResolution(IntPtr bmp, float xdpi, float ydpi);
+
+
+ // This an internal GDIPlus Cairo function, not part GDIPlus interface
+ //[DllImport("gdiplus.dll")]
+ //(internal static extern Status ____BitmapLockBits (IntPtr bmp, ref GpRect rc, ImageLockMode flags, PixelFormat format, ref int width, ref int height, ref int stride, ref int format2, ref int reserved, ref IntPtr scan0);
[DllImport("gdiplus.dll")]
internal static extern Status GdipBitmapUnlockBits (IntPtr bmp, [In,Out] BitmapData bmpData);
+
+ [DllImport("gdiplus.dll")]
+ internal static extern Status GdipBitmapGetPixel (IntPtr bmp, int x, int y, out int argb);
+
+ [DllImport("gdiplus.dll")]
+ internal static extern Status GdipBitmapSetPixel (IntPtr bmp, int x, int y, int argb);
// Image functions
[DllImport("gdiplus.dll")]
internal static extern Status GdipDisposeImage (IntPtr image);
[DllImport("gdiplus.dll")]
- internal static extern Status GdipDrawImageI( IntPtr graphics, IntPtr image, int x, int y);
+ internal static extern Status GdipDrawImageI (IntPtr graphics, IntPtr image, int x, int y);
+ [DllImport("gdiplus.dll")]
+ internal static extern Status GdipGetImageGraphicsContext (IntPtr image, out int graphics);
+ [DllImport("gdiplus.dll")]
+ internal static extern Status GdipDrawImage (IntPtr graphics, IntPtr image, float x, float y);
+
+ [DllImport("gdiplus.dll")]
+ internal static extern Status GdipBeginContainer (IntPtr graphics, RectangleF dstrect,
+ RectangleF srcrect, GraphicsUnit unit, out int state);
+
+ [DllImport("gdiplus.dll")]
+ internal static extern Status GdipBeginContainerI (IntPtr graphics, Rectangle dstrect,
+ Rectangle srcrect, GraphicsUnit unit, out int state);
+
+ [DllImport("gdiplus.dll")]
+ internal static extern Status GdipBeginContainer2 (IntPtr graphics, out int state);
+
+ [DllImport("gdiplus.dll")]
+ internal static extern Status GdipDrawImagePoints (IntPtr graphics, IntPtr image, PointF [] destPoints, int count);
+
+
+ [DllImport("gdiplus.dll")]
+ internal static extern Status GdipDrawImagePointsI (IntPtr graphics, IntPtr image, Point [] destPoints, int count);
+
[DllImport("gdiplus.dll")]
- internal static extern Status GdipGetImageGraphicsContext( IntPtr image, out int graphics);
+ internal static extern Status GdipDrawImageRectRectI (IntPtr graphics, IntPtr image,
+ int dstx, int dsty, int dstwidth, int dstheight,
+ int srcx, int srcy, int srcwidth, int srcheight,
+ GraphicsUnit srcUnit, IntPtr imageattr, IntPtr callback, int callbackData);
+
+ [DllImport("gdiplus.dll")]
+ internal static extern Status GdipDrawImageRect(IntPtr graphics, IntPtr image, float x, float y, float width, float height);
+ [DllImport("gdiplus.dll")]
+ internal static extern Status GdipDrawImagePointRect(IntPtr graphics, IntPtr image, float x,
+ float y, float srcx, float srcy, float srcwidth, float srcheight, GraphicsUnit srcUnit);
+
+ [DllImport("gdiplus.dll")]
+ internal static extern Status GdipCreateStringFormat(StringFormatFlags formatAttributes, int language, out IntPtr native);
+
+ [DllImport("gdiplus.dll")]
+ internal static extern Status GdipCreateHBITMAPFromBitmap (IntPtr bmp, out IntPtr HandleBmp, int clrbackground);
+
+ [DllImport("gdiplus.dll")]
+ internal static extern Status GdipCreateHICONFromBitmap (IntPtr bmp, out IntPtr HandleIcon);
+
+ [DllImport("gdiplus.dll")]
+ internal static extern Status GdipCreateBitmapFromHICON (IntPtr hicon, out IntPtr bitmap);
+
+ [DllImport("gdiplus.dll")]
+ internal static extern Status GdipCreateBitmapFromResource (IntPtr hInstance,
+ string lpBitmapName, out IntPtr bitmap);
// Matrix functions
[DllImport ("gdiplus.dll")]
@@ -253,9 +545,9 @@ namespace System.Drawing {
[DllImport ("gdiplus.dll")]
internal static extern Status GdipCreateMatrix2 (float m11, float m12, float m21, float m22, float dx, float dy, out IntPtr matrix);
[DllImport ("gdiplus.dll")]
- internal static extern Status GdipCreateMatrix3 (GpRectF rect, PointF[] dstplg, out IntPtr matrix);
+ internal static extern Status GdipCreateMatrix3 (RectangleF rect, PointF[] dstplg, out IntPtr matrix);
[DllImport ("gdiplus.dll")]
- internal static extern Status GdipCreateMatrix3I (GpRect rect, Point[] dstplg, out IntPtr matrix);
+ internal static extern Status GdipCreateMatrix3I (Rectangle rect, Point[] dstplg, out IntPtr matrix);
[DllImport ("gdiplus.dll")]
internal static extern Status GdipDeleteMatrix (IntPtr matrix);
@@ -293,8 +585,181 @@ namespace System.Drawing {
[DllImport ("gdiplus.dll")]
internal static extern Status GdipIsMatrixIdentity (IntPtr matrix, out bool result);
[DllImport ("gdiplus.dll")]
- internal static extern Status GdipIsMatrixEqual (IntPtr matrix, IntPtr matrix2, out bool result);
+ internal static extern Status GdipIsMatrixEqual (IntPtr matrix, IntPtr matrix2, out bool result);
+
+ // GraphicsPath functions
+ [DllImport ("gdiplus.dll")]
+ internal static extern Status GdipCreatePath (FillMode brushMode, out IntPtr path);
+ [DllImport ("gdiplus.dll")]
+ internal static extern Status GdipCreatePath2 (PointF points, byte [] types, int count, FillMode brushMode, out IntPtr path);
+ [DllImport ("gdiplus.dll")]
+ internal static extern Status GdipClonePath (IntPtr path, out IntPtr clonePath);
+ [DllImport ("gdiplus.dll")]
+ internal static extern Status GdipDeletePath (IntPtr path);
+ [DllImport ("gdiplus.dll")]
+ internal static extern Status GdipResetPath (IntPtr path);
+ [DllImport ("gdiplus.dll")]
+ internal static extern Status GdipGetPointCount (IntPtr path, out int count);
+ [DllImport ("gdiplus.dll")]
+ internal static extern Status GdipGetPathTypes (IntPtr path, [Out] byte [] types, int count);
+ [DllImport ("gdiplus.dll")]
+ internal static extern Status GdipGetPathPoints (IntPtr path, [Out] PointF [] points, int count);
+ [DllImport ("gdiplus.dll")]
+ internal static extern Status GdipGetPathPointsI (IntPtr path, [Out] Point [] points, int count);
+ [DllImport ("gdiplus.dll")]
+ internal static extern Status GdipGetPathFillMode (IntPtr path, out FillMode fillMode);
+ [DllImport ("gdiplus.dll")]
+ internal static extern Status GdipSetPathFillMode (IntPtr path, FillMode fillMode);
+ [DllImport ("gdiplus.dll")]
+ internal static extern Status GdipGetPathData (IntPtr path, out IntPtr pathData);
+ [DllImport ("gdiplus.dll")]
+ internal static extern Status GdipStartPathFigure (IntPtr path);
+ [DllImport ("gdiplus.dll")]
+ internal static extern Status GdipClosePathFigure (IntPtr path);
+ [DllImport ("gdiplus.dll")]
+ internal static extern Status GdipClosePathFigures (IntPtr path);
+ [DllImport ("gdiplus.dll")]
+ internal static extern Status GdipSetPathMarker (IntPtr path);
+ [DllImport ("gdiplus.dll")]
+ internal static extern Status GdipClearPathMarkers (IntPtr path);
+ [DllImport ("gdiplus.dll")]
+ internal static extern Status GdipReversePath (IntPtr path);
+ [DllImport ("gdiplus.dll")]
+ internal static extern Status GdipGetPathLastPoint (IntPtr path, out PointF lastPoint);
+ [DllImport ("gdiplus.dll")]
+ internal static extern Status GdipAddPathLine (IntPtr path, float x1, float y1, float x2, float y2);
+ [DllImport ("gdiplus.dll")]
+ internal static extern Status GdipAddPathArc (IntPtr path, float x, float y, float width, float height, float startAngle, float sweepAngle);
+ [DllImport ("gdiplus.dll")]
+ internal static extern Status GdipAddPathBezier (IntPtr path, float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4);
+ [DllImport ("gdiplus.dll")]
+ internal static extern Status GdipAddPathBeziers (IntPtr path, PointF [] points, int count);
+ [DllImport ("gdiplus.dll")]
+ internal static extern Status GdipAddPathCurve (IntPtr path, PointF [] points, int count);
+ [DllImport ("gdiplus.dll")]
+ internal static extern Status GdipAddPathRectangle (IntPtr path, float x, float y, float width, float height);
+ [DllImport ("gdiplus.dll")]
+ internal static extern Status GdipAddPathRectangles (IntPtr path, RectangleF [] rects, int count);
+ [DllImport ("gdiplus.dll")]
+ internal static extern Status GdipAddPathEllipse (IntPtr path, float x, float y, float width, float height);
+ [DllImport ("gdiplus.dll")]
+ internal static extern Status GdipAddPathEllipseI (IntPtr path, int x, int y, int width, int height);
+ [DllImport ("gdiplus.dll")]
+ internal static extern Status GdipAddPathPie (IntPtr path, float x, float y, float width, float height, float startAngle, float sweepAngle);
+ [DllImport ("gdiplus.dll")]
+ internal static extern Status GdipAddPathPolygon (IntPtr path, PointF [] points, int count);
+ [DllImport ("gdiplus.dll")]
+ internal static extern Status GdipAddPathPath (IntPtr path, IntPtr addingPath, bool connect);
+ [DllImport ("gdiplus.dll")]
+ internal static extern Status GdipAddPathLineI (IntPtr path, int x1, int y1, int x2, int y2);
+ [DllImport ("gdiplus.dll")]
+ internal static extern Status GdipAddPathArcI (IntPtr path, int x, int y, int width, int height, float startAngle, float sweepAngle);
+
+ [DllImport ("gdiplus.dll")]
+ internal static extern Status GdipAddPathBezierI (IntPtr path, int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4);
+ [DllImport ("gdiplus.dll")]
+ internal static extern Status GdipAddPathBeziersI (IntPtr path, Point [] points, int count);
+
+ [DllImport ("gdiplus.dll")]
+ internal static extern Status GdipAddPathPolygonI (IntPtr path, Point [] points, int count);
+ [DllImport ("gdiplus.dll")]
+ internal static extern Status GdipAddPathRectangleI (IntPtr path, int x, int y, int width, int height);
+ [DllImport ("gdiplus.dll")]
+ internal static extern Status GdipAddPathRectanglesI (IntPtr path, Rectangle [] rects, int count);
+ [DllImport ("gdiplus.dll")]
+ internal static extern Status GdipTransformPath (IntPtr path, IntPtr matrix);
+ [DllImport ("gdiplus.dll")]
+ internal static extern Status GdipGetPathWorldBoundsI (IntPtr path, IntPtr bounds, IntPtr matrix, IntPtr pen);
+ [DllImport ("gdiplus.dll")]
+ internal static extern Status GdipIsVisiblePathPoint (IntPtr path, float x, float y, IntPtr graphics, out bool result);
+ [DllImport ("gdiplus.dll")]
+ internal static extern Status GdipIsVisiblePathPointI (IntPtr path, int x, int y, IntPtr graphics, out bool result);
+ [DllImport ("gdiplus.dll")]
+ internal static extern Status GdipIsOutlineVisiblePathPoint (IntPtr path, float x, float y, IntPtr graphics, out bool result);
+ [DllImport ("gdiplus.dll")]
+ internal static extern Status GdipIsOutlineVisiblePathPointI (IntPtr path, int x, int y, IntPtr graphics, out bool result);
+
+ // ImageAttributes
+ [DllImport ("gdiplus.dll")]
+ internal static extern Status GdipCreateImageAttributes (out IntPtr imageattr);
+
+ [DllImport ("gdiplus.dll")]
+ internal static extern Status GdipSetImageAttributesColorKeys (IntPtr imageattr,
+ ColorAdjustType type, bool enableFlag, int colorLow, int colorHigh);
+
+ [DllImport ("gdiplus.dll")]
+ internal static extern Status GdipDisposeImageAttributes (IntPtr imageattr);
+
+ [DllImport ("gdiplus.dll")]
+ internal static extern Status GdipSetImageAttributesColorMatrix (IntPtr imageattr,
+ ColorAdjustType type, bool enableFlag, ColorMatrix colorMatrix,
+ ColorMatrix grayMatrix, ColorMatrixFlag flags);
+
+ // Font
+ [DllImport("gdiplus.dll")]
+ internal static extern Status GdipCreateFont (IntPtr fontFamily, float emSize, FontStyle style, GraphicsUnit unit, out IntPtr font);
+ [DllImport("gdiplus.dll")]
+ internal static extern Status GdipDeleteFont (IntPtr font);
+
+ // FontCollection
+ [DllImport ("gdiplus.dll")]
+ internal static extern Status GdipGetFontCollectionFamilyCount (IntPtr collection, out int found);
+
+ [DllImport ("gdiplus.dll")]
+ internal static extern Status GdipGetFontCollectionFamilyList (IntPtr collection, int getCount, IntPtr dest, out int retCount);
+ //internal static extern Status GdipGetFontCollectionFamilyList( IntPtr collection, int getCount, [Out] FontFamily[] familyList, out int retCount );
+
+ [DllImport ("gdiplus.dll")]
+ internal static extern Status GdipNewInstalledFontCollection (out IntPtr collection);
+
+ [DllImport ("gdiplus.dll")]
+ internal static extern Status GdipNewPrivateFontCollection (out IntPtr collection);
+
+ [DllImport ("gdiplus.dll")]
+ internal static extern Status GdipDeletePrivateFontCollection (IntPtr collection);
+
+ [DllImport ("gdiplus.dll", CharSet=CharSet.Auto)]
+ internal static extern Status GdipPrivateAddFontFile (IntPtr collection,
+ [MarshalAs (UnmanagedType.LPWStr)] string fileName );
+
+ [DllImport ("gdiplus.dll")]
+ internal static extern Status GdipPrivateAddMemoryFont (IntPtr collection, IntPtr mem, int length);
+
+ //FontFamily
+ [DllImport ("gdiplus.dll", CharSet=CharSet.Auto)]
+ internal static extern Status GdipCreateFontFamilyFromName (
+ [MarshalAs(UnmanagedType.LPWStr)] string fName, IntPtr collection, out IntPtr fontFamily);
+
+ /*[DllImport ("gdiplus.dll", CharSet=CharSet.Auto)]
+ internal static extern Status GdipGetFamilyName(IntPtr fontFamily, );
+ GpStatus WINGDIPAPI GdipGetFamilyName( GDIPCONST GpFontFamily *family, WCHAR name[LF_FACESIZE], LANGID language )*/
+
+ [DllImport ("gdiplus.dll")]
+ internal static extern Status GdipGetGenericFontFamilySansSerif (out IntPtr fontFamily);
+
+ [DllImport ("gdiplus.dll")]
+ internal static extern Status GdipGetGenericFontFamilySerif (out IntPtr fontFamily);
+
+ [DllImport ("gdiplus.dll")]
+ internal static extern Status GdipGetGenericFontFamilyMonospace (out IntPtr fontFamily);
- #endregion
- }
-}
+ [DllImport ("gdiplus.dll")]
+ internal static extern Status GdipGetCellAscent (IntPtr fontFamily, int style, out uint ascent);
+
+ [DllImport ("gdiplus.dll")]
+ internal static extern Status GdipGetCellDescent (IntPtr fontFamily, int style, out uint descent);
+
+ [DllImport ("gdiplus.dll")]
+ internal static extern Status GdipGetLineSpacing (IntPtr fontFamily, int style, out uint spacing);
+
+ [DllImport ("gdiplus.dll")]
+ internal static extern Status GdipGetEmHeight (IntPtr fontFamily, int style, out uint emHeight);
+
+ [DllImport ("gdiplus.dll")]
+ internal static extern Status GdipIsStyleAvailable (IntPtr fontFamily, int style, out bool styleAvailable);
+
+ [DllImport ("gdiplus.dll")]
+ internal static extern Status GdipDeleteFontFamily (IntPtr fontFamily);
+#endregion
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing/gdipStructs.cs b/mcs/class/System.Drawing/System.Drawing/gdipStructs.cs
index 1564bc07015..2ada6a1daee 100644
--- a/mcs/class/System.Drawing/System.Drawing/gdipStructs.cs
+++ b/mcs/class/System.Drawing/System.Drawing/gdipStructs.cs
@@ -15,10 +15,10 @@ namespace System.Drawing {
[StructLayout(LayoutKind.Sequential)]
internal struct GdiplusStartupInput
{
- uint GdiplusVersion;
- IntPtr DebugEventCallback;
- int SuppressBackgroundThread;
- int SuppressExternalCodecs;
+ uint GdiplusVersion;
+ IntPtr DebugEventCallback;
+ int SuppressBackgroundThread;
+ int SuppressExternalCodecs;
internal static GdiplusStartupInput MakeGdiplusStartupInput ()
{
@@ -30,14 +30,14 @@ namespace System.Drawing {
return result;
}
- }
+ }
[StructLayout(LayoutKind.Sequential)]
internal struct GdiplusStartupOutput
{
- internal IntPtr NotificationHook;
- internal IntPtr NotificationUnhook;
-
+ internal IntPtr NotificationHook;
+ internal IntPtr NotificationUnhook;
+
internal static GdiplusStartupOutput MakeGdiplusStartupOutput ()
{
GdiplusStartupOutput result = new GdiplusStartupOutput ();
@@ -45,40 +45,5 @@ namespace System.Drawing {
return result;
}
}
-
- [StructLayout(LayoutKind.Sequential)]
- internal struct GpRect
- {
- internal int left;
- internal int top;
- internal int right;
- internal int bottom;
-
- internal GpRect (Rectangle r)
- {
- left = r.Left;
- top = r.Top;
- right = r.Right;
- bottom = r.Bottom;
- }
- }
-
- [StructLayout(LayoutKind.Sequential)]
- internal struct GpRectF
- {
- internal float left;
- internal float top;
- internal float right;
- internal float bottom;
-
- internal GpRectF (RectangleF r)
- {
- left = r.Left;
- top = r.Top;
- right = r.Right;
- bottom = r.Bottom;
- }
- }
-
}
diff --git a/mcs/class/System.Drawing/System.Drawing_test.dll.sources b/mcs/class/System.Drawing/System.Drawing_test.dll.sources
new file mode 100644
index 00000000000..aef4d5fe8ad
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing_test.dll.sources
@@ -0,0 +1,4 @@
+System.Drawing/TestPoint.cs
+System.Drawing/TestPointF.cs
+System.Drawing/TestSize.cs
+System.Drawing/TestSizeF.cs
diff --git a/mcs/class/System.Drawing/Test/System.Drawing/BmpPaint.cs b/mcs/class/System.Drawing/Test/System.Drawing/BmpPaint.cs
index d254f25e60a..5ef7ab6e089 100644
--- a/mcs/class/System.Drawing/Test/System.Drawing/BmpPaint.cs
+++ b/mcs/class/System.Drawing/Test/System.Drawing/BmpPaint.cs
@@ -33,7 +33,7 @@ public class BmpPaint {
Console.WriteLine("Bitmap stored to " + filename);
}
- static public void PaintOnBitmap (string filename)
+ static public void PaintOnBitmap (string filename, string newname)
{
Bitmap bmp = new Bitmap(filename);
Console.WriteLine("Bitmap readed OK {0}", bmp != null);
@@ -48,19 +48,19 @@ public class BmpPaint {
gr.DrawRectangle(p, 20.0F, 20.0F, 60.0F, 60.0F);
p.Dispose();
}
- bmp.Save(filename);
+ bmp.Save(newname);
gr.Dispose();
bmp.Dispose();
- Console.WriteLine("Modified Bitmap stored to " + filename);
+ Console.WriteLine("Modified Bitmap stored to " + newname);
}
static public void Main( string[] args)
{
CreateBitmap ("file.bmp", ImageFormat.Bmp);
- PaintOnBitmap ("file.bmp");
+ PaintOnBitmap ("file.bmp", "file-painted.bmp");
CreateBitmap ("file.jpg", ImageFormat.Jpeg);
- PaintOnBitmap ("file.jpg");
- CreateBitmap ("file.png", ImageFormat.Png);
- PaintOnBitmap ("file.png");
+ //PaintOnBitmap ("file.jpg", "file-painted.jpg");
+ //CreateBitmap ("file.png", ImageFormat.Png);
+ //PaintOnBitmap ("file.png", "file-painted.png");
}
};
diff --git a/mcs/class/System.Drawing/Test/System.Drawing/ChangeLog b/mcs/class/System.Drawing/Test/System.Drawing/ChangeLog
index 1b48732aff3..b11157305ac 100644
--- a/mcs/class/System.Drawing/Test/System.Drawing/ChangeLog
+++ b/mcs/class/System.Drawing/Test/System.Drawing/ChangeLog
@@ -1,3 +1,14 @@
+2004-01-26 Ravindra <rkumar@novell.com>
+ * TestPointF.cs: Added.
+ * TestSize.cs: Added.
+ * TestSizeF: Added.
+
+2004-01-16 Ravindra <rkumar@novell.com>
+ * BmpPaint.cs did not run on .NET.
+ Modified to make it run on .NET. Specs say
+ "Do not save an image to the same stream
+ that was used to construct the image."
+
2003-07-30 Alexandre Pigolkine <pigolkine@gmx.de>
* BmpPaint.cs modified
diff --git a/mcs/class/System.Drawing/Test/System.Drawing/README b/mcs/class/System.Drawing/Test/System.Drawing/README
new file mode 100644
index 00000000000..38d1f5878da
--- /dev/null
+++ b/mcs/class/System.Drawing/Test/System.Drawing/README
@@ -0,0 +1,10 @@
+README
+
+* test.sh runs the tests using the Mono runtime and stores the bimaps created by
+tests in the directory called Mono.
+
+* test-ms.sh runs the test using the MS .Net runtime and stores the bimaps
+created by tests in the directory called MsNet.
+
+Fell free to hack both scripts
+
diff --git a/mcs/class/System.Drawing/Test/System.Drawing/TestBitmap.cs b/mcs/class/System.Drawing/Test/System.Drawing/TestBitmap.cs
new file mode 100644
index 00000000000..43b5856d0b6
--- /dev/null
+++ b/mcs/class/System.Drawing/Test/System.Drawing/TestBitmap.cs
@@ -0,0 +1,143 @@
+//
+// Bitmap class testing unit
+//
+// Author:
+//
+// Jordi Mas i Hernàndez (jmas@softcatala.org>
+//
+// (C) 2004 Ximian, Inc. http://www.ximian.com
+//
+using System;
+using System.Drawing;
+using System.Drawing.Imaging;
+using NUnit.Framework;
+
+namespace MonoTests.System.Drawing{
+
+ [TestFixture]
+ public class BitMapTest : Assertion {
+
+ [TearDown]
+ public void Clean() {}
+
+ [SetUp]
+ public void GetReady()
+ {
+
+ }
+
+ //[Test]
+ public void TestPixels()
+ {
+ // Tests GetSetPixel/SetPixel
+ Bitmap bmp= new Bitmap(100,100, PixelFormat.Format32bppRgb);
+ bmp.SetPixel(0,0,Color.FromArgb(255,128,128,128));
+ Color color = bmp.GetPixel(0,0);
+
+ AssertEquals (Color.FromArgb(255,128,128,128), color);
+
+ bmp.SetPixel(99,99,Color.FromArgb(255,255,0,155));
+ Color color2 = bmp.GetPixel(99,99);
+ AssertEquals (Color.FromArgb(255,255,0,155), color2);
+ }
+
+ /* Get the right directory depending on the runtime*/
+ internal string getSubDir()
+ {
+ string sRslt;
+
+ if (Environment.GetEnvironmentVariable("MSNet")==null)
+ sRslt = "mono/";
+ else
+ sRslt = "MSNet/";
+
+ return sRslt;
+ }
+
+ [Test]
+ public void BitmapLoadAndSave()
+ {
+ string sOutFile = getSubDir() + "linerect.bmp";
+
+ // Save
+ Bitmap bmp = new Bitmap(100,100, PixelFormat.Format32bppRgb);
+ Graphics gr = Graphics.FromImage(bmp);
+
+ Pen p = new Pen(Color.Red, 2);
+ gr.DrawLine(p, 10.0F, 10.0F, 90.0F, 90.0F);
+ gr.DrawRectangle(p, 10.0F, 10.0F, 80.0F, 80.0F);
+ p.Dispose();
+ bmp.Save(sOutFile, ImageFormat.Bmp);
+ gr.Dispose();
+ bmp.Dispose();
+
+ // Load
+ Bitmap bmpLoad = new Bitmap(sOutFile);
+ if( bmpLoad == null)
+ Console.WriteLine("Unable to load "+ sOutFile);
+
+ Color color = bmpLoad.GetPixel(10,10);
+
+ Console.WriteLine("Color "+ color);
+ AssertEquals (Color.FromArgb(255,255,0,0), color);
+ }
+
+ [Test]
+ public void MakeTransparent()
+ {
+ string sInFile = "bitmaps/maketransparent.bmp";
+ string sOutFile = getSubDir() + "transparent.bmp";
+
+ Bitmap bmp = new Bitmap(sInFile);
+ Console.WriteLine("Bitmap loaded OK", bmp != null);
+
+ bmp.MakeTransparent();
+ bmp.Save(sOutFile);
+
+ Color color = bmp.GetPixel(1,1);
+ AssertEquals (Color.Black.R, color.R);
+ AssertEquals (Color.Black.G, color.G);
+ AssertEquals (Color.Black.B, color.B);
+ }
+
+ [Test]
+ public void Clone ()
+ {
+ string sInFile = "bitmaps/almogaver24bits.bmp";
+ string sOutFile = getSubDir() + "clone24.bmp";
+
+ Rectangle rect = new Rectangle(0,0,50,50);
+ Bitmap bmp = new Bitmap(sInFile);
+
+ Bitmap bmpNew = bmp.Clone (rect, PixelFormat.Format32bppArgb);
+ bmpNew.Save(sOutFile);
+
+ Color colororg0 = bmp.GetPixel(0,0);
+ Color colororg50 = bmp.GetPixel(49,49);
+ Color colornew0 = bmpNew.GetPixel(0,0);
+ Color colornew50 = bmpNew.GetPixel(49,49);
+
+ AssertEquals (colororg0, colornew0);
+ AssertEquals (colororg50, colornew50);
+ }
+
+ [Test]
+ public void Handles()
+ {
+ // This is a simple test. We should test really if there are valid
+ // handles for Win32/Wine
+
+ string sInFile = "bitmaps/almogaver24bits.bmp";
+
+ Bitmap bmp = new Bitmap(sInFile);
+ IntPtr HandleBmp = bmp.GetHbitmap();
+ Console.WriteLine("Handles.GetHbitmap()-> " + HandleBmp);
+ Assert(HandleBmp!=IntPtr.Zero);
+
+ IntPtr HandleIcon = bmp.GetHicon();
+ Console.WriteLine("Handles.GetHicon()-> " + HandleIcon);
+ Assert(HandleIcon!=IntPtr.Zero);
+ }
+
+ }
+}
diff --git a/mcs/class/System.Drawing/Test/System.Drawing/TestPoint.cs b/mcs/class/System.Drawing/Test/System.Drawing/TestPoint.cs
index 01de794dc02..9c9bf12741c 100644
--- a/mcs/class/System.Drawing/Test/System.Drawing/TestPoint.cs
+++ b/mcs/class/System.Drawing/Test/System.Drawing/TestPoint.cs
@@ -1,159 +1,158 @@
// Tests for System.Drawing.Point.cs
//
// Author: Mike Kestner (mkestner@speakeasy.net)
-//
+// Improvements by Jordi Mas i Hernàndez <jmas@softcatala.org>
// Copyright (c) 2001 Ximian, Inc.
using NUnit.Framework;
using System;
using System.Drawing;
-public class PointTest : TestCase {
- Point pt1_1;
- Point pt1_0;
- Point pt0_1;
-
- protected override void SetUp ()
- {
- pt1_1 = new Point (1, 1);
- pt1_0 = new Point (1, 0);
- pt0_1 = new Point (0, 1);
- }
-
- public PointTest(String name) : base (name) {}
-
- public static ITest Suite {
- get {
- TestSuite suite = new TestSuite ();
- suite.AddTest (new PointTest ("EqualsTest"));
- suite.AddTest (new PointTest ("EqualityOpTest"));
- suite.AddTest (new PointTest ("InequalityOpTest"));
- suite.AddTest (new PointTest ("CeilingTest"));
- suite.AddTest (new PointTest ("RoundTest"));
- suite.AddTest (new PointTest ("TruncateTest"));
- suite.AddTest (new PointTest ("NullTest"));
- suite.AddTest (new PointTest ("AdditionTest"));
- suite.AddTest (new PointTest ("SubtractionTest"));
- suite.AddTest (new PointTest ("Point2SizeTest"));
- suite.AddTest (new PointTest ("Point2PointFTest"));
- suite.AddTest (new PointTest ("ConstructorTest"));
- suite.AddTest (new PointTest ("PropertyTest"));
- suite.AddTest (new PointTest ("OffsetTest"));
- return suite;
+namespace MonoTests.System.Drawing{
+
+ [TestFixture]
+ public class PointTest : Assertion {
+ Point pt1_1;
+ Point pt1_0;
+ Point pt0_1;
+
+ [TearDown]
+ public void Clean() {}
+
+ [SetUp]
+ public void GetReady()
+ {
+ pt1_1 = new Point (1, 1);
+ pt1_0 = new Point (1, 0);
+ pt0_1 = new Point (0, 1);
+ }
+
+
+ [Test]
+ public void EqualsTest ()
+ {
+ AssertEquals (pt1_1, pt1_1);
+ AssertEquals (pt1_1, new Point (1, 1));
+ Assert (!pt1_1.Equals (pt1_0));
+ Assert (!pt1_1.Equals (pt0_1));
+ Assert (!pt1_0.Equals (pt0_1));
+ }
+
+ [Test]
+ public void EqualityOpTest ()
+ {
+ Assert (pt1_1 == pt1_1);
+ Assert (pt1_1 == new Point (1, 1));
+ Assert (!(pt1_1 == pt1_0));
+ Assert (!(pt1_1 == pt0_1));
+ Assert (!(pt1_0 == pt0_1));
}
- }
-
- public void EqualsTest ()
- {
- AssertEquals (pt1_1, pt1_1);
- AssertEquals (pt1_1, new Point (1, 1));
- Assert (!pt1_1.Equals (pt1_0));
- Assert (!pt1_1.Equals (pt0_1));
- Assert (!pt1_0.Equals (pt0_1));
- }
-
- public void EqualityOpTest ()
- {
- Assert (pt1_1 == pt1_1);
- Assert (pt1_1 == new Point (1, 1));
- Assert (!(pt1_1 == pt1_0));
- Assert (!(pt1_1 == pt0_1));
- Assert (!(pt1_0 == pt0_1));
- }
-
- public void InequalityOpTest ()
- {
- Assert (!(pt1_1 != pt1_1));
- Assert (!(pt1_1 != new Point (1, 1)));
- Assert (pt1_1 != pt1_0);
- Assert (pt1_1 != pt0_1);
- Assert (pt1_0 != pt0_1);
- }
-
- public void CeilingTest ()
- {
- PointF ptf = new PointF (0.8f, 0.3f);
- AssertEquals (pt1_1, Point.Ceiling (ptf));
- }
-
- public void RoundTest ()
- {
- PointF ptf = new PointF (0.8f, 1.3f);
- AssertEquals (pt1_1, Point.Round (ptf));
- }
-
- public void TruncateTest ()
- {
- PointF ptf = new PointF (0.8f, 1.3f);
- AssertEquals (pt0_1, Point.Truncate (ptf));
- }
-
- public void NullTest ()
- {
- Point pt = new Point (0, 0);
- AssertEquals (pt, Point.Empty);
- }
-
- public void AdditionTest ()
- {
- AssertEquals (pt1_1, pt1_0 + new Size (0, 1));
- AssertEquals (pt1_1, pt0_1 + new Size (1, 0));
- }
-
- public void SubtractionTest ()
- {
- AssertEquals (pt1_0, pt1_1 - new Size (0, 1));
- AssertEquals (pt0_1, pt1_1 - new Size (1, 0));
- }
-
- public void Point2SizeTest ()
- {
- Size sz1 = new Size (1, 1);
- Size sz2 = (Size) pt1_1;
-
- AssertEquals (sz1, sz2);
- }
-
- public void Point2PointFTest ()
- {
- PointF ptf1 = new PointF (1, 1);
- PointF ptf2 = pt1_1;
-
- AssertEquals (ptf1, ptf2);
- }
-
- public void ConstructorTest ()
- {
- int i = (1 << 16) + 1;
- Size sz = new Size (1, 1);
- Point pt_i = new Point (i);
- Point pt_sz = new Point (sz);
-
- AssertEquals (pt_i, pt_sz);
- AssertEquals (pt_i, pt1_1);
- AssertEquals (pt_sz, pt1_1);
- }
-
- public void PropertyTest ()
- {
- Point pt = new Point (0, 0);
-
- Assert (pt.IsEmpty);
- Assert (!pt1_1.IsEmpty);
- AssertEquals (1, pt1_0.X);
- AssertEquals (1, pt0_1.Y);
- }
- public void OffsetTest ()
- {
- Point pt = new Point (0, 0);
- pt.Offset (0, 1);
- AssertEquals (pt, pt0_1);
- pt.Offset (1, 0);
- AssertEquals (pt, pt1_1);
- pt.Offset (0, -1);
- AssertEquals (pt, pt1_0);
+ [Test]
+ public void InequalityOpTest ()
+ {
+ Assert (!(pt1_1 != pt1_1));
+ Assert (!(pt1_1 != new Point (1, 1)));
+ Assert (pt1_1 != pt1_0);
+ Assert (pt1_1 != pt0_1);
+ Assert (pt1_0 != pt0_1);
+ }
+
+ [Test]
+ public void CeilingTest ()
+ {
+ PointF ptf = new PointF (0.8f, 0.3f);
+ AssertEquals (pt1_1, Point.Ceiling (ptf));
+ }
+
+ [Test]
+ public void RoundTest ()
+ {
+ PointF ptf = new PointF (0.8f, 1.3f);
+ AssertEquals (pt1_1, Point.Round (ptf));
+ }
+
+ [Test]
+ public void TruncateTest ()
+ {
+ PointF ptf = new PointF (0.8f, 1.3f);
+ AssertEquals (pt0_1, Point.Truncate (ptf));
+ }
+
+ [Test]
+ public void NullTest ()
+ {
+ Point pt = new Point (0, 0);
+ AssertEquals (pt, Point.Empty);
+ }
+
+ [Test]
+ public void AdditionTest ()
+ {
+ AssertEquals (pt1_1, pt1_0 + new Size (0, 1));
+ AssertEquals (pt1_1, pt0_1 + new Size (1, 0));
+ }
+
+ [Test]
+ public void SubtractionTest ()
+ {
+ AssertEquals (pt1_0, pt1_1 - new Size (0, 1));
+ AssertEquals (pt0_1, pt1_1 - new Size (1, 0));
+ }
+
+ [Test]
+ public void Point2SizeTest ()
+ {
+ Size sz1 = new Size (1, 1);
+ Size sz2 = (Size) pt1_1;
+
+ AssertEquals (sz1, sz2);
+ }
+
+ [Test]
+ public void Point2PointFTest ()
+ {
+ PointF ptf1 = new PointF (1, 1);
+ PointF ptf2 = pt1_1;
+
+ AssertEquals (ptf1, ptf2);
+ }
+
+ [Test]
+ public void ConstructorTest ()
+ {
+ int i = (1 << 16) + 1;
+ Size sz = new Size (1, 1);
+ Point pt_i = new Point (i);
+ Point pt_sz = new Point (sz);
+
+ AssertEquals (pt_i, pt_sz);
+ AssertEquals (pt_i, pt1_1);
+ AssertEquals (pt_sz, pt1_1);
+ }
+
+ [Test]
+ public void PropertyTest ()
+ {
+ Point pt = new Point (0, 0);
+
+ Assert (pt.IsEmpty);
+ Assert (!pt1_1.IsEmpty);
+ AssertEquals (1, pt1_0.X);
+ AssertEquals (1, pt0_1.Y);
+ }
+
+ [Test]
+ public void OffsetTest ()
+ {
+ Point pt = new Point (0, 0);
+ pt.Offset (0, 1);
+ AssertEquals (pt, pt0_1);
+ pt.Offset (1, 0);
+ AssertEquals (pt, pt1_1);
+ pt.Offset (0, -1);
+ AssertEquals (pt, pt1_0);
+ }
}
}
-
diff --git a/mcs/class/System.Drawing/Test/System.Drawing/TestPointF.cs b/mcs/class/System.Drawing/Test/System.Drawing/TestPointF.cs
new file mode 100644
index 00000000000..e218d6f2b48
--- /dev/null
+++ b/mcs/class/System.Drawing/Test/System.Drawing/TestPointF.cs
@@ -0,0 +1,110 @@
+// Tests for System.Drawing.PointF.cs
+//
+// Author: Ravindra (rkumar@novell.com)
+//
+// Copyright (c) 2004 Novell, Inc.
+//
+
+using NUnit.Framework;
+using System;
+using System.Drawing;
+
+namespace MonoTests.System.Drawing
+{
+ [TestFixture]
+ public class PointFTest : Assertion
+ {
+ PointF pt11_99;
+ PointF pt11_0;
+ PointF pt0_11;
+
+ [TearDown]
+ public void TearDown () {}
+
+ [SetUp]
+ public void SetUp ()
+ {
+ pt11_99 = new PointF (1.1F, 9.9F);
+ pt11_0 = new PointF (1.1F, 0F);
+ pt0_11 = new PointF (0F, 1.1F);
+ }
+
+ [Test]
+ public void TestConstructors ()
+ {
+ PointF pt = new PointF (1.5F, 5.8F);
+ AssertEquals ("C#1", 1.5F, pt.X);
+ AssertEquals ("C#2", 5.8F, pt.Y);
+ }
+
+ [Test]
+ public void TestEmptyField ()
+ {
+ PointF pt = new PointF (0.0F, 0.0F);
+ AssertEquals ("EMP#1", pt, PointF.Empty);
+ }
+
+ [Test]
+ public void TestProperties ()
+ {
+ PointF pt = new PointF (0.0F, 0.0F);
+
+ Assert ("P#1", pt.IsEmpty);
+ Assert ("P#2", ! pt11_99.IsEmpty);
+ AssertEquals ("P#3", 1.1F, pt11_0.X);
+ AssertEquals ("P#4", 1.1F, pt0_11.Y);
+ }
+
+ [Test]
+ public void TestEquals ()
+ {
+ AssertEquals ("EQ#1", pt11_99, pt11_99);
+ AssertEquals ("EQ#2", pt11_99, new PointF (1.1F, 9.9F));
+ Assert ("EQ#3", ! pt11_99.Equals (pt11_0));
+ Assert ("EQ#4", ! pt11_99.Equals (pt0_11));
+ Assert ("EQ#5", ! pt11_0.Equals (pt0_11));
+ }
+
+ [Test]
+ public void Test2String ()
+ {
+ AssertEquals ("2STR#1", "{X=1.1, Y=9.9}", pt11_99.ToString ());
+ }
+
+ [Test]
+ public void TestAddition ()
+ {
+ AssertEquals ("ADD#1", pt11_0, pt11_0 + new Size (0, 0));
+ AssertEquals ("ADD#2", pt0_11, pt0_11 + new Size (0, 0));
+ }
+
+ [Test]
+ public void TestEqualityOp ()
+ {
+ Assert ("EOP#1", pt11_99 == pt11_99);
+ Assert ("EOP#2", pt11_99 == new PointF (1.1F, 9.9F));
+ Assert ("EOP#3", ! (pt11_99 == pt11_0));
+ Assert ("EOP#4", ! (pt11_99 == pt0_11));
+ Assert ("EOP#5", ! (pt11_0 == pt0_11));
+ }
+
+ [Test]
+ public void TestInequalityOp ()
+ {
+ Assert ("IOP#1", ! (pt11_99 != pt11_99));
+ Assert ("IOP#2", ! (pt11_99 != new PointF (1.1F, 9.9F)));
+ Assert ("IOP#3", pt11_99 != pt11_0);
+ Assert ("IOP#4", pt11_99 != pt0_11);
+ Assert ("IOP#5", pt11_0 != pt0_11);
+ }
+
+ [Test]
+ public void TestSubtraction ()
+ {
+ AssertEquals ("SUB#1", pt11_0, pt11_0 - new Size (0, 0));
+ AssertEquals ("SUB#2", pt0_11, pt0_11 - new Size (0, 0));
+ }
+
+ }
+}
+
diff --git a/mcs/class/System.Drawing/Test/System.Drawing/TestSize.cs b/mcs/class/System.Drawing/Test/System.Drawing/TestSize.cs
new file mode 100644
index 00000000000..7cfa2c7db04
--- /dev/null
+++ b/mcs/class/System.Drawing/Test/System.Drawing/TestSize.cs
@@ -0,0 +1,164 @@
+// Tests for System.Drawing.Size.cs
+//
+// Author: Ravindra (rkumar@novell.com)
+//
+// Copyright (c) 2004 Novell, Inc.
+//
+
+using NUnit.Framework;
+using System;
+using System.Drawing;
+
+namespace MonoTests.System.Drawing
+{
+ [TestFixture]
+ public class SizeTest : Assertion
+ {
+ Size sz1_1;
+ Size sz1_0;
+ Size sz0_1;
+
+ [TearDown]
+ public void TearDown () {}
+
+ [SetUp]
+ public void SetUp ()
+ {
+ sz1_1 = new Size (1, 1);
+ sz1_0 = new Size (1, 0);
+ sz0_1 = new Size (0, 1);
+ }
+
+ [Test]
+ public void TestConstructors ()
+ {
+ Size sz_wh = new Size (1, 5);
+ AssertEquals ("C#1", 1, sz_wh.Width);
+ AssertEquals ("C#2", 5, sz_wh.Height);
+
+ Size sz_pt = new Size (new Point (1, 5));
+ AssertEquals ("C#3", 1, sz_pt.Width);
+ AssertEquals ("C#4", 5, sz_pt.Height);
+
+ AssertEquals ("C#5", sz_wh, sz_pt);
+ }
+
+ [Test]
+ public void TestEmptyField ()
+ {
+ Size sz = new Size (0, 0);
+ AssertEquals ("EMP#1", sz, Size.Empty);
+ }
+
+ [Test]
+ public void TestProperties ()
+ {
+ Size sz = new Size (0, 0);
+
+ Assert ("P#1", sz.IsEmpty);
+ Assert ("P#2", ! sz1_1.IsEmpty);
+ AssertEquals ("P#3", 1, sz1_0.Width);
+ AssertEquals ("P#4", 1, sz0_1.Height);
+ }
+
+ [Test]
+ public void TestCeiling ()
+ {
+ SizeF sf = new SizeF (0.5F, 0.6F);
+ AssertEquals ("CL#1", sz1_1, Size.Ceiling (sf));
+
+ sf = new SizeF (1.0F, 1.0F);
+ AssertEquals ("CL#2", sz1_1, Size.Ceiling (sf));
+ }
+
+ [Test]
+ public void TestEquals ()
+ {
+ AssertEquals ("EQ#1", sz1_1, sz1_1);
+ AssertEquals ("EQ#2", sz1_1, new Size (1, 1));
+ Assert ("EQ#3", ! sz1_1.Equals (sz1_0));
+ Assert ("EQ#4", ! sz1_1.Equals (sz0_1));
+ Assert ("EQ#5", ! sz1_0.Equals (sz0_1));
+ }
+
+ [Test]
+ public void TestRound ()
+ {
+ SizeF sf = new SizeF (0.3F, 0.7F);
+ AssertEquals ("CL#1", sz0_1, Size.Round (sf));
+
+ sf = new SizeF (0.6F, 0.6F);
+ AssertEquals ("CL#2", sz1_1, Size.Round (sf));
+
+ sf = new SizeF (1.0F, 1.0F);
+ AssertEquals ("CL#3", sz1_1, Size.Round (sf));
+ }
+
+
+ [Test]
+ public void TestTruncate ()
+ {
+ SizeF sf = new SizeF (0.8f, 1.3f);
+ AssertEquals ("TR#1", sz0_1, Size.Truncate (sf));
+
+ sf = new SizeF (1.9f, 1.9f);
+ AssertEquals ("TR#2", sz1_1, Size.Truncate (sf));
+
+ sf = new SizeF (1.0f, 1.0f);
+ AssertEquals ("TR#3", sz1_1, Size.Truncate (sf));
+ }
+
+ [Test]
+ public void TestAddition ()
+ {
+ AssertEquals ("ADD#1", sz1_1, sz1_0 + sz0_1);
+ AssertEquals ("ADD#2", sz1_1, sz1_1 + new Size (0, 0));
+ }
+
+ [Test]
+ public void TestEqualityOp ()
+ {
+ Assert ("EOP#1", sz1_1 == sz1_1);
+ Assert ("EOP#2", sz1_1 == new Size (1, 1));
+ Assert ("EOP#3", ! (sz1_1 == sz1_0));
+ Assert ("EOP#4", ! (sz1_1 == sz0_1));
+ Assert ("EOP#5", ! (sz1_0 == sz0_1));
+ }
+
+ [Test]
+ public void TestInequalityOp ()
+ {
+ Assert ("IOP#1", ! (sz1_1 != sz1_1));
+ Assert ("IOP#2", ! (sz1_1 != new Size (1, 1)));
+ Assert ("IOP#3", sz1_1 != sz1_0);
+ Assert ("IOP#4", sz1_1 != sz0_1);
+ Assert ("IOP#5", sz1_0 != sz0_1);
+ }
+
+ [Test]
+ public void TestSubtraction ()
+ {
+ AssertEquals ("SUB#1", sz1_0, sz1_1 - sz0_1);
+ AssertEquals ("SUB#2", sz0_1, sz1_1 - sz1_0);
+ }
+
+ [Test]
+ public void TestSize2Point ()
+ {
+ Point pt1 = new Point (1, 1);
+ Point pt2 = (Point) sz1_1;
+
+ AssertEquals ("SZ2PT#1", pt1, pt2);
+ }
+
+ [Test]
+ public void TestSize2SizeF ()
+ {
+ SizeF sf1 = new SizeF (1.0F, 1.0F);
+ SizeF sf2 = (SizeF) sz1_1;
+
+ AssertEquals ("SZ2SF#1", sf1, sf2);
+ }
+ }
+}
+
diff --git a/mcs/class/System.Drawing/Test/System.Drawing/TestSizeF.cs b/mcs/class/System.Drawing/Test/System.Drawing/TestSizeF.cs
new file mode 100644
index 00000000000..7b32ed29b47
--- /dev/null
+++ b/mcs/class/System.Drawing/Test/System.Drawing/TestSizeF.cs
@@ -0,0 +1,145 @@
+// Tests for System.Drawing.SizeF.cs
+//
+// Author: Ravindra (rkumar@novell.com)
+//
+// Modified TestPoint.cs for testing SizeF.cs.
+//
+// Copyright (c) 2004 Novell, Inc.
+//
+
+using NUnit.Framework;
+using System;
+using System.Drawing;
+
+namespace MonoTests.System.Drawing
+{
+ [TestFixture]
+ public class SizeFTest : Assertion
+ {
+ SizeF sz11_99;
+ SizeF sz11_0;
+ SizeF sz0_11;
+
+ [TearDown]
+ public void TearDown () {}
+
+ [SetUp]
+ public void SetUp ()
+ {
+ sz11_99 = new SizeF (1.1F, 9.9F);
+ sz11_0 = new SizeF (1.1F, 0F);
+ sz0_11 = new SizeF (0F, 1.1F);
+ }
+
+ [Test]
+ public void TestConstructors ()
+ {
+ SizeF sz_wh = new SizeF (1.5F, 5.8F);
+ AssertEquals ("C#1", 1.5F, sz_wh.Width);
+ AssertEquals ("C#2", 5.8F, sz_wh.Height);
+
+ SizeF sz_pf = new SizeF (new PointF (1.5F, 5.8F));
+ AssertEquals ("C#3", 1.5F, sz_pf.Width);
+ AssertEquals ("C#4", 5.8F, sz_pf.Height);
+
+ SizeF sz_sz = new SizeF (sz_wh);
+ AssertEquals ("C#5", 1.5F, sz_sz.Width);
+ AssertEquals ("C#6", 5.8F, sz_sz.Height);
+
+ AssertEquals ("C#7", sz_wh, sz_pf);
+ AssertEquals ("C#8", sz_pf, sz_sz);
+ AssertEquals ("C#9", sz_wh, sz_sz);
+ }
+
+ [Test]
+ public void TestEmptyField ()
+ {
+ SizeF sz = new SizeF (0.0F, 0.0F);
+ AssertEquals ("EMP#1", sz, SizeF.Empty);
+ }
+
+ [Test]
+ public void TestProperties ()
+ {
+ SizeF sz = new SizeF (0.0F, 0.0F);
+
+ Assert ("P#1", sz.IsEmpty);
+ Assert ("P#2", ! sz11_99.IsEmpty);
+ AssertEquals ("P#3", 1.1F, sz11_0.Width);
+ AssertEquals ("P#4", 1.1F, sz0_11.Height);
+ }
+
+ [Test]
+ public void TestEquals ()
+ {
+ AssertEquals ("EQ#1", sz11_99, sz11_99);
+ AssertEquals ("EQ#2", sz11_99, new SizeF (1.1F, 9.9F));
+ Assert ("EQ#3", ! sz11_99.Equals (sz11_0));
+ Assert ("EQ#4", ! sz11_99.Equals (sz0_11));
+ Assert ("EQ#5", ! sz11_0.Equals (sz0_11));
+ }
+
+ [Test]
+ public void Test2PointF ()
+ {
+ PointF p1 = new PointF (1.1F, 9.9F);
+ PointF p2 = sz11_99.ToPointF ();
+
+ AssertEquals ("2PF#1", p1, p2);
+ }
+
+ [Test]
+ public void Test2Size ()
+ {
+ Size sz1 = new Size (1, 9);
+ Size sz2 = sz11_99.ToSize ();
+
+ AssertEquals ("2SZ#1", sz1, sz2);
+ }
+
+
+ [Test]
+ public void TestAddition ()
+ {
+ AssertEquals ("ADD#1", sz11_99, sz11_0 + new SizeF (0.0F, 9.9F));
+ AssertEquals ("ADD#2", sz11_99, new SizeF (0.0F, 0.0F) + new SizeF (1.1F, 9.9F));
+ }
+
+ [Test]
+ public void TestEqualityOp ()
+ {
+ Assert ("EOP#1", sz11_99 == sz11_99);
+ Assert ("EOP#2", sz11_99 == new SizeF (1.1F, 9.9F));
+ Assert ("EOP#3", ! (sz11_99 == sz11_0));
+ Assert ("EOP#4", ! (sz11_99 == sz0_11));
+ Assert ("EOP#5", ! (sz11_0 == sz0_11));
+ }
+
+ [Test]
+ public void TestInequalityOp ()
+ {
+ Assert ("IOP#1", ! (sz11_99 != sz11_99));
+ Assert ("IOP#2", ! (sz11_99 != new SizeF (1.1F, 9.9F)));
+ Assert ("IOP#3", sz11_99 != sz11_0);
+ Assert ("IOP#4", sz11_99 != sz0_11);
+ Assert ("IOP#5", sz11_0 != sz0_11);
+ }
+
+ [Test]
+ public void TestSubtraction ()
+ {
+ AssertEquals ("SUB#1", sz11_0, sz11_99 - new SizeF (0.0F, 9.9F));
+ AssertEquals ("SUB#2", sz0_11, new SizeF (1.1F, 1.1F) - new SizeF (1.1F, 0.0F));
+ }
+
+ [Test]
+ public void TestSizeF2PointF ()
+ {
+ PointF pf1 = new PointF (1.1F, 9.9F);
+ PointF pf2 = (PointF) sz11_99;
+
+ AssertEquals ("SF2PF#1", pf1, pf2);
+ }
+ }
+}
+
diff --git a/mcs/class/System.Drawing/Test/System.Drawing/bitmaps/almogaver24bits.bmp b/mcs/class/System.Drawing/Test/System.Drawing/bitmaps/almogaver24bits.bmp
new file mode 100644
index 00000000000..a5117a587b9
--- /dev/null
+++ b/mcs/class/System.Drawing/Test/System.Drawing/bitmaps/almogaver24bits.bmp
Binary files differ
diff --git a/mcs/class/System.Drawing/Test/System.Drawing/bitmaps/maketransparent.bmp b/mcs/class/System.Drawing/Test/System.Drawing/bitmaps/maketransparent.bmp
new file mode 100644
index 00000000000..b9f6a206dd2
--- /dev/null
+++ b/mcs/class/System.Drawing/Test/System.Drawing/bitmaps/maketransparent.bmp
Binary files differ
diff --git a/mcs/class/System.Drawing/Test/System.Drawing/graphicsUi.cs b/mcs/class/System.Drawing/Test/System.Drawing/graphicsUi.cs
new file mode 100644
index 00000000000..aaf0e4983c3
--- /dev/null
+++ b/mcs/class/System.Drawing/Test/System.Drawing/graphicsUi.cs
@@ -0,0 +1,130 @@
+//
+// Test application for some graphics.cs functions implementation
+//
+// Author:
+// Jordi Mas i Hernàndez, jordi@ximian.com
+//
+
+using System;
+using System.Collections;
+using System.Windows.Forms;
+using System.Drawing;
+using System.Drawing.Drawing2D;
+
+//
+public class TestForm : System.Windows.Forms.Form
+{
+
+ public static void Main(string[] args)
+ {
+ Application.Run(new TestForm());
+ }
+
+ public TestForm()
+ {
+ InitializeComponent();
+ }
+
+ protected override void OnPaint(PaintEventArgs e)
+ {
+ Graphics dc = CreateGraphics();
+ Pen BluePen = new Pen(Color.Blue, 3);
+ Pen GreenPen = new Pen(Color.Green, 3);
+ Pen RedPen = new Pen(Color.Red, 3);
+ SolidBrush redBrush = new SolidBrush(Color.Red);
+ SolidBrush blueBrush = new SolidBrush(Color.Blue);
+
+ int x=0;
+ int y=0;
+
+ this.Show();
+
+ /* First Row*/
+ dc.DrawRectangle(BluePen, x,y,50,50);
+ x+=50;
+ dc.DrawEllipse(RedPen, x, y, 70, 50);
+ dc.DrawArc (BluePen, x, y, 50, 40, (float)0, (float)120);
+ x+=70;
+
+ dc.DrawBezier (GreenPen, new Point(x, y+5), new Point(x+50, y+5),
+ new Point(x+20, y+20), new Point(x+50, y+50));
+
+ x+=50;
+
+ PointF point1 = new PointF(10.0F+x, 10.0F);
+ PointF point2 = new PointF(10.0F+x, 5.0F);
+ PointF point3 = new PointF(40.0F+x, 5.0F);
+ PointF point4 = new PointF(50.0F+x, 10.0F);
+ PointF point5 = new PointF(60.0F+x, 20.0F);
+ PointF point6 = new PointF(70.0F+x, 40.0F);
+ PointF point7 = new PointF(50.0F+x, 50.0F);
+ PointF[] curvePoints ={point1,point2,point3, point4,point5, point6, point7};
+ dc.DrawLines(RedPen, curvePoints);
+ float tension = 1.0F;
+ FillMode aFillMode = FillMode.Alternate;
+ dc.DrawClosedCurve(GreenPen, curvePoints, tension, aFillMode);
+
+ x+=80;
+
+ // FillClosedCurve
+ PointF point10 = new PointF(x, y+15.0F);
+ PointF point20 = new PointF(x+40.0F, y+10.0F);
+ PointF point30 = new PointF(x+50.0F, y+40.0F);
+ PointF point40 = new PointF(x+10.0F, y+30.0F);
+ PointF[] points = {point10, point20, point30, point40};
+ FillMode newFillMode = FillMode.Winding;
+ e.Graphics.FillClosedCurve(redBrush, points, newFillMode, tension);
+
+ // Fill pie to screen.
+ e.Graphics.FillPie(blueBrush, x, 0, 200.0F, 100.0f, 300.0F, 45.0F);
+
+ /* second row*/
+ y+=80;
+ x=0;
+
+ // Clipping and Graphics container test
+ dc.SetClip(new Rectangle(5+x, 5+y, 75, 75));
+
+ // Begin a graphics container.
+ GraphicsContainer container = dc.BeginContainer();
+
+ // Set an additional clipping region for the container.
+ dc.SetClip(new Rectangle(50+x, 25+y, 50, 37));
+
+ // Fill a red rectangle in the container.
+ dc.FillRectangle(redBrush, 0, 0, 200, 200);
+
+ dc.EndContainer(container);
+ SolidBrush blueBrushLight = new SolidBrush(Color.FromArgb(128, 0, 0, 255));
+ dc.FillRectangle(blueBrushLight, 0, 0, 200, 200);
+
+ dc.ResetClip();
+ Pen blackPen = new Pen(Color.FromArgb(255, 0, 0, 0), 2.0f);
+ dc.DrawRectangle(blackPen, 5+x, 5+y, 75, 75);
+ dc.DrawRectangle(blackPen, 50+x, 25+y, 50, 37);
+
+ x=100;
+ y+=10;
+
+
+ Point[] ptstrans = {new Point(x, y), new Point(50+x, 25+y)};
+ dc.DrawLine(BluePen, ptstrans[0], ptstrans[1]);
+ dc.TranslateTransform(40.0F, 30.0F);
+ dc.TransformPoints(CoordinateSpace.Page,CoordinateSpace.World,ptstrans);
+ dc.ResetTransform();
+ dc.DrawLine(RedPen, ptstrans[0], ptstrans[1]);
+
+ }
+
+ private void InitializeComponent()
+ {
+ Text = "Test application for the graphic class implementation";
+ ClientSize = new System.Drawing.Size(500, 250);
+
+
+ return;
+ }
+
+}
+
+
diff --git a/mcs/class/System.Drawing/Test/System.Drawing/tests-ms.sh b/mcs/class/System.Drawing/Test/System.Drawing/tests-ms.sh
new file mode 100755
index 00000000000..114ac84afd0
--- /dev/null
+++ b/mcs/class/System.Drawing/Test/System.Drawing/tests-ms.sh
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+if [ ! -d "MSNet" ]; then
+ mkdir MSNet
+fi
+
+export MSNet=Yes
+
+mcs /target:library TestPoint.cs /r:NUnit.Framework.dll /r:System.Drawing.dll
+nunit-console TestBitmap.dll
+
+mcs /target:library TestBitmap.cs /r:NUnit.Framework.dll /r:System.Drawing.dll
+nunit-console TestBitmap.dll
+
+mcs /target:library TestSizeF.cs /r:NUnit.Framework.dll /r:System.Drawing.dll
+nunit-console TestSizeF.dll
+
+mcs /target:library TestSize.cs /r:NUnit.Framework.dll /r:System.Drawing.dll
+nunit-console TestSize.dll \ No newline at end of file
diff --git a/mcs/class/System.Drawing/Test/System.Drawing/tests.sh b/mcs/class/System.Drawing/Test/System.Drawing/tests.sh
new file mode 100755
index 00000000000..06538ae7f6b
--- /dev/null
+++ b/mcs/class/System.Drawing/Test/System.Drawing/tests.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+if [ ! -d "mono" ]; then
+ mkdir mono
+fi
+
+mcs TestPoint.cs /r:NUnit.Framework.dll /r:System.Drawing.dll /target:library
+nunit-console TestPoint.dll
+
+mcs TestBitmap.cs /r:NUnit.Framework.dll /r:System.Drawing.dll /target:library
+mono --debug nunit-console.exe TestBitmap.dll
+
+mcs TestSize.cs /r:NUnit.Framework.dll /r:System.Drawing.dll /target:library
+mono --debug nunit-console.exe TestSize.dll
+
+mcs TestSizeF.cs /r:NUnit.Framework.dll /r:System.Drawing.dll /target:library
+mono --debug nunit-console.exe TestSizeF.dll \ No newline at end of file
diff --git a/mcs/class/System.Drawing/gdiplus/ChangeLog b/mcs/class/System.Drawing/gdiplus/ChangeLog
deleted file mode 100644
index eac0211d886..00000000000
--- a/mcs/class/System.Drawing/gdiplus/ChangeLog
+++ /dev/null
@@ -1,279 +0,0 @@
-2003-12-25 Duncan Mak <duncan@ximian.com>
-
- * graphics-path.c (GdipAddPathLine): Use append instead of
- append_point.
- (GdipTransformPath): Remember to reset the points after the
- transformation.
-
-2003-12-25 Duncan Mak <duncan@ximian.com>
-
- * graphics.c (DrawBezier, DrawBezierI): Well, it's pretty obvious
- that the code was incorrect before. After Christmas, I'm gonna
- hook up the GraphicsPath code and work on testing and making sure
- this stuff is correct. I'm pretty sure, in a first pass, there are
- lots of littles bugs waiting to be fixed.
-
- * graphics-path.c (new_point): Removed, we now pack the point
- inside the append functions.
- (append): New function that takes the X, Y coordinates directly.
- (append_bezier): Take coordinates instead of GpPointFs. Use the
- new append function instead of append_point.
-
-2003-12-23 Duncan Mak <duncan@ximian.com>
-
- * graphics-path.c:
- * graphics-path.h: Implemented GraphicsPath.
-
- * Makefile: Added graphics-path.c.
-
- * gdip.h (GpPathPointType, GpWarpMode): Added.
-
-2003-12-21 Duncan Mak <duncan@ximian.com>
-
- * graphics.c (C1): Made it more precise.
- (make_pie): Fixed.
- (make_arc): New helper function for getting the right Bezier for
- an elliptical arc, based on an algorithm found in the
- comp.text.pdf FAQ.
-
-2003-12-02 Bernie Solomon <bernard@ugsolutions.com>
-
- * pen.c (GdipSetPenLineCap): fix arg type so it compiles
- using HP compiler.
-
- * gdip.h: fix spelling of GdipSetPenLineJoin and add
- prototype for GdipGetPenLineJoin
-
-2003-11-28 Duncan Mak <duncan@ximian.com>
-
- * brush.c (gdip_brush_setup): Check on the type of the brush and
- delegate the implementation to the concrete Brushes,
- (GdipCloneBrush, GdipDeleteBrush, GdipGetBrushType): Implemented.
-
- * gdip.h (DashStyle): Fixed typo.
- (PenAlignment, BrushType): Added new enumerations.
- (GpBrush): Added new type field.
- (GpPen): Added new fields: color, brush, mode, dash_array and
- unit. Updated the header file to include new Pen functions.
-
- * pen.c (convert_dash_array): Utitlity function for converting
- from a float* from GDI+ to a double* for Cairo.
- (GdipCreatePen2, GdipClonePen): Implemented.
- (PenWidth, BrushFill, Color, PenMode, PenUnit, DashStyle):
- (DashOffset, DashCount, DashArray): Implemented the Get/Set
- function pairs for these properties.
- (GdipGetPenCompoundArray, GdipSetPenCompoundArray):
- (GdipGetPenCompoundArrayCount): Stubbed.
-
- * solidbrush.c (gdip_solidfill_init): Utility for initializing a
- SolidBrush. Sets type as BrushTypeSolidColor.
- (gdip_solidfill_setup): Moved from gdip_brush_setup.
- (gdip_solidfill_clone): Implementation for GdipCloneBrush for a
- GpSolidFill.
- (GdipSetSolidFillColor, GdipGetSolidFillColor): Implemented.
-
-2003-11-22 Duncan Mak <duncan@ximian.com>
-
- * matrix.c (GdipCreateMatrix3, GdipCreateMatrix3I): Implemented.
- (GdipCloneMatrix): Fixed.
- (GdipShearMatrix, set_shear): Implemented.
-
- * graphics.c:
- (GdipGetWorldTransform, GdipMultiplyWorldTransform): Implemented.
- (GdipRotatePenTransform, GdipTranslatePenTransform): Use GDI+
- functions instead.
-
- * gdip.h
- (GdipRotatePenTransform, GdipTranslatePenTransform): Fix
- signature.
- (GdipCreateMatrix3, GdipCreateMatrix3I): Use const appropriately.
-
-2003-11-17 Duncan Mak <duncan@ximian.com>
-
- * matrix.c (matrix_equals): New helper function help test matrix
- equality.
- (GdipIsMatrixIdentity, GdipIsMatrixEqual): Use matrix_equals.
- (GdipGetMatrixElements): Don't malloc here, because the caller
- should hand us an allocated array.
-
-2003-11-16 Duncan Mak <duncan@ximian.com>
-
- * matrix.c (GdipCreateMatrix2, GdipCreateMatrix3)
- (GdipCreateMatrix3I): Implemented.
-
- * pen.c (GdipResetPenTransform):
- (GdipMultiplyPenTransform, GdipTranslatePenTransform):
- (GdipScalePenTransform, GdipRotatePenTransform): Implemented.
-
- * matrix.c (set_translate, set_scale, set_rotate): Helper
- functions copied from Cairo. We are doing this because you can
- specify the order of multiplcation in GDI+, but not in Cairo.
-
-2003-11-15 Duncan Mak <duncan@ximian.com>
-
- * graphics.c: Moved PI and GRADTORAD to gdip.h.
- * gdip.h: Renamed GRADTORAD to DEGTORAD.
-
- * matrix.c (GdipCloneMatrix): Fix argument order.
- * matrix.c
- (GdipMultiplyMatrix, GdipTranslateMatrix, GdipScaleMatrix):
- (GdipRotateMatrix, GdipInvertMatrix):
- (GdipTransformMatrixPoints, GdipVectorTransformMatrixPoints):
- (GdipSetMatrixElements, GdipGetMatrixElements):
- (GdipIsMatrixInvertible): Implemented.
-
- * matrix.c (GdipIsMatrixIdentity, GdipIsMatrixEqual): Implemented.
-
-2003-11-14 Duncan Mak <duncan@ximian.com>
-
- * general.c (gdip_get_status): Take cairo_status_t instead of
- cairo_t. We need this because this is used in matrix.c and we only
- have cairo_matrix_t there.
- * graphics.c: Updated calls to gdip_get_status.
-
- * pen.c
- (convert_line_cap, convert_line_join): Added static keyword.
- (GdipDeletePen): Implemented.
-
- * matrix.c
- (GdipCreateMatrix2, GdipCloneMatrix, GdipInvertMatrix): Use
- gdip_get_status instead of just returning Ok.
- (GdipRotateMatrix, GdipScaleMatrix, GdipTranslateMatrix):
- Implemented.
-
-2003-11-12 Duncan Mak <duncan@ximian.com>
-
- * bitmap.c, brush.c, general.c:
- * graphics.c, image.c, matrix.c:
- * pen.c, solidbrush.c: Use gdip.h instead of gdip_main.h.
-
- * gdip.h: New header file, merged from gdip_main.h and
- gdip_defs.h.
-
- * gdip_main.h, gdip_defs.h: Removed.
-
- * pen.c
- (convert_line_join, convert_line_cap): new function for converting
- enumerations between GDI+ and Cairo.
- (gdip_pen_setup): set miter limit and line join.
- (GdipSetPenMiterLimit, GdipGetPenMiterLimit):
- (GdipSetPenLineJoin, GdipGetPenLineJoin):
- (GdipSetPenLineJoin, GdipGetPenTransform): implemented.
-
-2003-11-12 Alexandre Pigolkine <pigolkine@gmx.de>
- * bitmap.c copy image funciton added
-
-2003-11-06 Duncan Mak <duncan@ximian.com>
-
- * graphics.c (GdipDrawRectangle): Add call to gdip_pen_setup so
- that we stroke with the right color.
-
-2003-11-05 Duncan Mak <duncan@ximian.com>
-
- * graphics.c
- (make_pie, make_ellipse, make_polygon): Add static keyword.
-
- * gdip_defs.h: Update headers to include DrawBezier, DrawBeziers,
- DrawEllipse, DrawPie, DrawPolygon, DrawRectangle, FillEllipse,
- FillPolygon and the RenderingOrigin property.
-
- * Makefile (install-local): Added missing semi-colons.
-
-2003-11-03 Bernie Solomon <bernard@ugsolutions.com>
-
- * gdip_main.h, gdip_win32.h, gdip_win32.c:
- fixes for non-GCC compilers
-
-2003-11-02 Alexandre Pigolkine <pigolkine@gmx.de>
-
- * bitmap.c convert 24/32 bpp images in LockBits
-
-2003-11-01 Duncan Mak <duncan@ximian.com>
-
- * matrix.c
- (GdipCreateMatrix, GdipCreateMatrix2, GdipCloneMatrix):
- (GdipDeleteMatrix, GdipInvertMatrix): Implemented; the rest of the
- functions are stubbed out.
-
- * gdip_defs.h (GpMatrixOrder): Added.
-
- * gdip_main.h
- (GpRect, GpRectF): Synonyms for Rect and RectF.
- (GpMatrix): An alias of cairo_matrix_t.
-
- * Makefile: Added matrix.c.
-
-2003-10-28 Duncan Mak <duncan@ximian.com>
-
- * gdip_main.h, gdip_def.h:
- Renamed all gdip_foo_ptr types are now GpFoo *.
- Renamed Status to GpStatus.
- Reformatted all C++ style comments to C style comments.
- Reformatted all C function prototypes to the style used by GTK+.
-
- * gdip_main.h (GpPoint, GpPointF): Added.
-
- * gdip_defs.h (GpFillMode): Added.
-
- * graphics.c (make_ellipse):
- (make_polygon, make_polygon_from_integers):
- (make_pie): private functions (make_foo) to be reused by DrawFoo
- and FillFoo.
-
- (convert_fill_mode): Converts a GpFillMode to a cairo_fill_rule_t.
-
- (GdipDrawPie, GdipFillEllipse, GdipFillPolygon): Implemented.
-
-2003-10-26 Duncan Mak <duncan@ximian.com>
-
- * graphics.c
- (GdipSetRenderingOrigin, GdipGetRenderingOrigin): Implemented.
-
-2003-10-25 Duncan Mak <duncan@ximian.com>
-
- * graphics.c
- (GdipDrawBezier, GdipDrawBezierI):
- (GdipDrawBeziers, GdipDrawBeziersI):
- (GdipDrawLine, GdipDrawLineI):
- (GdipDrawLines, GdipDrawLinesI): implemented.
-
- (GdipFillRectangle):
- (GdipDrawString): Make use of gdip_get_status.
-
- * general.c
- (gdip_get_status): A new function for retrieving a Status from a
- cairo_t.
-
-2003-10-23 Miguel de Icaza <miguel@ximian.com>
-
- * bitmap.c (GdipCreateBitmapFromScan0): Do not allocate buffer
- here, expect that our caller to allocate that.
-
- Do not compute the stride here, expect our caller to do this
- properly.
-
- * Use the Mono coding conventions.
-
-2003-10-15 Alexandre Pigolkine <pigolkine@gmx.de>
- * image.c GdipDrawImageRectI changed
-
-2003-10-14 Alexandre Pigolkine <pigolkine@gmx.de>
- * gdip_defs.h
- * graphics.c
- * gdip_main.h
- DrawString function added
-
-2003-10-12 Alexandre Pigolkine <pigolkine@gmx.de>
- * bitmap.c
- * brush.c
- * gdip_defs.h
- * gdip_win32.c
- * gdip_win32.h
- * gdip_main.h
- * general.c
- * graphics.c
- * image.c
- * Makefile
- * pen.c
- * solidbrush.c
- Added
diff --git a/mcs/class/System.Drawing/gdiplus/Makefile b/mcs/class/System.Drawing/gdiplus/Makefile
deleted file mode 100644
index 62328c753c8..00000000000
--- a/mcs/class/System.Drawing/gdiplus/Makefile
+++ /dev/null
@@ -1,72 +0,0 @@
-thisdir := class/System.Drawing/gdiplus
-SUBDIRS :=
-include ../../../build/rules.make
-
-MoreWarnings = -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls
-LOCAL_CFLAGS=-g -Wall `pkg-config --cflags cairo mono`
-LOCAL_LDFLAGS=`pkg-config --libs cairo mono`
-gdiplus = $(topdir)/class/lib/libgdiplus.dll.so
-local_sources = bitmap.c \
- brush.c \
- general.c \
- graphics.c \
- graphics-path.c \
- image.c \
- matrix.c \
- pen.c \
- solidbrush.c \
- gdip_win32.c
-
-local_objs = bitmap.o \
- brush.o \
- general.o \
- graphics.o \
- image.o \
- matrix.o \
- pen.o \
- solidbrush.o \
- gdip_win32.o
-
-
-all-local:
- (if pkg-config --modversion cairo; then \
- make guilibrary; \
- else \
- echo WARNING: Skipping gdiplus library compilation; \
- gcc -shared -Wl,-soname,libgdiplus.dll.so -o $(gdiplus) empty.c; \
- fi)
-
-clean-local:
- rm -f *.o
- rm -f $(gdiplus)
-# rm -f detect.h detect.libs detect-stamp
-
-install-local: all-local
- $(MKINSTALLDIRS) $(DESTDIR)$(prefix)/lib; \
- if test -f $(gdiplus); then \
- $(INSTALL_LIB) $(gdiplus) $(DESTDIR)$(prefix)/lib; \
- fi
-
-dist-local: dist-default
-
-guilibrary: $(gdiplus)
-
-$(gdiplus) : $(local_sources:.c=.o)
- gcc -shared -Wl,-soname,libgdiplus.dll.so -o $(gdiplus) $(local_objs) $(LOCAL_LDFLAGS)
-
-%.o: %.c
- $(CCOMPILE) -c -o $@ $^
-
-test-local:
- echo Done
-
-test:
- echo DOne
-
-#detect.h detect.libs: detect-stamp
-# sh detect
-#
-#detect-stamp:
-# touch detect-stamp
-#
-
diff --git a/mcs/class/System.Drawing/gdiplus/bitmap.c b/mcs/class/System.Drawing/gdiplus/bitmap.c
deleted file mode 100644
index 6c30f6ae22e..00000000000
--- a/mcs/class/System.Drawing/gdiplus/bitmap.c
+++ /dev/null
@@ -1,356 +0,0 @@
-/*
- * bitmap.c
- *
- * Copyright (c) 2003 Alexandre Pigolkine
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
- * and associated documentation files (the "Software"), to deal in the Software without restriction,
- * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all copies or substantial
- * portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
- * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
- * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- * Alexandre Pigolkine(pigolkine@gmx.de)
- */
-
-#include <glib.h>
-#include "gdip.h"
-#include "gdip_win32.h"
-#include <string.h>
-#include <unistd.h>
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-
-void
-gdip_bitmap_init (GpBitmap *bitmap)
-{
- gdip_image_init (&bitmap->image);
- bitmap->image.type = imageBitmap;
- bitmap->cairo_format = 0;
- bitmap->data.Width = 0;
- bitmap->data.Height = 0;
- bitmap->data.Stride = 0;
- bitmap->data.PixelFormat = 0;
- bitmap->data.Scan0 = 0;
- bitmap->data.Reserved = 0;
-
- bitmap->hBitmapDC = 0;
- bitmap->hInitialBitmap = 0;
- bitmap->hBitmap = 0;
-}
-
-GpBitmap *
-gdip_bitmap_new ()
-{
- GpBitmap *result = (GpBitmap *) GdipAlloc (sizeof(GpBitmap));
- gdip_bitmap_init (result);
- return result;
-}
-
-/*
- * This should only be called from GdipDisposeImage, and it should *not* free
- * the structure, that one is freed by GdipDisposeImage
- */
-void
-gdip_bitmap_dispose (GpBitmap *bitmap)
-{
-
-}
-
-void
-gdip_bitmap_fill_info_header (GpBitmap *bitmap, PBITMAPINFOHEADER bmi)
-{
- int bitmapLen = bitmap->data.Stride * bitmap->data.Height;
- memset (bmi, 0, 40);
- bmi->biSize = sizeof (BITMAPINFOHEADER);
- bmi->biWidth = bitmap->data.Width;
- bmi->biHeight = -bitmap->data.Height;
- bmi->biPlanes = 1;
- bmi->biBitCount = 32;
- bmi->biCompression = BI_RGB;
- bmi->biSizeImage = bitmapLen;
-}
-
-void
-gdip_bitmap_save_bmp (const char *name, GpBitmap *bitmap)
-{
- BITMAPFILEHEADER bmfh;
- BITMAPINFOHEADER bmi;
- int bitmapLen = bitmap->data.Stride * bitmap->data.Height;
- FILE *fp;
-
- bmfh.bfReserved1 = bmfh.bfReserved2 = 0;
- bmfh.bfType = BFT_BITMAP;
- bmfh.bfOffBits = (14 + 40 + 0 * 4);
- bmfh.bfSize = (bmfh.bfOffBits + bitmapLen);
- fp = fopen (name, "w+b");
- fwrite (&bmfh, 1, sizeof (bmfh), fp);
- gdip_bitmap_fill_info_header (bitmap, &bmi);
- bmi.biHeight = -bmi.biHeight;
- fwrite (&bmi, 1, sizeof (bmi), fp);
- fwrite (bitmap->data.Scan0, 1, bitmapLen, fp);
- fclose (fp);
-}
-
-void *
-gdip_bitmap_create_Win32_HDC (GpBitmap *bitmap)
-{
- void * result = 0;
- void * hdc = CreateCompatibleDC_pfn (0);
- void * hbitmap = 0, * holdbitmap = 0;
- void * hdcDesc = GetDC_pfn (0);
-
- hbitmap = CreateCompatibleBitmap_pfn (hdcDesc, bitmap->data.Width, bitmap->data.Height);
- if (hbitmap != 0) {
- BITMAPINFO bmi;
- gdip_bitmap_fill_info_header (bitmap, &bmi.bmiHeader);
- //_saveBmp ("file1.bmp", bitmap);
- SetDIBits_pfn (hdc, hbitmap, 0, bitmap->data.Height, bitmap->data.Scan0, &bmi, 0);
- holdbitmap = SelectObject_pfn (hdc, hbitmap);
- bitmap->hBitmapDC = hdc;
- bitmap->hInitialBitmap = holdbitmap;
- bitmap->hBitmap = hbitmap;
- result = hdc;
- }
- else {
- DeleteDC_pfn (hdc);
- }
- ReleaseDC_pfn (0, hdcDesc);
- return result;
-}
-
-void
-gdip_bitmap_destroy_Win32_HDC (GpBitmap *bitmap, void *hdc)
-{
- if (bitmap->hBitmapDC == hdc) {
-
- BITMAPINFO bmi;
- int res = 0;
- unsigned long *array, *end;
-
- SelectObject_pfn (bitmap->hBitmapDC, bitmap->hInitialBitmap);
-
- gdip_bitmap_fill_info_header (bitmap, &bmi.bmiHeader);
- res = GetDIBits_pfn (bitmap->hBitmapDC, bitmap->hBitmap, 0, bitmap->data.Height, bitmap->data.Scan0, &bmi, 0);
- if (bitmap->cairo_format == CAIRO_FORMAT_ARGB32) {
- array = bitmap->data.Scan0;
- end = array + (bmi.bmiHeader.biSizeImage >> 2);
- while (array < end) {
- *array |= 0xff000000;
- ++array;
- }
- }
- //_saveBmp ("file2.bmp", bitmap);
-
- DeleteObject_pfn (bitmap->hBitmap);
- DeleteDC_pfn (bitmap->hBitmapDC);
- bitmap->hBitmapDC = 0;
- bitmap->hInitialBitmap = 0;
- bitmap->hBitmap = 0;
- }
-}
-
-GpStatus
-GdipCreateBitmapFromScan0 (int width, int height, int stride, int format, void *scan0, GpBitmap **bitmap)
-{
- GpBitmap *result = 0;
- int cairo_format = 0;
-
- if (stride == 0)
- return InvalidParameter;
- if (scan0 == NULL)
- return InvalidParameter;
-
- switch (format) {
- case Format24bppRgb:
- cairo_format = CAIRO_FORMAT_RGB24;
- break;
- case Format32bppArgb:
- cairo_format = CAIRO_FORMAT_ARGB32;
- break;
- default:
- *bitmap = 0;
- return NotImplemented;
- }
- result = gdip_bitmap_new ();
- result->cairo_format = cairo_format;
- result->data.Width = width;
- result->data.Height = height;
- result->data.Stride = stride;
- result->data.PixelFormat = format;
- result->data.Scan0 = scan0;
-
- *bitmap = result;
- return Ok;
-}
-
-GpStatus
-GdipCreateBitmapFromGraphics (int width, int height, GpGraphics *graphics, GpBitmap **bitmap)
-{
- GpBitmap *result = 0;
- int bmpSize = 0;
- int cairo_format = 0;
- int stride = width;
-
- /*
- * FIXME: should get the stride based on the format of the graphics object.
- */
- fprintf (stderr, "GdipCreateBitmapFromGraphics: This routine has not been checked for stride size\n");
- while (stride % 4)
- stride++;
-
- stride *= 4;
- cairo_format = CAIRO_FORMAT_ARGB32;
- bmpSize = stride * height;
- result = gdip_bitmap_new ();
- result->cairo_format = cairo_format;
- result->data.Width = width;
- result->data.Height = height;
- result->data.Stride = stride;
- result->data.PixelFormat = Format32bppArgb;
- result->data.Scan0 = GdipAlloc (bmpSize);
- result->data.Reserved = 1;
- *bitmap = result;
- return Ok;
-}
-
-GpStatus
-GdipCloneBitmapAreaI (int x, int y, int width, int height, int format, GpBitmap *original, GpBitmap **bitmap)
-{
- GpBitmap *result = 0;
- int bmpSize = original->data.Height * original->data.Stride;
-
- /*
- * FIXME: Convert format if needed and copy only specified rectangle
- */
- result = gdip_bitmap_new ();
- result->cairo_format = original->cairo_format;
- result->data.Width = original->data.Width;
- result->data.Height = original->data.Height;
- result->data.Stride = original->data.Stride;
- result->data.PixelFormat = original->data.PixelFormat;
- result->data.Scan0 = GdipAlloc (bmpSize);
- memmove (result->data.Scan0, original->data.Scan0, bmpSize);
- result->data.Reserved = 1;
-
- *bitmap = result;
- return Ok;
-}
-
-static int
-ChangePixelFormat (GpBitmap *bitmap, GdipBitmapData *destData)
-{
- int sourcePixelIncrement = (bitmap->data.PixelFormat == Format32bppArgb) ? 1 : 0;
- int destinationPixelIncrement = (destData->PixelFormat == Format32bppArgb) ? 1 : 0;
- char * curSrc = bitmap->data.Scan0;
- char * curDst = 0;
- int i, j;
-
- /*
- printf("ChangePixelFormat to %d. Src inc %d, Dest Inc %d\n",
- destData->PixelFormat, sourcePixelIncrement, destinationPixelIncrement);
- */
- if (bitmap->data.PixelFormat == destData->PixelFormat) return 0;
-
- if (destData->PixelFormat != Format32bppArgb && destData->PixelFormat != Format24bppRgb) {
- fprintf (stderr, "This pixel format is not supported %d\n", destData->PixelFormat);
- return 0;
- }
- destData->Width = bitmap->data.Width;
- destData->Height = bitmap->data.Height;
- destData->Stride = ((destData->PixelFormat == Format32bppArgb ) ? 4 : 3 ) * bitmap->data.Width;
- destData->Scan0 = GdipAlloc (destData->Stride * bitmap->data.Height);
- destData->Reserved = 1;
- curSrc = bitmap->data.Scan0;
- curDst = (char *)destData->Scan0;
- for ( i = 0; i < bitmap->data.Height; i++) {
- for( j = 0; j < bitmap->data.Width; j++) {
- *curDst++ = *curSrc++;
- *curDst++ = *curSrc++;
- *curDst++ = *curSrc++;
- curSrc += sourcePixelIncrement;
- curDst += destinationPixelIncrement;
- }
- }
- return 1;
-}
-
-GpStatus
-GdipBitmapLockBits (GpBitmap *bitmap, Rect *rc, int flags, int format, GdipBitmapData *result)
-{
- if (bitmap == 0){
- printf ("Bitmap is null\n");
- return InvalidParameter;
- }
-
- /* Special case: the entire image is requested */
- if (rc->left == 0 && rc->right == bitmap->data.Width &&
- rc->top == 0 && rc->bottom == bitmap->data.Height &&
- format == bitmap->data.PixelFormat){
- *result = bitmap->data;
- result->Reserved = result->Reserved & ~1;
- return Ok;
- }
-
- if (bitmap->data.PixelFormat != format) {
- GdipBitmapData convert;
- convert.PixelFormat = format;
- if (!ChangePixelFormat (bitmap, &convert)) {
- printf ("Requesting format change, not supported yet %d %d\n", bitmap->data.PixelFormat, format);
- return InvalidParameter;
- }
- result->Width = convert.Width;
- result->Height = convert.Height;
- result->Stride = convert.Stride;
- result->PixelFormat = convert.PixelFormat;
- result->Reserved = convert.Reserved;
- result->Scan0 = convert.Scan0;
- }
- else {
- result->Width = bitmap->data.Width;
- result->Height = bitmap->data.Height;
- result->Stride = bitmap->data.Stride;
- result->PixelFormat = bitmap->data.PixelFormat;
- result->Reserved = bitmap->data.Reserved;
- result->Scan0 = bitmap->data.Scan0;
- }
-
- return Ok;
-}
-
-GpStatus
-____BitmapLockBits (GpBitmap *bitmap, Rect *rc, int flags, int format, int *width, int *height, int *stride, int *fptr, int *res, int *scan0)
-{
- GdipBitmapData d;
- int s;
-
- s = GdipBitmapLockBits (bitmap, rc, flags, format, &d);
- *width = d.Width;
- *height = d.Height;
- *stride = d.Stride;
- *fptr = d.PixelFormat;
- *res = d.Reserved;
- *scan0 = d.Scan0;
-
- return s;
-}
-
-GpStatus
-GdipBitmapUnlockBits (GpBitmap *bitmap, GdipBitmapData *bitmap_data)
-{
- if (bitmap_data->Reserved & 1)
- GdipFree (bitmap_data->Scan0);
- return Ok;
-}
-
diff --git a/mcs/class/System.Drawing/gdiplus/brush.c b/mcs/class/System.Drawing/gdiplus/brush.c
deleted file mode 100644
index dbeb859af84..00000000000
--- a/mcs/class/System.Drawing/gdiplus/brush.c
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * brush.c
- *
- * Copyright (c) 2003 Alexandre Pigolkine
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
- * and associated documentation files (the "Software"), to deal in the Software without restriction,
- * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all copies or substantial
- * portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
- * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
- * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- * Alexandre Pigolkine(pigolkine@gmx.de)
- */
-
-#include "gdip.h"
-
-void
-gdip_brush_setup (GpGraphics *graphics, GpBrush *brush)
-{
- GpBrushType type;
- GdipGetBrushType (brush, &type);
-
- if (type == BrushTypeSolidColor) {
- GpSolidFill *solid = brush;
- gdip_solidfill_setup (graphics, solid);
- }
-}
-
-GpBrush *
-gdip_brush_new (void)
-{
- GpBrush *result = (GpBrush *) GdipAlloc (sizeof (GpBrush));
-
- return result;
-}
-
-GpStatus
-GdipCloneBrush (GpBrush *brush, GpBrush **clonedBrush)
-{
- GpBrushType type;
- GdipGetBrushType (brush, &type);
-
- if (type == BrushTypeSolidColor)
- return gdip_solidfill_clone (brush, clonedBrush);
- else
- return NotImplemented;
-}
-
-GpStatus
-GdipDeleteBrush (GpBrush *brush)
-{
- GdipFree (brush);
-}
-
-GpStatus
-GdipGetBrushType (GpBrush *brush, GpBrushType *type)
-{
- *type = brush->type;
- return Ok;
-}
diff --git a/mcs/class/System.Drawing/gdiplus/empty.c b/mcs/class/System.Drawing/gdiplus/empty.c
deleted file mode 100755
index 264324c5bd1..00000000000
--- a/mcs/class/System.Drawing/gdiplus/empty.c
+++ /dev/null
@@ -1 +0,0 @@
-/* empty file */
diff --git a/mcs/class/System.Drawing/gdiplus/gdip.h b/mcs/class/System.Drawing/gdiplus/gdip.h
deleted file mode 100644
index 4d2a139520a..00000000000
--- a/mcs/class/System.Drawing/gdiplus/gdip.h
+++ /dev/null
@@ -1,432 +0,0 @@
-/*
- * gdip.h
- *
- * Authors:
- * Alexandre Pigolkine (pigolkine@gmx.de)
- * Duncan Mak (duncan@ximian.com)
- * Miguel de Icaza (miguel@ximian.com)
- *
- * Copyright (C) Novell, Inc. 2003.
- */
-
-#ifndef _GDIP_H
-#define _GDIP_H
-
-#include <stdlib.h>
-#include <stdio.h>
-
-#include <cairo.h>
-#include <cairo-xlib.h>
-#include <mono/io-layer/uglify.h>
-
-/*
- * Constants
- *
- */
-#define PI 3.14159265358979323846
-#define DEGTORAD PI / 180.0
-
-typedef unsigned char byte;
-typedef int bool;
-
-/*
- * Enums
- *
- */
-
-typedef enum {
- Ok = 0,
- GenericError = 1,
- InvalidParameter = 2,
- OutOfMemory = 3,
- ObjectBusy = 4,
- InsufficientBuffer = 5,
- NotImplemented = 6,
- Win32Error = 7,
- WrongState = 8,
- Aborted = 9,
- FileNotFound = 10,
- ValueOverflow = 11,
- AccessDenied = 12,
- UnknownImageFormat = 13,
- FontFamilyNotFound = 14,
- FontStyleNotFound = 15,
- NotTrueTypeFont = 16,
- UnsupportedGdiplusVersion = 17,
- GdiplusNotInitialized = 18,
- PropertyNotFound = 19,
- PropertyNotSupported = 20
-} GpStatus;
-
-typedef enum {
- MatrixOrderPrepend = 0,
- MatrixOrderAppend = 1
-} MatrixOrder, GpMatrixOrder;
-
-typedef enum {
- UnitWorld = 0,
- UnitDisplay = 1,
- UnitPixel = 2,
- UnitPoint = 3,
- UnitInch = 4,
- UnitDocument = 5,
- UnitMillimeter = 6
-} GpUnit, Unit;
-
-typedef enum {
- Alpha = 262144,
- Canonical = 2097152,
- DontCare = 0,
- Extended = 1048576,
- Format16bppArgb1555 = 397319,
- Format16bppGrayScale = 1052676,
- Format16bppRgb555 = 135173,
- Format16bppRgb565 = 135174,
- Format1bppIndexed = 196865,
- Format24bppRgb = 137224,
- Format32bppArgb = 2498570,
- Format32bppPArgb = 925707,
- Format32bppRgb = 139273,
- Format48bppRgb = 1060876,
- Format4bppIndexed = 197634,
- Format64bppArgb = 3424269,
- Format64bppPArgb = 1851406,
- Format8bppIndexed = 198659,
- Gdi = 131072,
- Indexed = 65536,
- Max = 15,
- PAlpha = 524288,
- Undefined = 0
-} PixelFormat;
-
-typedef enum {
- ReadOnly = 1,
- ReadWrite = 3,
- UserInputBuffer = 4,
- WriteOnly = 2
-} ImageLockMode;
-
-typedef enum {
- FillModeAlternate,
- FillModeWinding
-} GpFillMode;
-
-typedef enum {
- DashStyleSolid = 0, /* solid line */
- DashStyleDash = 1, /* dashed line */
- DashStyleDot = 2, /* dotted line */
- DashStyleDashDot = 3, /* alt. dash-dot */
- DashStyleDashDotDot = 4, /* alt. dash-dot-dot */
- DashStyleCustom = 5 /* user-defined */
-} GpDashStyle;
-
-typedef enum {
- LineJoinMiter = 0, /* sharp corner */
- LineJoinBevel = 1, /* round corner */
- LineJoinRound = 2, /* circular, smooth, circular arc */
- LineJoinMiterClipped = 3 /* miter, sharp or beveled corner */
-} GpLineJoin;
-
-typedef enum {
- imageUndefined,
- imageBitmap,
- imageMetafile
-} ImageType;
-
-typedef enum {
- gtUndefined,
- gtX11Drawable,
- gtMemoryBitmap
-} GraphicsType;
-
-typedef enum {
- LineCapFlat = 0,
- LineCapSquare = 1,
- LineCapRound = 2,
- LineCapTriangle = 3,
- LineCapNoAnchor = 0x10,
- LineCapSquareAnchor = 0x11,
- LineCapRoundAnchor = 0x12,
- LineCapDiamondAnchor = 0x13,
- LineCapArrowAnchor = 0x14,
- LineCapCustom = 0xff
-} GpLineCap;
-
-typedef enum {
- PenAlignmentCenter = 0,
- PenAlignmentInset = 1
-} GpPenAlignment, PenAlignment;
-
-typedef enum {
- BrushTypeSolidColor = 0,
- BrushTypeHatchFill = 1,
- BrushTypeTextureFill = 2,
- BrushTypePathGradient = 3,
- BrushTypeLinearGradient = 4
-} GpBrushType, BrushType;
-
-typedef enum {
- PathPointTypeStart = 0,
- PathPointTypeLine = 1,
- PathPointTypeBezier = 3,
- PathPointTypePathTypeMask = 0x7,
- PathPointTypePathDashMode = 0x10,
- PathPointTypePathMarker = 0x20,
- PathPointTypeCloseSubpath = 0x80,
- PathPointTypeBezier3 = 3
-} GpPathPointType, PathPointType;
-
-typedef enum {
- WarpModePerspective = 0,
- WarpModeBilinear = 1
-} GpWarpMode, WarpMode;
-/*
- * Structures
- *
- */
-typedef struct {
- unsigned int Width;
- unsigned int Height;
- int Stride;
- int PixelFormat;
- void *Scan0;
- unsigned int Reserved;
-} GdipBitmapData, BitmapData;
-
-typedef struct {
- int left, top, right, bottom;
-} GpRect, Rect;
-
-typedef struct {
- float left, top, right, bottom;
-} GpRectF, RectF;
-
-typedef struct {
- int X, Y;
-} GpPoint, Point;
-
-typedef struct {
- float X, Y;
-} GpPointF, PointF;
-
-typedef struct {
- cairo_t *ct;
- cairo_matrix_t *copy_of_ctm;
- void *hdc;
- int hdc_busy_count;
- void *image;
- int type;
-} GpGraphics;
-
-typedef cairo_matrix_t GpMatrix;
-
-typedef struct {
- int color;
- GpBrushType type;
-} GpBrush, GpSolidFill;
-
-typedef struct {
- int color;
- GpBrush *brush;
- float width;
- float miter_limit;
- GpLineJoin line_join;
- GpDashStyle dash_style;
- GpLineCap line_cap;
- GpPenAlignment mode;
- float dash_offset;
- int dash_count;
- float *dash_array;
- GpUnit unit;
- GpMatrix *matrix;
-} GpPen;
-
-typedef struct {
- cairo_matrix_t *matrix;
-} GpState;
-
-typedef struct {
- ImageType type;
- cairo_surface_t *surface;
- GpGraphics *graphics; /* created by GdipGetImageGraphicsContext */
-} GpImage;
-
-typedef struct {
- GpImage image;
- int cairo_format;
- BitmapData data;
- void *hBitmapDC;
- void *hInitialBitmap;
- void *hBitmap;
-} GpBitmap;
-
-typedef struct {
- GpFillMode fill_mode;
- int count;
- GByteArray *types;
- GArray *points;
-} GpPath;
-
-typedef struct {
- int Count;
- PointF *Points;
- byte *Types;
-} GpPathData;
-
-/*
- * Functions
- *
- */
-void gdip_image_init (GpImage *image);
-void *gdip_image_create_Win32_HDC (GpImage *image);
-void gdip_image_destroy_Win32_HDC (GpImage *image, void *hdc);
-
-void gdip_bitmap_init (GpBitmap *bitmap);
-GpBitmap *gdip_bitmap_new (void);
-void gdip_bitmap_dispose (GpBitmap *bitmap);
-
-void *gdip_bitmap_create_Win32_HDC (GpBitmap *bitmap);
-void gdip_bitmap_destroy_Win32_HDC (GpBitmap *bitmap, void *hdc);
-
-void *_get_gdi32Handle (void);
-void *_get_user32Handle (void);
-
-void gdip_graphics_init (GpGraphics *graphics);
-GpGraphics *gdip_graphics_new (void);
-void gdip_graphics_attach_bitmap (GpGraphics *graphics, GpBitmap *image);
-void gdip_graphics_detach_bitmap (GpGraphics *graphics, GpBitmap *image);
-
-/* Brush */
-void gdip_brush_setup (GpGraphics *graphics, GpBrush *brush);
-GpBrush *gdip_brush_new (void);
-
-/* Solid fill */
-void gdip_solidfill_init (GpSolidFill *brush);
-void gdip_solidfill_setup (GpGraphics *graphics, GpBrush *brush);
-GpStatus gdip_solidfill_clone (GpBrush *brush, GpBrush **clonedBrush);
-GpSolidFill *gdip_solidfill_new (void);
-
-/* Pen */
-void gdip_pen_init (GpPen *pen);
-GpPen *gdip_pen_new (void);
-void gdip_pen_setup (GpGraphics *graphics, GpPen *pen);
-
-extern Display *GDIP_display;
-
-void initializeGdipWin32 (void);
-
-/* Bitmap */
-GpStatus GdipCreateBitmapFromScan0 (int width, int height, int strideIn, int format, void *scan0, GpBitmap **bitmap);
-GpStatus GdipCreateBitmapFromGraphics (int width, int height, GpGraphics *graphics, GpBitmap **bitmap);
-GpStatus GdipBitmapLockBits (GpBitmap *bmp, Rect *rc, int flags, int format, GdipBitmapData *result);
-GpStatus GdipBitmapUnlockBits (GpBitmap *bmp, GdipBitmapData *bmpData);
-
-/* Graphics */
-GpStatus GdipCreateFromHDC (int hDC, GpGraphics **graphics);
-GpStatus GdipDeleteGraphics (GpGraphics *graphics);
-GpStatus GdipGetDC (GpGraphics *graphics, int *hDC);
-GpStatus GdipReleaseDC (GpGraphics *graphics, int hDC);
-GpStatus GdipRestoreGraphics (GpGraphics *graphics, unsigned int graphicsState);
-GpStatus GdipSaveGraphics(GpGraphics *graphics, unsigned int * state);
-GpStatus GdipRotateWorldTransform (GpGraphics *graphics, float angle, GpMatrixOrder order);
-GpStatus GdipTranslateWorldTransform (GpGraphics *graphics, float dx, float dy, GpMatrixOrder order);
-GpStatus GdipDrawBezier (GpGraphics *graphics, GpPen *pen, float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4);
-GpStatus GdipDrawBezierI (GpGraphics *graphics, GpPen *pen, int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4);
-GpStatus GdipDrawBeziers (GpGraphics *graphics, GpPen *pen, GpPointF *points, int count);
-GpStatus GdipDrawBeziersI (GpGraphics *graphics, GpPen *pen, GpPoint *points, int count);
-GpStatus GdipDrawEllipse (GpGraphics *graphics, GpPen *pen, float x, float y, float width, float height);
-GpStatus GdipDrawLine (GpGraphics *graphics, GpPen *pen, float x1, float y1, float x2, float y2);
-GpStatus GdipDrawLineI (GpGraphics *graphics, GpPen *pen, int x1, int y1, int x2, int y2);
-GpStatus GdipDrawLines (GpGraphics *graphics, GpPen *pen, GpPointF *points, int count);
-GpStatus GdipDrawLinesI (GpGraphics *graphics, GpPen *pen, GpPoint *points, int count);
-GpStatus GdipDrawPie (GpGraphics *graphics, GpPen *pen, float x, float y, float width, float height, float startAngle, float sweepAngle);
-GpStatus GdipDrawPieI (GpGraphics *graphics, GpPen *pen, int x, int y, int width, int height, float startAngle, float sweepAngle);
-GpStatus GdipDrawPolygon (GpGraphics *graphics, GpPen *pen, GpPointF *points, int count);
-GpStatus GdipDrawPolygonI (GpGraphics *graphics, GpPen *pen, GpPoint *points, int count);
-GpStatus GdipDrawRectangle (GpGraphics *graphics, GpPen *pen, float x, float y, float width, float height);
-GpStatus GdipDrawRectangleI (GpGraphics *graphics, GpPen *pen, int x, int y, int width, int height);
-GpStatus GdipFillEllipse (GpGraphics *graphics, GpBrush *brush, float x, float y, float width, float height);
-GpStatus GdipFillEllipseI (GpGraphics *graphics, GpBrush *brush, int x, int y, int width, int height);
-GpStatus GdipFillRectangle (GpGraphics *graphics, GpBrush *brush, float x1, float y1, float x2, float y2);
-GpStatus GdipFillPolygon (GpGraphics *graphics, GpBrush *brush, GpPointF *points, int count, GpFillMode fillMode);
-GpStatus GdipFillPolygonI (GpGraphics *graphics, GpBrush *brush, GpPoint *points, int count, GpFillMode fillMode);
-GpStatus GdipFillPolygon2 (GpGraphics *graphics, GpBrush *brush, GpPointF *points, int count);
-GpStatus GdipFillPolygon2I (GpGraphics *graphics, GpBrush *brush, GpPoint *points, int count);
-GpStatus GdipSetRenderingOrigin (GpGraphics *graphics, int x, int y);
-GpStatus GdipGetRenderingOrigin (GpGraphics *graphics, int *x, int *y);
-
-/* Status */
-GpStatus gdip_get_status (cairo_status_t status);
-
-/* Brush */
-GpStatus GdipCloneBrush (GpBrush *brush, GpBrush **clonedBrush);
-GpStatus GdipDeleteBrush (GpBrush *brush);
-GpStatus GdipGetBrushType (GpBrush *brush, GpBrushType *brushType);
-
-/* Solidfill Brush */
-GpStatus GdipGetSolidFillColor (GpSolidFill *brush, int *color);
-
-/* Pen */
-GpStatus GdipCreatePen1 (int argb, float width, GpUnit unit, GpPen **pen);
-GpStatus GdipCreatePen2 (GpBrush *brush, float width, GpUnit unit, GpPen **pen);
-GpStatus GdipClonePen (GpPen *pen, GpPen **clonedpen);
-GpStatus GdipSetPenWidth (GpPen *pen, float width);
-GpStatus GdipGetPenWidth (GpPen *pen, float *width);
-GpStatus GdipSetPenBrushFill (GpPen *pen, GpBrush *brush);
-GpStatus GdipGetPenBrushFill (GpPen *pen, GpBrush **brush);
-GpStatus GdipSetPenColor (GpPen *pen, int color);
-GpStatus GdipGetPenColor (GpPen *pen, int *color);;
-GpStatus GdipSetPenDashStyle (GpPen *pen, GpDashStyle dashStyle);
-GpStatus GdipGetPenDashStyle (GpPen *pen, GpDashStyle *dashStyle);
-GpStatus GdipSetPenDashOffset (GpPen *pen, float offset);
-GpStatus GdipGetPenDashOffset (GpPen *pen, float *offset);
-GpStatus GdipSetPenDashCount (GpPen *pen, int count);
-GpStatus GdipGetPenDashCount (GpPen *pen, int *count);
-GpStatus GdipSetPenDashArray (GpPen *pen, float *dash, int count);
-GpStatus GdipGetPenDashArray (GpPen *pen, float **dash, int *count);
-GpStatus GdipSetPenDashCompoundArray (GpPen *pen, float *dash, int count);
-GpStatus GdipGetPenDashCompoundArray (GpPen *pen, float **dash, int *count);
-GpStatus GdipGetPenDashCompoundCount (GpPen *pen, int *count);
-GpStatus GdipSetPenMode (GpPen *pen, GpPenAlignment penMode);
-GpStatus GdipGetPenMode (GpPen *pen, GpPenAlignment *penMode);
-GpStatus GdipSetPenUnit (GpPen *pen, GpUnit unit);
-GpStatus GdipGetPenUnit (GpPen *pen, GpUnit *unit);
-GpStatus GdipDeletePen (GpPen *pen);
-GpStatus GdipSetPenMiterLimit (GpPen *pen, float miterLimit);
-GpStatus GdipGetPenMiterLimit (GpPen *pen, float *miterLimit);
-GpStatus GdipSetPenLineCap (GpPen *pen, GpLineCap lineCap);
-GpStatus GdipGetPenLineCap (GpPen *pen, GpLineCap *lineCap);
-GpStatus GdipSetPenLineJoin (GpPen *pen, GpLineJoin lineJoin);
-GpStatus GdipGetPenLineJoin (GpPen *pen, GpLineJoin *lineJoin);
-
-/* Text */
-GpStatus GdipDrawString (GpGraphics *graphics, const char *string, int len, void *font, RectF *rc, void *format, GpBrush *brush);
-
-/* Matrix */
-GpStatus GdipCreateMatrix (GpMatrix **matrix);
-GpStatus GdipCreateMatrix2 (float m11, float m12, float m21, float m22, float dx, float dy, GpMatrix **matrix);
-GpStatus GdipCreateMatrix3 (const GpRectF *rect, const GpPointF *dstplg, GpMatrix **matrix);
-GpStatus GdipCreateMatrix3I (const GpRect *rect, const GpPoint *dstplg, GpMatrix **matrix);
-GpStatus GdipCloneMatrix (GpMatrix *matrix, GpMatrix **cloneMatrix);
-GpStatus GdipDeleteMatrix (GpMatrix *matrix);
-GpStatus GdipSetMatrixElements (GpMatrix *matrix, float m11, float m12, float m21, float m22, float dx, float dy);
-GpStatus GdipMultiplyMatrix (GpMatrix *matrix, GpMatrix *matrix2, GpMatrixOrder order);
-GpStatus GdipTranslateMatrix (GpMatrix *matrix, float offsetX, float offsetY, GpMatrixOrder order);
-GpStatus GdipScaleMatrix (GpMatrix *matrix, float scaleX, float scaleY, GpMatrixOrder order);
-GpStatus GdipRotateMatrix(GpMatrix *matrix, float angle, GpMatrixOrder order);
-GpStatus GdipShearMatrix (GpMatrix *matrix, float shearX, float shearY, GpMatrixOrder order);
-GpStatus GdipInvertMatrix (GpMatrix *matrix);
-GpStatus GdipTransformMatrixPoints (GpMatrix *matrix, GpPointF *pts, int count);
-GpStatus GdipTransformMatrixPointsI (GpMatrix *matrix, GpPoint *pts, int count);
-GpStatus GdipVectorTransformMatrixPoints (GpMatrix *matrix, GpPointF *pts, int count);
-GpStatus GdipVectorTransformMatrixPointsI (GpMatrix *matrix, GpPoint *pts, int count);
-GpStatus GdipGetMatrixElements (GpMatrix *matrix, float *matrixOut);
-GpStatus GdipIsMatrixInvertible (GpMatrix *matrix, int *result);
-GpStatus GdipIsMatrixIdentity (GpMatrix *matrix, int *result);
-GpStatus GdipIsMatrixEqual (GpMatrix *matrix, GpMatrix *matrix2, int *result);
-
-/* Memory */
-void *GdipAlloc (int size);
-void GdipFree (void *ptr);
-
-#endif /* _GDIP_H */
diff --git a/mcs/class/System.Drawing/gdiplus/gdip_win32.c b/mcs/class/System.Drawing/gdiplus/gdip_win32.c
deleted file mode 100644
index 9058f6de44b..00000000000
--- a/mcs/class/System.Drawing/gdiplus/gdip_win32.c
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- * gdip_win32.c
- *
- * Copyright (c) 2003 Alexandre Pigolkine
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
- * and associated documentation files (the "Software"), to deal in the Software without restriction,
- * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all copies or substantial
- * portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
- * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
- * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- * Alexandre Pigolkine(pigolkine@gmx.de)
- */
-
-#include "gdip_win32.h"
-#include <dlfcn.h>
-
-static void * gdi32Handle = 0;
-static void * user32Handle = 0;
-
-static void _load_gdi32 (void)
-{
- if (gdi32Handle == 0) {
- gdi32Handle = dlopen ("libgdi32.dll.so", 1);
- if (gdi32Handle == 0) {
- gdi32Handle = dlopen ("/usr/local/lib/libgdi32.dll.so", 1);
- }
- if (gdi32Handle == 0) {
- gdi32Handle = dlopen ("/usr/lib/libgdi32.dll.so", 1);
- }
- }
-}
-
-static void _load_user32 (void)
-{
- if (user32Handle == 0) {
- user32Handle = dlopen ("libuser32.dll.so", 1);
- if (user32Handle == 0) {
- user32Handle = dlopen ("/usr/local/lib/libuser32.dll.so", 1);
- }
- if (user32Handle == 0) {
- user32Handle = dlopen ("/usr/lib/libuser32.dll.so", 1);
- }
- }
-}
-
-void *_get_gdi32Handle (void)
-{
- _load_gdi32 ();
- return gdi32Handle;
-}
-
-void *_get_user32Handle (void)
-{
- _load_user32 ();
- return user32Handle;
-}
-
-DC* DC_GetDCPtr_gdip (int hdc)
-{
- return 0;
-}
-
-void GDI_ReleaseObj_gdip (int hdc)
-{
-}
-
-void* __stdcall CreateCompatibleDC_gdip (void * hdc)
-{
- return 0;
-}
-
-void* __stdcall CreateCompatibleBitmap_gdip (void * hdc, int width, int height)
-{
- return 0;
-}
-
-void* __stdcall GetDC_gdip (void * hwnd)
-{
- return 0;
-}
-
-void* __stdcall SelectObject_gdip (void * hdc, void *object)
-{
- return 0;
-}
-
-void __stdcall DeleteDC_gdip (void * hdc)
-{
-}
-
-int __stdcall DeleteObject_gdip (void * obj)
-{
- return 0;
-}
-
-void __stdcall ReleaseDC_gdip (void *hwnd, void * hdc)
-{
-}
-
-int __stdcall GetDIBits_gdip (void *hdc, void *hbitmap, unsigned startScan, unsigned scanLines, void *bitmapBits, PBITMAPINFO pbmi, unsigned int colorUse)
-{
- return 0;
-}
-
-int __stdcall SetDIBits_gdip (void *hdc, void *hbitmap, unsigned startScan, unsigned scanLines, void *bitmapBits, PBITMAPINFO pbmi, unsigned int colorUse)
-{
- return 0;
-}
-
-void* (__stdcall *CreateCompatibleDC_pfn) (void * hdc);
-void* (__stdcall *CreateCompatibleBitmap_pfn) (void * hdc, int width, int height);
-void* (__stdcall *GetDC_pfn) (void * hwnd);
-
-void* (__stdcall *SelectObject_pfn) (void * hdc, void *object);
-
-void (__stdcall *DeleteDC_pfn) (void * hdc);
-int (__stdcall *DeleteObject_pfn) (void * obj);
-void (__stdcall *ReleaseDC_pfn) (void *hwnd, void * hdc);
-
-int (__stdcall *GetDIBits_pfn) (void *hdc, void *hbitmap, unsigned startScan, unsigned scanLines, void *bitmapBits, PBITMAPINFO pbmi, unsigned int colorUse);
-int (__stdcall *SetDIBits_pfn) (void *hdc, void *hbitmap, unsigned startScan, unsigned scanLines, void *bitmapBits, PBITMAPINFO pbmi, unsigned int colorUse);
-
-DC* (*DC_GetDCPtr_pfn) (int hdc);
-void (*GDI_ReleaseObj_pfn) (int hdc);
-
-#define CHECK_FUNCTION(name) if (name##_pfn == 0) name##_pfn = name##_gdip;
-void initializeGdipWin32 (void)
-{
- void * gdi32Handle = _get_gdi32Handle ();
- void * user32Handle = _get_user32Handle ();
-
- if (gdi32Handle != 0 && user32Handle != 0) {
- CreateCompatibleDC_pfn = dlsym (gdi32Handle,"CreateCompatibleDC");
- CreateCompatibleBitmap_pfn = dlsym (gdi32Handle,"CreateCompatibleBitmap");
- SelectObject_pfn = dlsym (gdi32Handle,"SelectObject");
- DeleteDC_pfn = dlsym (gdi32Handle,"DeleteDC");
- DeleteObject_pfn = dlsym (gdi32Handle,"DeleteObject");
- SetDIBits_pfn = dlsym (gdi32Handle,"SetDIBits");
- GetDIBits_pfn = dlsym (gdi32Handle,"GetDIBits");
-
- GetDC_pfn = dlsym (user32Handle,"GetDC");
- ReleaseDC_pfn = dlsym (user32Handle, "ReleaseDC");
-
- DC_GetDCPtr_pfn = dlsym(gdi32Handle,"DC_GetDCPtr");
- GDI_ReleaseObj_pfn = dlsym(gdi32Handle,"GDI_ReleaseObj");
- }
- CHECK_FUNCTION (CreateCompatibleDC);
- CHECK_FUNCTION (CreateCompatibleBitmap);
- CHECK_FUNCTION (SelectObject);
- CHECK_FUNCTION (DeleteDC);
- CHECK_FUNCTION (DeleteObject);
- CHECK_FUNCTION (SetDIBits);
- CHECK_FUNCTION (GetDIBits);
- CHECK_FUNCTION (GetDC);
- CHECK_FUNCTION (ReleaseDC);
-
- CHECK_FUNCTION (DC_GetDCPtr);
- CHECK_FUNCTION (GDI_ReleaseObj);
-}
-
-DC *_get_DC_by_HDC (int hDC)
-{
- return DC_GetDCPtr_pfn (hDC);
-}
-
-void _release_hdc (int hdc)
-{
- GDI_ReleaseObj_pfn (hdc);
-}
diff --git a/mcs/class/System.Drawing/gdiplus/gdip_win32.h b/mcs/class/System.Drawing/gdiplus/gdip_win32.h
deleted file mode 100644
index 2cbb437708a..00000000000
--- a/mcs/class/System.Drawing/gdiplus/gdip_win32.h
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * gdip_win32.h
- *
- * Authors:
- * Alexandre Pigolkine(pigolkine@gmx.de)
- */
-
-#ifndef _GDIP_WIN32_H
-#define _GDIP_WIN32_H
-
-#include <cairo.h>
-#include <cairo-xlib.h>
-#include <mono/io-layer/uglify.h>
-
-/* sizeof (GDIOBJHDR) = 12 (2 + 2 + 4 + 4) */
-/* offsetof (DC, physDev) = 20 (12 + 4 + 4) */
-typedef struct tagGDIOBJHDR {
- short next;
- short wMagic;
- long dwCount;
- void* funcs;
-} GDIOBJHDR;
-
-typedef struct tagX11DRV_PDEVICE
-{
- void* hdc;
- void *dc; /* direct pointer to DC, should go away */
- GC gc; /* X Window GC */
- Drawable drawable;
-} X11DRV_PDEVICE;
-
-typedef struct tagDC {
- GDIOBJHDR header;
- void* hSelf; /* Handle to this DC */
- void *funcs; /* DC function table */
- X11DRV_PDEVICE *physDev; /* Physical device (driver-specific) */
-} DC;
-
-typedef struct {
- BYTE rgbBlue;
- BYTE rgbGreen;
- BYTE rgbRed;
- BYTE rgbReserved;
-} RGBQUAD, *LPRGBQUAD;
-
-typedef struct
-{
- DWORD biSize;
- LONG biWidth;
- LONG biHeight;
- WORD biPlanes;
- WORD biBitCount;
- DWORD biCompression;
- DWORD biSizeImage;
- LONG biXPelsPerMeter;
- LONG biYPelsPerMeter;
- DWORD biClrUsed;
- DWORD biClrImportant;
-} BITMAPINFOHEADER, *PBITMAPINFOHEADER, *LPBITMAPINFOHEADER;
-
- /* biCompression */
-#define BI_RGB 0
-#define BI_RLE8 1
-#define BI_RLE4 2
-#define BI_BITFIELDS 3
-
-typedef struct {
- BITMAPINFOHEADER bmiHeader;
- RGBQUAD bmiColors[1];
-} BITMAPINFO, *PBITMAPINFO, *LPBITMAPINFO;
-
-#ifdef __GNUC__
-# pragma pack(2)
-#endif
-typedef struct
-{
- WORD bfType;
- DWORD bfSize;
- WORD bfReserved1;
- WORD bfReserved2;
- DWORD bfOffBits;
-} BITMAPFILEHEADER, *PBITMAPFILEHEADER, *LPBITMAPFILEHEADER;
-#ifdef __GNUC__
-# pragma pack()
-#endif
-
-#define BFT_BITMAP 0x4d42
-
-#ifdef __GNUC__
-# define __stdcall __attribute__((__stdcall__))
-#else
-# define __stdcall
-#endif
-
-extern void* (__stdcall *CreateCompatibleDC_pfn) (void * hdc);
-extern void* (__stdcall *CreateCompatibleBitmap_pfn) (void * hdc, int width, int height);
-extern void* (__stdcall *GetDC_pfn) (void * hwnd);
-
-extern void* (__stdcall *SelectObject_pfn) (void * hdc, void *object);
-
-extern void (__stdcall *DeleteDC_pfn) (void * hdc);
-extern int (__stdcall *DeleteObject_pfn) (void * obj);
-extern void (__stdcall *ReleaseDC_pfn) (void *hwnd, void * hdc);
-
-extern int (__stdcall *GetDIBits_pfn) (void *hdc, void *hbitmap, unsigned startScan, unsigned scanLines, void *bitmapBits, PBITMAPINFO pbmi, unsigned int colorUse);
-extern int (__stdcall *SetDIBits_pfn) (void *hdc, void *hbitmap, unsigned startScan, unsigned scanLines, void *bitmapBits, PBITMAPINFO pbmi, unsigned int colorUse);
-
-
-DC *_get_DC_by_HDC (int hDC);
-void _release_hdc (int hdc);
-
-#endif /* _GDIP_WIN32_H */
diff --git a/mcs/class/System.Drawing/gdiplus/general.c b/mcs/class/System.Drawing/gdiplus/general.c
deleted file mode 100644
index 3c11daf404c..00000000000
--- a/mcs/class/System.Drawing/gdiplus/general.c
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * general.c
- *
- * Copyright (c) 2003 Alexandre Pigolkine
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
- * and associated documentation files (the "Software"), to deal in the Software without restriction,
- * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all copies or substantial
- * portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
- * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
- * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- * Alexandre Pigolkine(pigolkine@gmx.de)
- * Duncan Mak (duncan@ximian.com)
- */
-
-#include "gdip.h"
-#include <dlfcn.h>
-#include <cairo.h>
-
-/* Startup / shutdown */
-
-struct startupInput
-{
- unsigned int version;
- void * ptr;
- int threadOpt;
- int codecOpt;
-};
-
-
-struct startupOutput
-{
- void *hook;
- void *unhook;
-};
-
-Display *GDIP_display = 0;
-int closeDisplay = 0;
-
-static void * x11drvHandle = 0;
-
-static void _load_x11drv ()
-{
- if (x11drvHandle == 0) {
- x11drvHandle = dlopen ("libx11drv.dll.so", 1);
- if (x11drvHandle == 0) {
- x11drvHandle = dlopen ("/usr/local/lib/libx11drv.dll.so", 1);
- }
- if (x11drvHandle == 0) {
- x11drvHandle = dlopen ("/usr/lib/libx11drv.dll.so", 1);
- }
- }
-}
-
-static void _unload_x11drv ()
-{
- if (x11drvHandle != 0) {
- dlclose (x11drvHandle);
- }
-}
-
-Display *_get_wine_display ()
-{
- Display * result = 0;
- _load_x11drv ();
- if (x11drvHandle != 0) {
- Display **addr = dlsym(x11drvHandle,"gdi_display");
- if (addr) {
- result = *addr;
- }
- }
- return result;
-}
-
-GpStatus
-GdiplusStartup(unsigned long *token, const struct startupInput *input, struct startupOutput *output)
-{
- GDIP_display = _get_wine_display ();
- if (GDIP_display == 0){
- GDIP_display = XOpenDisplay(0);
- closeDisplay = 1;
- }
-
- /* printf ("GdiplusStartup. GDIP_Display %p\n", GDIP_display); */
- initializeGdipWin32 ();
- *token = 1;
- return Ok;
-}
-
-void
-GdiplusShutdown(unsigned long *token)
-{
- if (closeDisplay) {
- XCloseDisplay(GDIP_display);
- }
- _unload_x11drv ();
-}
-
-
-/* Memory */
-void *
-GdipAlloc (int size)
-{
- return malloc (size);
-}
-
-void
-GdipFree (void *ptr)
-{
- free (ptr);
-}
-
-/* Helpers */
-GpStatus
-gdip_get_status (cairo_status_t status)
-{
- if (status == CAIRO_STATUS_SUCCESS)
- return Ok;
-
- else {
- switch (status) {
-
- case CAIRO_STATUS_NO_MEMORY:
- return OutOfMemory;
-
- case CAIRO_STATUS_INVALID_MATRIX:
- case CAIRO_STATUS_INVALID_RESTORE:
- case CAIRO_STATUS_INVALID_POP_GROUP:
- return InvalidParameter;
-
- case CAIRO_STATUS_NO_CURRENT_POINT:
- case CAIRO_STATUS_NO_TARGET_SURFACE:
- return WrongState;
-
- default:
- return GenericError;
- }
- }
-}
diff --git a/mcs/class/System.Drawing/gdiplus/graphics-path.c b/mcs/class/System.Drawing/gdiplus/graphics-path.c
deleted file mode 100644
index 6d2642caed0..00000000000
--- a/mcs/class/System.Drawing/gdiplus/graphics-path.c
+++ /dev/null
@@ -1,762 +0,0 @@
-/*
- * graphics-path.c
- *
- * Author: Duncan Mak (duncan@ximian.com)
- *
- * Copyright (C) 2003, Novell Inc.
- *
- */
-
-#include <math.h>
-#include "gdip.h"
-#include "graphics-path.h"
-
-static GArray *
-array_to_g_array (const GpPointF *pt, int length)
-{
- GArray *p = g_array_sized_new (FALSE, TRUE, sizeof (GpPointF), length);
- g_array_append_vals (p, pt, length);
- return p;
-}
-
-static GpPointF *
-g_array_to_array (GArray *p)
-{
- int length = p->len;
- GpPointF *pts = (GpPointF *) GdipAlloc (sizeof (GpPointF) * length);
-
- memcpy (pts, p->data, p->len * sizeof (GpPointF));
-
- return pts;
-}
-
-static byte *
-g_byte_array_to_array (GByteArray *p)
-{
- int length = p->len;
- byte *types = (byte *) GdipAlloc (sizeof (byte) * length);
-
- memcpy (types, p->data, p->len * sizeof (byte));
-
- return types;
-}
-
-static GByteArray *
-array_to_g_byte_array (const byte *types, int count)
-{
- GByteArray *p = g_byte_array_sized_new (count);
- g_byte_array_append (p, types, count);
- return p;
-}
-
-static GpPoint *
-float_to_int (const GpPointF *pts, int count)
-{
- GpPoint *p = (GpPoint *) GdipAlloc (sizeof (GpPoint) * count);
- GpPointF *tmp = (GpPointF *) pts;
- int i;
-
- for (i = 0; i < count; i++, p++, tmp++) {
- p->X = (int) tmp->X;
- p->Y = (int) tmp->Y;
- }
-
- return p;
-}
-
-static GpPointF *
-int_to_float (const GpPoint *pts, int count)
-{
- GpPointF *p = (GpPointF *) GdipAlloc (sizeof (GpPointF) * count);
- GpPoint *tmp = (GpPoint *) pts;
- int i;
-
- for (i = 0; i < count; i++, p++, tmp++) {
- p->X = (float) tmp->X;
- p->Y = (float) tmp->Y;
- }
-
- return p;
-}
-
-static void
-append (GpPath *path, float x, float y, GpPathPointType type)
-{
- byte t = (byte) type;
- GpPointF pt = { x, y };
- g_array_append_val (path->points, pt);
- g_byte_array_append (path->types, &t, 1);
-}
-
-static void
-append_point (GpPath *path, GpPointF pt, GpPathPointType type)
-{
- byte t = (byte) type;
- g_array_append_val (path->points, pt);
- g_byte_array_append (path->types, &t, 1);
-}
-
-static void
-append_bezier (GpPath *path, float x1, float y1, float x2, float y2, float x3, float y3)
-{
- append (path, x1, y1, PathPointTypeBezier3);
- append (path, x2, y2, PathPointTypeBezier3);
- append (path, x3, y3, PathPointTypeBezier3);
-}
-
-GpStatus
-GdipCreatePath (GpFillMode brushMode, GpPath **path)
-{
- *path = (GpPath *) GdipAlloc (sizeof (GpPath));
-
- (*path)->fill_mode = brushMode;
- (*path)->points = NULL;
- (*path)->types = NULL;
- (*path)->count = 0;
-
- return Ok;
-}
-
-GpStatus
-GdipCreatePath2 (const GpPointF *points, const byte *types,
- int count, GpFillMode fillMode, GpPath **path)
-{
- GArray *pts = array_to_g_array (points, count);
- GByteArray *t = array_to_g_byte_array (types, count);
-
- *path = (GpPath *) GdipAlloc (sizeof (GpPath));
- (*path)->fill_mode = fillMode;
- (*path)->count = count;
- (*path)->points = pts;
- (*path)->types = t;
-
- return Ok;
-}
-
-GpStatus
-GdipClonePath (GpPath *path, GpPath **clonePath)
-{
- *clonePath = (GpPath *) GdipAlloc (sizeof (GpPath));
- (*clonePath)->fill_mode = path->fill_mode;
- (*clonePath)->count = path->count;
- (*clonePath)->points = path->points;
- (*clonePath)->types = path->types;
-
- return Ok;
-}
-
-GpStatus
-GdipDeletePath (GpPath *path)
-{
- if (path->count != 0) {
- if (path->points != NULL)
- g_array_free (path->points, TRUE);
-
- if (path->types != NULL)
- g_byte_array_free (path->types, TRUE);
- }
-
- GdipFree (path);
- return Ok;
-}
-
-GpStatus
-GdipResetPath (GpPath *path)
-{
- path->points = NULL;
- path->types = NULL;
- path->count = 0;
-
- return Ok;
-}
-
-GpStatus
-GdipGetPointCount (GpPath *path, int *count)
-{
- *count = path->count;
- return Ok;
-}
-
-GpStatus
-GdipGetPathTypes (GpPath *path, byte *types, int *count)
-{
- *count = path->count;
- types = g_byte_array_to_array (path->types);
-
- return Ok;
-}
-
-GpStatus
-GdipGetPathPoints (GpPath *path, GpPointF *points, int *count)
-{
- *count = path->count;
- points = g_array_to_array (path->points);
-
- return Ok;
-}
-
-GpStatus
-GdipGetPathPointsI (GpPath *path, GpPoint *points, int *count)
-{
- *count = path->count;
- PointF *tmp = g_array_to_array (path->points);
-
- points = float_to_int (tmp, path->count);
-
- GdipFree (tmp);
-
- return Ok;
-}
-
-GpStatus
-GdipGetPathFillMode (GpPath *path, GpFillMode *fillmode)
-{
- *fillmode = path->fill_mode;
-
- return Ok;
-}
-
-GpStatus
-GdipSetPathFillMode (GpPath *path, GpFillMode fillmode)
-{
- path->fill_mode = fillmode;
-
- return Ok;
-}
-
-GpStatus
-GdipGetPathData (GpPath *path, GpPathData *pathData)
-{
- pathData->Count = path->count;
- pathData->Points = g_array_to_array (path->points);
- pathData->Types = g_byte_array_to_array (path->types);
-
- return Ok;
-}
-
-GpStatus
-GdipStartPathFigure (GpPath *path)
-{
- return NotImplemented;
-}
-
-GpStatus
-GdipClosePathFigure (GpPath *path)
-{
- return NotImplemented;
-}
-
-GpStatus
-GdipClosePathFigures (GpPath *path)
-{
- return NotImplemented;
-}
-
-GpStatus
-GdipSetPathMarker (GpPath *path)
-{
- return NotImplemented;
-}
-
-GpStatus
-GdipClearPathMarkers (GpPath *path)
-{
- return NotImplemented;
-}
-
-GpStatus
-GdipReversePath (GpPath *path)
-{
- int length= path->count;
- GByteArray *types = g_byte_array_sized_new (length);
- GArray *points = g_array_sized_new (FALSE, TRUE, sizeof (GpPointF), length);
- int i;
- for (i = length; i > 0; i--) {
- byte t = g_array_index (path->types, byte, i);
- GpPointF pt = g_array_index (path->points, GpPointF, i);
-
- g_byte_array_append (types, &t, 1);
- g_array_append_val (points, pt);
- }
- path->points = points;
- path->types = types;
-
- return Ok;
-}
-
-GpStatus
-GdipGetPathLastPoint (GpPath *path, GpPointF *lastPoint)
-{
- *lastPoint = g_array_index (path->points, GpPointF, path->count);
- return Ok;
-}
-
-GpStatus
-GdipAddPathLine (GpPath *path, float x1, float y1, float x2, float y2)
-{
- append (path, x1, y1, PathPointTypeStart);
- append (path, x2, y2, PathPointTypeLine);
-
- return Ok;
-}
-
-GpStatus
-GdipAddPathLine2 (GpPath *path, const GpPointF *points, int count)
-{
- int i;
- GpPointF *tmp = (GpPointF *) points;
-
- for (i = 0; i < count; i++, tmp++)
- append_point (path, *tmp, PathPointTypeLine);
-
- return Ok;
-}
-
-GpStatus
-GdipAddPathArc (GpPath *path, float x, float y,
- float width, float height, float startAngle, float sweepAngle)
-{
- float rx = width / 2;
- float ry = height / 2;
-
- /* center */
- int cx = x + rx;
- int cy = y + ry;
-
- /* angles in radians */
- float alpha = startAngle * PI / 180;
- float beta = sweepAngle * PI / 180;
-
- float delta = beta - alpha;
- float bcp = 4.0 / 3 * (1 - cos (delta / 2)) / sin (delta /2);
-
- float sin_alpha = sin (alpha);
- float sin_beta = sin (beta);
- float cos_alpha = cos (alpha);
- float cos_beta = cos (beta);
-
- append (path,
- cx + rx * cos_alpha,
- cy + ry * sin_alpha,
- PathPointTypeStart);
-
- append_bezier (path,
- cx + rx * (cos_alpha - bcp * sin_alpha),
- cy + ry * (sin_alpha + bcp * cos_alpha),
- cx + rx * (cos_beta + bcp * sin_beta),
- cy + ry * (sin_beta - bcp * cos_beta),
- cx + rx * cos_beta,
- cy + ry * sin_beta);
-
- return Ok;
-}
-
-GpStatus
-GdipAddPathBezier (GpPath *path,
- float x1, float y1, float x2, float y2,
- float x3, float y3, float x4, float y4)
-{
- append (path, x1, y1, PathPointTypeStart);
- append_bezier (path, x2, y2, x3, y3, x4, y4);
-
- return Ok;
-}
-
-GpStatus
-GdipAddPathBeziers (GpPath *path, const GpPointF *points, int count)
-{
- int i;
- GpPointF *tmp = (GpPointF *) points;
-
- append_point (path, *tmp, PathPointTypeStart);
- tmp++;
-
- for (i = 1; i < count; i++, tmp++)
- append_point (path, *tmp, PathPointTypeBezier3);
-
- return Ok;
-}
-
-GpStatus
-GdipAddPathCurve (GpPath *path, const GpPointF *points, int count)
-{
- return NotImplemented;
-}
-
-GpStatus
-GdipAddPathCurve2 (GpPath *path, const GpPointF *points, int count, float tension)
-{
- return NotImplemented;
-}
-
-GpStatus
-GdipAddPathCurve3 (GpPath *path, const GpPointF *points, int count,
- int offset, int numberOfSegments, float tension)
-{
- return NotImplemented;
-}
-
-GpStatus
-GdipAddPathClosedCurve (GpPath *path, const GpPointF *points, int count)
-{
- return GdipAddPathClosedCurve2 (path, points, count, 0.5);
-}
-
-GpStatus
-GdipAddPathClosedCurve2 (GpPath *path, const GpPointF *points, int count, float tension)
-{
- return NotImplemented;
-}
-
-GpStatus
-GdipAddPathRectangle (GpPath *path, float x, float y, float width, float height)
-{
- append (path, x, y, PathPointTypeLine);
- append (path, x + width, y, PathPointTypeLine);
- append (path, x + width, y + height, PathPointTypeLine);
- append (path, x, y + height, PathPointTypeLine);
-
- return Ok;
-}
-
-GpStatus
-GdipAddPathRectangles (GpPath *path, const GpRectF *rects, int count)
-{
- int i;
- for (i = 0; i < count; i++, rects++) {
- float x = rects->left;
- float y = rects->top;
- float width = rects->right - rects->left;
- float height = rects->bottom - rects->top;
- GdipAddPathRectangle (path, x, y, width, height);
- }
-
- return Ok;
-}
-
-GpStatus
-GdipAddPathEllipse (GpPath *path, float x, float y, float width, float height)
-{
- float C1 = 0.552285;
- double rx = width / 2;
- double ry = height / 2;
- double cx = x + rx;
- double cy = y + ry;
-
- /* origin */
- append (path, cx + rx, cy, PathPointTypeStart);
-
- /* quadrant I */
- append_bezier (path,
- cx + rx, cy - C1 * ry,
- cx + C1 * rx, cy - ry,
- cx, cy - ry);
-
- /* quadrant II */
- append_bezier (path,
- cx - C1 * rx, cy - ry,
- cx - rx, cy - C1 * ry,
- cx - rx, cy);
-
- /* quadrant III */
- append_bezier (path,
- cx - rx, cy + C1 * ry,
- cx - C1 * rx, cy + ry,
- cx, cy + ry);
-
- /* quadrant IV */
- append_bezier (path,
- cx + C1 * rx, cy + ry,
- cx + rx, cy + C1 * ry,
- cx + rx, cy);
-
- return Ok;
-}
-
-GpStatus
-GdipAddPathPie (GpPath *path, float x, float y, float width, float height, float startAngle, float sweepAngle)
-{
- float rx = width / 2;
- float ry = height / 2;
- int cx = x + rx;
- int cy = y + ry;
-
- /* angles in radians */
- float alpha = startAngle * PI / 180;
- float beta = sweepAngle * PI / 180;
-
- float delta = beta - alpha;
- float bcp = 4.0 / 3 * (1 - cos (delta / 2)) / sin (delta /2);
-
- float sin_alpha = sin (alpha);
- float sin_beta = sin (beta);
- float cos_alpha = cos (alpha);
- float cos_beta = cos (beta);
-
- /* move to center */
- append (path, cx, cy, PathPointTypeStart);
-
-
- /* draw pie edge */
- append (path, cx + rx * cos_alpha, cy + ry * sin_alpha,
- PathPointTypeLine);
-
- /* draw arc */
- append_bezier (path,
- cx + rx * (cos_alpha - bcp * sin_alpha),
- cy + ry * (sin_alpha + bcp * cos_alpha),
- cx + rx * (cos_beta + bcp * sin_beta),
- cy + ry * (sin_beta - bcp * cos_beta),
- cx + rx * cos_beta,
- cy + ry * sin_beta);
-
- /* draw pie edge */
- append (path, cx, cy, PathPointTypeLine);
-
- return Ok;
-}
-
-GpStatus
-GdipAddPathPolygon (GpPath *path, const GpPointF *points, int count)
-{
- int i;
- GpPointF *tmp = (GpPointF *) points;
-
- append_point (path, *tmp, PathPointTypeStart);
- tmp ++;
-
- for (i = 1; i < count; i++, tmp++)
- append_point (path, *tmp, PathPointTypeLine);
-
- return Ok;
-}
-
-GpStatus
-GdipAddPathPath (GpPath *path, GpPath *addingPath, bool connect)
-{
- /* XXX:need to understand the connect argument */
-
- return NotImplemented;
-}
-
-/* XXX: This one is really hard. They really translate a string into bezier points and what not */
-/*
- * GpStatus
- * GdipAddString (GpPath *path, const char *string, int length,
- * const GpFontFamily *family, int style, float emSize, const GpRectF *layoutRect,
- * const GpStringFormat *format)
- * {
- * return NotImplemented;
- * }
- */
-
-/*
- * GpStatus
- * GdipAddString (GpPath *path, const char *string, int length,
- * const GpFontFamily *family, int style, float emSize, const GpRect *layoutRect,
- * const GpStringFormat *format)
- * {
- * return NotImplemented;
- * }
- */
-
-GpStatus
-GdipAddPathLineI (GpPath *path, int x1, int y1, int x2, int y2)
-{
- append (path, x1, y1, PathPointTypeStart);
- append (path, x2, y2, PathPointTypeLine);
-
- return Ok;
-}
-
-GpStatus
-GdipAddPathLine2I (GpPath* path, const GpPoint *points, int count)
-{
- int i;
- GpPointF *tmp = int_to_float (points, count);
-
- append_point (path, *tmp, PathPointTypeStart);
- tmp++;
-
- for (i = 1; i < count; i++, tmp++)
- append_point (path, *tmp, PathPointTypeLine);
-
- GdipFree (tmp);
-
- return Ok;
-}
-
-GpStatus
-GdipAddPathArcI (GpPath *path, int x, int y, int width, int height, float startAngle, float sweepAngle)
-{
- return GdipAddPathArc (path, x, y, width, height, startAngle, sweepAngle);
-}
-
-GpStatus
-GdipAddPathBezierI (GpPath *path, int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4)
-{
- return GdipAddPathBezier (path, x1, y1, x2, y2, x3, y3, x4, y4);
-}
-
-GpStatus
-GdipAddPathBeziersI (GpPath *path, const GpPoint *points, int count)
-{
- GpPointF *tmp = int_to_float (points, count);
- Status s = GdipAddPathBeziers (path, tmp, count);
-
- GdipFree (tmp);
-
- return s;
-}
-
-GpStatus
-GdipAddPathCurveI (GpPath *path, const GpPoint *points, int count)
-{
- return GdipAddPathCurve2I (path, points, count, 0.5);
-}
-
-GpStatus
-GdipAddPathCurve2I (GpPath *path, const GpPoint *points, int count, float tension)
-{
- return NotImplemented;
-}
-
-GpStatus
-GdipAddPathCurve3I (GpPath *path, const GpPoint *points,
- int count, int offset, int numberOfSegments, float tension)
-{
- return NotImplemented;
-}
-
-GpStatus
-GdipAddPathClosedCurveI (GpPath *path, const GpPoint *points, int count)
-{
- return GdipAddPathClosedCurve2I (path, points, count, 0.5);
-}
-
-GpStatus
-GdipAddPathClosedCurve2I (GpPath *path, const GpPoint *points, int count, float tension)
-{
- return NotImplemented;
-}
-
-GpStatus
-GdipAddPathRectangleI (GpPath *path, int x, int y, int width, int height)
-{
- return GdipAddPathRectangle (path, x, y, width, height);
-}
-
-GpStatus
-GdipAddPathRectanglesI (GpPath *path, const GpRect *rects, int count)
-{
- int i;
- for (i = 0; i < count; i++, rects++) {
- float x = (float) rects->left;
- float y = (float) rects->top;
- float width = (float) (rects->right - rects->left);
- float height = (float) (rects->bottom - rects->top);
- GdipAddPathRectangle (path, x, y, width, height);
- }
-
- return Ok;
-}
-
-GpStatus
-GdipAddPathEllipseI (GpPath *path, int x, int y, int width, int height)
-{
- return GdipAddPathEllipse (path, x, y, width, height);
-}
-
-GpStatus
-GdipAddPathPieI (GpPath *path, int x, int y, int width, int height, float startAngle, float sweepAngle)
-{
- return GdipAddPathPie (path, x, y, width, height, startAngle, sweepAngle);
-}
-
-GpStatus
-GdipAddPathPolygonI (GpPath *path, const GpPoint *points, int count)
-{
- GpPointF *tmp = int_to_float (points, count);
-
- Status s = GdipAddPathPolygon (path, tmp, count);
-
- GdipFree (tmp);
-
- return s;
-}
-
-GpStatus
-GdipFlattenPath (GpPath *path, GpMatrix *matrix, float flatness)
-{
- return NotImplemented;
-}
-
-GpStatus
-GdipWindingModeOutline (GpPath *path, GpMatrix *matrix, float flatness)
-{
- return NotImplemented;
-}
-
-GpStatus
-GdipWidenPath (GpPath *nativePath, GpPen *pen, GpMatrix *matrix, float flatness)
-{
- return NotImplemented;
-}
-
-GpStatus
-GdipWarpPath (GpPath *nativePath, GpMatrix *matrix, const GpPointF *points, int count,
- float src, float srcy, float srcwidth, float srcheight, WarpMode warpMode, float flatness)
-{
- return NotImplemented;
-}
-
-GpStatus
-GdipTransformPath (GpPath* path, GpMatrix *matrix)
-{
- PointF *points = g_array_to_array (path->points);
- int count = path->count;
-
- Status s = GdipTransformMatrixPoints (matrix, points, count);
-
- path->points = array_to_g_array (points, count);
-
- GdipFree (points);
-
- return s;
-}
-
-GpStatus
-GdipGetPathWorldBounds (GpPath *path, GpRectF *bounds, const GpMatrix *matrix, const GpPen *pen)
-{
- return NotImplemented;
-}
-
-GpStatus
-GdipGetPathWorldBoundsI (GpPath *path, GpRect *bounds, const GpMatrix *matrix, const GpPen *pen)
-{
- return NotImplemented;
-}
-
-GpStatus
-GdipIsVisiblePathPoint (GpPath *path, float x, float y, GpGraphics *graphics, bool *result)
-{
- return NotImplemented;
-}
-
-GpStatus
-GdipIsVisiblePathPointI (GpPath *path, int x, int y, GpGraphics *graphics, bool *result)
-{
- return NotImplemented;
-}
-
-GpStatus
-GdipIsOutlineVisiblePathPoint (GpPath *path, float x, float y, GpGraphics *graphics, bool *result)
-{
- return NotImplemented;
-}
-
-GpStatus
-GdipIsOutlineVisiblePathPointI (GpPath *path, int x, int y, GpGraphics *graphics, bool *result)
-{
- return NotImplemented;
-}
diff --git a/mcs/class/System.Drawing/gdiplus/graphics-path.h b/mcs/class/System.Drawing/gdiplus/graphics-path.h
deleted file mode 100644
index ebd079d5950..00000000000
--- a/mcs/class/System.Drawing/gdiplus/graphics-path.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * graphics-path.h
- *
- * Author:
- * Duncan Mak (duncan@ximian.com)
- *
- * Copyright (C) Novell, Inc. 2003.
- */
-
-
-#ifndef _GRAPHICS_PATH_H_
-#define _GRAPHICS_PATH_H_
-
-#include "gdip.h"
-
-GpStatus GdipCreatePath (GpFillMode brushMode, GpPath **path);
-GpStatus GdipCreatePath2 (const GpPointF *points, const byte *types, int count, GpFillMode fillMode, GpPath **path);
-GpStatus GdipClonePath (GpPath *path, GpPath **clonePath);
-GpStatus GdipDeletePath (GpPath *path);
-GpStatus GdipResetPath (GpPath *path);
-GpStatus GdipGetPointCount (GpPath *path, int *count);
-GpStatus GdipGetPathTypes (GpPath *path, byte *types, int *count);
-GpStatus GdipGetPathPoints (GpPath *path, GpPointF *points, int *count);
-GpStatus GdipGetPathPointsI (GpPath *path, GpPoint *points, int *count);
-GpStatus GdipGetPathFillMode (GpPath *path, GpFillMode *fillmode);
-GpStatus GdipSetPathFillMode (GpPath *path, GpFillMode fillmode);
-GpStatus GdipGetPathData (GpPath *path, GpPathData *pathData);
-GpStatus GdipStartPathFigure (GpPath *path);
-GpStatus GdipClosePathFigure (GpPath *path);
-GpStatus GdipClosePathFigures (GpPath *path);
-GpStatus GdipSetPathMarker (GpPath *path);
-GpStatus GdipClearPathMarker (GpPath *path);
-GpStatus GdipReversePath (GpPath *path);
-GpStatus GdipGetPathLastPoint (GpPath *path, GpPointF *lastPoint);
-GpStatus GdipAddPathLine (GpPath *path, float x1, float y1, float x2, float y2);
-GpStatus GdipAddPathLine2 (GpPath *path, const GpPointF *points, int count);
-GpStatus GdipAddPathArc (GpPath *path, float x, float y, float width, float height, float startAngle, float sweepAngle);
-GpStatus GdipAddPathBezier (GpPath *path, float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4);
-GpStatus GdipAddPathBeziers (GpPath *path, const GpPointF *points, int count);
-GpStatus GdipAddPathCurve (GpPath *path, const GpPointF *points, int count);
-GpStatus GdipAddPathCurve2 (GpPath *path, const GpPointF *points, int count, float tension);
-GpStatus GdipAddPathCurve3 (GpPath *path, const GpPointF *points, int count, int offset, int numberOfSegments, float tension);
-GpStatus GdipAddPathClosedCurve (GpPath *path, const GpPointF *points, int count);
-GpStatus GdipAddPathClosedCurve2 (GpPath *path, const GpPointF *points, int count, float tension);
-GpStatus GdipAddPathRectangle (GpPath *path, float x, float y, float width, float height);
-GpStatus GdipAddPathRectangles (GpPath *path, const GpRectF *rects, int count);
-GpStatus GdipAddPathEllipse (GpPath *path, float x, float y, float width, float height);
-GpStatus GdipAddPathPie (GpPath *path, float x, float y, float width, float height, float startAngle, float sweepAngle);
-GpStatus GdipAddPathPolygon (GpPath *path, const GpPointF *points, int count);
-GpStatus GdipAddPathPath (GpPath *path, GpPath *addingPath, bool connect);
-
-GpStatus GdipAddPathLineI (GpPath *path, int x1, int y1, int x2, int y2);
-GpStatus GdipAddPathLine2I (GpPath *path, const GpPoint *points, int count);
-GpStatus GdipAddPathArcI (GpPath *path, int x, int y, int width, int height, float startAngle, float sweepAngle);
-GpStatus GdipAddPathBezierI (GpPath *path, int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4);
-GpStatus GdipAddPathBeziersI (GpPath *path, const GpPoint *points, int count);
-GpStatus GdipAddPathCurveI (GpPath *path, const GpPoint *points, int count);
-GpStatus GdipAddPathCurve2I (GpPath *path, const GpPoint *points, int count, float tension);
-GpStatus GdipAddPathCurve3I (GpPath *path, const GpPoint *points, int count, int offset, int numberOfSegments, float tension);
-GpStatus GdipAddPathClosedCurveI (GpPath *path, const GpPoint *points, int count);
-GpStatus GdipAddPathClosedCurve2I (GpPath *path, const GpPoint *points, int count, float tension);
-GpStatus GdipAddPathRectangleI (GpPath *path, int x, int y, int width, int height);
-GpStatus GdipAddPathRectanglesI (GpPath *path, const GpRect *rects, int count);
-GpStatus GdipAddPathEllipseI (GpPath *path, int x, int y, int width, int height);
-GpStatus GdipAddPathPieI (GpPath *path, int x, int y, int width, int height, float startAngle, float sweepAngle);
-GpStatus GdipAddPathPolygonI (GpPath *path, const GpPoint *points, int count);
-GpStatus GdipFlattenPath (GpPath *path, GpMatrix *matrix, float flatness);
-GpStatus GdipWindingModeOutline (GpPath *path, GpMatrix *matrix, float flatness);
-GpStatus GdipWidenPath (GpPath *nativePath, GpPen *pen, GpMatrix *matrix, float flatness);
-GpStatus GdipWarpPath (GpPath *nativePath, GpMatrix *matrix, const GpPointF *points, int count,
- float src, float srcy, float srcwidth, float srcheight, WarpMode warpMode, float flatness);
-GpStatus GdipTransformPath (GpPath* path, GpMatrix *matrix);
-GpStatus GdipGetPathWorldBounds (GpPath *path, GpRectF *bounds, const GpMatrix *matrix, const GpPen *pen);
-GpStatus GdipGetPathWorldBoundsI (GpPath *path, GpRect *bounds, const GpMatrix *matrix, const GpPen *pen);
-GpStatus GdipIsVisiblePathPoint (GpPath *path, float x, float y, GpGraphics *graphics, bool *result);
-GpStatus GdipIsVisiblePathPointI (GpPath *path, int x, int y, GpGraphics *graphics, bool *result);
-GpStatus GdipIsOutlineVisiblePathPoint (GpPath *path, float x, float y, GpGraphics *graphics, bool *result);
-GpStatus GdipIsOutlineVisiblePathPointI (GpPath *path, int x, int y, GpGraphics *graphics, bool *result);
-
-
-
-#endif /* _GRAPHICS_PATH_H_ */
diff --git a/mcs/class/System.Drawing/gdiplus/graphics.c b/mcs/class/System.Drawing/gdiplus/graphics.c
deleted file mode 100644
index b2f9e290aa6..00000000000
--- a/mcs/class/System.Drawing/gdiplus/graphics.c
+++ /dev/null
@@ -1,787 +0,0 @@
-/*
- * graphics.c
- *
- * Copyright (c) 2003 Alexandre Pigolkine, 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.
- *
- * Authors:
- * Alexandre Pigolkine(pigolkine@gmx.de)
- * Duncan Mak (duncan@ximian.com)
- *
- */
-
-#include "gdip.h"
-#include "gdip_win32.h"
-#include <math.h>
-
-void
-gdip_graphics_init (GpGraphics *graphics)
-{
- graphics->ct = cairo_create ();
- graphics->copy_of_ctm = cairo_matrix_create ();
- cairo_matrix_set_identity (graphics->copy_of_ctm);
- graphics->hdc = 0;
- graphics->hdc_busy_count = 0;
- graphics->image = 0;
- graphics->type = gtUndefined;
- /* cairo_select_font (graphics->ct, "serif:12"); */
- cairo_select_font (graphics->ct, "serif:12", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
-}
-
-GpGraphics *
-gdip_graphics_new ()
-{
- GpGraphics *result = (GpGraphics *) GdipAlloc (sizeof (GpGraphics));
- gdip_graphics_init (result);
- return result;
-}
-
-void
-gdip_graphics_attach_bitmap (GpGraphics *graphics, GpBitmap *image)
-{
- cairo_set_target_image (graphics->ct, image->data.Scan0, image->cairo_format,
- image->data.Width, image->data.Height, image->data.Stride);
- graphics->image = image;
- graphics->type = gtMemoryBitmap;
-}
-
-void
-gdip_graphics_detach_bitmap (GpGraphics *graphics, GpBitmap *image)
-{
- printf ("Implement graphics_detach_bitmap");
- /* FIXME: implement me */
-}
-
-#define C1 0.552285
-static void
-make_ellipse (GpGraphics *graphics, float x, float y, float width, float height)
-{
- double rx = width / 2;
- double ry = height / 2;
- double cx = x + rx;
- double cy = y + ry;
-
- cairo_move_to (graphics->ct, cx + rx, cy);
-
- /* an approximate of the ellipse by drawing a curve in each
- * quartrant */
- cairo_curve_to (graphics->ct,
- cx + rx, cy - C1 * ry,
- cx + C1 * rx, cy - ry,
- cx, cy - ry);
-
- cairo_curve_to (graphics->ct,
- cx - C1 * rx, cy - ry,
- cx - rx, cy - C1 * ry,
- cx - rx, cy);
-
- cairo_curve_to (graphics->ct,
- cx - rx, cy + C1 * ry,
- cx - C1 * rx, cy + ry,
- cx, cy + ry);
-
- cairo_curve_to (graphics->ct,
- cx + C1 * rx, cy + ry,
- cx + rx, cy + C1 * ry,
- cx + rx, cy);
-
- cairo_close_path (graphics->ct);
-}
-
-static void
-make_polygon (GpGraphics *graphics, GpPointF *points, int count)
-{
- int i;
- cairo_move_to (graphics->ct, points [0].X, points [0].Y);
-
- for (i = 0; i < count; i++)
- cairo_line_to (graphics->ct, points [i].X, points [i].Y);
-
- /*
- * Draw a line from the last point back to the first point if
- * they're not the same
- */
- if (points [0].X != points [count].X && points [0].Y != points [count].Y)
- cairo_line_to (graphics->ct, points [0].X, points [0].Y);
-
- cairo_close_path (graphics->ct);
-}
-
-static void
-make_polygon_from_integers (
- GpGraphics *graphics, GpPoint *points, int count)
-{
- int i;
- cairo_move_to (graphics->ct, points [0].X, points [0].Y);
-
- for (i = 0; i < count; i++)
- cairo_line_to (graphics->ct, points [i].X, points [i].Y);
-
- /*
- * Draw a line from the last point back to the first point if
- * they're not the same
- */
- if (points [0].X != points [count].X && points [0].Y != points [count].Y)
- cairo_line_to (graphics->ct, points [0].X, points [0].Y);
-
- cairo_close_path (graphics->ct);
-}
-
-/*
- * Based on the algorithm described in
- * http://www.stillhq.com/ctpfaq/2002/03/c1088.html#AEN1212
- */
-static void
-make_pie (GpGraphics *graphics, float x, float y,
- float width, float height, float startAngle, float sweepAngle)
-{
- float rx = width / 2;
- float ry = height / 2;
- int cx = x + rx;
- int cy = y + ry;
-
- /* angles in radians */
- float alpha = startAngle * PI / 180;
- float beta = sweepAngle * PI / 180;
-
- float delta = beta - alpha;
- float bcp = 4.0 / 3 * (1 - cos (delta / 2)) / sin (delta /2);
-
- float sin_alpha = sin (alpha);
- float sin_beta = sin (beta);
- float cos_alpha = cos (alpha);
- float cos_beta = cos (beta);
-
- /* move to center */
- cairo_move_to (graphics->ct, cx, cy);
-
- /* draw pie edge */
- cairo_line_to (graphics->ct,
- cx + rx * cos_alpha,
- cy + ry * sin_alpha);
-
- cairo_curve_to (graphics->ct,
- cx + rx * (cos_alpha - bcp * sin_alpha),
- cy + ry * (sin_alpha + bcp * cos_alpha),
- cx + rx * (cos_beta + bcp * sin_beta),
- cy + ry * (sin_beta - bcp * cos_beta),
- cx + rx * cos_beta,
- cy + ry * sin_beta);
-
- /* draws line back to center */
- cairo_close_path (graphics->ct);
-}
-
-static void
-make_arc (GpGraphics *graphics, float x, float y, float width,
- float height, float startAngle, float sweepAngle)
-{
- float rx = width / 2;
- float ry = height / 2;
-
- /* center */
- int cx = x + rx;
- int cy = y + ry;
-
- /* angles in radians */
- float alpha = startAngle * PI / 180;
- float beta = sweepAngle * PI / 180;
-
- float delta = beta - alpha;
- float bcp = 4.0 / 3 * (1 - cos (delta / 2)) / sin (delta /2);
-
- float sin_alpha = sin (alpha);
- float sin_beta = sin (beta);
- float cos_alpha = cos (alpha);
- float cos_beta = cos (beta);
-
- /* move to pie edge */
- cairo_move_to (graphics->ct,
- cx + rx * cos_alpha,
- cy + ry * sin_alpha);
-
- cairo_curve_to (graphics->ct,
- cx + rx * (cos_alpha - bcp * sin_alpha),
- cy + ry * (sin_alpha + bcp * cos_alpha),
- cx + rx * (cos_beta + bcp * sin_beta),
- cy + ry * (sin_beta - bcp * cos_beta),
- cx + rx * cos_beta,
- cy + ry * sin_beta);
-}
-
-static cairo_fill_rule_t
-convert_fill_mode (GpFillMode fill_mode)
-{
- if (fill_mode == FillModeAlternate)
- return CAIRO_FILL_RULE_EVEN_ODD;
- else
- return CAIRO_FILL_RULE_WINDING;
-}
-
-
-GpStatus
-GdipCreateFromHDC (int hDC, GpGraphics **graphics)
-{
- DC* dc = _get_DC_by_HDC (hDC);
-
- /* printf ("GdipCreateFromHDC. in %d, DC %p\n", hDC, dc); */
- if (dc == 0) return NotImplemented;
-
- *graphics = gdip_graphics_new ();
- cairo_set_target_drawable ((*graphics)->ct, GDIP_display, dc->physDev->drawable);
- _release_hdc (hDC);
- (*graphics)->hdc = (void*)hDC;
- (*graphics)->type = gtX11Drawable;
- /* printf ("GdipCreateFromHDC. graphics %p, ct %p\n", (*graphics), (*graphics)->ct); */
- return Ok;
-}
-
-GpStatus
-GdipDeleteGraphics (GpGraphics *graphics)
-{
- /* FIXME: attention to surface (image, etc.) */
- /* printf ("GdipDeleteGraphics. graphics %p\n", graphics); */
- cairo_matrix_destroy (graphics->copy_of_ctm);
- cairo_destroy (graphics->ct);
- GdipFree (graphics);
- return Ok;
-}
-
-GpStatus
-GdipGetDC (GpGraphics *graphics, int *hDC)
-{
- if (graphics->hdc == 0) {
- if (graphics->image != 0) {
- /* Create DC */
- graphics->hdc = gdip_image_create_Win32_HDC (graphics->image);
- if (graphics->hdc != 0) {
- ++graphics->hdc_busy_count;
- }
- }
- }
- *hDC = (int)graphics->hdc;
- return Ok;
-}
-
-GpStatus
-GdipReleaseDC (GpGraphics *graphics, int hDC)
-{
- if (graphics->hdc != (void *)hDC) return InvalidParameter;
- if (graphics->hdc_busy_count > 0) {
- --graphics->hdc_busy_count;
- if (graphics->hdc_busy_count == 0) {
- /* Destroy DC */
- gdip_image_destroy_Win32_HDC (graphics->image, (void*)hDC);
- graphics->hdc = 0;
- }
- }
- return Ok;
-}
-
-#define MAX_GRAPHICS_STATE_STACK 100
-
-GpState saved_stack [MAX_GRAPHICS_STATE_STACK];
-int current_stack_pos = 0;
-
-GpStatus
-GdipRestoreGraphics (GpGraphics *graphics, unsigned int graphicsState)
-{
- if (graphicsState < MAX_GRAPHICS_STATE_STACK) {
- cairo_matrix_copy (graphics->copy_of_ctm, saved_stack[graphicsState].matrix);
- cairo_set_matrix (graphics->ct, graphics->copy_of_ctm);
- }
- else {
- return InvalidParameter;
- }
- return Ok;
-}
-
-GpStatus
-GdipSaveGraphics(GpGraphics *graphics, unsigned int *state)
-{
- if (current_stack_pos < MAX_GRAPHICS_STATE_STACK) {
- saved_stack[current_stack_pos].matrix = cairo_matrix_create ();
- cairo_matrix_copy (saved_stack[current_stack_pos].matrix, graphics->copy_of_ctm);
- *state = current_stack_pos;
- ++current_stack_pos;
- }
- else {
- return OutOfMemory;
- }
- return Ok;
-}
-GpStatus
-GdipResetWorldTransform (GpGraphics *graphics)
-{
- GpStatus s = cairo_matrix_set_identity (graphics->copy_of_ctm);
-
- if (s != Ok)
- return s;
- else {
- cairo_set_matrix (graphics->ct, graphics->copy_of_ctm);
- return Ok;
- }
-}
-
-GpStatus
-GdipSetWorldTransform (GpGraphics *graphics, GpMatrix *matrix)
-{
- graphics->copy_of_ctm = matrix;
- cairo_set_matrix (graphics->ct, graphics->copy_of_ctm);
- return Ok;
-}
-
-GpStatus
-GdipGetWorldTransform (GpGraphics *graphics, GpMatrix *matrix)
-{
- cairo_current_matrix (graphics->ct, matrix);
- return Ok;
-}
-
-GpStatus
-GdipMultiplyWorldTransform (GpGraphics *graphics, GpMatrix *matrix, GpMatrixOrder order)
-{
- Status s = GdipMultiplyMatrix (graphics->copy_of_ctm, matrix, order);
-
- if (s != Ok)
- return s;
-
- else {
- cairo_set_matrix (graphics->ct, graphics->copy_of_ctm);
- return Ok;
- }
-}
-
-GpStatus
-GdipRotateWorldTransform (GpGraphics *graphics, float angle, GpMatrixOrder order)
-{
- GpStatus s = GdipRotateMatrix (graphics->copy_of_ctm, angle, order);
-
- if (s != Ok)
- return s;
- else {
- cairo_set_matrix (graphics->ct, graphics->copy_of_ctm);
- return Ok;
- }
-}
-
-GpStatus
-GdipTranslateWorldTransform (GpGraphics *graphics, float dx, float dy, GpMatrixOrder order)
-{
- GpStatus s = GdipTranslateMatrix (graphics->copy_of_ctm, dx, dy, order);
-
- if (s != Ok)
- return s;
- else {
- cairo_set_matrix (graphics->ct, graphics->copy_of_ctm);
- return Ok;
- }
-}
-
-GpStatus
-GdipDrawArc (GpGraphics *graphics, GpPen *pen,
- float x, float y, float width, float height,
- float startAngle, float sweepAngle)
-{
- gdip_pen_setup (graphics, pen);
-
- float delta = sweepAngle - startAngle;
-
- if (delta < 180)
- make_arc (graphics, x, y, width, height, startAngle, sweepAngle);
-
- else {
- make_arc (graphics, x, y, width, height, startAngle, startAngle + 180);
- make_arc (graphics, x, y, width, height, startAngle + 180, sweepAngle);
- }
-
- cairo_stroke (graphics->ct);
-
- return gdip_get_status (cairo_status (graphics->ct));
-}
-
-GpStatus
-GdipDrawArcI (GpGraphics *graphics, GpPen *pen,
- int x, int y, int width, int height,
- float startAngle, float sweepAngle)
-{
- gdip_pen_setup (graphics, pen);
-
- float delta = sweepAngle - startAngle;
-
- if (delta < 180)
- make_arc (graphics, x, y, width, height, startAngle, sweepAngle);
-
- else {
- make_arc (graphics, x, y, width, height, startAngle, startAngle + 180);
- make_arc (graphics, x, y, width, height, startAngle + 180, sweepAngle);
- }
-
- cairo_stroke (graphics->ct);
-
- return gdip_get_status (cairo_status (graphics->ct));
-}
-
-GpStatus
-GdipDrawBezier (GpGraphics *graphics, GpPen *pen,
- float x1, float y1, float x2, float y2,
- float x3, float y3, float x4, float y4)
-{
- gdip_pen_setup (graphics, pen);
-
- cairo_move_to (graphics->ct, x1, y1);
- cairo_curve_to (graphics->ct, x2, y2, x3, y3, x4, y4);
- cairo_stroke (graphics->ct);
-
- return gdip_get_status (cairo_status (graphics->ct));
-}
-
-GpStatus GdipDrawBezierI (GpGraphics *graphics, GpPen *pen,
- int x1, int y1, int x2, int y2,
- int x3, int y3, int x4, int y4)
-{
- return GdipDrawBezier (graphics, pen,
- x1, y1, x2, y2, x3, y3, x4, y4);
-}
-
-GpStatus
-GdipDrawBeziers (GpGraphics *graphics, GpPen *pen,
- GpPointF *points, int count)
-{
- int i, j, k;
-
- if (count == 0)
- return Ok;
-
- gdip_pen_setup (graphics, pen);
-
- cairo_move_to (graphics->ct, points [0].X, points [0].Y);
-
- for (i = 0; i < count - 3; i += 3) {
- j = i + 1;
- k = i + 2;
- cairo_curve_to (graphics->ct,
- points [i].X, points [i].Y,
- points [j].X, points [j].Y,
- points [k].X, points [k].Y);
- }
-
- cairo_stroke (graphics->ct);
-
- return gdip_get_status (cairo_status (graphics->ct));
-}
-
-GpStatus
-GdipDrawBeziersI (GpGraphics *graphics, GpPen *pen,
- GpPoint *points, int count)
-{
- int i, j, k;
-
- if (count == 0)
- return Ok;
-
- gdip_pen_setup (graphics, pen);
-
- cairo_move_to (graphics->ct, points [0].X, points [0].Y);
-
- for (i = 0; i < count - 3; i += 3) {
- j = i + 1;
- k = i + 2;
- cairo_curve_to (graphics->ct,
- points [i].X, points [i].Y,
- points [j].X, points [j].Y,
- points [k].X, points [k].Y);
- }
-
- cairo_stroke (graphics->ct);
-
- return gdip_get_status (cairo_status (graphics->ct));
-}
-
-GpStatus
-GdipDrawEllipse (GpGraphics *graphics, GpPen *pen,
- float x, float y, float width, float height)
-{
- gdip_pen_setup (graphics, pen);
-
- make_ellipse (graphics, x, y, width, height);
- cairo_stroke (graphics->ct);
-
- return gdip_get_status (cairo_status (graphics->ct));
-}
-
-GpStatus
-GdipDrawEllipseI (GpGraphics *graphics, GpPen *pen,
- int x, int y, int width, int height)
-{
- return GdipDrawEllipse (graphics, pen, x, y, width, height);
-}
-
-GpStatus
-GdipDrawLine (GpGraphics *graphics, GpPen *pen,
- float x1, float y1, float x2, float y2)
-{
- gdip_pen_setup (graphics, pen);
-
- cairo_move_to (graphics->ct, x1, y1);
- cairo_line_to (graphics->ct, x2, y2);
- cairo_stroke (graphics->ct);
-
- return gdip_get_status (cairo_status (graphics->ct));
-}
-
-GpStatus
-GdipDrawLineI (GpGraphics *graphics, GpPen *pen,
- int x1, int y1, int x2, int y2)
-{
- return GdipDrawLine (graphics, pen, x1, y1, x2, y2);
-}
-
-GpStatus
-GdipDrawLines (GpGraphics *graphics, GpPen *pen, GpPointF *points, int count)
-{
- GpStatus s;
- int i, j;
-
- for (i = 0; i < count - 1; i++) {
- j = i + 1;
- s = GdipDrawLine (graphics, pen,
- points [i].X, points [i].Y,
- points [j].X, points [j].Y);
-
- if (s != Ok) return s;
- }
-
- return gdip_get_status (cairo_status (graphics->ct));
-}
-
-GpStatus
-GdipDrawLinesI (GpGraphics *graphics, GpPen *pen,
- GpPoint *points, int count)
-{
- GpStatus s;
- int i, j;
-
- for (i = 0; i < count - 1; i++) {
- j = i + 1;
- s = GdipDrawLineI (graphics, pen,
- points [i].X, points [i].Y,
- points [j].X, points [j].Y);
-
- if (s != Ok) return s;
- }
-
- return Ok;
-}
-
-GpStatus
-GdipDrawPie (GpGraphics *graphics, GpPen *pen, float x, float y,
- float width, float height, float startAngle, float sweepAngle)
-{
- gdip_pen_setup (graphics, pen);
-
- float delta = sweepAngle - startAngle;
-
- if (delta < 180)
- make_pie (graphics, x, y, width, height, startAngle, sweepAngle);
- else {
- make_pie (graphics, x, y, width, height, startAngle, startAngle + 180);
- make_pie (graphics, x, y, width, height, startAngle + 180, sweepAngle);
- }
-
- cairo_stroke (graphics->ct);
-
- cairo_close_path (graphics->ct);
-
- return gdip_get_status (cairo_status (graphics->ct));
-}
-
-GpStatus
-GdipDrawPieI (GpGraphics *graphics, GpPen *pen, int x, int y,
- int width, int height, float startAngle, float sweepAngle)
-{
- gdip_pen_setup (graphics, pen);
-
- float delta = sweepAngle - startAngle;
-
- if (delta < 180)
- make_pie (graphics, x, y, width, height, startAngle, sweepAngle);
- else {
- make_pie (graphics, x, y, width, height, startAngle, startAngle + 180);
- make_pie (graphics, x, y, width, height, startAngle + 180, sweepAngle);
- }
-
- cairo_stroke (graphics->ct);
-
- cairo_close_path (graphics->ct);
-
- return gdip_get_status (cairo_status (graphics->ct));
-}
-
-GpStatus
-GdipDrawPolygon (GpGraphics *graphics, GpPen *pen, GpPointF *points, int count)
-{
- gdip_pen_setup (graphics, pen);
-
- make_polygon (graphics, points, count);
- cairo_stroke (graphics->ct);
-
- return gdip_get_status (cairo_status (graphics->ct));
-}
-
-GpStatus
-GdipDrawPolygonI (GpGraphics *graphics, GpPen *pen, GpPoint *points, int count)
-{
- gdip_pen_setup (graphics, pen);
-
- make_polygon_from_integers (graphics, points, count);
- cairo_stroke (graphics->ct);
-
- return gdip_get_status (cairo_status (graphics->ct));
-}
-
-GpStatus
-GdipDrawRectangle (GpGraphics *graphics, GpPen *pen,
- float x, float y, float width, float height)
-{
- gdip_pen_setup (graphics, pen);
-
- cairo_rectangle (graphics->ct, x, y, width, height);
- cairo_stroke (graphics->ct);
-
- return gdip_get_status (cairo_status (graphics->ct));
-}
-
-GpStatus
-GdipDrawRectangleI (GpGraphics *graphics, GpPen *pen,
- int x, int y, int width, int height)
-{
- return GdipDrawRectangle (graphics, pen, x, y, width, height);
-}
-
-GpStatus
-GdipFillEllipse (GpGraphics *graphics, GpBrush *brush,
- float x, float y, float width, float height)
-{
- gdip_brush_setup (graphics, brush);
- make_ellipse (graphics, x, y, width, height);
- cairo_fill (graphics->ct);
-
- return gdip_get_status (cairo_status (graphics->ct));
-}
-
-GpStatus
-GdipFillEllipseI (GpGraphics *graphics, GpBrush *brush,
- int x, int y, int width, int height)
-{
- return GdipFillEllipse (graphics, brush, x, y, width, height);
-}
-
-GpStatus
-GdipFillRectangle (GpGraphics *graphics, GpBrush *brush,
- float x, float y, float width, float height)
-{
- gdip_brush_setup (graphics, brush);
- cairo_rectangle (graphics->ct, x, y, width, height);
- cairo_fill (graphics->ct);
- return gdip_get_status (cairo_status (graphics->ct));
-}
-
-GpStatus
-GdipFillPolygon (GpGraphics *graphics, GpBrush *brush,
- GpPointF *points, int count, GpFillMode fillMode)
-{
- gdip_brush_setup (graphics, brush);
- make_polygon (graphics, points, count);
-
- cairo_set_fill_rule (
- graphics->ct,
- convert_fill_mode (fillMode));
-
- cairo_fill (graphics->ct);
-
- return gdip_get_status (cairo_status (graphics->ct));
-}
-
-GpStatus
-GdipFillPolygonI (GpGraphics *graphics, GpBrush *brush,
- GpPoint *points, int count, GpFillMode fillMode)
-{
- gdip_brush_setup (graphics, brush);
- make_polygon_from_integers (graphics, points, count);
-
- cairo_set_fill_rule (
- graphics->ct,
- convert_fill_mode (fillMode));
-
- cairo_fill (graphics->ct);
-
- return gdip_get_status (cairo_status (graphics->ct));
-}
-
-GpStatus
-GdipFillPolygon2 (GpGraphics *graphics, GpBrush *brush, GpPointF *points, int count)
-{
- return GdipFillPolygon (graphics, brush, points, count, FillModeAlternate);
-}
-
-GpStatus
-GdipFillPolygon2I (GpGraphics *graphics, GpBrush *brush, GpPoint *points, int count)
-{
- return GdipFillPolygonI (graphics, brush, points, count, FillModeAlternate);
-}
-
-GpStatus
-GdipDrawString (GpGraphics *graphics, const char *string,
- int len, void *font, RectF *rc, void *format, GpBrush *brush)
-{
- cairo_save (graphics->ct);
- if (brush)
- gdip_brush_setup (graphics, brush);
-
- else
- cairo_set_rgb_color (graphics->ct, 0., 0., 0.);
-
- cairo_move_to (graphics->ct, rc->left, rc->top + 12);
- cairo_scale_font (graphics->ct, 12);
- cairo_show_text (graphics->ct, string);
-
- cairo_restore (graphics->ct);
- return gdip_get_status (cairo_status (graphics->ct));
-}
-
-GpStatus
-GdipSetRenderingOrigin (GpGraphics *graphics, int x, int y)
-{
- cairo_move_to (graphics->ct, x, y);
- cairo_close_path (graphics->ct);
-
- return gdip_get_status (cairo_status (graphics->ct));
-}
-
-GpStatus
-GdipGetRenderingOrigin (GpGraphics *graphics, int *x, int *y)
-{
- double cx, cy;
- cairo_current_point (graphics->ct, &cx, &cy);
-
- *x = (int) cx;
- *y = (int) cy;
-
- return gdip_get_status (cairo_status (graphics->ct));
-}
-
diff --git a/mcs/class/System.Drawing/gdiplus/image.c b/mcs/class/System.Drawing/gdiplus/image.c
deleted file mode 100644
index 8ba56f2f8b0..00000000000
--- a/mcs/class/System.Drawing/gdiplus/image.c
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * image.c
- *
- * Copyright (c) 2003 Alexandre Pigolkine
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
- * and associated documentation files (the "Software"), to deal in the Software without restriction,
- * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all copies or substantial
- * portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
- * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
- * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- * Alexandre Pigolkine(pigolkine@gmx.de)
- *
- */
-
-#include "gdip.h"
-#include <math.h>
-
-void
-gdip_image_init (GpImage *image)
-{
- image->type = imageUndefined;
- image->surface = 0;
- image->graphics = 0;
-}
-
-void *
-gdip_image_create_Win32_HDC (GpImage *image)
-{
- void *result = 0;
- switch (image->type) {
- case imageBitmap:
- result = gdip_bitmap_create_Win32_HDC ((GpBitmap *) image);
- break;
- case imageMetafile:
- break;
- case imageUndefined:
- break;
- }
- return result;
-}
-
-void
-gdip_image_destroy_Win32_HDC (GpImage *image, void *hdc)
-{
- switch (image->type) {
- case imageBitmap:
- gdip_bitmap_destroy_Win32_HDC ((GpBitmap *) image, hdc);
- break;
- case imageMetafile:
- break;
- case imageUndefined:
- break;
- }
-}
-
-GpStatus
-GdipDisposeImage (GpImage *image)
-{
- switch (image->type){
- case imageBitmap:
- gdip_bitmap_dispose ((GpBitmap *) image);
- break;
- case imageMetafile:
- break;
- case imageUndefined:
- break;
- }
- cairo_surface_destroy (image->surface);
- image->surface = 0;
- GdipFree (image);
-
- return Ok;
-}
-
-GpStatus
-GdipGetImageGraphicsContext (GpImage *image, GpGraphics **graphics)
-{
- if (image->graphics == 0) {
- image->graphics = gdip_graphics_new ();
- if (image->type == imageBitmap) {
- gdip_graphics_attach_bitmap (image->graphics, (GpBitmap *) image);
- }
- else if (image->type == imageMetafile) {
- }
- }
- *graphics = image->graphics;
- return Ok;
-}
-
-GpStatus
-GdipDrawImageI (GpGraphics *graphics, GpImage *image, int x, int y)
-{
- printf("GdipDrawImageI. %p (type %d), %p, (%d,%d)\n", graphics, graphics->type, image, x, y);
- return NotImplemented;
-}
-
-GpStatus
-GdipDrawImageRectI (GpGraphics *graphics, GpImage *image, int x, int y, int width, int height)
-{
- GpGraphics *image_graphics = 0;
- cairo_surface_t *image_surface = 0;
-
- if (image->type != imageBitmap)
- return InvalidParameter;
-
- /* printf("GdipDrawImageRectI. %p (type %d), %p, (%d,%d) (%d,%d)\n", graphics, graphics->type, image, x, y, width, height); */
-
- GdipGetImageGraphicsContext (image, &image_graphics);
- if (image_graphics == 0) {
- printf("GdipDrawImageRectI. Error : cannot get graphics\n");
- return GenericError;
- }
- image_surface = cairo_current_target_surface (image_graphics->ct);
- if (image_surface == 0) {
- printf("GdipDrawImageRectI. Error : cannot get surface\n");
- return GenericError;
- }
- cairo_move_to (graphics->ct, x, y);
- cairo_set_pattern (graphics->ct, image_surface);
- cairo_rectangle (graphics->ct, x, y, width, height);
- cairo_fill (graphics->ct);
-
- return Ok;
-}
-
diff --git a/mcs/class/System.Drawing/gdiplus/matrix.c b/mcs/class/System.Drawing/gdiplus/matrix.c
deleted file mode 100644
index 0af414c0e35..00000000000
--- a/mcs/class/System.Drawing/gdiplus/matrix.c
+++ /dev/null
@@ -1,327 +0,0 @@
-/**
- * matrix.c
- *
- * Author: Duncan Mak (duncan@ximian.com)
- *
- * Copyright (C) Novell, Inc. 2003.
- *
- **/
-
-#include <math.h>
-#include "gdip.h"
-
-GpStatus
-GdipCreateMatrix (GpMatrix **matrix)
-{
- *matrix = cairo_matrix_create ();
- cairo_matrix_set_affine (*matrix, 1, 0, 0, 1, 0, 0);
- return Ok;
-}
-
-GpStatus
-GdipCreateMatrix2 (float m11, float m12, float m21, float m22, float dx, float dy, GpMatrix **matrix)
-{
- *matrix = cairo_matrix_create ();
-
- return gdip_get_status (
- cairo_matrix_set_affine (
- *matrix, m11, m12, m21, m22, dx, dy));
-}
-
-GpStatus
-GdipCreateMatrix3 (const GpRectF *rect, const GpPointF *dstplg, GpMatrix **matrix)
-{
- *matrix = cairo_matrix_create ();
- double m11 = rect->left;
- double m12 = rect->top;
- double m21 = (rect->right) - (rect->left); /* width */
- double m22 = (rect->bottom) - (rect->top); /* height */
- double dx = dstplg->X;
- double dy = dstplg->Y;
-
- Status s = cairo_matrix_set_affine (
- *matrix, m11, m12, m21, m22, dx, dy);
-
- return gdip_get_status (s);
-}
-
-GpStatus
-GdipCreateMatrix3I (const GpRect *rect, const GpPoint *dstplg, GpMatrix **matrix)
-{
- *matrix = cairo_matrix_create ();
- double m11 = rect->left;
- double m12 = rect->top;
- double m21 = (rect->right) - (rect->left); /* width */
- double m22 = (rect->bottom) - (rect->top); /* height */
- double dx = dstplg->X;
- double dy = dstplg->Y;
-
- Status s = cairo_matrix_set_affine (
- *matrix, m11, m12, m21, m22, dx, dy);
-
- return gdip_get_status (s);
-}
-
-GpStatus
-GdipCloneMatrix (GpMatrix *matrix, GpMatrix **cloneMatrix)
-{
- *cloneMatrix = cairo_matrix_create ();
-
- return gdip_get_status (
- cairo_matrix_copy (*cloneMatrix, matrix));
-}
-
-GpStatus
-GdipDeleteMatrix (GpMatrix *matrix)
-{
- if (matrix)
- cairo_matrix_destroy (matrix);
- return Ok;
-}
-
-GpStatus
-GdipSetMatrixElements (GpMatrix *matrix, float m11, float m12, float m21, float m22, float dx, float dy)
-{
- return gdip_get_status (
- cairo_matrix_set_affine (matrix, m11, m12, m21, m22, dx, dy));
-}
-
-GpStatus
-GdipGetMatrixElements (GpMatrix *matrix, float *matrixOut)
-{
- double a, b, c, d, tx, ty;
-
- cairo_matrix_get_affine (matrix, &a, &b, &c, &d, &tx, &ty);
-
- matrixOut[0] = (float) a;
- matrixOut[1] = (float) b;
- matrixOut[2] = (float) c;
- matrixOut[3] = (float) d;
- matrixOut[4] = (float) tx;
- matrixOut[5] = (float) ty;
-
- return Ok;
-}
-
-GpStatus
-GdipMultiplyMatrix (GpMatrix *matrix, GpMatrix *matrix2, GpMatrixOrder order)
-{
- cairo_status_t status;
-
- if (order == MatrixOrderPrepend)
- status = cairo_matrix_multiply (matrix, matrix, matrix2);
-
- else if (order == MatrixOrderAppend)
- status = cairo_matrix_multiply (matrix, matrix2, matrix);
-
- else
- return GenericError;
-
- return gdip_get_status (status);
-}
-
-static GpMatrix *
-set_translate (float offsetX, float offsetY)
-{
- GpMatrix *matrix = cairo_matrix_create ();
- cairo_matrix_set_affine (matrix, 1, 0, 0, 1, offsetX, offsetY);
- return matrix;
-}
-
-GpStatus
-GdipTranslateMatrix (GpMatrix *matrix, float offsetX, float offsetY, GpMatrixOrder order)
-{
- GpMatrix *tmp = set_translate (offsetX, offsetY);
- GpStatus s = GdipMultiplyMatrix (matrix, tmp, order);
- GdipDeleteMatrix (tmp);
-
- return s;
-}
-
-static GpMatrix *
-set_scale (float scaleX, float scaleY)
-{
- GpMatrix *matrix = cairo_matrix_create ();
- cairo_matrix_set_affine (matrix, scaleX, 0, 0, scaleY, 0, 0);
- return matrix;
-}
-
-GpStatus
-GdipScaleMatrix (GpMatrix *matrix, float scaleX, float scaleY, GpMatrixOrder order)
-{
- GpMatrix *tmp = set_scale (scaleX, scaleY);
- GpStatus s = GdipMultiplyMatrix (matrix, tmp, order);
- GdipDeleteMatrix (tmp);
-
- return s;
-}
-
-static GpMatrix *
-set_rotate (float angle)
-{
- float rad = angle * DEGTORAD;
- GpMatrix *matrix = cairo_matrix_create ();
- cairo_matrix_set_affine (matrix, cos (rad), sin (rad), -sin (rad), cos (rad), 0, 0);
-
- return matrix;
-}
-
-GpStatus
-GdipRotateMatrix (GpMatrix *matrix, float angle, GpMatrixOrder order)
-{
- GpMatrix *tmp = set_rotate (angle);
- GpStatus s = GdipMultiplyMatrix (matrix, tmp, order);
- GdipDeleteMatrix (tmp);
-
- return s;
-}
-
-static GpMatrix *
-set_shear (float shearX, float shearY)
-{
- GpMatrix *matrix = cairo_matrix_create ();
- cairo_matrix_set_affine (matrix, 1, shearX, shearY, 1, 0, 0);
- return matrix;
-}
-
-GpStatus
-GdipShearMatrix (GpMatrix *matrix, float shearX, float shearY, GpMatrixOrder order)
-{
- GpMatrix *tmp = set_shear (shearX, shearY);
- GpStatus s = GdipMultiplyMatrix (matrix, tmp, order);
- GdipDeleteMatrix (tmp);
-
- return s;
-}
-
-GpStatus
-GdipInvertMatrix (GpMatrix *matrix)
-{
- return gdip_get_status (
- cairo_matrix_invert (matrix));
-}
-
-GpStatus
-GdipTransformMatrixPoints (GpMatrix *matrix, GpPointF *pts, int count)
-{
- int i;
- cairo_status_t status;
-
- for (i = 0; i < count; i++, pts++) {
- double x = pts->X;
- double y = pts->Y;
- status = cairo_matrix_transform_point (matrix, &x, &y);
- if (status != CAIRO_STATUS_SUCCESS)
- return gdip_get_status (status);
-
- pts->X = (float) x;
- pts->Y = (float) y;
- }
-
- return Ok;
-}
-
-GpStatus
-GdipTransformMatrixPointsI (GpMatrix *matrix, GpPoint *pts, int count)
-{
- int i;
- cairo_status_t status;
-
- for (i = 0; i < count; i++, pts++) {
- double x = pts->X;
- double y = pts->Y;
- status = cairo_matrix_transform_point (matrix, &x, &y);
- if (status != CAIRO_STATUS_SUCCESS)
- return gdip_get_status (status);
- pts->X = (int) x;
- pts->Y = (int) y;
- }
-
- return Ok;
-}
-
-GpStatus
-GdipVectorTransformMatrixPoints (GpMatrix *matrix, GpPointF *pts, int count)
-{
- int i;
- cairo_status_t status;
-
- for (i = 0; i < count; i++, pts++) {
- double x = pts->X;
- double y = pts->Y;
- status = cairo_matrix_transform_distance (matrix, &x, &y);
- if (status != CAIRO_STATUS_SUCCESS)
- return gdip_get_status (status);
- pts->X = (float) x;
- pts->Y = (float) y;
- }
-
- return Ok;
-}
-
-GpStatus
-GdipVectorTransformMatrixPointsI (GpMatrix *matrix, GpPoint *pts, int count)
-{
- int i;
- cairo_status_t status;
-
- for (i = 0; i < count; i++, pts++) {
- double x = pts->X;
- double y = pts->Y;
- status = cairo_matrix_transform_distance (matrix, &x, &y);
- if (status != CAIRO_STATUS_SUCCESS)
- return gdip_get_status (status);
-
- pts->X = (int) x;
- pts->Y = (int) y;
- }
-
- return Ok;
-}
-
-GpStatus
-GdipIsMatrixInvertible (GpMatrix *matrix, int *result)
-{
- cairo_status_t status = cairo_matrix_invert (matrix);
-
- if (status == CAIRO_STATUS_INVALID_MATRIX)
- *result = 0;
-
- *result = 1;
- return Ok;
-}
-
-static int
-matrix_equals (GpMatrix *x, GpMatrix *y)
-{
- double ax, bx, cx, dx, ex, fx;
- double ay, by, cy, dy, ey, fy;
-
- cairo_matrix_get_affine (x, &ax, &bx, &cx, &dx, &ex, &fx);
- cairo_matrix_get_affine (y, &ay, &by, &cy, &dy, &ey, &fy);
-
- if ((ax != ay) || (bx != by) || (cx != cy) ||
- (dx != dy) || (ex != ey) || (fx != fy))
- return 0;
-
- return 1;
-}
-
-GpStatus
-GdipIsMatrixIdentity (GpMatrix *matrix, int *result)
-{
- GpMatrix *identity = cairo_matrix_create ();
- cairo_matrix_set_identity (identity);
-
- Status s = GdipIsMatrixEqual (matrix, identity, result);
- GdipDeleteMatrix (identity);
-
- return s;
-}
-
-GpStatus
-GdipIsMatrixEqual (GpMatrix *matrix, GpMatrix *matrix2, int *result)
-{
- *result = matrix_equals (matrix, matrix2);
- return Ok;
-}
diff --git a/mcs/class/System.Drawing/gdiplus/pen.c b/mcs/class/System.Drawing/gdiplus/pen.c
deleted file mode 100644
index 5d5a20229b2..00000000000
--- a/mcs/class/System.Drawing/gdiplus/pen.c
+++ /dev/null
@@ -1,488 +0,0 @@
-/*
- * pen.c
- *
- * Copyright (c) 2003 Alexandre Pigolkine
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
- * and associated documentation files (the "Software"), to deal in the Software without restriction,
- * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all copies or substantial
- * portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
- * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
- * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- * Alexandre Pigolkine(pigolkine@gmx.de)
- * Duncan Mak (duncan@ximian.com)
- *
- */
-
-#include "gdip.h"
-
-void
-gdip_pen_init (GpPen *pen)
-{
- pen->color = 0;
- pen->width = 1;
- pen->miter_limit = 10;
- pen->line_join = LineJoinMiter;
- pen->matrix = NULL;
- pen->dash_offset = 0;
- pen->line_cap = LineCapFlat;
- pen->line_join = LineJoinMiter;
-}
-
-GpPen*
-gdip_pen_new (void)
-{
- GpPen *result = (GpPen *) GdipAlloc (sizeof (GpPen));
- gdip_pen_init (result);
- return result;
-}
-
-static cairo_line_join_t
-convert_line_join (GpLineJoin join)
-{
- switch (join) {
-
- case LineJoinMiter:
- return CAIRO_LINE_JOIN_MITER;
-
- case LineJoinBevel:
- return CAIRO_LINE_JOIN_BEVEL;
-
- case LineJoinRound:
- return CAIRO_LINE_JOIN_ROUND;
-
- case LineJoinMiterClipped:
- default:
- return CAIRO_LINE_JOIN_MITER;
- }
-}
-
-static cairo_line_cap_t
-convert_line_cap (GpLineCap cap)
-{
- switch (cap) {
-
- case LineCapSquare:
- return CAIRO_LINE_CAP_SQUARE;
-
- case LineCapRound:
- return CAIRO_LINE_CAP_ROUND;
-
- case LineCapFlat:
- case LineCapTriangle:
- case LineCapNoAnchor:
- case LineCapSquareAnchor:
- case LineCapRoundAnchor:
- case LineCapDiamondAnchor:
- case LineCapArrowAnchor:
- case LineCapCustom:
- default:
- return CAIRO_LINE_CAP_BUTT;
- }
-}
-
-static double *
-convert_dash_array (float *f, int count)
-{
- double *retval = malloc (sizeof (double) * count);
- int i;
- for (i = 0; i < count; i++, f++, retval++)
- *retval = (double) *f;
-
- return retval;
-}
-
-void
-gdip_pen_setup (GpGraphics *graphics, GpPen *pen)
-{
- int R = (pen->color & 0x00FF0000 ) >> 16;
- int G = (pen->color & 0x0000FF00 ) >> 8;
- int B = (pen->color & 0x000000FF );
-
- cairo_set_rgb_color (graphics->ct, (double) R, (double) G, (double) B);
- cairo_set_line_width (graphics->ct, (double) pen->width);
- cairo_set_miter_limit (graphics->ct, (double) pen->miter_limit);
- cairo_set_line_join (graphics->ct, convert_line_join (pen->line_join));
- cairo_set_line_cap (graphics->ct, convert_line_cap (pen->line_cap));
-
- if (pen->matrix != NULL)
- cairo_set_matrix (graphics->ct, pen->matrix);
-
- if (pen->dash_array != NULL && pen->dash_count != 0)
- cairo_set_dash (graphics->ct,
- convert_dash_array (pen->dash_array, pen->dash_count),
- pen->dash_count, pen->dash_offset);
-}
-
-GpStatus
-GdipCreatePen1(int argb, float width, GpUnit unit, GpPen **pen)
-{
- *pen = gdip_pen_new ();
- (*pen)->color = argb;
- (*pen)->width = width;
- return Ok;
-}
-
-GpStatus
-GdipCreatePen2 (GpBrush *brush, float width, GpUnit unit, GpPen **pen)
-{
- int color;
- GpBrushType type;
- *pen = gdip_pen_new ();
- (*pen)->width = width;
-
- GdipGetBrushType (brush, &type);
-
- switch (type) {
-
- case BrushTypeSolidColor:
-
- GdipGetSolidFillColor (brush, &color);
- (*pen)->color = color;
- return Ok;
-
- case BrushTypeHatchFill:
- case BrushTypeTextureFill:
- case BrushTypePathGradient:
- case BrushTypeLinearGradient:
- default:
- return GenericError;
- }
-}
-
-GpStatus
-GdipClonePen (GpPen *pen, GpPen **clonepen)
-{
- GpPen *result = gdip_pen_new ();
- result->color = pen->color;
- result->width = pen->width;
- result->miter_limit = pen->miter_limit;
- result->line_join = pen->line_join;
- result->matrix = pen->matrix;
- result->dash_offset = pen->dash_offset;
- result->line_cap = pen->line_cap;
- result->line_join = pen->line_join;
-
- *clonepen = result;
-
- return Ok;
-}
-
-
-GpStatus
-GdipDeletePen (GpPen *pen)
-{
- if (pen->matrix != NULL)
- cairo_matrix_destroy (pen->matrix);
-
- if (pen->dash_array != NULL)
- free (pen->dash_array);
-
- GdipFree (pen);
-}
-
-GpStatus
-GdipSetPenWidth (GpPen *pen, float width)
-{
- pen->width = width;
- return Ok;
-}
-
-GpStatus
-GdipGetPenWidth (GpPen *pen, float *width)
-{
- *width = pen->width;
- return Ok;
-}
-
-GpStatus
-GdipSetPenBrushFill (GpPen *pen, GpBrush *brush)
-{
- GpStatus s;
- pen->brush = brush;
- int color;
- s = GdipGetSolidFillColor (brush, &color);
-
- if (s != Ok)
- return s;
-
- pen->color = color;
- return Ok;
-}
-
-GpStatus
-GdipGetPenBrushFill (GpPen *pen, GpBrush **brush)
-{
- *brush = pen->brush;
- return Ok;
-}
-
-GpStatus
-GdipSetPenColor (GpPen *pen, int argb)
-{
- pen->color = argb;
-
- return Ok;
-}
-
-GpStatus
-GdipGetPenColor (GpPen *pen, int *argb)
-{
- *argb = pen->color;
- return Ok;
-}
-
-GpStatus
-GdipSetPenMiterLimit (GpPen *pen, float miterLimit)
-{
- pen->miter_limit = miterLimit;
- return Ok;
-}
-
-GpStatus
-GdipGetPenMiterLimit (GpPen *pen, float *miterLimit)
-{
- *miterLimit = pen->miter_limit;
-
- return Ok;
-}
-
-GpStatus
-GdipSetPenLineJoin (GpPen *pen, GpLineJoin lineJoin)
-{
- pen->line_join = lineJoin;
- return Ok;
-}
-
-GpStatus
-GdipGetPenLineJoin (GpPen *pen, GpLineJoin *lineJoin)
-{
- *lineJoin = pen->line_join;
- return Ok;
-}
-
-GpStatus
-GdipSetPenLineCap (GpPen *pen, GpLineCap lineCap)
-{
- pen->line_cap = lineCap;
- return Ok;
-}
-
-GpStatus
-GdipGetPenLineCap (GpPen *pen, GpLineCap *lineCap)
-{
- *lineCap = pen->line_cap;
- return Ok;
-}
-
-GpStatus
-GdipSetPenMode (GpPen *pen, GpPenAlignment penMode)
-{
- pen->mode = penMode;
- return Ok;
-}
-
-GpStatus
-GdipGetPenMode (GpPen *pen, GpPenAlignment *penMode)
-{
- *penMode = pen->mode;
- return Ok;
-}
-
-GpStatus
-GdipGetPenUnit (GpPen *pen, GpUnit *unit)
-{
- *unit = pen->unit;
- return Ok;
-}
-
-GpStatus
-GdipSetPenUnit (GpPen *pen, GpUnit unit)
-{
- pen->unit = unit;
- return Ok;
-}
-
-GpStatus
-GdipSetPenTransform (GpPen *pen, GpMatrix *matrix)
-{
- pen->matrix = matrix;
- return Ok;
-}
-
-GpStatus
-GdipGetPenTransform (GpPen *pen, GpMatrix *matrix)
-{
- matrix = pen->matrix;
- return Ok;
-}
-
-GpStatus
-GdipResetPenTransform (GpPen *pen)
-{
- pen->matrix = cairo_matrix_create ();
- return Ok;
-}
-
-GpStatus
-GdipMultiplyPenTransform (GpPen *pen, GpMatrix *matrix, GpMatrixOrder order)
-{
- return GdipMultiplyMatrix (pen->matrix, matrix, order);
-}
-
-GpStatus
-GdipTranslatePenTransform (GpPen *pen, float dx, float dy, GpMatrixOrder order)
-{
- return GdipTranslateMatrix (pen->matrix, dx, dy, order);
-}
-
-GpStatus
-GdipScalePenTransform (GpPen *pen, float sx, float sy, GpMatrixOrder order)
-{
- return GdipScaleMatrix (pen->matrix, sx, sy, order);
-}
-
-GpStatus
-GdipRotatePenTransform (GpPen *pen, float angle, GpMatrixOrder order)
-{
- return GdipRotateMatrix (pen->matrix, angle, order);
-}
-
-GpStatus
-GdipGetPenDashStyle (GpPen *pen, GpDashStyle *dashStyle)
-{
- *dashStyle = pen->dash_style;
- return Ok;
-}
-
-static float Custom [] = { 1.0 };
-static float Dot [] = { 1.0, 1.0 };
-static float Dash [] = { 3.0, 1.0 };
-static float DashDot [] = { 3.0, 1.0, 1.0, 1.0 };
-static float DashDotDot [] = { 3.0, 1.0, 1.0, 1.0, 1.0, 1.0 };
-
-GpStatus
-GdipSetPenDashStyle (GpPen *pen, GpDashStyle dashStyle)
-{
- pen->dash_style = dashStyle;
-
- switch (dashStyle) {
- case DashStyleSolid:
- pen->dash_array = NULL;
- return Ok;
-
- case DashStyleDashDot:
- pen->dash_array = DashDot;
- pen->dash_count = 4;
- return Ok;
-
- case DashStyleDashDotDot:
- pen->dash_array = DashDotDot;
- pen->dash_count = 6;
- return Ok;
-
- case DashStyleDot:
- pen->dash_array = Dot;
- pen->dash_count = 2;
- return Ok;
-
- case DashStyleDash:
- pen->dash_array = Dash;
- pen->dash_count = 2;
- return Ok;
-
- case DashStyleCustom:
- pen->dash_array = Custom;
- pen->dash_count = 1;
- return Ok;
-
- default:
- return GenericError;
- }
-}
-
-GpStatus
-GdipGetPenDashOffset (GpPen *pen, float *offset)
-{
- *offset = pen->dash_offset;
- return Ok;
-}
-
-GpStatus
-GdipSetPenDashOffset (GpPen *pen, float offset)
-{
- pen->dash_offset = offset;
- return Ok;
-}
-
-GpStatus
-GdipGetPenDashCount (GpPen *pen, int *count)
-{
- *count = pen->dash_count;
-
- return Ok;
-}
-
-GpStatus
-GdipSetPenDashCount (GpPen *pen, int count)
-{
- pen->dash_count = count;
-
- return Ok;
-}
-
-/*
- * This is the DashPattern property in Pen
- */
-GpStatus
-GdipGetPenDashArray (GpPen *pen, float **dash, int *count)
-{
- *dash = pen->dash_array;
- *count = pen->dash_count;
-
- return Ok;
-}
-
-GpStatus
-GdipSetPenDashArray (GpPen *pen, float *dash, int count)
-{
- if (count == 0 || dash == NULL)
- return Ok;
-
- GdipSetPenDashStyle (pen, DashStyleCustom);
- pen->dash_array = dash;
- pen->dash_count = count;
-
- return Ok;
-}
-
-/*
- * MonoTODO: Find out what the difference is between CompoundArray and DashArray
- */
-GpStatus
-GdipGetPenCompoundCount (GpPen *pen, int *count)
-{
- return NotImplemented;
-}
-
-GpStatus
-GdipSetPenCompoundArray (GpPen *pen, const float *dash, int count)
-{
- return NotImplemented;
-}
-
-GpStatus
-GdipGetPenCompoundArray (GpPen *pen, float **dash, int count)
-{
- return NotImplemented;
-}
diff --git a/mcs/class/System.Drawing/gdiplus/solidbrush.c b/mcs/class/System.Drawing/gdiplus/solidbrush.c
deleted file mode 100644
index 73ef84ecbb1..00000000000
--- a/mcs/class/System.Drawing/gdiplus/solidbrush.c
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * solidbrush.c
- *
- * Copyright (c) 2003 Alexandre Pigolkine
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
- * and associated documentation files (the "Software"), to deal in the Software without restriction,
- * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all copies or substantial
- * portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
- * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
- * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- * Alexandre Pigolkine(pigolkine@gmx.de)
- */
-
-#include "gdip.h"
-
-void
-gdip_solidfill_init (GpSolidFill *brush)
-{
- brush->color = 0;
- brush->type = BrushTypeSolidColor;
-}
-
-GpSolidFill *
-gdip_solidfill_new (void)
-{
- GpSolidFill *result = (GpSolidFill *) gdip_brush_new ();
- gdip_solidfill_init (result);
- return result;
-}
-
-void
-gdip_solidfill_setup (GpGraphics *graphics, GpBrush *brush)
-{
- int R = (brush->color & 0x00FF0000 ) >> 16;
- int G = (brush->color & 0x0000FF00 ) >> 8;
- int B = (brush->color & 0x000000FF );
- cairo_set_rgb_color (graphics->ct, (double) R, (double) G, (double) B);
-}
-
-GpStatus
-gdip_solidfill_clone (GpBrush *brush, GpBrush **clonedBrush)
-{
- *clonedBrush = gdip_brush_new ();
- (*clonedBrush)->color = brush->color;
-
- return Ok;
-}
-
-GpStatus
-GdipCreateSolidFill (int color, GpBrush **brush)
-{
- *brush = gdip_brush_new ();
- (*brush)->color = color;
- return NotImplemented;
-}
-
-GpStatus
-GdipSetSolidFillColor (GpSolidFill *brush, int color)
-{
- brush->color = color;
-
- return Ok;
-}
-
-GpStatus
-GdipGetSolidFillColor (GpSolidFill *brush, int *color)
-{
- *color = brush->color;
-
- return Ok;
-}
diff --git a/mcs/class/System.EnterpriseServices/Assembly/AssemblyInfo.cs b/mcs/class/System.EnterpriseServices/Assembly/AssemblyInfo.cs
new file mode 100644
index 00000000000..b682c845c2f
--- /dev/null
+++ b/mcs/class/System.EnterpriseServices/Assembly/AssemblyInfo.cs
@@ -0,0 +1,44 @@
+//
+// AssemblyInfo.cs
+//
+// Author:
+// Marek Safar (marek.safar@seznam.cz)
+//
+//
+
+using System;
+using System.Reflection;
+using System.Resources;
+using System.Security;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+#if (NET_1_0)
+ [assembly: AssemblyVersion("1.0.3300.0")]
+ [assembly: SatelliteContractVersion("1.0.3300.0")]
+#endif
+#if (NET_1_1)
+ [assembly: AssemblyVersion("1.0.5000.0")]
+ [assembly: SatelliteContractVersion("1.0.5000.0")]
+ [assembly: ComCompatibleVersion(1, 0, 3300, 0)]
+ [assembly: TypeLibVersion(1, 10)]
+#endif
+
+[assembly: AssemblyTitle("System.EnterpriseServices.dll")]
+[assembly: AssemblyDescription("System.EnterpriseServices.dll")]
+[assembly: AssemblyConfiguration("Development version")]
+[assembly: AssemblyCompany("MONO development team")]
+[assembly: AssemblyProduct("MONO CLI")]
+[assembly: AssemblyCopyright("(c) 2004 Various Authors")]
+[assembly: AssemblyTrademark("")]
+
+[assembly: CLSCompliant(true)]
+[assembly: AssemblyDefaultAlias("System.EnterpriseServices.dll")]
+[assembly: AssemblyInformationalVersion("0.0.0.1")]
+[assembly: NeutralResourcesLanguage("en-US")]
+
+[assembly: ComVisible(false)]
+[assembly: AllowPartiallyTrustedCallers]
+
+//[assembly: AssemblyDelaySign(false)]
+//[assembly: AssemblyKeyFile("")] \ No newline at end of file
diff --git a/mcs/class/System.EnterpriseServices/Assembly/ChangeLog b/mcs/class/System.EnterpriseServices/Assembly/ChangeLog
new file mode 100644
index 00000000000..49fa0b2228b
--- /dev/null
+++ b/mcs/class/System.EnterpriseServices/Assembly/ChangeLog
@@ -0,0 +1,4 @@
+2004-01-23 Marek Safar <marek.safar@seznam.cz>
+
+ * AssemblyInfo.cs: Added
+ * ChangeLog: Added
diff --git a/mcs/class/System.EnterpriseServices/ChangeLog b/mcs/class/System.EnterpriseServices/ChangeLog
index 53a6b70cbb9..c3bac89102c 100644
--- a/mcs/class/System.EnterpriseServices/ChangeLog
+++ b/mcs/class/System.EnterpriseServices/ChangeLog
@@ -1,3 +1,6 @@
+2004-01-23 Marek Safar <marek.safar@seznam.cz>
+ * System.EnterpriseServices.dll.sources: Added AssemblyInfo.cs
+
2002-11-20 Alejandro Sánchez Acosta <raciel@es.gnu.org>
* list: new files added to build
diff --git a/mcs/class/System.EnterpriseServices/System.EnterpriseServices.dll.sources b/mcs/class/System.EnterpriseServices/System.EnterpriseServices.dll.sources
index 8b910f0a18f..007ff60a37c 100644
--- a/mcs/class/System.EnterpriseServices/System.EnterpriseServices.dll.sources
+++ b/mcs/class/System.EnterpriseServices/System.EnterpriseServices.dll.sources
@@ -1,3 +1,4 @@
+Assembly/AssemblyInfo.cs
System.EnterpriseServices/AccessChecksLevelOption.cs
System.EnterpriseServices/ActivationOption.cs
System.EnterpriseServices/ApplicationAccessControlAttribute.cs
diff --git a/mcs/class/System.Runtime.Remoting/.cvsignore b/mcs/class/System.Runtime.Remoting/.cvsignore
index 0c2ee6906fa..b0048a9cb44 100644
--- a/mcs/class/System.Runtime.Remoting/.cvsignore
+++ b/mcs/class/System.Runtime.Remoting/.cvsignore
@@ -1,3 +1,5 @@
+System.Runtime.Remoting_test.dll
+System.Runtime.Remoting_test.pdb
list
.makefrag
.response
diff --git a/mcs/class/System.Runtime.Serialization.Formatters.Soap/.cvsignore b/mcs/class/System.Runtime.Serialization.Formatters.Soap/.cvsignore
index 0c2ee6906fa..e20564fc944 100644
--- a/mcs/class/System.Runtime.Serialization.Formatters.Soap/.cvsignore
+++ b/mcs/class/System.Runtime.Serialization.Formatters.Soap/.cvsignore
@@ -1,3 +1,5 @@
+System.Runtime.Serialization.Formatters.Soap_test.dll
+System.Runtime.Serialization.Formatters.Soap_test.pdb
list
.makefrag
.response
diff --git a/mcs/class/System.Security/.cvsignore b/mcs/class/System.Security/.cvsignore
new file mode 100755
index 00000000000..fff2ce70887
--- /dev/null
+++ b/mcs/class/System.Security/.cvsignore
@@ -0,0 +1,6 @@
+System.Security_test.dll
+System.Security_test.pdb
+list
+.makefrag
+.response
+library-deps.stamp
diff --git a/mcs/class/System.Security/Assembly/AssemblyInfo.cs b/mcs/class/System.Security/Assembly/AssemblyInfo.cs
new file mode 100755
index 00000000000..0d9ea7bc2a0
--- /dev/null
+++ b/mcs/class/System.Security/Assembly/AssemblyInfo.cs
@@ -0,0 +1,38 @@
+//
+// AssemblyInfo.cs
+//
+// Author:
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+//
+// (C) 2003 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Reflection;
+using System.Resources;
+using System.Security;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about the system assembly
+
+#if (NET_1_0)
+ [assembly: AssemblyVersion ("1.0.3300.0")]
+ [assembly: SatelliteContractVersion ("1.0.3300.0")]
+#endif
+#if (NET_1_1)
+ [assembly: AssemblyVersion ("1.0.5000.0")]
+ [assembly: SatelliteContractVersion ("1.0.5000.0")]
+#endif
+
+[assembly: AssemblyTitle ("System.Security.dll")]
+[assembly: AssemblyDescription ("System.Security.dll")]
+[assembly: AssemblyCompany ("MONO development team")]
+[assembly: AssemblyProduct ("MONO CLI")]
+[assembly: AssemblyCopyright ("(c) 2003-2004 Various Authors")]
+
+[assembly: CLSCompliant (true)]
+[assembly: NeutralResourcesLanguage ("en-US")]
+
+//[assembly: AssemblyDelaySign (false)]
+//[assembly: AssemblyKeyFile ("")]
diff --git a/mcs/class/System.Security/Assembly/ChangeLog b/mcs/class/System.Security/Assembly/ChangeLog
new file mode 100755
index 00000000000..953468750e8
--- /dev/null
+++ b/mcs/class/System.Security/Assembly/ChangeLog
@@ -0,0 +1,5 @@
+2004-01-11 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * AssemblyInfo.cs: New. Copied and ajusted from corlib.
+ * Locale.cs: New. Copied (verbatim) from corlib.
+ * ChangeLog: New. \ No newline at end of file
diff --git a/mcs/class/System.Security/Assembly/Locale.cs b/mcs/class/System.Security/Assembly/Locale.cs
new file mode 100755
index 00000000000..a456449296f
--- /dev/null
+++ b/mcs/class/System.Security/Assembly/Locale.cs
@@ -0,0 +1,24 @@
+//
+// Locale.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+//
+// (C) 2001 - 2003 Ximian, Inc (http://www.ximian.com)
+//
+
+internal sealed class Locale {
+
+ private Locale ()
+ {
+ }
+
+ /// <summary>
+ /// Returns the translated message for the current locale
+ /// </summary>
+ public static string GetText (string msg)
+ {
+ return msg;
+ }
+}
diff --git a/mcs/class/System.Security/ChangeLog b/mcs/class/System.Security/ChangeLog
index 05a504b30ea..0c6c440e6e3 100644
--- a/mcs/class/System.Security/ChangeLog
+++ b/mcs/class/System.Security/ChangeLog
@@ -1,3 +1,7 @@
+2004-01-11 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * System.Security.dll.sources: Added AssemblyInfo.cs and Locale.cs.
+
2003-07-24 Sebastien Pouliot <spouliot@videotron.ca>
* System.Security.dll.sources: Added new Mono.Xml.XmlCanonicalizer.cs
diff --git a/mcs/class/System.Security/System.Security.Cryptography.Xml/ChangeLog b/mcs/class/System.Security/System.Security.Cryptography.Xml/ChangeLog
index 3a43953e70e..63f91adbdd2 100644
--- a/mcs/class/System.Security/System.Security.Cryptography.Xml/ChangeLog
+++ b/mcs/class/System.Security/System.Security.Cryptography.Xml/ChangeLog
@@ -1,3 +1,10 @@
+2004-01-11 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * SignedXml.cs: Fixed class signature (for 1.1+) by adding public to
+ Resolver property.
+ * Transform.cs: Fixed class signature (for 1.1+) by adding public to
+ Resolver property.
+
2003-12-14 Sebastien Pouliot <spouliot@videotron.ca>
* SignedXml.cs: Now load the public key when verifying (bug #52084)
diff --git a/mcs/class/System.Security/System.Security.Cryptography.Xml/SignedXml.cs b/mcs/class/System.Security/System.Security.Cryptography.Xml/SignedXml.cs
index 7d621bc019f..bcbc3d7e7b0 100644
--- a/mcs/class/System.Security/System.Security.Cryptography.Xml/SignedXml.cs
+++ b/mcs/class/System.Security/System.Security.Cryptography.Xml/SignedXml.cs
@@ -357,7 +357,7 @@ namespace System.Security.Cryptography.Xml {
[MonoTODO("property not (yet) used in class")]
[ComVisible(false)]
- XmlResolver Resolver {
+ public XmlResolver Resolver {
set { xmlResolver = value; }
}
#endif
diff --git a/mcs/class/System.Security/System.Security.Cryptography.Xml/Transform.cs b/mcs/class/System.Security/System.Security.Cryptography.Xml/Transform.cs
index e65f9695bed..bdfa1cc6ce5 100644
--- a/mcs/class/System.Security/System.Security.Cryptography.Xml/Transform.cs
+++ b/mcs/class/System.Security/System.Security.Cryptography.Xml/Transform.cs
@@ -54,7 +54,7 @@ namespace System.Security.Cryptography.Xml {
[MonoTODO("property not (yet) used in derived classes")]
[ComVisible(false)]
- XmlResolver Resolver {
+ public XmlResolver Resolver {
set { xmlResolver = value; }
}
#endif
diff --git a/mcs/class/System.Security/System.Security.dll.sources b/mcs/class/System.Security/System.Security.dll.sources
index 52f1eddf761..f2e4f02a4ea 100644
--- a/mcs/class/System.Security/System.Security.dll.sources
+++ b/mcs/class/System.Security/System.Security.dll.sources
@@ -1,3 +1,5 @@
+Assembly/AssemblyInfo.cs
+Assembly/Locale.cs
Mono.Xml/XmlCanonicalizer.cs
System.Security.Cryptography.Xml/DSAKeyValue.cs
System.Security.Cryptography.Xml/DataObject.cs
diff --git a/mcs/class/System.Web.Services/.cvsignore b/mcs/class/System.Web.Services/.cvsignore
index 98896d1a9ab..a858c33f62c 100755
--- a/mcs/class/System.Web.Services/.cvsignore
+++ b/mcs/class/System.Web.Services/.cvsignore
@@ -1,4 +1,5 @@
*.dll
+*.pdb
*.suo
*.sln
*.csproj.user
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Configuration/ChangeLog b/mcs/class/System.Web.Services/System.Web.Services.Configuration/ChangeLog
index 1910eafa790..3dda296f77c 100644
--- a/mcs/class/System.Web.Services/System.Web.Services.Configuration/ChangeLog
+++ b/mcs/class/System.Web.Services/System.Web.Services.Configuration/ChangeLog
@@ -1,3 +1,7 @@
+2004-01-24 Lluis Sanchez Gual <lluis@ximian.com>
+
+ * XmlFormatExtensionPrefixAttribute.cs: Allow multiple usage.
+
2003-12-12 Lluis Sanchez Gual <lluis@ximian.com>
* WebServicesConfigurationSectionHandler.cs: Removed TODO.
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Configuration/XmlFormatExtensionPrefixAttribute.cs b/mcs/class/System.Web.Services/System.Web.Services.Configuration/XmlFormatExtensionPrefixAttribute.cs
index 91ed4038e60..0f531d801f1 100644
--- a/mcs/class/System.Web.Services/System.Web.Services.Configuration/XmlFormatExtensionPrefixAttribute.cs
+++ b/mcs/class/System.Web.Services/System.Web.Services.Configuration/XmlFormatExtensionPrefixAttribute.cs
@@ -8,7 +8,7 @@
//
namespace System.Web.Services.Configuration {
- [AttributeUsage (AttributeTargets.Class)]
+ [AttributeUsage (AttributeTargets.Class, AllowMultiple = true)]
public sealed class XmlFormatExtensionPrefixAttribute : Attribute {
#region Fields
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/ChangeLog b/mcs/class/System.Web.Services/System.Web.Services.Description/ChangeLog
index 829f7e6fb0c..021c22b6c09 100644
--- a/mcs/class/System.Web.Services/System.Web.Services.Description/ChangeLog
+++ b/mcs/class/System.Web.Services/System.Web.Services.Description/ChangeLog
@@ -1,3 +1,57 @@
+2004-01-27 Lluis Sanchez Gual <lluis@ximian.com>
+
+ * SoapProtocolImporter.cs, SoapProtocolReflector.cs: Support methods with
+ "any" as return type. In this case, the part of the return message contains
+ a reference to the type that describes the "any" element.
+
+2004-01-24 Lluis Sanchez Gual <lluis@ximian.com>
+
+ * ExtensionManager.cs: Support more than one XmlFormatExtensionPrefixAttribute
+ un one soap extension.
+ * HttpSimpleProtocolImporter.cs: Made class internal.
+ * HttpSimpleProtocolReflector.cs.cs: ReflectMethodBinding(): GET and POST
+ do not use method bindings. Return null.
+ * ProtocolReflector.cs: Several fixes: do not generate binding if it doesn't
+ have any operation, avoid port and binding name colisions, and other minor
+ fixes.
+ * ServiceDescription.cs: Collect the namespaces to be added to the root
+ element of a serializaed wsdl document from the soap extensions.
+ * ServiceDescriptionSerializerBase.cs: Made classes internal.
+ * SoapAddressBinding.cs, SoapFaultBinding.cs, SoapOperationBinding.cs,
+ SoapProtocolImporter.cs: Class should not be sealed.
+ * SoapBodyBinding.cs: Set the correct class attributes.
+ * SoapHeaderBinding.cs: Class should not be sealed. Added missing method.
+ * SoapHeaderFaultBinding.cs: Fixed class attributes.
+
+2004-01-21 Lluis Sanchez Gual <lluis@ximian.com>
+
+ * HttpSimpleProtocolImporter.cs: pass the web service class list to the xml
+ importers to make sure that no data classes are created with the same
+ name as the web service.
+ * ProtocolImporter.cs: Use port name as class name only if there is more
+ than one port using the same protocol. This fixes big #52742.
+
+2004-01-19 Lluis Sanchez Gual <lluis@ximian.com>
+
+ * HttpSimpleProtocolReflector.cs, SoapProtocolReflector.cs:
+ Use GetWebServiceLiteralNamespace instead of WebServiceLiteralNamespace.
+ * ProtocolReflector.cs: Port names must be unique in a service description.
+ This fixes bug #53019.
+ * ProtocolImporter.cs: Little fix.
+
+2004-01-14 Lluis Sanchez Gual <lluis@ximian.com>
+
+ * ProtocolImporter.cs, SoapProtocolImporter.cs: Added support for OneWay
+ operations (those don't have output message).
+ * SoapProtocolReflector.cs: Set the correct element name and
+ namespace for headers (those are not managed like other data classes).
+
+2004-01-13 Lluis Sanchez Gual <lluis@ximian.com>
+
+ * ProtocolReflector.cs: in the case a new ServiceDescription is created,
+ the name of the BindingInfo was not copied into the new ServiceDescriptor.
+ Patch by Yaacov Akiba Slama.
+
2003-12-12 Lluis Sanchez Gual <lluis@ximian.com>
* HttpSimpleProtocolImporter.cs: In ImportOutMembersMapping(), support part
@@ -5,8 +59,6 @@
In GetOutMimeFormatter(), support MimeContentBinding.
* ProtocolImporter.cs, SoapProtocolImporter.cs: Improved error and warning
handling. Minor fixes.
- * DiscoveryReference.cs: In FilenameFromUrl(), improved name generation
- for some common cases.
2003-11-11 Lluis Sanchez Gual <lluis@ximian.com>
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/ExtensionManager.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/ExtensionManager.cs
index c5d58e5753f..c245ecde13a 100644
--- a/mcs/class/System.Web.Services/System.Web.Services.Description/ExtensionManager.cs
+++ b/mcs/class/System.Web.Services/System.Web.Services.Description/ExtensionManager.cs
@@ -11,6 +11,7 @@ using System.Reflection;
using System.Collections;
using System.Web.Services.Configuration;
using System.Xml.Serialization;
+using System.Xml;
namespace System.Web.Services.Description
{
@@ -38,7 +39,7 @@ namespace System.Web.Services.Description
RegisterExtensionType (typeof (SoapBodyBinding));
RegisterExtensionType (typeof (SoapFaultBinding));
RegisterExtensionType (typeof (SoapHeaderBinding));
- RegisterExtensionType (typeof (SoapHeaderFaultBinding));
+// RegisterExtensionType (typeof (SoapHeaderFaultBinding));
RegisterExtensionType (typeof (SoapOperationBinding));
foreach (Type type in WSConfig.Instance.FormatExtensionTypes)
@@ -51,12 +52,9 @@ namespace System.Web.Services.Description
ext.Type = type;
object[] ats = type.GetCustomAttributes (typeof(XmlFormatExtensionPrefixAttribute), true);
- if (ats.Length > 0)
- {
- XmlFormatExtensionPrefixAttribute at = (XmlFormatExtensionPrefixAttribute)ats[0];
- ext.Prefix = at.Prefix;
- ext.Namespace = at.Namespace;
- }
+
+ foreach (XmlFormatExtensionPrefixAttribute at in ats)
+ ext.NamespaceDeclarations.Add (new XmlQualifiedName (at.Prefix, at.Namespace));
ats = type.GetCustomAttributes (typeof(XmlFormatExtensionAttribute), true);
if (ats.Length > 0)
@@ -158,16 +156,18 @@ namespace System.Web.Services.Description
internal class ExtensionInfo
{
- public string _prefix;
- public string _namespace;
- public string _elementName;
- public Type _type;
- public XmlSerializer _serializer;
+ ArrayList _namespaceDeclarations;
+ string _namespace;
+ string _elementName;
+ Type _type;
+ XmlSerializer _serializer;
- public string Prefix
+ public ArrayList NamespaceDeclarations
{
- get { return _prefix; }
- set { _prefix = value; }
+ get {
+ if (_namespaceDeclarations == null) _namespaceDeclarations = new ArrayList ();
+ return _namespaceDeclarations;
+ }
}
public string Namespace
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/HttpSimpleProtocolImporter.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/HttpSimpleProtocolImporter.cs
index 6ed1664f6d4..a0199c29891 100644
--- a/mcs/class/System.Web.Services/System.Web.Services.Description/HttpSimpleProtocolImporter.cs
+++ b/mcs/class/System.Web.Services/System.Web.Services.Description/HttpSimpleProtocolImporter.cs
@@ -18,7 +18,7 @@ using System.Collections;
namespace System.Web.Services.Description
{
- public abstract class HttpSimpleProtocolImporter : ProtocolImporter
+ internal abstract class HttpSimpleProtocolImporter : ProtocolImporter
{
#region Fields
@@ -67,8 +67,8 @@ namespace System.Web.Services.Description
protected override void BeginNamespace ()
{
- xmlImporter = new XmlSchemaImporter (Schemas);
- soapImporter = new SoapSchemaImporter (Schemas);
+ xmlImporter = new XmlSchemaImporter (Schemas, ClassNames);
+ soapImporter = new SoapSchemaImporter (Schemas, ClassNames);
xmlExporter = new XmlCodeExporter (CodeNamespace, null);
}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/HttpSimpleProtocolReflector.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/HttpSimpleProtocolReflector.cs
index de2b3bf2922..c1272df96f3 100644
--- a/mcs/class/System.Web.Services/System.Web.Services.Description/HttpSimpleProtocolReflector.cs
+++ b/mcs/class/System.Web.Services/System.Web.Services.Description/HttpSimpleProtocolReflector.cs
@@ -61,7 +61,7 @@ namespace System.Web.Services.Description {
MessagePart part = new MessagePart ();
part.Name = "Body";
- XmlTypeMapping map = ReflectionImporter.ImportTypeMapping (Method.ReturnType, ti.WebServiceLiteralNamespace);
+ XmlTypeMapping map = ReflectionImporter.ImportTypeMapping (Method.ReturnType, ti.GetWebServiceLiteralNamespace (ServiceDescription.TargetNamespace));
XmlQualifiedName qname = new XmlQualifiedName (map.ElementName, map.Namespace);
part.Element = qname;
OutputMessage.Parts.Add (part);
@@ -114,7 +114,7 @@ namespace System.Web.Services.Description {
protected override string ReflectMethodBinding ()
{
- return TypeInfo.DefaultBinding;
+ return null;
}
#endregion
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/ProtocolImporter.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/ProtocolImporter.cs
index 02c18979ef6..a6a1581623d 100644
--- a/mcs/class/System.Web.Services/System.Web.Services.Description/ProtocolImporter.cs
+++ b/mcs/class/System.Web.Services/System.Web.Services.Description/ProtocolImporter.cs
@@ -163,6 +163,13 @@ namespace System.Web.Services.Description {
foreach (Service service in info.ServiceDescription.Services)
{
this.service = service;
+ int bindingCount = 0;
+ foreach (Port port in service.Ports)
+ {
+ binding = ServiceDescriptions.GetBinding (port.Binding);
+ if (IsBindingSupported ()) bindingCount ++;
+ }
+
foreach (Port port in service.Ports)
{
this.iinfo = info;
@@ -171,7 +178,7 @@ namespace System.Web.Services.Description {
if (!IsBindingSupported ()) continue;
found = true;
- ImportPortBinding ();
+ ImportPortBinding (bindingCount > 1);
}
}
}
@@ -181,9 +188,9 @@ namespace System.Web.Services.Description {
return true;
}
- void ImportPortBinding ()
+ void ImportPortBinding (bool multipleBindings)
{
- if (service.Ports.Count > 1) className = port.Name;
+ if (multipleBindings) className = port.Name;
else className = service.Name;
className = classNames.AddUnique (CodeIdentifier.MakeValid (className), port);
@@ -251,8 +258,18 @@ namespace System.Web.Services.Description {
Operation FindPortOperation ()
{
- string inMessage = (operationBinding.Input.Name != null) ? operationBinding.Input.Name : operationBinding.Name;
- string outMessage = (operationBinding.Output.Name != null) ? operationBinding.Output.Name : operationBinding.Name;
+ string inMessage = null;
+ string outMessage = null;
+ int numMsg = 1;
+
+ if (operationBinding.Input == null) throw new InvalidOperationException ("Input operation binding not found");
+ inMessage = (operationBinding.Input.Name != null) ? operationBinding.Input.Name : operationBinding.Name;
+
+ if (operationBinding.Output != null) {
+ outMessage = (operationBinding.Output.Name != null) ? operationBinding.Output.Name : operationBinding.Name;
+ numMsg++;
+ }
+
string operName = operationBinding.Name;
Operation foundOper = null;
@@ -266,7 +283,7 @@ namespace System.Web.Services.Description {
if (omsg is OperationInput && GetOperMessageName (omsg, operName) == inMessage) hits++;
if (omsg is OperationOutput && GetOperMessageName (omsg, operName) == outMessage) hits++;
}
- if (hits == 2) return oper;
+ if (hits == numMsg) return oper;
foundOper = oper;
}
}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/ProtocolReflector.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/ProtocolReflector.cs
index dd0e93b510a..e471285eca2 100644
--- a/mcs/class/System.Web.Services/System.Web.Services.Description/ProtocolReflector.cs
+++ b/mcs/class/System.Web.Services/System.Web.Services.Description/ProtocolReflector.cs
@@ -45,6 +45,8 @@ namespace System.Web.Services.Description {
XmlReflectionImporter reflectionImporter;
SoapReflectionImporter soapReflectionImporter;
+ CodeIdentifiers portNames;
+
#endregion // Fields
#region Constructors
@@ -141,7 +143,7 @@ namespace System.Web.Services.Description {
get { return schemaExporter; }
}
- public SoapSchemaExporter SoapSchemaExporter {
+ internal SoapSchemaExporter SoapSchemaExporter {
get { return soapSchemaExporter; }
}
@@ -184,6 +186,7 @@ namespace System.Web.Services.Description {
internal void Reflect (ServiceDescriptionReflector serviceReflector, Type type, string url, XmlSchemaExporter xxporter, SoapSchemaExporter sxporter)
{
+ portNames = new CodeIdentifiers ();
this.serviceReflector = serviceReflector;
serviceUrl = url;
serviceType = type;
@@ -224,9 +227,8 @@ namespace System.Web.Services.Description {
void ImportBinding (ServiceDescription desc, Service service, TypeStubInfo typeInfo, string url, BindingInfo binfo)
{
port = new Port ();
- port.Name = binfo.Name;
- port.Binding = new XmlQualifiedName (binfo.Name, binfo.Namespace);
- service.Ports.Add (port);
+ port.Name = portNames.AddUnique (binfo.Name, port);
+ bool bindingFull = true;
if (binfo.Namespace != desc.TargetNamespace)
{
@@ -234,28 +236,53 @@ namespace System.Web.Services.Description {
{
ServiceDescription newDesc = new ServiceDescription();
newDesc.TargetNamespace = binfo.Namespace;
- int id = ServiceDescriptions.Add (newDesc);
- AddImport (desc, binfo.Namespace, GetWsdlUrl (url,id));
- ImportBindingContent (newDesc, typeInfo, url, binfo);
+ newDesc.Name = binfo.Name;
+ bindingFull = ImportBindingContent (newDesc, typeInfo, url, binfo);
+ if (bindingFull) {
+ int id = ServiceDescriptions.Add (newDesc);
+ AddImport (desc, binfo.Namespace, GetWsdlUrl (url,id));
+ }
}
- else
+ else {
AddImport (desc, binfo.Namespace, binfo.Location);
+ bindingFull = true;
+ }
}
else
- ImportBindingContent (desc, typeInfo, url, binfo);
+ bindingFull = ImportBindingContent (desc, typeInfo, url, binfo);
+
+ if (bindingFull)
+ {
+ port.Binding = new XmlQualifiedName (binding.Name, binfo.Namespace);
+ service.Ports.Add (port);
+ }
}
- void ImportBindingContent (ServiceDescription desc, TypeStubInfo typeInfo, string url, BindingInfo binfo)
+ bool ImportBindingContent (ServiceDescription desc, TypeStubInfo typeInfo, string url, BindingInfo binfo)
{
serviceDescription = desc;
+
+ // Look for an unused name
+
+ int n=0;
+ string name = binfo.Name;
+ bool found;
+ do
+ {
+ found = false;
+ foreach (Binding bi in desc.Bindings)
+ if (bi.Name == name) { found = true; n++; name = binfo.Name+n; break; }
+ }
+ while (found);
+
+ // Create the binding
+
binding = new Binding ();
- binding.Name = binfo.Name;
- binding.Type = new XmlQualifiedName (binfo.Name, binfo.Namespace);
- desc.Bindings.Add (binding);
+ binding.Name = name;
+ binding.Type = new XmlQualifiedName (binding.Name, binfo.Namespace);
portType = new PortType ();
portType.Name = binding.Name;
- desc.PortTypes.Add (portType);
BeginClass ();
@@ -264,7 +291,7 @@ namespace System.Web.Services.Description {
methodStubInfo = method;
string metBinding = ReflectMethodBinding ();
- if (metBinding != null && (metBinding != binding.Name)) continue;
+ if (typeInfo.GetBinding (metBinding) != binfo) continue;
operation = new Operation ();
operation.Name = method.OperationName;
@@ -299,8 +326,17 @@ namespace System.Web.Services.Description {
reflector.ReflectMethod ();
}
}
-
+
EndClass ();
+
+ if (portType.Operations.Count > 0)
+ {
+ desc.Bindings.Add (binding);
+ desc.PortTypes.Add (portType);
+ return true;
+ }
+ else
+ return false;
}
void ImportOperationBinding ()
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/ServiceDescription.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/ServiceDescription.cs
index 6330987a6ad..c04a806833b 100644
--- a/mcs/class/System.Web.Services/System.Web.Services.Description/ServiceDescription.cs
+++ b/mcs/class/System.Web.Services/System.Web.Services.Description/ServiceDescription.cs
@@ -202,9 +202,38 @@ namespace System.Web.Services.Description {
ns.Add ("mime", MimeContentBinding.Namespace);
ns.Add ("tm", MimeTextBinding.Namespace);
ns.Add ("s0", TargetNamespace);
+
+ AddExtensionNamespaces (ns, Extensions);
+
+ if (Types != null) AddExtensionNamespaces (ns, Types.Extensions);
+
+ foreach (Service ser in Services)
+ foreach (Port port in ser.Ports)
+ AddExtensionNamespaces (ns, port.Extensions);
+
+ foreach (Binding bin in Bindings)
+ {
+ AddExtensionNamespaces (ns, bin.Extensions);
+ foreach (OperationBinding op in bin.Operations)
+ {
+ AddExtensionNamespaces (ns, op.Extensions);
+ if (op.Input != null) AddExtensionNamespaces (ns, op.Input.Extensions);
+ if (op.Output != null) AddExtensionNamespaces (ns, op.Output.Extensions);
+ }
+ }
return ns;
}
+ void AddExtensionNamespaces (XmlSerializerNamespaces ns, ServiceDescriptionFormatExtensionCollection extensions)
+ {
+ foreach (ServiceDescriptionFormatExtension ext in extensions)
+ {
+ ExtensionInfo einf = ExtensionManager.GetFormatExtensionInfo (ext.GetType ());
+ foreach (XmlQualifiedName qname in einf.NamespaceDeclarations)
+ ns.Add (qname.Name, qname.Namespace);
+ }
+ }
+
internal static void WriteExtensions (XmlWriter writer, object ob)
{
ServiceDescriptionFormatExtensionCollection extensions = ExtensionManager.GetExtensionPoint (ob);
@@ -219,16 +248,15 @@ namespace System.Web.Services.Description {
{
Type type = ext.GetType ();
ExtensionInfo info = ExtensionManager.GetFormatExtensionInfo (type);
- string prefix = info.Prefix;
-
- if (prefix == null || prefix == "") prefix = writer.LookupPrefix (info.Namespace);
// if (prefix != null && prefix != "")
// Writer.WriteStartElement (prefix, info.ElementName, info.Namespace);
// else
// WriteStartElement (info.ElementName, info.Namespace, false);
- info.Serializer.Serialize (writer, ext);
+ XmlSerializerNamespaces ns = new XmlSerializerNamespaces ();
+ ns.Add ("","");
+ info.Serializer.Serialize (writer, ext, ns);
}
internal static void ReadExtension (XmlReader reader, object ob)
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/ServiceDescriptionSerializerBase.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/ServiceDescriptionSerializerBase.cs
index a5f069da771..e6ed60b1682 100644
--- a/mcs/class/System.Web.Services/System.Web.Services.Description/ServiceDescriptionSerializerBase.cs
+++ b/mcs/class/System.Web.Services/System.Web.Services.Description/ServiceDescriptionSerializerBase.cs
@@ -7,7 +7,7 @@ using System.Globalization;
namespace System.Web.Services.Description
{
- public class ServiceDescriptionReaderBase : XmlSerializationReader
+ internal class ServiceDescriptionReaderBase : XmlSerializationReader
{
public System.Web.Services.Description.ServiceDescription ReadTree ()
{
@@ -1297,7 +1297,7 @@ namespace System.Web.Services.Description
}
- public class ServiceDescriptionWriterBase : XmlSerializationWriter
+ internal class ServiceDescriptionWriterBase : XmlSerializationWriter
{
public void WriteTree (System.Web.Services.Description.ServiceDescription ob)
{
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/SoapAddressBinding.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/SoapAddressBinding.cs
index 82a3a3dca0e..de3db795d5f 100644
--- a/mcs/class/System.Web.Services/System.Web.Services.Description/SoapAddressBinding.cs
+++ b/mcs/class/System.Web.Services/System.Web.Services.Description/SoapAddressBinding.cs
@@ -12,7 +12,7 @@ using System.Xml.Serialization;
namespace System.Web.Services.Description {
[XmlFormatExtension ("address", "http://schemas.xmlsoap.org/wsdl/soap/", typeof (Port))]
- public sealed class SoapAddressBinding : ServiceDescriptionFormatExtension {
+ public class SoapAddressBinding : ServiceDescriptionFormatExtension {
#region Fields
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/SoapBodyBinding.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/SoapBodyBinding.cs
index 951818910ce..8377e4367c5 100644
--- a/mcs/class/System.Web.Services/System.Web.Services.Description/SoapBodyBinding.cs
+++ b/mcs/class/System.Web.Services/System.Web.Services.Description/SoapBodyBinding.cs
@@ -13,7 +13,9 @@ using System.Xml.Serialization;
namespace System.Web.Services.Description {
[XmlFormatExtension ("body", "http://schemas.xmlsoap.org/wsdl/soap/", typeof (InputBinding), typeof (OutputBinding), typeof (MimePart))]
- public sealed class SoapBodyBinding : ServiceDescriptionFormatExtension {
+ [XmlFormatExtensionPrefixAttribute ("soap", "http://schemas.xmlsoap.org/wsdl/soap/")]
+ [XmlFormatExtensionPrefixAttribute ("soapenc", "http://schemas.xmlsoap.org/soap/encoding/")]
+ public class SoapBodyBinding : ServiceDescriptionFormatExtension {
#region Fields
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/SoapFaultBinding.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/SoapFaultBinding.cs
index a67e4219de8..6d5c39aa88a 100644
--- a/mcs/class/System.Web.Services/System.Web.Services.Description/SoapFaultBinding.cs
+++ b/mcs/class/System.Web.Services/System.Web.Services.Description/SoapFaultBinding.cs
@@ -13,7 +13,7 @@ using System.Xml.Serialization;
namespace System.Web.Services.Description {
[XmlFormatExtension ("fault", "http://schemas.xmlsoap.org/wsdl/soap/", typeof (FaultBinding))]
- public sealed class SoapFaultBinding : ServiceDescriptionFormatExtension {
+ public class SoapFaultBinding : ServiceDescriptionFormatExtension {
#region Fields
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/SoapHeaderBinding.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/SoapHeaderBinding.cs
index 13904e4276c..a8f6e46eea6 100644
--- a/mcs/class/System.Web.Services/System.Web.Services.Description/SoapHeaderBinding.cs
+++ b/mcs/class/System.Web.Services/System.Web.Services.Description/SoapHeaderBinding.cs
@@ -15,7 +15,7 @@ using System.Xml.Serialization;
namespace System.Web.Services.Description {
[XmlFormatExtension ("header", "http://schemas.xmlsoap.org/wsdl/soap/", typeof (InputBinding), typeof (OutputBinding))]
- public sealed class SoapHeaderBinding : ServiceDescriptionFormatExtension {
+ public class SoapHeaderBinding : ServiceDescriptionFormatExtension {
#region Fields
@@ -83,6 +83,15 @@ namespace System.Web.Services.Description {
set { use = value; }
}
+#if NET_1_1
+ [MonoTODO]
+ public SoapHeaderFaultBinding Fault
+ {
+ get { return null; }
+ set { ; }
+ }
+#endif
+
#endregion // Properties
}
}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/SoapHeaderFaultBinding.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/SoapHeaderFaultBinding.cs
index 5f1d384ce02..0a4e4aadb75 100644
--- a/mcs/class/System.Web.Services/System.Web.Services.Description/SoapHeaderFaultBinding.cs
+++ b/mcs/class/System.Web.Services/System.Web.Services.Description/SoapHeaderFaultBinding.cs
@@ -13,8 +13,8 @@ using System.Xml;
using System.Xml.Serialization;
namespace System.Web.Services.Description {
- [XmlFormatExtension ("headerfault", "http://schemas.xmlsoap.org/wsdl/soap/", typeof (InputBinding), typeof (OutputBinding))]
- public sealed class SoapHeaderFaultBinding : ServiceDescriptionFormatExtension {
+
+ public class SoapHeaderFaultBinding : ServiceDescriptionFormatExtension {
#region Fields
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/SoapOperationBinding.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/SoapOperationBinding.cs
index b4207bcd5f5..2075aa56f4b 100644
--- a/mcs/class/System.Web.Services/System.Web.Services.Description/SoapOperationBinding.cs
+++ b/mcs/class/System.Web.Services/System.Web.Services.Description/SoapOperationBinding.cs
@@ -13,7 +13,7 @@ using System.Xml.Serialization;
namespace System.Web.Services.Description {
[XmlFormatExtension ("operation", "http://schemas.xmlsoap.org/wsdl/soap/", typeof (OperationBinding))]
- public sealed class SoapOperationBinding : ServiceDescriptionFormatExtension {
+ public class SoapOperationBinding : ServiceDescriptionFormatExtension {
#region Fields
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/SoapProtocolImporter.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/SoapProtocolImporter.cs
index 8e744184f00..001ca59fbd0 100644
--- a/mcs/class/System.Web.Services/System.Web.Services.Description/SoapProtocolImporter.cs
+++ b/mcs/class/System.Web.Services/System.Web.Services.Description/SoapProtocolImporter.cs
@@ -18,7 +18,7 @@ using System.Configuration;
using System.Collections;
namespace System.Web.Services.Description {
- public sealed class SoapProtocolImporter : ProtocolImporter {
+ public class SoapProtocolImporter : ProtocolImporter {
#region Fields
@@ -146,19 +146,29 @@ namespace System.Web.Services.Description {
SoapOperationBinding soapOper = OperationBinding.Extensions.Find (typeof (SoapOperationBinding)) as SoapOperationBinding;
if (soapOper == null) throw new InvalidOperationException ("Soap operation binding not found");
- SoapBodyBinding isbb = OperationBinding.Input.Extensions.Find (typeof(SoapBodyBinding)) as SoapBodyBinding;
- if (isbb == null) throw new InvalidOperationException ("Soap body binding not found");
-
- SoapBodyBinding osbb = OperationBinding.Output.Extensions.Find (typeof(SoapBodyBinding)) as SoapBodyBinding;
- if (osbb == null) throw new InvalidOperationException ("Soap body binding not found");
-
SoapBindingStyle style = soapOper.Style != SoapBindingStyle.Default ? soapOper.Style : soapBinding.Style;
- XmlMembersMapping inputMembers = ImportMembersMapping (InputMessage, isbb, style, false);
+ SoapBodyBinding isbb = null;
+ XmlMembersMapping inputMembers = null;
+
+ isbb = OperationBinding.Input.Extensions.Find (typeof(SoapBodyBinding)) as SoapBodyBinding;
+ if (isbb == null) throw new InvalidOperationException ("Soap body binding not found");
+
+ inputMembers = ImportMembersMapping (InputMessage, isbb, style, false);
if (inputMembers == null) throw new InvalidOperationException ("Input message not declared");
+
+ // If OperationBinding.Output is null, it is an OneWay operation
+
+ SoapBodyBinding osbb = null;
+ XmlMembersMapping outputMembers = null;
+
+ if (OperationBinding.Output != null) {
+ osbb = OperationBinding.Output.Extensions.Find (typeof(SoapBodyBinding)) as SoapBodyBinding;
+ if (osbb == null) throw new InvalidOperationException ("Soap body binding not found");
- XmlMembersMapping outputMembers = ImportMembersMapping (OutputMessage, osbb, style, true);
- if (outputMembers == null) throw new InvalidOperationException ("Output message not declared");
+ outputMembers = ImportMembersMapping (OutputMessage, osbb, style, true);
+ if (outputMembers == null) throw new InvalidOperationException ("Output message not declared");
+ }
CodeMemberMethod met = GenerateMethod (memberIds, soapOper, isbb, inputMembers, outputMembers);
@@ -167,11 +177,13 @@ namespace System.Web.Services.Description {
else
soapExporter.ExportMembersMapping (inputMembers);
- if (osbb.Use == SoapBindingUse.Literal)
- xmlExporter.ExportMembersMapping (outputMembers);
- else
- soapExporter.ExportMembersMapping (outputMembers);
-
+ if (osbb != null) {
+ if (osbb.Use == SoapBindingUse.Literal)
+ xmlExporter.ExportMembersMapping (outputMembers);
+ else
+ soapExporter.ExportMembersMapping (outputMembers);
+ }
+
foreach (SoapExtensionImporter eximporter in extensionImporters)
{
eximporter.ImportContext = this;
@@ -231,11 +243,18 @@ namespace System.Web.Services.Description {
{
if (style == SoapBindingStyle.Rpc)
throw new InvalidOperationException ("The combination of style=rpc with use=literal is not supported");
-
- XmlQualifiedName[] pnames = new XmlQualifiedName [msg.Parts.Count];
- for (int n=0; n<pnames.Length; n++)
- pnames[n] = msg.Parts[n].Element;
- return xmlImporter.ImportMembersMapping (pnames);
+
+ if (msg.Parts.Count == 1 && msg.Parts[0].Type != XmlQualifiedName.Empty)
+ {
+ return xmlImporter.ImportAnyType (msg.Parts[0].Type, null);
+ }
+ else
+ {
+ XmlQualifiedName[] pnames = new XmlQualifiedName [msg.Parts.Count];
+ for (int n=0; n<pnames.Length; n++)
+ pnames[n] = msg.Parts[n].Element;
+ return xmlImporter.ImportMembersMapping (pnames);
+ }
}
}
}
@@ -257,8 +276,9 @@ namespace System.Web.Services.Description {
for (int n=0; n<inputMembers.Count; n++)
pids.AddUnique (inputMembers[n].MemberName, inputMembers[n]);
- for (int n=0; n<outputMembers.Count; n++)
- pids.AddUnique (outputMembers[n].MemberName, outputMembers[n]);
+ if (outputMembers != null)
+ for (int n=0; n<outputMembers.Count; n++)
+ pids.AddUnique (outputMembers[n].MemberName, outputMembers[n]);
string varAsyncResult = pids.AddUnique ("asyncResult","asyncResult");
string varResults = pids.AddUnique ("results","results");
@@ -277,7 +297,7 @@ namespace System.Web.Services.Description {
methodEnd.Parameters.Add (new CodeParameterDeclarationExpression (typeof (IAsyncResult),varAsyncResult));
CodeExpression[] paramArray = new CodeExpression [inputMembers.Count];
- CodeParameterDeclarationExpression[] outParams = new CodeParameterDeclarationExpression [outputMembers.Count];
+ CodeParameterDeclarationExpression[] outParams = new CodeParameterDeclarationExpression [outputMembers != null ? outputMembers.Count : 0];
for (int n=0; n<inputMembers.Count; n++)
{
@@ -288,39 +308,42 @@ namespace System.Web.Services.Description {
paramArray [n] = new CodeVariableReferenceExpression (param.Name);
}
- for (int n=0; n<outputMembers.Count; n++)
+ if (outputMembers != null)
{
- CodeParameterDeclarationExpression cpd = GenerateParameter (outputMembers[n], FieldDirection.Out);
- outParams [n] = cpd;
-
- bool found = false;
- foreach (CodeParameterDeclarationExpression ip in method.Parameters)
+ for (int n=0; n<outputMembers.Count; n++)
{
- if (ip.Name == cpd.Name && ip.Type.BaseType == cpd.Type.BaseType) {
- ip.Direction = FieldDirection.Ref;
- methodEnd.Parameters.Add (GenerateParameter (outputMembers[n], FieldDirection.Out));
- found = true;
- break;
+ CodeParameterDeclarationExpression cpd = GenerateParameter (outputMembers[n], FieldDirection.Out);
+ outParams [n] = cpd;
+
+ bool found = false;
+ foreach (CodeParameterDeclarationExpression ip in method.Parameters)
+ {
+ if (ip.Name == cpd.Name && ip.Type.BaseType == cpd.Type.BaseType) {
+ ip.Direction = FieldDirection.Ref;
+ methodEnd.Parameters.Add (GenerateParameter (outputMembers[n], FieldDirection.Out));
+ found = true;
+ break;
+ }
}
+
+ if (found) continue;
+
+ if ((outputMembers [n].ElementName == Operation.Name + "Result") ||
+ (outputMembers.Count==1))
+ {
+ method.ReturnType = cpd.Type;
+ methodEnd.ReturnType = cpd.Type;
+ GenerateReturnAttributes (outputMembers, outputMembers[n], bodyBinding.Use, method);
+ outParams [n] = null;
+ continue;
+ }
+
+ method.Parameters.Add (cpd);
+ GenerateMemberAttributes (outputMembers, outputMembers[n], bodyBinding.Use, cpd);
+ methodEnd.Parameters.Add (GenerateParameter (outputMembers[n], FieldDirection.Out));
}
-
- if (found) continue;
-
- if ((outputMembers [n].ElementName == Operation.Name + "Result") ||
- (outputMembers.Count==1))
- {
- method.ReturnType = cpd.Type;
- methodEnd.ReturnType = cpd.Type;
- GenerateReturnAttributes (outputMembers, outputMembers[n], bodyBinding.Use, method);
- outParams [n] = null;
- continue;
- }
-
- method.Parameters.Add (cpd);
- GenerateMemberAttributes (outputMembers, outputMembers[n], bodyBinding.Use, cpd);
- methodEnd.Parameters.Add (GenerateParameter (outputMembers[n], FieldDirection.Out));
}
-
+
methodBegin.Parameters.Add (new CodeParameterDeclarationExpression (typeof (AsyncCallback),varCallback));
methodBegin.Parameters.Add (new CodeParameterDeclarationExpression (typeof (object),varAsyncState));
methodBegin.ReturnType = new CodeTypeReference (typeof(IAsyncResult));
@@ -361,7 +384,7 @@ namespace System.Web.Services.Description {
CodeVariableDeclarationStatement dec;
inv = new CodeMethodInvokeExpression (ethis, "Invoke", varMsgName, methodParams);
- if (outputMembers.Count > 0)
+ if (outputMembers != null && outputMembers.Count > 0)
{
dec = new CodeVariableDeclarationStatement (typeof(object[]), varResults, inv);
method.Statements.Add (dec);
@@ -381,7 +404,7 @@ namespace System.Web.Services.Description {
CodeExpression varAsyncr = new CodeVariableReferenceExpression (varAsyncResult);
inv = new CodeMethodInvokeExpression (ethis, "EndInvoke", varAsyncr);
- if (outputMembers.Count > 0)
+ if (outputMembers != null && outputMembers.Count > 0)
{
dec = new CodeVariableDeclarationStatement (typeof(object[]), varResults, inv);
methodEnd.Statements.Add (dec);
@@ -403,28 +426,31 @@ namespace System.Web.Services.Description {
att = new CodeAttributeDeclaration ("System.Web.Services.Protocols.SoapRpcMethodAttribute");
att.Arguments.Add (GetArg (soapOper.SoapAction));
if (inputMembers.ElementName != method.Name) att.Arguments.Add (GetArg ("RequestElementName", inputMembers.ElementName));
- if (outputMembers.ElementName != (method.Name + "Response")) att.Arguments.Add (GetArg ("ResponseElementName", outputMembers.ElementName));
+ if (outputMembers != null && outputMembers.ElementName != (method.Name + "Response")) att.Arguments.Add (GetArg ("ResponseElementName", outputMembers.ElementName));
att.Arguments.Add (GetArg ("RequestNamespace", inputMembers.Namespace));
- att.Arguments.Add (GetArg ("ResponseNamespace", outputMembers.Namespace));
+ if (outputMembers != null) att.Arguments.Add (GetArg ("ResponseNamespace", outputMembers.Namespace));
+ if (outputMembers == null) att.Arguments.Add (GetArg ("OneWay", true));
}
else
{
- if (inputMembers.ElementName == "" && outputMembers.ElementName != "" ||
- inputMembers.ElementName != "" && outputMembers.ElementName == "")
+ if (outputMembers != null && (inputMembers.ElementName == "" && outputMembers.ElementName != "" ||
+ inputMembers.ElementName != "" && outputMembers.ElementName == ""))
throw new InvalidOperationException ("Parameter style is not the same for the input message and output message");
att = new CodeAttributeDeclaration ("System.Web.Services.Protocols.SoapDocumentMethodAttribute");
att.Arguments.Add (GetArg (soapOper.SoapAction));
if (inputMembers.ElementName != "") {
if (inputMembers.ElementName != method.Name) att.Arguments.Add (GetArg ("RequestElementName", inputMembers.ElementName));
- if (outputMembers.ElementName != (method.Name + "Response")) att.Arguments.Add (GetArg ("ResponseElementName", outputMembers.ElementName));
+ if (outputMembers != null && outputMembers.ElementName != (method.Name + "Response")) att.Arguments.Add (GetArg ("ResponseElementName", outputMembers.ElementName));
att.Arguments.Add (GetArg ("RequestNamespace", inputMembers.Namespace));
- att.Arguments.Add (GetArg ("ResponseNamespace", outputMembers.Namespace));
+ if (outputMembers != null) att.Arguments.Add (GetArg ("ResponseNamespace", outputMembers.Namespace));
att.Arguments.Add (GetEnumArg ("ParameterStyle", "System.Web.Services.Protocols.SoapParameterStyle", "Wrapped"));
}
else
att.Arguments.Add (GetEnumArg ("ParameterStyle", "System.Web.Services.Protocols.SoapParameterStyle", "Bare"));
+ if (outputMembers == null) att.Arguments.Add (GetArg ("OneWay", true));
+
att.Arguments.Add (GetEnumArg ("Use", "System.Web.Services.Description.SoapBindingUse", bodyBinding.Use.ToString()));
}
@@ -472,6 +498,8 @@ namespace System.Web.Services.Description {
ImportHeader (method, hb, SoapHeaderDirection.In);
}
+ if (OperationBinding.Output == null) return;
+
foreach (object ob in OperationBinding.Output.Extensions)
{
SoapHeaderBinding hb = ob as SoapHeaderBinding;
@@ -483,6 +511,8 @@ namespace System.Web.Services.Description {
bool HasHeader (MessageBinding msg, SoapHeaderBinding hb)
{
+ if (msg == null) return false;
+
foreach (object ob in msg.Extensions)
{
SoapHeaderBinding mhb = ob as SoapHeaderBinding;
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/SoapProtocolReflector.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/SoapProtocolReflector.cs
index 193c1ff6f1f..2e8ce41f3d8 100644
--- a/mcs/class/System.Web.Services/System.Web.Services.Description/SoapProtocolReflector.cs
+++ b/mcs/class/System.Web.Services/System.Web.Services.Description/SoapProtocolReflector.cs
@@ -90,13 +90,25 @@ namespace System.Web.Services.Description {
if (method.Use == SoapBindingUse.Literal)
{
- XmlTypeMapping mapping = ReflectionImporter.ImportTypeMapping (hf.HeaderType, TypeInfo.LogicalType.WebServiceLiteralNamespace);
+ // MS.NET reflects header classes in a weird way. The root element
+ // name is the CLR class name unless it is specified in an XmlRootAttribute.
+ // The usual is to use the xml type name by default, but not in this case.
+
+ XmlRootAttribute root;
+ XmlAttributes ats = new XmlAttributes (hf.HeaderType);
+ if (ats.XmlRoot != null) root = ats.XmlRoot;
+ else root = new XmlRootAttribute (hf.HeaderType.Name);
+
+ if (root.Namespace == null) root.Namespace = TypeInfo.LogicalType.GetWebServiceLiteralNamespace (ServiceDescription.TargetNamespace);
+ if (root.ElementName == null) root.ElementName = hf.HeaderType.Name;
+
+ XmlTypeMapping mapping = ReflectionImporter.ImportTypeMapping (hf.HeaderType, root);
part.Element = new XmlQualifiedName (mapping.ElementName, mapping.Namespace);
SchemaExporter.ExportTypeMapping (mapping);
}
else
{
- XmlTypeMapping mapping = SoapReflectionImporter.ImportTypeMapping (hf.HeaderType, TypeInfo.LogicalType.WebServiceEncodedNamespace);
+ XmlTypeMapping mapping = SoapReflectionImporter.ImportTypeMapping (hf.HeaderType, TypeInfo.LogicalType.GetWebServiceEncodedNamespace (ServiceDescription.TargetNamespace));
part.Type = new XmlQualifiedName (mapping.ElementName, mapping.Namespace);
SoapSchemaExporter.ExportTypeMapping (mapping);
hb.Encoding = EncodingNamespace;
@@ -146,7 +158,10 @@ namespace System.Web.Services.Description {
part.Name = members[n].MemberName;
if (method.Use == SoapBindingUse.Literal) {
- part.Element = new XmlQualifiedName (members[n].MemberName, members[n].Namespace);
+ if (members[n].Any)
+ part.Type = new XmlQualifiedName ("any", members[n].Namespace);
+ else
+ part.Element = new XmlQualifiedName (members[n].MemberName, members[n].Namespace);
}
else {
string namesp = members[n].TypeNamespace;
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Discovery/ChangeLog b/mcs/class/System.Web.Services/System.Web.Services.Discovery/ChangeLog
index 33b002c0d54..10af1119e9e 100755
--- a/mcs/class/System.Web.Services/System.Web.Services.Discovery/ChangeLog
+++ b/mcs/class/System.Web.Services/System.Web.Services.Discovery/ChangeLog
@@ -1,3 +1,9 @@
+2004-01-24 Lluis Sanchez Gual <lluis@ximian.com>
+
+ * ContractReference.cs, DiscoveryClientProtocol.cs,
+ DiscoveryDocumentReference.cs: When resolving a wsdl document, recursively
+ resolve the documents it imports.
+
2003-12-19 Lluis Sanchez Gual <lluis@ximian.com>
* DiscoveryDocument.cs: Set namespace for ContractReference references.
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Discovery/ContractReference.cs b/mcs/class/System.Web.Services/System.Web.Services.Discovery/ContractReference.cs
index 22455a8a6eb..c4543c739c2 100755
--- a/mcs/class/System.Web.Services/System.Web.Services.Discovery/ContractReference.cs
+++ b/mcs/class/System.Web.Services/System.Web.Services.Discovery/ContractReference.cs
@@ -11,6 +11,8 @@
using System.IO;
using System.Web.Services.Description;
using System.Xml.Serialization;
+using System.Xml;
+using System.Xml.Schema;
namespace System.Web.Services.Discovery {
@@ -98,9 +100,53 @@ namespace System.Web.Services.Discovery {
protected internal override void Resolve (string contentType, Stream stream)
{
ServiceDescription wsdl = ServiceDescription.Read (stream);
- ClientProtocol.Documents.Add (Url, wsdl);
+
if (!ClientProtocol.References.Contains (Url))
ClientProtocol.References.Add (this);
+
+ ClientProtocol.Documents.Add (Url, wsdl);
+ ResolveInternal (ClientProtocol, wsdl);
+ }
+
+ internal void ResolveInternal (DiscoveryClientProtocol prot, ServiceDescription wsdl)
+ {
+ if (wsdl.Imports == null) return;
+
+ foreach (Import import in wsdl.Imports)
+ {
+ if (prot.Documents.Contains (import.Location)) // Already resolved
+ continue;
+
+ string url = import.Location;
+ string contentType = null;
+ Stream stream = prot.Download (ref url, ref contentType);
+ XmlTextReader reader = new XmlTextReader (stream);
+ reader.MoveToContent ();
+
+ DiscoveryReference refe;
+ if (ServiceDescription.CanRead (reader))
+ {
+ ServiceDescription refWsdl = ServiceDescription.Read (reader);
+ refe = new ContractReference ();
+ refe.ClientProtocol = prot;
+ refe.Url = url;
+ ((ContractReference)refe).ResolveInternal (prot, refWsdl);
+ prot.Documents.Add (url, refWsdl);
+ }
+ else
+ {
+ XmlSchema schema = XmlSchema.Read (reader, null);
+ refe = new SchemaReference ();
+ refe.ClientProtocol = prot;
+ refe.Url = url;
+ prot.Documents.Add (url, schema);
+ }
+
+ if (!prot.References.Contains (url))
+ prot.References.Add (refe);
+
+ reader.Close ();
+ }
}
public override void WriteDocument (object document, Stream stream)
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Discovery/DiscoveryClientProtocol.cs b/mcs/class/System.Web.Services/System.Web.Services.Discovery/DiscoveryClientProtocol.cs
index 15168bc5352..960cd5ec89c 100755
--- a/mcs/class/System.Web.Services/System.Web.Services.Discovery/DiscoveryClientProtocol.cs
+++ b/mcs/class/System.Web.Services/System.Web.Services.Discovery/DiscoveryClientProtocol.cs
@@ -105,6 +105,7 @@ namespace System.Web.Services.Discovery {
doc = new DiscoveryDocument ();
refe = new ContractReference ();
doc.References.Add (refe);
+ ((ContractReference)refe).ResolveInternal (this, wsdl);
}
else
{
@@ -185,9 +186,10 @@ namespace System.Web.Services.Discovery {
object doc = Documents [re.Url];
if (doc == null) continue;
- resfile.Results.Add (new DiscoveryClientResult (re.GetType(), re.Url, re.DefaultFilename));
+ string fileName = FindValidName (resfile, re.DefaultFilename);
+ resfile.Results.Add (new DiscoveryClientResult (re.GetType(), re.Url, fileName));
- string filepath = Path.Combine (directory, re.DefaultFilename);
+ string filepath = Path.Combine (directory, fileName);
FileStream fs = new FileStream (filepath, FileMode.Create, FileAccess.Write);
re.WriteDocument (doc, fs);
fs.Close ();
@@ -200,6 +202,28 @@ namespace System.Web.Services.Discovery {
return resfile.Results;
}
+ string FindValidName (DiscoveryClientResultsFile resfile, string baseName)
+ {
+ string name = baseName;
+ int id = 0;
+ bool found;
+ do
+ {
+ found = false;
+ foreach (DiscoveryClientResult res in resfile.Results)
+ {
+ if (name == res.Filename) {
+ found = true; break;
+ }
+ }
+ if (found)
+ name = Path.GetFileNameWithoutExtension (baseName) + (++id) + Path.GetExtension (baseName);
+ }
+ while (found);
+
+ return name;
+ }
+
#endregion // Methods
#region Classes
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Discovery/DiscoveryDocumentReference.cs b/mcs/class/System.Web.Services/System.Web.Services.Discovery/DiscoveryDocumentReference.cs
index e2dfd65b17e..8db4834cbc5 100755
--- a/mcs/class/System.Web.Services/System.Web.Services.Discovery/DiscoveryDocumentReference.cs
+++ b/mcs/class/System.Web.Services/System.Web.Services.Discovery/DiscoveryDocumentReference.cs
@@ -91,7 +91,10 @@ namespace System.Web.Services.Discovery {
ClientProtocol.References.Add (this);
foreach (DiscoveryReference re in doc.References)
+ {
+ re.ClientProtocol = ClientProtocol;
ClientProtocol.References.Add (re.Url, re);
+ }
}
public void ResolveAll ()
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Protocols/ChangeLog b/mcs/class/System.Web.Services/System.Web.Services.Protocols/ChangeLog
index d69f186ac91..87a9092899f 100644
--- a/mcs/class/System.Web.Services/System.Web.Services.Protocols/ChangeLog
+++ b/mcs/class/System.Web.Services/System.Web.Services.Protocols/ChangeLog
@@ -1,3 +1,53 @@
+2004-01-27 Lluis Sanchez Gual <lluis@ximian.com>
+
+ * SoapDocumentMethodAttribute.cs: Fixed bug in ResponseNamespace.
+
+2004-01-24 Lluis Sanchez Gual <lluis@ximian.com>
+
+ * HttpWebClientProtocol.cs: Added missing property.
+ * Methods.cs: Default binding for a method must be null.
+ * SoapHeaderDirection.cs: Added missing enum value.
+ * SoapMessage.cs: Added missing property.
+ * TypeStubManager.cs: Removed unneded check from AddBinding.
+ In GetBinding(), return default binding if name is null.
+ * ValueCollectionParameterReader.cs: IsPrimitive must be internal.
+
+2004-01-21 Lluis Sanchez Gual <lluis@ximian.com>
+
+ * HttpSoapWebServiceHandler.cs, SoapHttpClientProtocol.cs: Do not use
+ indented format for requests and responses. SOAPAction header value
+ must be quoted (fix by Yaacov Akiba Slama).
+
+2004-01-21 Lluis Sanchez Gual <lluis@ximian.com>
+
+ * Methods.cs: Set the correct namespaces for Fault. This fixes bug #53117.
+ Based on the fix by Eran Domb.
+
+2004-01-19 Lluis Sanchez Gual <lluis@ximian.com>
+
+ * Methods.cs: Get the method namespace from the binding, not from the web
+ service.
+ * TypeStubManager.cs: When adding a binding, ignore it if it has already
+ been added. Changed WebServiceLiteralNamespace by the method
+ GetWebServiceLiteralNamespace. The literal namespace depends on the binding
+ namespace, so it has to be provided as parameter.
+ * XmlReturnReader.cs, XmlReturnWriter.cs: Use GetWebServiceLiteralNamespace
+ instead of WebServiceLiteralNamespace.
+
+2004-01-14 Lluis Sanchez Gual <lluis@ximian.com>
+
+ * Methods.cs: Set the correct element name and namespace for headers (those
+ are not managed like other data classes).
+
+2004-01-10 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpSoapWebServiceHandler.cs:
+ * HttpSimpleWebServiceHandler.cs: set
+ base.Context property.
+
+ * WebServiceHandler.cs: added set_Context and set the context for the
+ WebService when creating the instance.
+
2003-12-23 Lluis Sanchez Gual <lluis@ximian.com>
* SoapDocumentationHandler.cs: Added support for DISCO file generation.
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Protocols/HttpSimpleClientProtocol.cs b/mcs/class/System.Web.Services/System.Web.Services.Protocols/HttpSimpleClientProtocol.cs
index 0afe6ad47eb..67ff43d3b80 100644
--- a/mcs/class/System.Web.Services/System.Web.Services.Protocols/HttpSimpleClientProtocol.cs
+++ b/mcs/class/System.Web.Services/System.Web.Services.Protocols/HttpSimpleClientProtocol.cs
@@ -3,6 +3,7 @@
//
// Author:
// Tim Coleman (tim@timcoleman.com)
+// Lluis Sanchez Gual (lluis@ximian.com)
//
// Copyright (C) Tim Coleman, 2002
//
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Protocols/HttpSimpleWebServiceHandler.cs b/mcs/class/System.Web.Services/System.Web.Services.Protocols/HttpSimpleWebServiceHandler.cs
index 02e4da826f2..8f5d3f1300f 100644
--- a/mcs/class/System.Web.Services/System.Web.Services.Protocols/HttpSimpleWebServiceHandler.cs
+++ b/mcs/class/System.Web.Services/System.Web.Services.Protocols/HttpSimpleWebServiceHandler.cs
@@ -30,6 +30,7 @@ namespace System.Web.Services.Protocols
public override void ProcessRequest (HttpContext context)
{
+ Context = context;
string name = context.Request.PathInfo;
if (name.StartsWith ("/")) name = name.Substring (1);
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Protocols/HttpSoapWebServiceHandler.cs b/mcs/class/System.Web.Services/System.Web.Services.Protocols/HttpSoapWebServiceHandler.cs
index 8f2a4b9bf6c..dc1ba17fa5d 100755
--- a/mcs/class/System.Web.Services/System.Web.Services.Protocols/HttpSoapWebServiceHandler.cs
+++ b/mcs/class/System.Web.Services/System.Web.Services.Protocols/HttpSoapWebServiceHandler.cs
@@ -38,6 +38,7 @@ namespace System.Web.Services.Protocols
public override void ProcessRequest (HttpContext context)
{
+ Context = context;
SoapServerMessage requestMessage = null;
SoapServerMessage responseMessage = null;
@@ -238,7 +239,6 @@ namespace System.Web.Services.Protocols
// What a waste of UTF8encoders, but it has to be thread safe.
XmlTextWriter xtw = new XmlTextWriter (outStream, new UTF8Encoding (false));
- xtw.Formatting = Formatting.Indented; // TODO: remove formatting when code is stable
if (message.Exception == null)
WebServiceHelper.WriteSoapMessage (xtw, _typeStubInfo, methodInfo.Use, methodInfo.ResponseSerializer, message.OutParameters, message.Headers);
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Protocols/HttpWebClientProtocol.cs b/mcs/class/System.Web.Services/System.Web.Services.Protocols/HttpWebClientProtocol.cs
index 7339742d38a..5579c3e8a56 100644
--- a/mcs/class/System.Web.Services/System.Web.Services.Protocols/HttpWebClientProtocol.cs
+++ b/mcs/class/System.Web.Services/System.Web.Services.Protocols/HttpWebClientProtocol.cs
@@ -25,7 +25,10 @@ namespace System.Web.Services.Protocols {
IWebProxy proxy;
string userAgent;
CookieCollection prevCookies;
-
+
+#if NET_1_1
+ bool _unsafeAuthenticated;
+#endif
#endregion
#region Constructors
@@ -80,6 +83,14 @@ namespace System.Web.Services.Protocols {
get { return userAgent; }
set { userAgent = value; }
}
+
+#if NET_1_1
+ public bool UnsafeAuthenticatedConnectionSharing
+ {
+ get { return _unsafeAuthenticated; }
+ set { _unsafeAuthenticated = value; }
+ }
+#endif
#endregion // Properties
@@ -139,6 +150,10 @@ namespace System.Web.Services.Protocols {
request.UserAgent = userAgent;
+#if NET_1_1
+ // request.UnsafeAuthenticatedConnectionSharing = _unsafeAuthenticated;
+#endif
+
return request;
}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Protocols/Methods.cs b/mcs/class/System.Web.Services/System.Web.Services.Protocols/Methods.cs
index 4d79d214cba..f212db57a02 100644
--- a/mcs/class/System.Web.Services/System.Web.Services.Protocols/Methods.cs
+++ b/mcs/class/System.Web.Services/System.Web.Services.Protocols/Methods.cs
@@ -125,13 +125,15 @@ namespace System.Web.Services.Protocols {
throw new Exception ("OneWay methods should not have out/ref parameters");
}
- if (RequestNamespace == "") RequestNamespace = parent.LogicalType.GetWebServiceNamespace (Use);
- if (ResponseNamespace == "") ResponseNamespace = parent.LogicalType.GetWebServiceNamespace (Use);
+ BindingInfo binfo = parent.GetBinding (Binding);
+ if (binfo == null) throw new InvalidOperationException ("Type '" + parent.Type + "' is missing WebServiceBinding attribute that defines a binding named '" + Binding + "'");
+
+ string serviceNamespace = binfo.Namespace;
+
+ if (RequestNamespace == "") RequestNamespace = parent.LogicalType.GetWebServiceNamespace (serviceNamespace, Use);
+ if (ResponseNamespace == "") ResponseNamespace = parent.LogicalType.GetWebServiceNamespace (serviceNamespace, Use);
if (RequestName == "") RequestName = Name;
if (ResponseName == "") ResponseName = Name + "Response";
- if (Binding == null || Binding == "") Binding = parent.DefaultBinding;
- else if (parent.GetBinding (Binding) == null) throw new InvalidOperationException ("Type '" + parent.Type + "' is missing WebServiceBinding attribute that defines a binding named '" + Binding + "'");
-
if (Action == null || Action == "")
Action = RequestNamespace.EndsWith("/") ? (RequestNamespace + Name) : (RequestNamespace + "/" + Name);
@@ -162,7 +164,7 @@ namespace System.Web.Services.Protocols {
Type headerType = (mems[0] is FieldInfo) ? ((FieldInfo)mems[0]).FieldType : ((PropertyInfo)mems[0]).PropertyType;
Headers [i] = new HeaderInfo (mems[0], att);
- parent.RegisterHeaderType (headerType, Use);
+ parent.RegisterHeaderType (headerType, serviceNamespace, Use);
}
SoapExtensions = SoapExtension.GetMethodExtensions (source);
@@ -276,8 +278,7 @@ namespace System.Web.Services.Protocols {
// FIXME: this class should be internal, but it needs to be public in
// order to be serialized using XmlSerializer.
- [SoapType (Namespace="http://schemas.xmlsoap.org/soap/envelope/")]
- [XmlType (Namespace="http://schemas.xmlsoap.org/soap/envelope/")]
+ [XmlRoot (Namespace="http://schemas.xmlsoap.org/soap/envelope/")]
public class Fault
{
public Fault () {}
@@ -290,8 +291,13 @@ namespace System.Web.Services.Protocols {
detail = ex.Detail;
}
+ [XmlElement (Namespace="")]
public XmlQualifiedName faultcode;
+
+ [XmlElement (Namespace="")]
public string faultstring;
+
+ [XmlElement (Namespace="")]
public string faultactor;
[SoapIgnore]
@@ -328,7 +334,7 @@ namespace System.Web.Services.Protocols {
o = Type.GetCustomAttributes (typeof (WebServiceBindingAttribute), false);
foreach (WebServiceBindingAttribute at in o)
- Bindings.Add (new BindingInfo (at, LogicalType.WebServiceNamespace));
+ AddBinding (new BindingInfo (at, LogicalType.WebServiceNamespace));
o = Type.GetCustomAttributes (typeof (SoapDocumentServiceAttribute), false);
if (o.Length == 1){
@@ -404,7 +410,7 @@ namespace System.Web.Services.Protocols {
return GetSerializer (faultSerializerId);
}
- internal void RegisterHeaderType (Type type, SoapBindingUse use)
+ internal void RegisterHeaderType (Type type, string serviceNamespace, SoapBindingUse use)
{
Hashtable serializers = header_serializers [(int)use];
if (serializers == null) {
@@ -419,11 +425,24 @@ namespace System.Web.Services.Protocols {
XmlTypeMapping tm;
if (use == SoapBindingUse.Literal) {
XmlReflectionImporter ri = new XmlReflectionImporter ();
- tm = ri.ImportTypeMapping (type, WebServiceAttribute.DefaultNamespace);
+
+ // MS.NET reflects header classes in a weird way. The root element
+ // name is the CLR class name unless it is specified in an XmlRootAttribute.
+ // The usual is to use the xml type name by default, but not in this case.
+
+ XmlRootAttribute root;
+ XmlAttributes ats = new XmlAttributes (type);
+ if (ats.XmlRoot != null) root = ats.XmlRoot;
+ else root = new XmlRootAttribute (type.Name);
+
+ if (root.Namespace == null) root.Namespace = LogicalType.GetWebServiceLiteralNamespace (serviceNamespace);
+ if (root.ElementName == null) root.ElementName = type.Name;
+
+ tm = ri.ImportTypeMapping (type, root);
}
else {
SoapReflectionImporter ri = new SoapReflectionImporter ();
- tm = ri.ImportTypeMapping (type, WebServiceAttribute.DefaultNamespace);
+ tm = ri.ImportTypeMapping (type, LogicalType.GetWebServiceEncodedNamespace (serviceNamespace));
}
int sid = RegisterSerializer (tm);
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapDocumentMethodAttribute.cs b/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapDocumentMethodAttribute.cs
index e95154d242f..c9b2476d042 100644
--- a/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapDocumentMethodAttribute.cs
+++ b/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapDocumentMethodAttribute.cs
@@ -97,7 +97,7 @@ namespace System.Web.Services.Protocols {
public string ResponseNamespace {
get {
- if (requestNamespace == null)
+ if (responseNamespace == null)
return "";
return responseNamespace;
}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapHeaderDirection.cs b/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapHeaderDirection.cs
index 14c60ee3119..6e599bec28c 100644
--- a/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapHeaderDirection.cs
+++ b/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapHeaderDirection.cs
@@ -13,6 +13,9 @@ namespace System.Web.Services.Protocols {
public enum SoapHeaderDirection {
In = 0x1,
InOut = 0x3,
- Out = 0x2
+ Out = 0x2,
+#if NET_1_1
+ Fault = 0x4
+#endif
}
}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapHttpClientProtocol.cs b/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapHttpClientProtocol.cs
index f0b21fb16b7..41611fb95de 100644
--- a/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapHttpClientProtocol.cs
+++ b/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapHttpClientProtocol.cs
@@ -167,7 +167,7 @@ namespace System.Web.Services.Protocols {
WebRequest request = GetWebRequest (uri);
request.Method = "POST";
WebHeaderCollection headers = request.Headers;
- headers.Add ("SOAPAction", message.Action);
+ headers.Add ("SOAPAction", "\"" + message.Action + "\"");
request.ContentType = message.ContentType + "; charset=utf-8";
return request;
}
@@ -184,7 +184,6 @@ namespace System.Web.Services.Protocols {
// What a waste of UTF8encoders, but it has to be thread safe.
XmlTextWriter xtw = new XmlTextWriter (s, new UTF8Encoding (false));
- xtw.Formatting = Formatting.Indented;
WebServiceHelper.WriteSoapMessage (xtw, type_info, message.MethodStubInfo.Use, message.MethodStubInfo.RequestSerializer, message.Parameters, message.Headers);
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapMessage.cs b/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapMessage.cs
index ac8f8195086..0c77adc1892 100644
--- a/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapMessage.cs
+++ b/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapMessage.cs
@@ -105,7 +105,16 @@ namespace System.Web.Services.Protocols {
public abstract string Url {
get;
}
-
+
+#if NET_1_1
+ [MonoTODO]
+ public string ContentEncoding
+ {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+#endif
+
#endregion Properties
#region Methods
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Protocols/TypeStubManager.cs b/mcs/class/System.Web.Services/System.Web.Services.Protocols/TypeStubManager.cs
index 269238cadfb..9f2c75c6dad 100644
--- a/mcs/class/System.Web.Services/System.Web.Services.Protocols/TypeStubManager.cs
+++ b/mcs/class/System.Web.Services/System.Web.Services.Protocols/TypeStubManager.cs
@@ -181,9 +181,16 @@ namespace System.Web.Services.Protocols {
get { return bindings; }
}
+ internal void AddBinding (BindingInfo info)
+ {
+ bindings.Add (info);
+ }
+
internal BindingInfo GetBinding (string name)
{
- for (int n=0; n<bindings.Count; n++)
+ if (name == null || name.Length == 0) return (BindingInfo) bindings[0];
+
+ for (int n=1; n<bindings.Count; n++)
if (((BindingInfo)bindings[n]).Name == name) return (BindingInfo)bindings[n];
return null;
}
@@ -221,11 +228,12 @@ namespace System.Web.Services.Protocols {
internal string WebServiceName;
internal string WebServiceNamespace;
- internal string WebServiceLiteralNamespace;
- internal string WebServiceEncodedNamespace;
+ string WebServiceLiteralNamespace;
+ string WebServiceEncodedNamespace;
internal string WebServiceAbstractNamespace;
internal string Description;
internal Type Type;
+ bool useEncoded;
TypeStubInfo soapProtocol;
TypeStubInfo httpGetProtocol;
@@ -248,19 +256,19 @@ namespace System.Web.Services.Protocols {
// Determine the namespaces for literal and encoded schema types
- bool encoded = false;
+ useEncoded = false;
o = t.GetCustomAttributes (typeof(SoapDocumentServiceAttribute), true);
if (o.Length > 0) {
SoapDocumentServiceAttribute at = (SoapDocumentServiceAttribute) o[0];
- encoded = (at.Use == SoapBindingUse.Encoded);
+ useEncoded = (at.Use == SoapBindingUse.Encoded);
}
else if (t.GetCustomAttributes (typeof(SoapRpcServiceAttribute), true).Length > 0)
- encoded = true;
+ useEncoded = true;
string sep = WebServiceNamespace.EndsWith ("/") ? "" : "/";
- if (encoded) {
+ if (useEncoded) {
WebServiceEncodedNamespace = WebServiceNamespace;
WebServiceLiteralNamespace = WebServiceNamespace + sep + "literalTypes";
}
@@ -307,10 +315,30 @@ namespace System.Web.Services.Protocols {
return tsi;
}
- public string GetWebServiceNamespace (SoapBindingUse use)
+ public string GetWebServiceLiteralNamespace (string baseNamespace)
+ {
+ if (useEncoded) {
+ string sep = baseNamespace.EndsWith ("/") ? "" : "/";
+ return baseNamespace + sep + "literalTypes";
+ }
+ else
+ return baseNamespace;
+ }
+
+ public string GetWebServiceEncodedNamespace (string baseNamespace)
+ {
+ if (useEncoded)
+ return baseNamespace;
+ else {
+ string sep = baseNamespace.EndsWith ("/") ? "" : "/";
+ return baseNamespace + sep + "encodedTypes";
+ }
+ }
+
+ public string GetWebServiceNamespace (string baseNamespace, SoapBindingUse use)
{
- if (use == SoapBindingUse.Literal) return WebServiceLiteralNamespace;
- else return WebServiceEncodedNamespace;
+ if (use == SoapBindingUse.Literal) return GetWebServiceLiteralNamespace (baseNamespace);
+ else return GetWebServiceEncodedNamespace (baseNamespace);
}
}
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Protocols/ValueCollectionParameterReader.cs b/mcs/class/System.Web.Services/System.Web.Services.Protocols/ValueCollectionParameterReader.cs
index 6ec8dc86ef6..cdacab78126 100644
--- a/mcs/class/System.Web.Services/System.Web.Services.Protocols/ValueCollectionParameterReader.cs
+++ b/mcs/class/System.Web.Services/System.Web.Services.Protocols/ValueCollectionParameterReader.cs
@@ -54,7 +54,7 @@ namespace System.Web.Services.Protocols {
else return IsSupportedPrimitive (type);
}
- public static bool IsSupportedPrimitive (Type type)
+ internal static bool IsSupportedPrimitive (Type type)
{
return ( type.IsPrimitive ||
type == typeof(string) ||
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Protocols/WebServiceHandler.cs b/mcs/class/System.Web.Services/System.Web.Services.Protocols/WebServiceHandler.cs
index b30565c6d3c..391ceb76e46 100644
--- a/mcs/class/System.Web.Services/System.Web.Services.Protocols/WebServiceHandler.cs
+++ b/mcs/class/System.Web.Services/System.Web.Services.Protocols/WebServiceHandler.cs
@@ -10,6 +10,7 @@
using System;
using System.Reflection;
+using System.Web;
using System.Web.Services;
namespace System.Web.Services.Protocols
@@ -17,6 +18,8 @@ namespace System.Web.Services.Protocols
internal class WebServiceHandler: IHttpHandler
{
Type _type;
+ HttpContext _context;
+
public WebServiceHandler (Type type)
{
@@ -32,6 +35,10 @@ namespace System.Web.Services.Protocols
{
get { return false; }
}
+
+ protected HttpContext Context {
+ set { _context = value; }
+ }
public virtual void ProcessRequest (HttpContext context)
{
@@ -39,7 +46,9 @@ namespace System.Web.Services.Protocols
protected object CreateServerInstance ()
{
- return Activator.CreateInstance (ServiceType);
+ WebService ws = (WebService) Activator.CreateInstance (ServiceType);
+ ws.SetContext (_context);
+ return ws;
}
[MonoTODO]
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Protocols/XmlReturnReader.cs b/mcs/class/System.Web.Services/System.Web.Services.Protocols/XmlReturnReader.cs
index 3e65d4e6d33..71cd0f2cb6e 100644
--- a/mcs/class/System.Web.Services/System.Web.Services.Protocols/XmlReturnReader.cs
+++ b/mcs/class/System.Web.Services/System.Web.Services.Protocols/XmlReturnReader.cs
@@ -30,7 +30,7 @@ namespace System.Web.Services.Protocols {
public override object GetInitializer (LogicalMethodInfo methodInfo)
{
LogicalTypeInfo sti = TypeStubManager.GetLogicalTypeInfo (methodInfo.DeclaringType);
- return new XmlSerializer (methodInfo.ReturnType, sti.WebServiceLiteralNamespace);
+ return new XmlSerializer (methodInfo.ReturnType, sti.GetWebServiceLiteralNamespace (sti.WebServiceNamespace));
}
public override object[] GetInitializers (LogicalMethodInfo[] methodInfos)
@@ -45,7 +45,7 @@ namespace System.Web.Services.Protocols {
else
{
LogicalTypeInfo sti = TypeStubManager.GetLogicalTypeInfo (metinfo.DeclaringType);
- sers[n] = importer.ImportTypeMapping (methodInfos[n].ReturnType, sti.WebServiceLiteralNamespace);
+ sers[n] = importer.ImportTypeMapping (methodInfos[n].ReturnType, sti.GetWebServiceLiteralNamespace (sti.WebServiceNamespace));
}
}
return XmlSerializer.FromMappings (sers);
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Protocols/XmlReturnWriter.cs b/mcs/class/System.Web.Services/System.Web.Services.Protocols/XmlReturnWriter.cs
index d60f4d5b315..c55abc1106b 100644
--- a/mcs/class/System.Web.Services/System.Web.Services.Protocols/XmlReturnWriter.cs
+++ b/mcs/class/System.Web.Services/System.Web.Services.Protocols/XmlReturnWriter.cs
@@ -21,7 +21,7 @@ namespace System.Web.Services.Protocols {
public override object GetInitializer (LogicalMethodInfo methodInfo)
{
LogicalTypeInfo sti = TypeStubManager.GetLogicalTypeInfo (methodInfo.DeclaringType);
- return new XmlSerializer (methodInfo.ReturnType, sti.WebServiceLiteralNamespace);
+ return new XmlSerializer (methodInfo.ReturnType, sti.GetWebServiceLiteralNamespace (sti.WebServiceNamespace));
}
public override object[] GetInitializers (LogicalMethodInfo[] methodInfos)
@@ -36,7 +36,7 @@ namespace System.Web.Services.Protocols {
else
{
LogicalTypeInfo sti = TypeStubManager.GetLogicalTypeInfo (metinfo.DeclaringType);
- sers[n] = importer.ImportTypeMapping (methodInfos[n].ReturnType, sti.WebServiceLiteralNamespace);
+ sers[n] = importer.ImportTypeMapping (methodInfos[n].ReturnType, sti.GetWebServiceLiteralNamespace (sti.WebServiceNamespace));
}
}
return XmlSerializer.FromMappings (sers);
diff --git a/mcs/class/System.Web.Services/System.Web.Services/ChangeLog b/mcs/class/System.Web.Services/System.Web.Services/ChangeLog
index aaa0f7555f5..2cb603045fa 100644
--- a/mcs/class/System.Web.Services/System.Web.Services/ChangeLog
+++ b/mcs/class/System.Web.Services/System.Web.Services/ChangeLog
@@ -1,3 +1,7 @@
+2004-01-10 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * WebService.cs: added SetContext ().
+
2003-02-25 Dave Bettin <dave@opendotnet.com>
* WebService.cs:
Changed private application to HttpContext
diff --git a/mcs/class/System.Web.Services/System.Web.Services/WebService.cs b/mcs/class/System.Web.Services/System.Web.Services/WebService.cs
index 74ed9fcb321..eda400ac860 100644
--- a/mcs/class/System.Web.Services/System.Web.Services/WebService.cs
+++ b/mcs/class/System.Web.Services/System.Web.Services/WebService.cs
@@ -31,6 +31,11 @@ namespace System.Web.Services {
#region Properties
+ internal void SetContext (HttpContext context)
+ {
+ _context = context;
+ }
+
[Browsable (false)]
[Description ("The ASP.NET application object for the current request.")]
[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
diff --git a/mcs/class/System.Web.Services/Test/standalone/ChangeLog b/mcs/class/System.Web.Services/Test/standalone/ChangeLog
index 9a184d149f4..93b832ce811 100644
--- a/mcs/class/System.Web.Services/Test/standalone/ChangeLog
+++ b/mcs/class/System.Web.Services/Test/standalone/ChangeLog
@@ -1,3 +1,20 @@
+2004-01-27 Lluis Sanchez Gual <lluis@ximian.com>
+
+ * wstest.cs: Improved the way wsdl documents are downloaded.
+ * services.xml: updated service list.
+ * wsdl.ignore: updated ignore list.
+ * client/external/GlobalWeatherTest.cs: new test.
+ * client/external/syndicateTest.cs: new test.
+ * client/external/TemperatureServiceTest.cs: new test.
+ * client/external/BankCodeEJBHomeTest.cs: added comment.
+ * server/TestBinding1.asmx, server/TestBinding2.asmx,
+ * server/TestBinding3.asmx, server/TestBinding4.asmx: new test services
+
+2004-01-14 Lluis Sanchez Gual <lluis@ximian.com>
+
+ * wstest.cs: Wsdl documents are cached locally.
+ * services.xml: updated services.
+
2003-12-23 Lluis Sanchez Gual <lluis@ximian.com>
* wstest.cs: Removed debug WriteLine.
diff --git a/mcs/class/System.Web.Services/Test/standalone/Makefile b/mcs/class/System.Web.Services/Test/standalone/Makefile
index a718e8d15ba..fcd6d1a6e76 100644
--- a/mcs/class/System.Web.Services/Test/standalone/Makefile
+++ b/mcs/class/System.Web.Services/Test/standalone/Makefile
@@ -15,6 +15,8 @@ wstest.exe: wstest.cs
clean:
rm -f *.dll *.exe *~ *.pdb
+ rm -rf proxies
+ rm -rf wsdlcache
rm error/*
proxies.dll:
diff --git a/mcs/class/System.Web.Services/Test/standalone/client/external/BankCodeEJBHomeTest.cs b/mcs/class/System.Web.Services/Test/standalone/client/external/BankCodeEJBHomeTest.cs
index cdead16225f..f95526ecb82 100644
--- a/mcs/class/System.Web.Services/Test/standalone/client/external/BankCodeEJBHomeTest.cs
+++ b/mcs/class/System.Web.Services/Test/standalone/client/external/BankCodeEJBHomeTest.cs
@@ -13,6 +13,8 @@ namespace BankCodeEJBHomeTests
[Test]
public void TestService ()
{
+ // BEA Weblogic / RPC
+
BankCode bc = new BankCode ();
AssertEquals ("#1", "10020000 ", bc.getCodeByName ("Berlin"));
diff --git a/mcs/class/System.Web.Services/Test/standalone/client/external/GlobalWeatherTest.cs b/mcs/class/System.Web.Services/Test/standalone/client/external/GlobalWeatherTest.cs
new file mode 100644
index 00000000000..8ffd0a712e2
--- /dev/null
+++ b/mcs/class/System.Web.Services/Test/standalone/client/external/GlobalWeatherTest.cs
@@ -0,0 +1,52 @@
+// Web service test for WSDL document:
+// http://live.capescience.com/wsdl/GlobalWeather.wsdl
+
+using System;
+using NUnit.Framework;
+using GlobalWeatherTests.Soap;
+
+namespace GlobalWeatherTests
+{
+ [TestFixture]
+ public class GlobalWeatherTest: WebServiceTest
+ {
+ // CapeConnect / RPC
+
+ [Test]
+ public void TestStationInfo ()
+ {
+ StationInfo si = new StationInfo ();
+ string[] countries = si.listCountries ();
+ AssertNotNull (countries);
+ AssertEquals (215, countries.Length);
+ AssertEquals ("afghanistan", countries[0]);
+ AssertEquals ("spain", countries[177]);
+ AssertEquals ("zimbabwe", countries[214]);
+
+ Station[] stations = si.searchByCountry ("spain");
+ AssertNotNull (stations);
+ foreach (Station sta in stations)
+ {
+ AssertNotNull (sta);
+ if (sta.icao == "LEBL")
+ AssertEquals ("Barcelona / Aeropuerto", sta.name);
+ }
+
+ Station[] st = si.searchByCode ("LEBL");
+ AssertNotNull (st);
+ AssertEquals (1, st.Length);
+ AssertEquals ("Barcelona / Aeropuerto", st[0].name);
+ }
+
+ [Test]
+ public void TestGlobalWeather ()
+ {
+ GlobalWeather gw = new GlobalWeather ();
+ WeatherReport wr = gw.getWeatherReport ("LEBL");
+
+ AssertNotNull (wr.station);
+ AssertEquals ("LEBL", wr.station.icao);
+ AssertEquals ("Barcelona / Aeropuerto", wr.station.name);
+ }
+ }
+}
diff --git a/mcs/class/System.Web.Services/Test/standalone/client/external/TemperatureServiceTest.cs b/mcs/class/System.Web.Services/Test/standalone/client/external/TemperatureServiceTest.cs
new file mode 100644
index 00000000000..2d05c3df0fb
--- /dev/null
+++ b/mcs/class/System.Web.Services/Test/standalone/client/external/TemperatureServiceTest.cs
@@ -0,0 +1,26 @@
+// Web service test for WSDL document:
+// http://www.xmethods.net/sd/2001/TemperatureService.wsdl
+
+using System;
+using NUnit.Framework;
+using TemperatureServiceTests.Soap;
+
+namespace TemperatureServiceTests
+{
+ [TestFixture]
+ public class TemperatureServiceTest: WebServiceTest
+ {
+ [Test]
+ public void TestService ()
+ {
+ // Apache SOAP / RPC
+
+ TemperatureService ts = new TemperatureService ();
+ float temp = ts.getTemp ("95110");
+ Assert (temp < 140 && temp > -60);
+
+ temp = ts.getTemp ("hola");
+ Assert (temp == -999);
+ }
+ }
+}
diff --git a/mcs/class/System.Web.Services/Test/standalone/client/external/syndicateTest.cs b/mcs/class/System.Web.Services/Test/standalone/client/external/syndicateTest.cs
new file mode 100644
index 00000000000..34525e9f539
--- /dev/null
+++ b/mcs/class/System.Web.Services/Test/standalone/client/external/syndicateTest.cs
@@ -0,0 +1,45 @@
+// Web service test for WSDL document:
+// http://www.forta.com/cf/tips/syndicate.cfc?wsdl
+
+using System;
+using NUnit.Framework;
+using syndicateTests.Soap;
+
+namespace syndicateTests
+{
+ [TestFixture]
+ public class syndicateTest: WebServiceTest
+ {
+ [Test]
+ public void TestService ()
+ {
+ syndicateService ss = new syndicateService ();
+ Map map = ss.Get (new DateTime(2004,1,1));
+ AssertNotNull ("map", map);
+ AssertNotNull ("map.item", map.item);
+ AssertEquals ("map.item.Length", 11, map.item.Length);
+ AssertEquals ("PREV", map.item[0].key);
+ AssertEquals ("true", map.item[0].value);
+ AssertEquals ("TITLE", map.item[2].key);
+ AssertEquals ("Ben Forta's ColdFusion Tip-of-the-Day", map.item[2].value);
+ AssertEquals ("HEADER", map.item[8].key);
+ AssertEquals ("Faster Dreamweaver Loading", map.item[8].value);
+
+ QueryBean qb = ss.Search ("dreamweaver");
+ AssertNotNull ("qb", qb);
+ AssertNotNull ("qb", qb.columnList);
+ AssertEquals ("qb.columnList.Length", 3, qb.columnList.Length);
+ AssertEquals ("qb.columnList[0]", "TITLE", qb.columnList[0]);
+ AssertEquals ("qb.columnList[1]", "AGE", qb.columnList[1]);
+ AssertEquals ("qb.columnList[2]", "DATE", qb.columnList[2]);
+
+ AssertNotNull ("qb.data", qb.data);
+ AssertNotNull ("qb.data[0]", qb.data[0]);
+ AssertEquals ("qb.data.Length", 38, qb.data.Length);
+ AssertEquals ("qb.data[12].Length", 3, qb.data[12].Length);
+ AssertEquals ("qb.data[12][0]", "Diagnosing FTP Problems", qb.data[12][0]);
+ AssertEquals ("qb.data[12][1]", 528, qb.data[12][1]);
+ AssertEquals ("qb.data[12][2]", new DateTime(2002, 8, 16), qb.data[12][2]);
+ }
+ }
+}
diff --git a/mcs/class/System.Web.Services/Test/standalone/client/localhost/ConvDocEncBarTest.cs b/mcs/class/System.Web.Services/Test/standalone/client/localhost/ConvDocEncBarTest.cs
index 565b529b32c..ecfeb7cbd9c 100644
--- a/mcs/class/System.Web.Services/Test/standalone/client/localhost/ConvDocEncBarTest.cs
+++ b/mcs/class/System.Web.Services/Test/standalone/client/localhost/ConvDocEncBarTest.cs
@@ -13,7 +13,7 @@ namespace ConvDocEncBarTests
[Test]
public void TestService ()
{
- ConverterServiceSoap cs = new ConverterServiceSoap ();
+ ConverterService cs = new ConverterService ();
cs.Login ("lluis");
cs.SetCurrencyRate ("EUR", 0.5);
AssertEquals ("#1", 0.5, cs.GetCurrencyRate ("EUR"));
diff --git a/mcs/class/System.Web.Services/Test/standalone/client/localhost/ConvDocEncWraTest.cs b/mcs/class/System.Web.Services/Test/standalone/client/localhost/ConvDocEncWraTest.cs
index 21f273379c5..e8250a48728 100644
--- a/mcs/class/System.Web.Services/Test/standalone/client/localhost/ConvDocEncWraTest.cs
+++ b/mcs/class/System.Web.Services/Test/standalone/client/localhost/ConvDocEncWraTest.cs
@@ -13,7 +13,7 @@ namespace ConvDocEncWraTests
[Test]
public void TestService ()
{
- ConverterServiceSoap cs = new ConverterServiceSoap ();
+ ConverterService cs = new ConverterService ();
cs.Login ("lluis");
cs.SetCurrencyRate ("EUR", 0.5);
AssertEquals ("#1", 0.5, cs.GetCurrencyRate ("EUR"));
diff --git a/mcs/class/System.Web.Services/Test/standalone/client/localhost/ConvDocLitBarTest.cs b/mcs/class/System.Web.Services/Test/standalone/client/localhost/ConvDocLitBarTest.cs
index 2949e344532..6f5fe2a3e2e 100644
--- a/mcs/class/System.Web.Services/Test/standalone/client/localhost/ConvDocLitBarTest.cs
+++ b/mcs/class/System.Web.Services/Test/standalone/client/localhost/ConvDocLitBarTest.cs
@@ -13,7 +13,7 @@ namespace ConvDocLitBarTests
[Test]
public void TestService ()
{
- ConverterServiceSoap cs = new ConverterServiceSoap ();
+ ConverterService cs = new ConverterService ();
cs.Login ("lluis");
cs.SetCurrencyRate ("EUR", 0.5);
AssertEquals ("#1", 0.5, cs.GetCurrencyRate ("EUR"));
diff --git a/mcs/class/System.Web.Services/Test/standalone/client/localhost/ConvDocLitWraTest.cs b/mcs/class/System.Web.Services/Test/standalone/client/localhost/ConvDocLitWraTest.cs
index c7d795d26d5..13b9f7345c4 100644
--- a/mcs/class/System.Web.Services/Test/standalone/client/localhost/ConvDocLitWraTest.cs
+++ b/mcs/class/System.Web.Services/Test/standalone/client/localhost/ConvDocLitWraTest.cs
@@ -2,8 +2,10 @@
// http://localhost:8080/ConvDocLitWra.asmx?wsdl
using System;
+using System.Threading;
using NUnit.Framework;
using ConvDocLitWraTests.Soap;
+using System.Web.Services.Protocols;
namespace ConvDocLitWraTests
{
@@ -13,7 +15,7 @@ namespace ConvDocLitWraTests
[Test]
public void TestService ()
{
- ConverterServiceSoap cs = new ConverterServiceSoap ();
+ ConverterService cs = new ConverterService ();
cs.Login ("lluis");
cs.SetCurrencyRate ("EUR", 0.5);
AssertEquals ("#1", 0.5, cs.GetCurrencyRate ("EUR"));
@@ -41,6 +43,120 @@ namespace ConvDocLitWraTests
}
AssertEquals ("#3 " + info.Name, val, info.Rate);
}
+ cs.SetCurrencyRate ("EUR", 0.9);
+ }
+
+ // Async tests
+
+ ConverterService acs;
+ bool a1;
+ bool a2;
+ bool a3;
+ AutoResetEvent eve = new AutoResetEvent (false);
+
+ [Test]
+ public void AsyncTestService ()
+ {
+ IAsyncResult ar;
+ acs = new ConverterService ();
+
+ ar = acs.BeginLogin ("lluis", null, null);
+ acs.EndLogin (ar);
+
+ acs.BeginSetCurrencyRate ("EUR", 0.5, new AsyncCallback(Callback1), null);
+
+ Assert ("#0", eve.WaitOne (5000, false));
+ Assert ("#1",a1);
+
+ Assert ("#2", eve.WaitOne (5000, false));
+ Assert ("#3",a2);
+
+ Assert ("#4", eve.WaitOne (5000, false));
+ Assert ("#5",a3);
+ }
+
+ void Callback1 (IAsyncResult ar)
+ {
+ acs.EndSetCurrencyRate (ar);
+ acs.BeginGetCurrencyRate ("EUR", new AsyncCallback(Callback2), null);
+ }
+
+ void Callback2 (IAsyncResult ar)
+ {
+ double res = acs.EndGetCurrencyRate (ar);
+ a1 = (res == 0.5);
+ eve.Set ();
+
+ acs.BeginConvert ("EUR","USD",6, new AsyncCallback(Callback3), null);
+ }
+
+ void Callback3 (IAsyncResult ar)
+ {
+ double res = acs.EndConvert (ar);
+ a2 = (res == 12);
+ eve.Set ();
+
+ acs.BeginGetCurrencyInfo (new AsyncCallback(Callback4),null);
+ }
+
+ void Callback4 (IAsyncResult ar)
+ {
+ CurrencyInfo[] infos = acs.EndGetCurrencyInfo (ar);
+
+ foreach (CurrencyInfo info in infos)
+ {
+ double val = 0;
+ switch (info.Name)
+ {
+ case "USD": val = 1; break;
+ case "EUR": val = 0.5; break;
+ case "GBP": val = 0.611817; break;
+ case "JPY": val = 118.271; break;
+ case "CAD": val = 1.36338; break;
+ case "AUD": val = 1.51485; break;
+ case "CHF": val = 1.36915; break;
+ case "RUR": val = 30.4300; break;
+ case "CNY": val = 8.27740; break;
+ case "ZAR": val = 7.62645; break;
+ case "MXN": val = 10.5025; break;
+ }
+ a3 = (val == info.Rate);
+ if (!a3) break;
+ }
+ eve.Set ();
+ }
+
+ [Test]
+ public void TestException ()
+ {
+ ConverterService cs = new ConverterService ();
+ try
+ {
+ cs.SetCurrencyRate ("EUR", 0.5);
+ Assert ("#0",false);
+ }
+ catch (SoapException ex)
+ {
+ Assert ("#1", ex.Message.IndexOf ("User not logged") != -1);
+ AssertEquals ("#2", SoapException.ServerFaultCode, ex.Code);
+ }
+ }
+
+ [Test]
+ public void AsyncTestException ()
+ {
+ ConverterService cs = new ConverterService ();
+ IAsyncResult ar = cs.BeginSetCurrencyRate ("EUR", 0.5, null, null);
+ try
+ {
+ cs.EndSetCurrencyRate (ar);
+ Assert ("#0",false);
+ }
+ catch (SoapException ex)
+ {
+ Assert ("#1", ex.Message.IndexOf ("User not logged") != -1);
+ AssertEquals ("#2", SoapException.ServerFaultCode, ex.Code);
+ }
}
}
}
diff --git a/mcs/class/System.Web.Services/Test/standalone/client/localhost/ConvRpcTest.cs b/mcs/class/System.Web.Services/Test/standalone/client/localhost/ConvRpcTest.cs
index 51335c14bb9..14c5afed190 100644
--- a/mcs/class/System.Web.Services/Test/standalone/client/localhost/ConvRpcTest.cs
+++ b/mcs/class/System.Web.Services/Test/standalone/client/localhost/ConvRpcTest.cs
@@ -13,7 +13,7 @@ namespace ConvRpcTests
[Test]
public void TestService ()
{
- ConverterServiceSoap cs = new ConverterServiceSoap ();
+ ConverterService cs = new ConverterService ();
cs.Login ("lluis");
cs.SetCurrencyRate ("EUR", 0.5);
AssertEquals ("#1", 0.5, cs.GetCurrencyRate ("EUR"));
diff --git a/mcs/class/System.Web.Services/Test/standalone/client/localhost/TestBinding4Test.cs b/mcs/class/System.Web.Services/Test/standalone/client/localhost/TestBinding4Test.cs
new file mode 100644
index 00000000000..0af33678aac
--- /dev/null
+++ b/mcs/class/System.Web.Services/Test/standalone/client/localhost/TestBinding4Test.cs
@@ -0,0 +1,49 @@
+// Web service test for WSDL document:
+// http://localhost:8080/TestBinding4.asmx?wsdl
+
+using System;
+using NUnit.Framework;
+using TestBinding4Tests.Soap;
+using TestBinding4Tests.HttpGet;
+using TestBinding4Tests.HttpPost;
+using System.Xml;
+
+namespace TestBinding4Tests
+{
+ [TestFixture]
+ public class TestBinding4Test: WebServiceTest
+ {
+ [Test]
+ public void TestService ()
+ {
+ TestBinding4Tests.Soap.GetData data = new TestBinding4Tests.Soap.GetData ();
+
+ XmlDocument doc = new XmlDocument ();
+ XmlElement elem1 = doc.CreateElement ("one");
+ elem1.SetAttribute ("someAtt","someValue");
+ XmlElement elem2 = doc.CreateElement ("two");
+ elem2.SetAttribute ("someAtt","someValue");
+ XmlNode[] nodes = new XmlNode[] {elem1,elem2};
+
+ nodes = data.GetTabList (nodes);
+ Check ("GetTabList", nodes);
+
+ nodes = data.GetTabStruct ("hello", nodes);
+ Check ("GetTabStruct", nodes);
+
+ Assert ("RebuildTabList 1", data.RebuildTabList (true));
+ Assert ("RebuildTabList 2", !data.RebuildTabList (false));
+
+ Assert ("RebuildTabStruct 1", data.RebuildTabStruct ("a", true));
+ Assert ("RebuildTabStruct 2", !data.RebuildTabStruct ("b", false));
+ }
+
+ void Check (string met, XmlNode[] nodes)
+ {
+ AssertNotNull (met + " #1", nodes);
+ AssertEquals (met + " #2", 2, nodes.Length);
+ AssertEquals (met + " #3", "<one someAtt=\"someValue\" xmlns=\"\" />", nodes[0].OuterXml);
+ AssertEquals (met + " #4", "<two someAtt=\"someValue\" xmlns=\"\" />", nodes[1].OuterXml);
+ }
+ }
+}
diff --git a/mcs/class/System.Web.Services/Test/standalone/server/ConvDocEncBar.asmx b/mcs/class/System.Web.Services/Test/standalone/server/ConvDocEncBar.asmx
index 4c70cdd846a..77c54866faa 100644
--- a/mcs/class/System.Web.Services/Test/standalone/server/ConvDocEncBar.asmx
+++ b/mcs/class/System.Web.Services/Test/standalone/server/ConvDocEncBar.asmx
@@ -35,7 +35,7 @@ namespace WebServiceTests
public int Dada;
}
- [WebServiceAttribute (Description="Web service that can make currency conversions")]
+ [WebServiceAttribute (Namespace="urn:mono-ws-tests", Description="Web service that can make currency conversions")]
[SoapDocumentServiceAttribute (Use=SoapBindingUse.Encoded, ParameterStyle=SoapParameterStyle.Bare)]
public class ConverterService : System.Web.Services.WebService
{
diff --git a/mcs/class/System.Web.Services/Test/standalone/server/ConvDocEncWra.asmx b/mcs/class/System.Web.Services/Test/standalone/server/ConvDocEncWra.asmx
index a0b24d6f04c..911a1b7a889 100644
--- a/mcs/class/System.Web.Services/Test/standalone/server/ConvDocEncWra.asmx
+++ b/mcs/class/System.Web.Services/Test/standalone/server/ConvDocEncWra.asmx
@@ -35,7 +35,7 @@ namespace WebServiceTests
public int Dada;
}
- [WebServiceAttribute (Description="Web service that can make currency conversions")]
+ [WebServiceAttribute (Namespace="urn:mono-ws-tests", Description="Web service that can make currency conversions")]
[SoapDocumentServiceAttribute (Use=SoapBindingUse.Encoded, ParameterStyle=SoapParameterStyle.Wrapped)]
public class ConverterService : System.Web.Services.WebService
{
diff --git a/mcs/class/System.Web.Services/Test/standalone/server/ConvDocLitBar.asmx b/mcs/class/System.Web.Services/Test/standalone/server/ConvDocLitBar.asmx
index ef6728dfb33..2b0ccbefe3c 100644
--- a/mcs/class/System.Web.Services/Test/standalone/server/ConvDocLitBar.asmx
+++ b/mcs/class/System.Web.Services/Test/standalone/server/ConvDocLitBar.asmx
@@ -35,7 +35,7 @@ namespace WebServiceTests
public int Dada;
}
- [WebServiceAttribute (Description="Web service that can make currency conversions")]
+ [WebServiceAttribute (Namespace="urn:mono-ws-tests", Description="Web service that can make currency conversions")]
[SoapDocumentServiceAttribute (Use=SoapBindingUse.Literal, ParameterStyle=SoapParameterStyle.Bare)]
public class ConverterService : System.Web.Services.WebService
{
diff --git a/mcs/class/System.Web.Services/Test/standalone/server/ConvDocLitWra.asmx b/mcs/class/System.Web.Services/Test/standalone/server/ConvDocLitWra.asmx
index 5908aa6763f..57512a196d1 100644
--- a/mcs/class/System.Web.Services/Test/standalone/server/ConvDocLitWra.asmx
+++ b/mcs/class/System.Web.Services/Test/standalone/server/ConvDocLitWra.asmx
@@ -35,7 +35,7 @@ namespace WebServiceTests
public int Dada;
}
- [WebServiceAttribute (Description="Web service that can make currency conversions")]
+ [WebServiceAttribute (Namespace="urn:mono-ws-tests", Description="Web service that can make currency conversions")]
[SoapDocumentServiceAttribute (Use=SoapBindingUse.Literal, ParameterStyle=SoapParameterStyle.Wrapped)]
public class ConverterService : System.Web.Services.WebService
{
diff --git a/mcs/class/System.Web.Services/Test/standalone/server/ConvRpc.asmx b/mcs/class/System.Web.Services/Test/standalone/server/ConvRpc.asmx
index f89da0ddfac..e5751b41ebd 100644
--- a/mcs/class/System.Web.Services/Test/standalone/server/ConvRpc.asmx
+++ b/mcs/class/System.Web.Services/Test/standalone/server/ConvRpc.asmx
@@ -35,7 +35,7 @@ namespace WebServiceTests
public int Dada;
}
- [WebServiceAttribute (Description="Web service that can make currency conversions")]
+ [WebServiceAttribute (Namespace="urn:mono-ws-tests", Description="Web service that can make currency conversions")]
[SoapRpcServiceAttribute ()]
public class ConverterService : System.Web.Services.WebService
{
diff --git a/mcs/class/System.Web.Services/Test/standalone/server/TestBinding1.asmx b/mcs/class/System.Web.Services/Test/standalone/server/TestBinding1.asmx
new file mode 100644
index 00000000000..4345ff2038d
--- /dev/null
+++ b/mcs/class/System.Web.Services/Test/standalone/server/TestBinding1.asmx
@@ -0,0 +1,29 @@
+<%@ WebService Language="c#" Codebehind="GetData.wsdl.cs" Class="GetData.wsdl.GetData" %>
+
+using System.Xml.Serialization;
+using System;
+using System.Web.Services.Protocols;
+using System.ComponentModel;
+using System.Web.Services;
+
+namespace GetData.wsdl{
+
+ [System.Web.Services.WebServiceBindingAttribute(Name="GetDataSoap", Namespace="http://tempuri.org/")]
+ public class GetData : System.Web.Services.WebService {
+
+
+ [System.Web.Services.WebMethodAttribute()]
+ public bool RebuildTabList(bool X_WS_ReturnValue_X)
+ {
+ return false;
+ }
+
+ [System.Web.Services.WebMethodAttribute()]
+ [SoapDocumentMethod (Binding="GetDataSoap")]
+ public bool OtherMethod(bool X_WS_ReturnValue_X)
+ {
+ return false;
+ }
+
+ }
+}
diff --git a/mcs/class/System.Web.Services/Test/standalone/server/TestBinding2.asmx b/mcs/class/System.Web.Services/Test/standalone/server/TestBinding2.asmx
new file mode 100644
index 00000000000..5aab05dc4e3
--- /dev/null
+++ b/mcs/class/System.Web.Services/Test/standalone/server/TestBinding2.asmx
@@ -0,0 +1,29 @@
+<%@ WebService Language="c#" Codebehind="GetData.wsdl.cs" Class="GetData.wsdl.GetData" %>
+
+using System.Xml.Serialization;
+using System;
+using System.Web.Services.Protocols;
+using System.ComponentModel;
+using System.Web.Services;
+
+namespace GetData.wsdl{
+
+ [System.Web.Services.WebServiceBindingAttribute(Name="GetDataSoap2", Namespace="http://anotheruri/")]
+ public class GetData : System.Web.Services.WebService {
+
+
+ [System.Web.Services.WebMethodAttribute()]
+ public bool RebuildTabList(bool X_WS_ReturnValue_X)
+ {
+ return false;
+ }
+
+ [System.Web.Services.WebMethodAttribute()]
+ [SoapDocumentMethod (Binding="GetDataSoap2")]
+ public bool OtherMethod(bool X_WS_ReturnValue_X)
+ {
+ return false;
+ }
+
+ }
+}
diff --git a/mcs/class/System.Web.Services/Test/standalone/server/TestBinding3.asmx b/mcs/class/System.Web.Services/Test/standalone/server/TestBinding3.asmx
new file mode 100644
index 00000000000..1f18d8cf4dd
--- /dev/null
+++ b/mcs/class/System.Web.Services/Test/standalone/server/TestBinding3.asmx
@@ -0,0 +1,52 @@
+<%@ WebService Language="c#" Codebehind="main.wsdl.cs" Class="main.wsdl.Main" %>
+
+using System.Xml.Serialization;
+using System;
+using System.Web.Services.Protocols;
+using System.ComponentModel;
+using System.Web.Services;
+
+namespace main.wsdl{
+
+/// <remarks/>
+[System.Web.Services.WebServiceBindingAttribute(Name="MainSoap", Namespace="http://msdn.microsoft.com/vbasic/")]
+public class Main : System.Web.Services.WebService {
+
+
+ /// <remarks/>
+ [System.Web.Services.WebMethodAttribute()]
+ [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://msdn.microsoft.com/vbasic/About", RequestNamespace="http://msdn.microsoft.com/vbasic/", ResponseNamespace="http://msdn.microsoft.com/vbasic/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
+ public string About(string X_WS_ReturnValue_X)
+ {
+ return null;
+ }
+
+ /// <remarks/>
+ [System.Web.Services.WebMethodAttribute()]
+ [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://msdn.microsoft.com/vbasic/GetCustomerOrderHistory", RequestNamespace="http://msdn.microsoft.com/vbasic/", ResponseNamespace="http://msdn.microsoft.com/vbasic/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
+ public CustomerAndOrderHistoryInfo GetCustomerOrderHistory( string strCustID, CustomerAndOrderHistoryInfo X_WS_ReturnValue_X)
+ {
+ return null;
+ }
+
+ /// <remarks/>
+ [System.Web.Services.WebMethodAttribute()]
+ [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://msdn.microsoft.com/vbasic/GetTenMostExpensiveProducts", RequestNamespace="http://msdn.microsoft.com/vbasic/", ResponseNamespace="http://msdn.microsoft.com/vbasic/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
+ public System.Data.DataSet GetTenMostExpensiveProducts(System.Data.DataSet X_WS_ReturnValue_X)
+ {
+ return null;
+ }
+}
+
+/// <remarks/>
+[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://msdn.microsoft.com/vbasic/")]
+public class CustomerAndOrderHistoryInfo {
+
+ /// <remarks/>
+ public System.Xml.XmlElement Orders;
+
+ /// <remarks/>
+ [System.Xml.Serialization.XmlAttributeAttribute()]
+ public string Company;
+}
+} \ No newline at end of file
diff --git a/mcs/class/System.Web.Services/Test/standalone/server/TestBinding4.asmx b/mcs/class/System.Web.Services/Test/standalone/server/TestBinding4.asmx
new file mode 100644
index 00000000000..d2be3433f5a
--- /dev/null
+++ b/mcs/class/System.Web.Services/Test/standalone/server/TestBinding4.asmx
@@ -0,0 +1,53 @@
+<%@ WebService Language="c#" Codebehind="GetData.wsdl.cs" Class="GetData.wsdl.GetData" %>
+
+using System.Xml.Serialization;
+using System;
+using System.Xml;
+using System.Web.Services.Protocols;
+using System.ComponentModel;
+using System.Web.Services;
+
+namespace GetData.wsdl{
+
+/// <remarks/>
+[System.Web.Services.WebServiceBindingAttribute(Name="GetDataSoap", Namespace="http://IUnknown.Team/ePortal/GetData")]
+public class GetData : System.Web.Services.WebService {
+
+
+ /// <remarks/>
+ [System.Web.Services.WebMethodAttribute()]
+ [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://IUnknown.Team/ePortal/GetData/GetTabList", ResponseNamespace="http://IUnknown.Team/ePortal/GetData", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Bare)]
+ [return: System.Xml.Serialization.XmlTextAttribute()]
+ [return: System.Xml.Serialization.XmlAnyElementAttribute()]
+ public System.Xml.XmlNode[] GetTabList(System.Xml.XmlNode[] X_WS_ReturnValue_X)
+ {
+ return X_WS_ReturnValue_X;
+ }
+
+ /// <remarks/>
+ [System.Web.Services.WebMethodAttribute()]
+ [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://IUnknown.Team/ePortal/GetData/RebuildTabList", RequestNamespace="http://IUnknown.Team/ePortal/GetData", ResponseNamespace="http://IUnknown.Team/ePortal/GetData", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
+ public bool RebuildTabList(bool X_WS_ReturnValue_X)
+ {
+ return X_WS_ReturnValue_X;
+ }
+
+ /// <remarks/>
+ [System.Web.Services.WebMethodAttribute()]
+ [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://IUnknown.Team/ePortal/GetData/RebuildTabStruct", RequestNamespace="http://IUnknown.Team/ePortal/GetData", ResponseNamespace="http://IUnknown.Team/ePortal/GetData", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
+ public bool RebuildTabStruct(string tabname, bool X_WS_ReturnValue_X)
+ {
+ return X_WS_ReturnValue_X;
+ }
+
+ /// <remarks/>
+ [System.Web.Services.WebMethodAttribute()]
+ [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://IUnknown.Team/ePortal/GetData/GetTabStruct", ResponseNamespace="http://IUnknown.Team/ePortal/GetData", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Bare)]
+ [return: System.Xml.Serialization.XmlTextAttribute()]
+ [return: System.Xml.Serialization.XmlAnyElementAttribute()]
+ public System.Xml.XmlNode[] GetTabStruct([System.Xml.Serialization.XmlElementAttribute(Namespace="http://IUnknown.Team/ePortal/GetData")] string tabname, System.Xml.XmlNode[] X_WS_ReturnValue_X)
+ {
+ return X_WS_ReturnValue_X;
+ }
+ }
+}
diff --git a/mcs/class/System.Web.Services/Test/standalone/services.xml b/mcs/class/System.Web.Services/Test/standalone/services.xml
index b8a4835f427..626dd5abe29 100644
--- a/mcs/class/System.Web.Services/Test/standalone/services.xml
+++ b/mcs/class/System.Web.Services/Test/standalone/services.xml
@@ -3,6 +3,7 @@
<service>
<wsdl>http://upload.eraserver.net/circle24/autoloan.asmx?wsdl</wsdl>
<name>autoloanTest</name>
+ <serverType>Microsoft-IIS/5.0 # </serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -13,6 +14,7 @@
<service>
<wsdl>http://www.kannadakasturi.com/WebServices/kannadakasturiwebservice.asmx?WSDL</wsdl>
<name>kannadakasturiwebserviceTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -23,6 +25,7 @@
<service>
<wsdl>http://www.esynaps.com/WebServices/eSynapsSearch.asmx?WSDL</wsdl>
<name>eSynapsSearchTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -31,6 +34,7 @@
<service>
<wsdl>http://www.codemechanisms.co.uk/WebServices/UNSPSC.asmx?WSDL</wsdl>
<name>UNSPSCTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -39,6 +43,7 @@
<service>
<wsdl>http://www.xmlme.com/WSCustNews.asmx?WSDL</wsdl>
<name>WSCustNewsTest</name>
+ <serverType>Microsoft-IIS/6.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -47,6 +52,7 @@
<service>
<wsdl>http://arcweb.esri.com/services/v2/Proximity.wsdl</wsdl>
<name>ProximityTest</name>
+ <serverType>Netscape-Enterprise/6.0 # </serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -55,6 +61,7 @@
<service>
<wsdl>http://addison.ra.cwru.edu/orc/calendar_copy/server.php?wsdl</wsdl>
<name>serverTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET,PHP/4.3.1</serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -63,20 +70,16 @@
<service>
<wsdl>http://xml.redcoal.net/SMSSOAP/xmlserver.wsdl</wsdl>
<name>xmlserverTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
<clientTest>false</clientTest>
</service>
<service>
- <wsdl>http://www.dotnetisp.com/webservices/dotnetisp/src2html.asmx?WSDL</wsdl>
- <name>src2htmlTest</name>
- <protocols />
- <clientTest>false</clientTest>
- </service>
- <service>
<wsdl>http://ws2.serviceobjects.net/ft/FastTax.asmx?WSDL</wsdl>
<name>FastTaxTest</name>
+ <serverType>Microsoft-IIS/5.0 # </serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -87,6 +90,7 @@
<service>
<wsdl>http://xml.nig.ac.jp/wsdl/ClustalW.wsdl</wsdl>
<name>ClustalWTest</name>
+ <serverType>GLUE/3.2.1,Apache Coyote/1.0 # </serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -95,6 +99,7 @@
<service>
<wsdl>http://www.marotz.se/scripts/searchperson.exe/wsdl/ISearchSwedishPerson</wsdl>
<name>ISearchSwedishPersonTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -103,6 +108,7 @@
<service>
<wsdl>http://www.xmlme.com/WSDailyXml.asmx?WSDL</wsdl>
<name>WSDailyXmlTest</name>
+ <serverType>Microsoft-IIS/6.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -121,6 +127,7 @@
<service>
<wsdl>http://www.barnaland.is/dev/puki.asmx?WSDL</wsdl>
<name>pukiTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -129,16 +136,9 @@
<clientTest>false</clientTest>
</service>
<service>
- <wsdl>http://www.transactionalweb.com/SOAP/geoserve.wsdl</wsdl>
- <name>geoserveTest</name>
- <protocols>
- <protocol>Soap</protocol>
- </protocols>
- <clientTest>false</clientTest>
- </service>
- <service>
<wsdl>http://www.hkwizard.com/WeatherService.asmx?wsdl</wsdl>
<name>WeatherServiceTest</name>
+ <serverType>Microsoft-IIS/5.0 # </serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -147,6 +147,7 @@
<service>
<wsdl>http://www.dl-me.com/webservices/dic2.asmx?WSDL</wsdl>
<name>dic2Test</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -155,6 +156,7 @@
<service>
<wsdl>http://www.xignite.com/xoptions.asmx?WSDL</wsdl>
<name>xoptionsTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -165,6 +167,7 @@
<service>
<wsdl>http://wsdl.wsdlfeeds.com/holidays.cfc?wsdl</wsdl>
<name>holidaysTest</name>
+ <serverType>Apache/1.3.27 (Unix) (Red-Hat/Linux) JRun/4.0 mod_ssl/2.8.12 OpenSSL/0.9.6b DAV/1.0.3 PHP/4.1.2 mod_perl/1.26 # </serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -173,6 +176,7 @@
<service>
<wsdl>http://scores.serviceobjects.com/CupScores.asmx?WSDL</wsdl>
<name>CupScoresTest</name>
+ <serverType>Microsoft-IIS/5.0 # </serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -183,6 +187,7 @@
<service>
<wsdl>http://soap.systinet.net/demos/Newsfeed/wsdl</wsdl>
<name>NewsfeedTest</name>
+ <serverType>Systinet WASP Server for Java/4.6.1 (Java/1.4.2; Linux/2.4.20-24.7) # </serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -191,6 +196,7 @@
<service>
<wsdl>http://www.xmlme.com/WSElectronics.asmx?WSDL</wsdl>
<name>WSElectronicsTest</name>
+ <serverType>Microsoft-IIS/6.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -199,6 +205,7 @@
<service>
<wsdl>http://arcweb.esri.com/services/v2/AddressFinder.wsdl</wsdl>
<name>AddressFinderTest</name>
+ <serverType>Netscape-Enterprise/6.0 # </serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -207,6 +214,7 @@
<service>
<wsdl>http://www.xmlme.com/WSVideoGames.asmx?WSDL</wsdl>
<name>WSVideoGamesTest</name>
+ <serverType>Microsoft-IIS/6.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -225,6 +233,7 @@
<service>
<wsdl>http://ws.digiposs.com/WorldTime.jws?wsdl</wsdl>
<name>WorldTimeTest</name>
+ <serverType>Apache/2.0.43 (Win32) mod_ssl/2.0.43 OpenSSL/0.9.6g PHP/4.3.0 mod_jk/1.2.2-beta-1 # </serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -233,6 +242,7 @@
<service>
<wsdl>http://www.cosme.nu/services/pop.php?wsdl</wsdl>
<name>popTest</name>
+ <serverType>Apache/1.3.26 (Unix) mod_ssl/2.8.9 OpenSSL/0.9.6a ApacheJServ/1.1.2 PHP/4.3.1 # PHP/4.3.1</serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -241,6 +251,7 @@
<service>
<wsdl>http://www.marotz.se/PGPKeyServer/PGPKeyServiceX.exe/wsdl/IPGPKeyServer</wsdl>
<name>IPGPKeyServerTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -249,6 +260,7 @@
<service>
<wsdl>http://www.alanbushtrust.org.uk/soap/compositions.wsdl</wsdl>
<name>compositionsTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -257,6 +269,7 @@
<service>
<wsdl>http://glkev.webs.innerhost.com/glkev_ws/businessnews.asmx?WSDL</wsdl>
<name>businessnewsTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -267,6 +280,7 @@
<service>
<wsdl>http://services.develop.co.za/GetLocalTime.asmx?WSDL</wsdl>
<name>GetLocalTimeTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -275,6 +289,7 @@
<service>
<wsdl>http://ws2.serviceobjects.net/ln/lotterynumbers.asmx?WSDL</wsdl>
<name>lotterynumbersTest</name>
+ <serverType>Microsoft-IIS/5.0 # </serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -295,6 +310,7 @@
<service>
<wsdl>http://www.esynaps.com/WebServices/DailyDiblert.asmx?WSDL</wsdl>
<name>DailyDiblertTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -303,6 +319,7 @@
<service>
<wsdl>http://soap.achchex.com/exec/achsoap.dll/wsdl/IACHSOAP</wsdl>
<name>IACHSOAPTest</name>
+ <serverType>Apache/2.0.43 (Win32) mod_ssl/2.0.43 OpenSSL/0.9.6g # </serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -311,14 +328,7 @@
<service>
<wsdl>http://transform.dataconcert.com/transform.wsdl</wsdl>
<name>transformTest</name>
- <protocols>
- <protocol>Soap</protocol>
- </protocols>
- <clientTest>false</clientTest>
- </service>
- <service>
- <wsdl>http://www.drouet-web.com/webservices/soap_cdtek.php?wsdl</wsdl>
- <name>soap_cdtekTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -327,6 +337,7 @@
<service>
<wsdl>http://icuisine.net/webservices/RecipeService.asmx?WSDL</wsdl>
<name>RecipeServiceTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -335,16 +346,9 @@
<clientTest>false</clientTest>
</service>
<service>
- <wsdl>http://www.cs.fsu.edu/~engelen/lu.wsdl</wsdl>
- <name>luTest</name>
- <protocols>
- <protocol>Soap</protocol>
- </protocols>
- <clientTest>false</clientTest>
- </service>
- <service>
<wsdl>http://www.bitounis.com/WebEvents/events.asmx?WSDL</wsdl>
<name>eventsTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -353,14 +357,9 @@
<clientTest>false</clientTest>
</service>
<service>
- <wsdl>http://interpressfact.net/webservices/promotionService.asmx?wsdl</wsdl>
- <name>promotionServiceTest</name>
- <protocols />
- <clientTest>false</clientTest>
- </service>
- <service>
<wsdl>http://www.OneOutBox.com/wsdl/FreeFaxService.wsdl</wsdl>
<name>FreeFaxServiceTest</name>
+ <serverType>Apache/1.3.27 (Unix) PHP/4.2.3 FrontPage/5.0.2.2510 Rewrit/1.1a # </serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -369,6 +368,7 @@
<service>
<wsdl>http://www.ebi.ac.uk/xembl/XEMBL.wsdl</wsdl>
<name>XEMBLTest</name>
+ <serverType>Apache/1.3.12 (Unix) ApacheJServ/1.1 # </serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -377,6 +377,7 @@
<service>
<wsdl>http://www.xmethods.net/sd/2001/CATrafficService.wsdl</wsdl>
<name>CATrafficServiceTest</name>
+ <serverType>Enhydra-MultiServer/3.1.1b1 # </serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -385,6 +386,7 @@
<service>
<wsdl>http://www.foxcentral.net/foxcentral.wsdl</wsdl>
<name>foxcentralTest</name>
+ <serverType> # </serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -393,6 +395,7 @@
<service>
<wsdl>http://www.cosme.nu/services/convert.php?wsdl</wsdl>
<name>convertTest</name>
+ <serverType>Apache/1.3.26 (Unix) mod_ssl/2.8.9 OpenSSL/0.9.6a ApacheJServ/1.1.2 PHP/4.3.1 # PHP/4.3.1</serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -401,6 +404,7 @@
<service>
<wsdl>http://www.ripedev.com/webservices/ZipCode.asmx?WSDL</wsdl>
<name>ZipCodeTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -409,6 +413,7 @@
<service>
<wsdl>http://ws.cdyne.com/psaddress/addresslookup.asmx?wsdl</wsdl>
<name>addresslookupTest</name>
+ <serverType>Microsoft-IIS/6.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -419,6 +424,7 @@
<service>
<wsdl>http://www.strikeiron.com/scripts/statistics.asmx?WSDL</wsdl>
<name>statisticsTest</name>
+ <serverType>Microsoft-IIS/6.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -427,6 +433,7 @@
<service>
<wsdl>http://www.bitounis.com/W3CParser/LogFileParser.asmx?WSDL</wsdl>
<name>LogFileParserTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -437,6 +444,7 @@
<service>
<wsdl>http://www.webservicex.net/NAICS.asmx?wsdl</wsdl>
<name>NAICSTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -447,6 +455,7 @@
<service>
<wsdl>http://ws.cdyne.com/emailverify/ev.asmx?wsdl</wsdl>
<name>evTest</name>
+ <serverType>Microsoft-IIS/6.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -457,6 +466,7 @@
<service>
<wsdl>http://62.212.78.36/cgi-bin/WagAddressServerSingle.exe/wsdl/IWagAddressServerSingle</wsdl>
<name>IWagAddressServerSingleTest</name>
+ <serverType>Apache/1.3.19 (Win32) # </serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -465,6 +475,7 @@
<service>
<wsdl>http://slashdemocracy.org/links/ws4gotze.wsdl</wsdl>
<name>ws4gotzeTest</name>
+ <serverType>Apache # </serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -473,6 +484,7 @@
<service>
<wsdl>http://java.rus.uni-stuttgart.de/quiz/quiz.wsdl</wsdl>
<name>quizTest</name>
+ <serverType>Microsoft-IIS/5.0,GLUE/3.2.3 # </serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -481,6 +493,7 @@
<service>
<wsdl>http://www.zanetti-dev.com/scripts/zpop3ws.exe/wsdl/IZPOP3</wsdl>
<name>IZPOP3Test</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -489,6 +502,7 @@
<service>
<wsdl>http://www.gama-system.com/webservices/stockquotes.asmx?wsdl</wsdl>
<name>stockquotesTest</name>
+ <serverType>Microsoft-IIS/5.0 # </serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -499,6 +513,7 @@
<service>
<wsdl>http://www.webservicex.net/barcode.asmx?WSDL</wsdl>
<name>barcodeTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -509,6 +524,7 @@
<service>
<wsdl>http://service.graphmagic.com/GMService/GraphMagic.asmx?wsdl</wsdl>
<name>GraphMagicTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -517,6 +533,7 @@
<service>
<wsdl>http://developerdays.com/cgi-bin/tempconverter.exe/wsdl/ITempConverter</wsdl>
<name>ITempConverterTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -525,6 +542,7 @@
<service>
<wsdl>http://www.webservicex.net/icd10.asmx?WSDL</wsdl>
<name>icd10Test</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -535,6 +553,7 @@
<service>
<wsdl>http://www.marotz.se/scripts/SlashdotHeadlines.exe/wsdl/ISlashdotHeadlineProvider</wsdl>
<name>ISlashdotHeadlineProviderTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -543,6 +562,7 @@
<service>
<wsdl>http://www.xmethods.net/sd/2001/CurrencyExchangeService.wsdl</wsdl>
<name>CurrencyExchangeServiceTest</name>
+ <serverType> # </serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -551,6 +571,7 @@
<service>
<wsdl>http://demo.soapam.com/services/FedEpayDirectory/FedEpayDirectoryService.wsdl</wsdl>
<name>FedEpayDirectoryServiceTest</name>
+ <serverType>NuWave Technologies SOAP/AM(tm) Server - Version 1.0.4002 (SP2) # </serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -559,6 +580,7 @@
<service>
<wsdl>http://webservices.eraserver.net/zipcoderesolver/zipcoderesolver.asmx?WSDL</wsdl>
<name>zipcoderesolverTest</name>
+ <serverType>Microsoft-IIS/5.0 # </serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -569,6 +591,7 @@
<service>
<wsdl>http://www.webservicex.net/icd9toicd10.asmx?WSDL</wsdl>
<name>icd9toicd10Test</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -579,6 +602,7 @@
<service>
<wsdl>http://www.ebob42.com/cgi-bin/Romulan.exe/wsdl/IRoman</wsdl>
<name>IRomanTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -587,6 +611,7 @@
<service>
<wsdl>http://www.sidespace.com/ws/fission/fissiondotnet.php?wsdl</wsdl>
<name>fissiondotnetTest</name>
+ <serverType>Apache/1.3.29 # PHP/4.3.4</serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -595,6 +620,7 @@
<service>
<wsdl>http://www.x-ws.de/cgi-bin/bork/service.wsdl</wsdl>
<name>serviceTest</name>
+ <serverType>Apache/1.3.27 (Linux/SuSE) PHP/4.3.4 mod_perl/1.27 # </serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -603,20 +629,16 @@
<service>
<wsdl>http://www.esynaps.com/WebServices/eSynapsMonitor.wsdl</wsdl>
<name>eSynapsMonitorTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
<clientTest>false</clientTest>
</service>
<service>
- <wsdl>http://www.dotnetisp.com/webservices/dotnetisp/ville.asmx?WSDL</wsdl>
- <name>villeTest</name>
- <protocols />
- <clientTest>false</clientTest>
- </service>
- <service>
<wsdl>http://www.xmlme.com/WSAmazonBox.asmx?WSDL</wsdl>
<name>WSAmazonBoxTest</name>
+ <serverType>Microsoft-IIS/6.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -625,6 +647,7 @@
<service>
<wsdl>http://www.west-wind.com/wconnect/soap/wwhelpservice.wsdl</wsdl>
<name>wwhelpserviceTest</name>
+ <serverType> # </serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -633,6 +656,7 @@
<service>
<wsdl>http://www.oakleaf.ws/cfrsectws/cfrsectws.asmx?wsdl</wsdl>
<name>cfrsectwsTest</name>
+ <serverType>Microsoft-IIS/5.0 # </serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -651,6 +675,7 @@
<service>
<wsdl>http://www.bitounis.com/RSAFunctions/RSAFuncs.asmx?WSDL</wsdl>
<name>RSAFuncsTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -661,6 +686,7 @@
<service>
<wsdl>http://soap.systinet.net/demos/RpmFinder/wsdl</wsdl>
<name>RpmFinderTest</name>
+ <serverType>Systinet WASP Server for Java/4.6.1 (Java/1.4.2; Linux/2.4.20-24.7) # </serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -669,6 +695,7 @@
<service>
<wsdl>http://www.ebob42.com/cgi-bin/DrBobsClinic.exe/wsdl/IHeadline</wsdl>
<name>IHeadlineTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -677,6 +704,7 @@
<service>
<wsdl>http://www.webservicex.net/periodictable.asmx?wsdl</wsdl>
<name>periodictableTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -687,6 +715,7 @@
<service>
<wsdl>http://www.maillocate.com/soap/index.php?wsdl</wsdl>
<name>indexTest</name>
+ <serverType>Apache/2.0.40 (Red Hat Linux) # PHP/4.2.2</serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -703,6 +732,7 @@
<service>
<wsdl>http://iis1.grantparksoftware.com:8080/gps/pos_public.asmx?WSDL</wsdl>
<name>pos_publicTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -713,6 +743,7 @@
<service>
<wsdl>http://www.framewerks.com/WebServices/fWArticleService/fwArticles.asmx?WSDL</wsdl>
<name>fwArticlesTest</name>
+ <serverType>Microsoft-IIS/5.0 Geobytes-GeoSelect/2.1.0.1 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -721,6 +752,7 @@
<service>
<wsdl>http://sandbox.grandcentral.com/services/reports?WSDL</wsdl>
<name>reportsTest</name>
+ <serverType>Apache/1.3.29 (Unix) mod_jk/1.2.0 mod_perl/1.29 mod_ssl/2.8.16 OpenSSL/0.9.7c # </serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -729,6 +761,7 @@
<service>
<wsdl>http://www.webservicex.net/CurrencyConvertor.asmx?wsdl</wsdl>
<name>CurrencyConvertorTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -739,6 +772,7 @@
<service>
<wsdl>http://www.x-ws.de/cgi-bin/msn/imstatus.wsdl</wsdl>
<name>imstatusTest</name>
+ <serverType>Apache/1.3.27 (Linux/SuSE) PHP/4.3.4 mod_perl/1.27 # </serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -747,6 +781,7 @@
<service>
<wsdl>http://www.esynaps.com/WebServices/MsProxy.asmx?WSDL</wsdl>
<name>MsProxyTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -763,6 +798,7 @@
<service>
<wsdl>http://www.webservicex.net/usweather.asmx?WSDL</wsdl>
<name>usweatherTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -773,14 +809,16 @@
<service>
<wsdl>http://www.forta.com/cf/tips/syndicate.cfc?wsdl</wsdl>
<name>syndicateTest</name>
+ <serverType>Apache/2.0.43 (Red Hat Linux) # </serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
- <clientTest>false</clientTest>
+ <clientTest>true</clientTest>
</service>
<service>
<wsdl>http://clientservice.muse.net/ClientService.asmx?WSDL</wsdl>
<name>ClientServiceTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -791,6 +829,7 @@
<service>
<wsdl>http://www.flash-db.com/services/ws/siteInspect.wsdl</wsdl>
<name>siteInspectTest</name>
+ <serverType>Apache/1.3.28 (Unix) mod_auth_passthrough/1.8 mod_bwprotect/0.2 mod_bwlimited/1.2 PHP/4.3.3 mod_log_bytes/1.2 FrontPage/5.0.2.2634 # PHP/4.3.3</serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -799,6 +838,7 @@
<service>
<wsdl>http://www.webservicex.net/stockquote.asmx?WSDL</wsdl>
<name>stockquoteTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -819,6 +859,7 @@
<service>
<wsdl>http://ws.acrosscommunications.com/TAP.asmx?WSDL</wsdl>
<name>TAPTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -827,6 +868,7 @@
<service>
<wsdl>http://www.xignite.com/xsecurity.asmx?WSDL</wsdl>
<name>xsecurityTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -837,6 +879,7 @@
<service>
<wsdl>http://www.codebump.com/services/placelookup.asmx?wsdl</wsdl>
<name>placelookupTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -847,6 +890,7 @@
<service>
<wsdl>http://www.aspiringgeek.com/cfc/keyword/sekeyword.cfc?wsdl</wsdl>
<name>sekeywordTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -855,6 +899,7 @@
<service>
<wsdl>http://www.x-ws.de/cgi-bin/eliza/chat.wsdl</wsdl>
<name>chatTest</name>
+ <serverType>Apache/1.3.27 (Linux/SuSE) PHP/4.3.4 mod_perl/1.27 # </serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -869,6 +914,7 @@
<service>
<wsdl>http://ws2.serviceobjects.net/pc/packcost.asmx?WSDL</wsdl>
<name>packcostTest</name>
+ <serverType>Microsoft-IIS/5.0 # </serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -879,6 +925,7 @@
<service>
<wsdl>http://soap.systinet.net/demos/ZVONSearch/wsdl</wsdl>
<name>ZVONSearchTest</name>
+ <serverType>Systinet WASP Server for Java/4.6.1 (Java/1.4.2; Linux/2.4.20-24.7) # </serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -887,6 +934,7 @@
<service>
<wsdl>http://www.richsolutions.com/RichPayments/RichCardValidator.asmx?WSDL</wsdl>
<name>RichCardValidatorTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -897,6 +945,7 @@
<service>
<wsdl>http://ww6.borland.com/webservices/BorlandBabel/BorlandBabel.exe/wsdl/IBorlandBabel</wsdl>
<name>IBorlandBabelTest</name>
+ <serverType>Microsoft-IIS/4.0 # </serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -905,6 +954,7 @@
<service>
<wsdl>http://www.aspxpressway.com/maincontent/webservices/piglatin.asmx?wsdl</wsdl>
<name>piglatinTest</name>
+ <serverType>Microsoft-IIS/5.0 # </serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -915,6 +965,7 @@
<service>
<wsdl>http://www.cosme.nu/services/dns.php?wsdl</wsdl>
<name>dnsTest</name>
+ <serverType>Apache/1.3.26 (Unix) mod_ssl/2.8.9 OpenSSL/0.9.6a ApacheJServ/1.1.2 PHP/4.3.1 # PHP/4.3.1</serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -939,6 +990,7 @@
<service>
<wsdl>http://www.swanandmokashi.com/HomePage/WebServices/StockQuotes.asmx?WSDL</wsdl>
<name>StockQuotesTest</name>
+ <serverType>Microsoft-IIS/5.0 # </serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -949,6 +1001,7 @@
<service>
<wsdl>http://www.scdi.org/~avernet/webservice/yim.wsdl</wsdl>
<name>yimTest</name>
+ <serverType>Apache/1.3.26 (Unix) Debian GNU/Linux # PHP/4.1.2</serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -957,6 +1010,7 @@
<service>
<wsdl>http://beta2.eraserver.net/webservices/mxchecker/mxchecker.asmx?WSDL</wsdl>
<name>mxcheckerTest</name>
+ <serverType>Microsoft-IIS/5.0 # </serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -977,6 +1031,7 @@
<service>
<wsdl>http://ws.interfax.net/dfs.asmx?WSDL</wsdl>
<name>dfsTest</name>
+ <serverType>Microsoft-IIS/5.0 # </serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -987,6 +1042,7 @@
<service>
<wsdl>http://www.xignite.com/xworldnews.asmx?WSDL</wsdl>
<name>xworldnewsTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -997,6 +1053,7 @@
<service>
<wsdl>http://www.xmlme.com/WSDailyNet.asmx?WSDL</wsdl>
<name>WSDailyNetTest</name>
+ <serverType>Microsoft-IIS/6.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -1005,6 +1062,7 @@
<service>
<wsdl>http://webservices.matlus.com/scripts/sessionservice.dll/wsdl/IMsSessionBrokerService</wsdl>
<name>IMsSessionBrokerServiceTest</name>
+ <serverType>Microsoft-IIS/6.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -1013,6 +1071,7 @@
<service>
<wsdl>http://www.xmethods.net/sd/2001/BNQuoteService.wsdl</wsdl>
<name>BNQuoteServiceTest</name>
+ <serverType>Enhydra-MultiServer/3.1.1b1 # </serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -1021,6 +1080,7 @@
<service>
<wsdl>http://www.gxchart.com/webchart.wsdl</wsdl>
<name>webchartTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -1029,6 +1089,7 @@
<service>
<wsdl>http://smsserver.dotnetisp.com/servicesms.asmx?WSDL</wsdl>
<name>servicesmsTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -1037,6 +1098,7 @@
<service>
<wsdl>http://ws2.serviceobjects.net/ds/domainspy.asmx?WSDL</wsdl>
<name>domainspyTest</name>
+ <serverType>Microsoft-IIS/5.0 # </serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -1047,6 +1109,7 @@
<service>
<wsdl>http://ewsdemo.webmethods.com/WmEWS/directory/wsd.dsp?interface=wmpayflow.sample&amp;service=Credit_Approval</wsdl>
<name>Credit_ApprovalTest</name>
+ <serverType> # </serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -1055,6 +1118,7 @@
<service>
<wsdl>http://sms.idws.com/soap/smsservice.dll/wsdl/ISMSService</wsdl>
<name>ISMSServiceTest</name>
+ <serverType>Microsoft-IIS/5.0 # </serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -1063,6 +1127,7 @@
<service>
<wsdl>http://glkev.webs.innerhost.com/glkev_ws/HistoricalStockQuotes.asmx?WSDL</wsdl>
<name>HistoricalStockQuotesTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -1073,6 +1138,7 @@
<service>
<wsdl>http://ws2.serviceobjects.net/fw/FastWeather.asmx?WSDL</wsdl>
<name>FastWeatherTest</name>
+ <serverType>Microsoft-IIS/5.0 # </serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -1083,6 +1149,7 @@
<service>
<wsdl>http://www22.brinkster.com/horaciovallejo/netpress1.asmx?wsdl</wsdl>
<name>netpress1Test</name>
+ <serverType>Microsoft-IIS/6.0 # </serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -1093,6 +1160,7 @@
<service>
<wsdl>http://ws.acrosscommunications.com/NumPager.asmx?WSDL</wsdl>
<name>NumPagerTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -1101,6 +1169,7 @@
<service>
<wsdl>http://ws.acrosscommunications.com/ICQ.asmx?WSDL</wsdl>
<name>ICQTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -1109,6 +1178,7 @@
<service>
<wsdl>http://oneoutbox.com/wsdl/FaxService.wsdl</wsdl>
<name>FaxServiceTest</name>
+ <serverType>Apache/1.3.27 (Unix) PHP/4.2.3 FrontPage/5.0.2.2510 Rewrit/1.1a # </serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -1117,6 +1187,7 @@
<service>
<wsdl>http://www.cgi101.com/~msmithso/wsdl/mach.wsdl</wsdl>
<name>machTest</name>
+ <serverType>Apache/1.3.29 # </serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -1125,6 +1196,7 @@
<service>
<wsdl>http://otn.oracle.com/ws/otnnews?WSDL</wsdl>
<name>otnnewsTest</name>
+ <serverType>Oracle9iAS/9.0.4 Oracle HTTP Server # </serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -1133,6 +1205,7 @@
<service>
<wsdl>http://xml.nig.ac.jp/wsdl/GetEntry.wsdl</wsdl>
<name>GetEntryTest</name>
+ <serverType>GLUE/3.2.1,Apache Coyote/1.0 # </serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -1141,6 +1214,7 @@
<service>
<wsdl>http://www.webservicex.net/aba.asmx?WSDL</wsdl>
<name>abaTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -1151,6 +1225,7 @@
<service>
<wsdl>http://www.infoaccelerator.net/cfc/rtf2html.cfc?WSDL</wsdl>
<name>rtf2htmlTest</name>
+ <serverType>Microsoft-IIS/5.0 # </serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -1159,6 +1234,7 @@
<service>
<wsdl>http://www.xeeinc.com/RateInformation/Rateinfo.asmx?WSDL</wsdl>
<name>RateinfoTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -1169,6 +1245,7 @@
<service>
<wsdl>http://www.esynaps.com/WebServices/eSynapsFeed.asmx?WSDL</wsdl>
<name>eSynapsFeedTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -1187,6 +1264,7 @@
<service>
<wsdl>http://xml.nig.ac.jp/wsdl/SRS.wsdl</wsdl>
<name>SRSTest</name>
+ <serverType>GLUE/3.2.1,Apache Coyote/1.0 # </serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -1195,6 +1273,7 @@
<service>
<wsdl>http://www28.brinkster.com/hegdes/NumberToWords.asmx?WSDL</wsdl>
<name>NumberToWordsTest</name>
+ <serverType>Microsoft-IIS/6.0 # </serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -1203,6 +1282,7 @@
<service>
<wsdl>http://www.richsolutions.com/richpayments/richpay.asmx?WSDL</wsdl>
<name>richpayTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -1213,6 +1293,7 @@
<service>
<wsdl>http://server1.pointwsp.net/ws/postal/main.asmx?WSDL</wsdl>
<name>mainTest</name>
+ <serverType>Microsoft-IIS/5.0 # </serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -1223,6 +1304,7 @@
<service>
<wsdl>http://xmlrad.com/WSFindMP3Bin/WSFindMP3.dll/WSDL</wsdl>
<name>WSFindMP3Test</name>
+ <serverType>Microsoft-IIS/6.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -1239,6 +1321,7 @@
<service>
<wsdl>http://www.webserviceoftheday.com/ws/soap/wsotd.asmx?wsdl</wsdl>
<name>wsotdTest</name>
+ <serverType>Microsoft-IIS/5.0 # </serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -1249,6 +1332,7 @@
<service>
<wsdl>http://www.ripedev.com/webservices/LocalTime.asmx?WSDL</wsdl>
<name>LocalTimeTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -1257,6 +1341,7 @@
<service>
<wsdl>http://majordojo.com/amazon_query/amazon_query.wsdl</wsdl>
<name>amazon_queryTest</name>
+ <serverType>Apache/1.3.29 (Unix) mod_jk/1.2.0 mod_ssl/2.8.16 OpenSSL/0.9.6g PHP/4.3.4 # </serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -1265,6 +1350,7 @@
<service>
<wsdl>http://www.SoapClient.com/xml/SQLDataSoap.wsdl</wsdl>
<name>SQLDataSoapTest</name>
+ <serverType>SQLData Server/3.01 # </serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -1273,6 +1359,7 @@
<service>
<wsdl>http://soap.einsteinware.com/nascar/nascardataservice.asmx?WSDL</wsdl>
<name>nascardataserviceTest</name>
+ <serverType>Microsoft-IIS/6.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpPost</protocol>
@@ -1282,6 +1369,7 @@
<service>
<wsdl>http://wsdl.wsdlfeeds.com/spell.cfc?wsdl</wsdl>
<name>spellTest</name>
+ <serverType>Apache/1.3.27 (Unix) (Red-Hat/Linux) JRun/4.0 mod_ssl/2.8.12 OpenSSL/0.9.6b DAV/1.0.3 PHP/4.1.2 mod_perl/1.26 # </serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -1290,6 +1378,7 @@
<service>
<wsdl>http://ws2.serviceobjects.net/av/AddressValidate.asmx?WSDL</wsdl>
<name>AddressValidateTest</name>
+ <serverType>Microsoft-IIS/5.0 # </serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -1300,6 +1389,7 @@
<service>
<wsdl>http://arcweb.esri.com/services/v2/RouteFinder.wsdl</wsdl>
<name>RouteFinderTest</name>
+ <serverType>Netscape-Enterprise/6.0 # </serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -1308,6 +1398,7 @@
<service>
<wsdl>http://arcweb.esri.com/services/v2/Query.wsdl</wsdl>
<name>QueryTest</name>
+ <serverType>Netscape-Enterprise/6.0 # </serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -1316,6 +1407,7 @@
<service>
<wsdl>http://www.webservicex.net/fax.asmx?wsdl</wsdl>
<name>faxTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -1326,6 +1418,7 @@
<service>
<wsdl>http://ws2.serviceobjects.net/gpp/GeoPinPoint.asmx?WSDL</wsdl>
<name>GeoPinPointTest</name>
+ <serverType>Microsoft-IIS/5.0 # </serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -1344,14 +1437,9 @@
<clientTest>false</clientTest>
</service>
<service>
- <wsdl>http://soap.prowizorka.com/spam/wsdl/ISpamCheck</wsdl>
- <name>ISpamCheckTest</name>
- <protocols />
- <clientTest>false</clientTest>
- </service>
- <service>
<wsdl>http://webservices.sld.cu/aldia.wsdl</wsdl>
<name>aldiaTest</name>
+ <serverType>Apache/1.3.27 (Unix) (Red-Hat/Linux) mod_ssl/2.8.12 OpenSSL/0.9.6b # </serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -1360,6 +1448,7 @@
<service>
<wsdl>http://www.inkostar.com/wsdl/iifws/iifws.wsdl</wsdl>
<name>iifwsTest</name>
+ <serverType>Microsoft-IIS/5.0 # </serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -1384,6 +1473,7 @@
<service>
<wsdl>http://ws.cdyne.com/ip2geo/ip2geo.asmx?wsdl</wsdl>
<name>ip2geoTest</name>
+ <serverType>Microsoft-IIS/6.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -1394,6 +1484,7 @@
<service>
<wsdl>http://www.xignite.com/xsimulation.asmx?WSDL</wsdl>
<name>xsimulationTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -1404,6 +1495,7 @@
<service>
<wsdl>http://www.webservicex.net/uszip.asmx?WSDL</wsdl>
<name>uszipTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -1414,6 +1506,7 @@
<service>
<wsdl>http://www.rightsecurity.biz/NRICWebServices/NRICWebServices.dll/wsdl/Iws_Verify_NRIC</wsdl>
<name>Iws_Verify_NRICTest</name>
+ <serverType>Netscape-Enterprise/3.5.1 # </serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -1422,14 +1515,16 @@
<service>
<wsdl>http://live.capescience.com/wsdl/GlobalWeather.wsdl</wsdl>
<name>GlobalWeatherTest</name>
+ <serverType> # </serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
- <clientTest>false</clientTest>
+ <clientTest>true</clientTest>
</service>
<service>
<wsdl>http://www.barnaland.is/dev/sms.asmx?WSDL</wsdl>
<name>smsTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -1440,6 +1535,7 @@
<service>
<wsdl>http://www.firelife.eu.com/dynamicflash/dynamicflash.asmx?WSDL</wsdl>
<name>dynamicflashTest</name>
+ <serverType>Microsoft-IIS/5.0 # </serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -1448,6 +1544,7 @@
<service>
<wsdl>http://www.e-naxos.com/scripts/enwscp.dll/wsdl/IODCODESPOSTAUX</wsdl>
<name>IODCODESPOSTAUXTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -1456,6 +1553,7 @@
<service>
<wsdl>http://www.indobiz.com/OptionPricing.asmx?WSDL</wsdl>
<name>OptionPricingTest</name>
+ <serverType>Microsoft-IIS/5.0 # </serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -1466,6 +1564,7 @@
<service>
<wsdl>http://xmlrad.com/WSGeneratorBin/WSGenerator.dll/WSDL</wsdl>
<name>WSGeneratorTest</name>
+ <serverType>Microsoft-IIS/6.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -1474,6 +1573,7 @@
<service>
<wsdl>http://xml.nig.ac.jp/wsdl/Blast.wsdl</wsdl>
<name>BlastTest</name>
+ <serverType>GLUE/3.2.1,Apache Coyote/1.0 # </serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -1482,6 +1582,7 @@
<service>
<wsdl>http://xml.nig.ac.jp/wsdl/TxSearch.wsdl</wsdl>
<name>TxSearchTest</name>
+ <serverType>GLUE/3.2.1,Apache Coyote/1.0 # </serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -1490,6 +1591,7 @@
<service>
<wsdl>http://www.codebump.com/services/zipcodelookup.asmx?wsdl</wsdl>
<name>zipcodelookupTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -1500,6 +1602,7 @@
<service>
<wsdl>http://www.esynaps.com/webservices/YourHostInfo.asmx?WSDL</wsdl>
<name>YourHostInfoTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -1508,6 +1611,7 @@
<service>
<wsdl>http://www.oakleaf.ws/cfrtocws/cfrtocws.asmx?wsdl</wsdl>
<name>cfrtocwsTest</name>
+ <serverType>Microsoft-IIS/5.0 # </serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -1518,6 +1622,7 @@
<service>
<wsdl>http://www.baxglobal.com/xmltracking/xmltracking.asmx?wsdl</wsdl>
<name>xmltrackingTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -1528,6 +1633,7 @@
<service>
<wsdl>http://webservices.isitedesign.com/ws/chartWS.cfc?wsdl</wsdl>
<name>chartWSTest</name>
+ <serverType>Microsoft-IIS/5.0 # </serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -1536,6 +1642,7 @@
<service>
<wsdl>http://ww6.borland.com/webservices/MapQuest/MapQuest.exe/wsdl/IMapQuest</wsdl>
<name>IMapQuestTest</name>
+ <serverType>Microsoft-IIS/4.0 # </serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -1544,6 +1651,7 @@
<service>
<wsdl>http://www.pinellus.com/cfc/Cod_fiscale.cfc?wsdl</wsdl>
<name>Cod_fiscaleTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -1552,6 +1660,7 @@
<service>
<wsdl>http://www.stgregorioschurchdc.org/wsdl/Bible.wsdl</wsdl>
<name>BibleTest</name>
+ <serverType>Apache/1.3.27 (Unix) PHP/4.2.3 FrontPage/5.0.2.2510 Rewrit/1.1a # </serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -1560,6 +1669,7 @@
<service>
<wsdl>http://aspnet.lamaan.com/webservices/QuranVerse.asmx?WSDL</wsdl>
<name>QuranVerseTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -1586,6 +1696,7 @@
<service>
<wsdl>http://wavendon.dsdata.co.uk/axis/services/CarRentalQuotes?wsdl</wsdl>
<name>CarRentalQuotesTest</name>
+ <serverType>Apache/2.0.39 (Win32) mod_jk/1.2.0 # </serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -1594,6 +1705,7 @@
<service>
<wsdl>http://soap.systinet.net/demos/W3CSearch/wsdl</wsdl>
<name>W3CSearchTest</name>
+ <serverType>Systinet WASP Server for Java/4.6.1 (Java/1.4.2; Linux/2.4.20-24.7) # </serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -1602,6 +1714,7 @@
<service>
<wsdl>http://www.codecube.net/services/xreonline.asmx?WSDL</wsdl>
<name>xreonlineTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -1612,6 +1725,7 @@
<service>
<wsdl>http://webservices.tei.or.th/getQuakeData.cfc?wsdl</wsdl>
<name>getQuakeDataTest</name>
+ <serverType>Microsoft-IIS/5.0 # </serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -1620,6 +1734,7 @@
<service>
<wsdl>http://wavendon.dsdata.co.uk:8080/axis/services/SBGGetAirFareQuote?wsdl</wsdl>
<name>SBGGetAirFareQuoteTest</name>
+ <serverType>Apache/2.0.39 (Win32) mod_jk/1.2.0 # </serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -1638,6 +1753,7 @@
<service>
<wsdl>http://ws.acrosscommunications.com/SMS.asmx?WSDL</wsdl>
<name>SMSTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -1646,6 +1762,7 @@
<service>
<wsdl>http://dotnet.cyberthink.net/computerdictionary/computerdictionary.asmx?wsdl</wsdl>
<name>computerdictionaryTest</name>
+ <serverType>Microsoft-IIS/5.0 # </serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -1656,6 +1773,7 @@
<service>
<wsdl>http://www.apniurdu.com/SOAP/Urdu2.wsdl</wsdl>
<name>Urdu2Test</name>
+ <serverType>Apache # </serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -1664,6 +1782,7 @@
<service>
<wsdl>http://www.webservicex.net/airport.asmx?wsdl</wsdl>
<name>airportTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -1674,6 +1793,7 @@
<service>
<wsdl>http://telecommerce.danet.de/axis/services/DocConverterServicePort?wsdl</wsdl>
<name>DocConverterServicePortTest</name>
+ <serverType>Apache/1.3.26 (Linux/SuSE) mod_webapp/1.2.0-dev PHP/4.2.2 # </serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -1682,6 +1802,7 @@
<service>
<wsdl>http://www.xmlme.com/WSShakespeare.asmx?WSDL</wsdl>
<name>WSShakespeareTest</name>
+ <serverType>Microsoft-IIS/6.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -1690,6 +1811,7 @@
<service>
<wsdl>http://glkev.webs.innerhost.com/glkev_ws/WeatherFetcher.asmx?WSDL</wsdl>
<name>WeatherFetcherTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -1700,6 +1822,7 @@
<service>
<wsdl>http://www.dl-me.com/webservices/unitext.asmx?wsdl</wsdl>
<name>unitextTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -1708,6 +1831,7 @@
<service>
<wsdl>http://www.suiyi.com/soap/economic.dll/wsdl/Ieconomic</wsdl>
<name>IeconomicTest</name>
+ <serverType>Microsoft-IIS/6.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -1716,6 +1840,7 @@
<service>
<wsdl>http://webservices.isitedesign.com/ws/slashdotnews.cfc?wsdl</wsdl>
<name>slashdotnewsTest</name>
+ <serverType>Microsoft-IIS/5.0 # </serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -1724,6 +1849,7 @@
<service>
<wsdl>http://www.xignite.com/xretirement.asmx?WSDL</wsdl>
<name>xretirementTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -1734,6 +1860,7 @@
<service>
<wsdl>http://ws2.serviceobjects.net/yp/YellowPages.asmx?WSDL</wsdl>
<name>YellowPagesTest</name>
+ <serverType>Microsoft-IIS/5.0 # </serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -1744,6 +1871,7 @@
<service>
<wsdl>http://www.securexml.net/securexml/securexml.wsdl</wsdl>
<name>securexmlTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -1752,6 +1880,7 @@
<service>
<wsdl>http://soap.4s4c.com/weblogs/subscribe.wsdl</wsdl>
<name>subscribeTest</name>
+ <serverType>Microsoft-IIS/5.0 # </serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -1760,6 +1889,7 @@
<service>
<wsdl>http://www.schemaweb.info/webservices/soap/SchemaWebSoap.asmx?wsdl</wsdl>
<name>SchemaWebSoapTest</name>
+ <serverType>Microsoft-IIS/6.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -1768,6 +1898,7 @@
<service>
<wsdl>http://www.financialwebservices.ltd.uk/axis/services/bond?wsdl</wsdl>
<name>bondTest</name>
+ <serverType>Apache Tomcat/4.0.4 (HTTP/1.1 Connector) # </serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -1776,6 +1907,7 @@
<service>
<wsdl>http://www.xignite.com/xnews.asmx?WSDL</wsdl>
<name>xnewsTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -1786,6 +1918,7 @@
<service>
<wsdl>http://www.what-is-around.com/awwia.wsdl</wsdl>
<name>awwiaTest</name>
+ <serverType>Apache/2.0.47 (Unix) mod_ssl/2.0.47 OpenSSL/0.9.7b # </serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -1794,6 +1927,7 @@
<service>
<wsdl>http://www.eyemaginations.com/cgi-bin/getWSDL.pl?wsdl=WebFunction.wsdl</wsdl>
<name>getWSDLTest</name>
+ <serverType>Apache/1.3.27 (Unix) FrontPage/5.0.2.2510 mod_ssl/2.8.12 OpenSSL/0.9.6g # </serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -1802,6 +1936,7 @@
<service>
<wsdl>http://www.flash-db.com/services/ws/companyInfo.wsdl</wsdl>
<name>companyInfoTest</name>
+ <serverType>Apache/1.3.28 (Unix) mod_auth_passthrough/1.8 mod_bwprotect/0.2 mod_bwlimited/1.2 PHP/4.3.3 mod_log_bytes/1.2 FrontPage/5.0.2.2634 # PHP/4.3.3</serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -1810,6 +1945,7 @@
<service>
<wsdl>http://www.abundanttech.com/webservices/population/population.wsdl</wsdl>
<name>populationTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -1820,6 +1956,7 @@
<service>
<wsdl>http://wsdl.wsdlfeeds.com/odp.cfc?wsdl</wsdl>
<name>odpTest</name>
+ <serverType>Apache/1.3.27 (Unix) (Red-Hat/Linux) JRun/4.0 mod_ssl/2.8.12 OpenSSL/0.9.6b DAV/1.0.3 PHP/4.1.2 mod_perl/1.26 # </serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -1828,6 +1965,7 @@
<service>
<wsdl>http://www.xignite.com/xstatistics.asmx?WSDL</wsdl>
<name>xstatisticsTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -1838,6 +1976,7 @@
<service>
<wsdl>http://www.nickhodge.com/nhodge/finnwords/finnwords.wsdl</wsdl>
<name>finnwordsTest</name>
+ <serverType>Apache/1.3.29 (Unix) mod_auth_passthrough/1.8 mod_gzip/1.3.26.1a mod_jk/1.2.0 mod_log_bytes/1.2 mod_bwlimited/1.4 PHP/4.3.4 FrontPage/5.0.2.2634 mod_ssl/2.8.16 OpenSSL/0.9.6b # PHP/4.3.4</serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -1846,6 +1985,7 @@
<service>
<wsdl>http://terraservice.net/TerraService.asmx?WSDL</wsdl>
<name>TerraServiceTest</name>
+ <serverType>Microsoft-IIS/6.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -1856,6 +1996,7 @@
<service>
<wsdl>http://www.swanandmokashi.com/HomePage/WebServices/QuoteOfTheDay.asmx?WSDL</wsdl>
<name>QuoteOfTheDayTest</name>
+ <serverType>Microsoft-IIS/5.0 # </serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -1866,6 +2007,7 @@
<service>
<wsdl>http://test.mapfrepr.net/Encryption/Encryption.asmx?WSDL</wsdl>
<name>EncryptionTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -1882,6 +2024,7 @@
<service>
<wsdl>http://glkev.webs.innerhost.com/glkev_ws/UPSTracking.asmx?WSDL</wsdl>
<name>UPSTrackingTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -1892,6 +2035,7 @@
<service>
<wsdl>http://www.webservicex.net/hcpcs.asmx?WSDL</wsdl>
<name>hcpcsTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -1902,6 +2046,7 @@
<service>
<wsdl>http://www.framewerks.com/WebServices/helpfulfunctions/helpfulfunctions.asmx?WSDL</wsdl>
<name>helpfulfunctionsTest</name>
+ <serverType>Microsoft-IIS/5.0 Geobytes-GeoSelect/2.1.0.1 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -1910,6 +2055,7 @@
<service>
<wsdl>http://www.esynaps.com/WebServices/BusinessList.asmx?WSDL</wsdl>
<name>BusinessListTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -1918,6 +2064,7 @@
<service>
<wsdl>http://webservices.wolfram.com/services/SearchServices/WolframSearch.wsdl</wsdl>
<name>WolframSearchTest</name>
+ <serverType>Apache Coyote/1.0 # </serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -1926,6 +2073,7 @@
<service>
<wsdl>http://webservices.matlus.com/scripts/emailwebservice.dll/wsdl/IEmailService</wsdl>
<name>IEmailServiceTest</name>
+ <serverType>Microsoft-IIS/6.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -1934,6 +2082,7 @@
<service>
<wsdl>http://www.seshakiran.com/QuoteService/QuotesService.asmx?wsdl</wsdl>
<name>QuotesServiceTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -1944,6 +2093,7 @@
<service>
<wsdl>http://ws2.serviceobjects.net/pa/phoneappend.asmx?wsdl</wsdl>
<name>phoneappendTest</name>
+ <serverType>Microsoft-IIS/5.0 # </serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -1954,6 +2104,7 @@
<service>
<wsdl>http://www.webservicex.net/uklocation.asmx?WSDL</wsdl>
<name>uklocationTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -1974,6 +2125,7 @@
<service>
<wsdl>http://docserv.aurigalogic.com/docserv.wsdl</wsdl>
<name>docservTest</name>
+ <serverType>Apache/1.3.27 (Unix) mod_jk2/2.0.3-dev mod_webapp/1.2.0-dev PHP/4.1.2 # </serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -1982,6 +2134,7 @@
<service>
<wsdl>http://www.barnaland.is/dev/phonebook.asmx?WSDL</wsdl>
<name>phonebookTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -1992,6 +2145,7 @@
<service>
<wsdl>http://www.xmlme.com/WSSportingGoods.asmx?WSDL</wsdl>
<name>WSSportingGoodsTest</name>
+ <serverType>Microsoft-IIS/6.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -2000,6 +2154,7 @@
<service>
<wsdl>http://www.saintlogin.com/SAINT_WS/SAINTlogin_service_mssoap.php?wsdl</wsdl>
<name>SAINTlogin_service_mssoapTest</name>
+ <serverType>Apache/2.0.46 # </serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -2008,6 +2163,7 @@
<service>
<wsdl>http://www.wsindex.org/pages/wsindexLinks.wsdl</wsdl>
<name>wsindexLinksTest</name>
+ <serverType>Apache/1.3.28 (Unix) mod_auth_passthrough/1.8 mod_bwlimited/1.4 PHP/4.3.3 mod_log_bytes/1.2 FrontPage/5.0.2.2634 mod_ssl/2.8.15 OpenSSL/0.9.6g # </serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -2016,6 +2172,7 @@
<service>
<wsdl>http://soap.einsteinware.com/email/emailservices.asmx?WSDL</wsdl>
<name>emailservicesTest</name>
+ <serverType>Microsoft-IIS/6.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpPost</protocol>
@@ -2025,6 +2182,7 @@
<service>
<wsdl>http://www.ejse.com/WeatherService/Service.asmx?WSDL</wsdl>
<name>ServiceTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -2035,6 +2193,7 @@
<service>
<wsdl>http://www.indobiz.com/IndoEconoCator.asmx?WSDL</wsdl>
<name>IndoEconoCatorTest</name>
+ <serverType>Microsoft-IIS/5.0 # </serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -2055,6 +2214,7 @@
<service>
<wsdl>http://www.abysal.com/soap/AbysalEmail.wsdl</wsdl>
<name>AbysalEmailTest</name>
+ <serverType>Abysal-webDTP/3.02 # </serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -2071,14 +2231,9 @@
<clientTest>false</clientTest>
</service>
<service>
- <wsdl>http://www.dotnetisp.com/webservices/dotnetisp/codepostal.asmx?WSDL</wsdl>
- <name>codepostalTest</name>
- <protocols />
- <clientTest>false</clientTest>
- </service>
- <service>
<wsdl>http://soap.systinet.net/demos/FreeDB/wsdl</wsdl>
<name>FreeDBTest</name>
+ <serverType>Systinet WASP Server for Java/4.6.1 (Java/1.4.2; Linux/2.4.20-24.7) # </serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -2087,6 +2242,7 @@
<service>
<wsdl>http://www.webservicex.net/FinanceService.asmx?WSDL</wsdl>
<name>FinanceServiceTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -2097,6 +2253,7 @@
<service>
<wsdl>http://arcweb.esri.com/services/v2/PlaceFinderSample.wsdl</wsdl>
<name>PlaceFinderSampleTest</name>
+ <serverType>Netscape-Enterprise/6.0 # </serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -2105,6 +2262,7 @@
<service>
<wsdl>http://www.PerfectXML.NET/WebServices/SalesRankNPrice/BookService.asmx?WSDL</wsdl>
<name>BookServiceTest</name>
+ <serverType>Microsoft-IIS/6.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -2115,6 +2273,7 @@
<service>
<wsdl>http://ws.xara.com/graphicrender/render3d.wsdl</wsdl>
<name>render3dTest</name>
+ <serverType>Microsoft-IIS/5.0 # </serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -2123,6 +2282,7 @@
<service>
<wsdl>http://www.bitwaste.com/xmethods/ATTPager/ATTPager.wsdl</wsdl>
<name>ATTPagerTest</name>
+ <serverType>Apache/2.0.40 (Red Hat Linux) PHP/4.2.2 DAV/2 # </serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -2157,6 +2317,7 @@
<service>
<wsdl>http://www.berneda.com/scripts/TeeChartSOAP.exe/wsdl/ITeeChart</wsdl>
<name>ITeeChartTest</name>
+ <serverType>Microsoft-IIS/6.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -2165,6 +2326,7 @@
<service>
<wsdl>http://www.discoverdance.co.uk/zipQuery/zipCodeService.asmx?wsdl</wsdl>
<name>zipCodeServiceTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -2173,6 +2335,7 @@
<service>
<wsdl>http://www.jusufdarmawan.com/wsprimegenerator.exe/wsdl/IPrimeGenerator</wsdl>
<name>IPrimeGeneratorTest</name>
+ <serverType>Microsoft-IIS/5.0 # </serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -2181,6 +2344,7 @@
<service>
<wsdl>http://www.xeeinc.com/RateInformation/RateInfo.asmx?WSDL</wsdl>
<name>RateInfoTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -2191,14 +2355,16 @@
<service>
<wsdl>http://www.xmethods.net/sd/2001/TemperatureService.wsdl</wsdl>
<name>TemperatureServiceTest</name>
+ <serverType>Enhydra-MultiServer/3.1.1b1 # </serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
- <clientTest>false</clientTest>
+ <clientTest>true</clientTest>
</service>
<service>
<wsdl>http://www.xmethods.net/wsdl/query.wsdl</wsdl>
<name>queryTest</name>
+ <serverType>Apache/1.3.26 (Unix) Enhydra-Director/3 PHP/4.0.6 DAV/1.0.3 AuthNuSphere/1.0.0 # </serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -2207,6 +2373,7 @@
<service>
<wsdl>http://appserver.pepperzak.net/bankcode/BankCodeEJBHome/wsdl.jsp</wsdl>
<name>BankCodeEJBHomeTest</name>
+ <serverType>WebLogic WebLogic Server 6.1 SP1 09/18/2001 14:28:44 #138716 # </serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -2215,6 +2382,7 @@
<service>
<wsdl>http://ws2.serviceobjects.net/pt/PackTrack.asmx?WSDL</wsdl>
<name>PackTrackTest</name>
+ <serverType>Microsoft-IIS/5.0 # </serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -2225,6 +2393,7 @@
<service>
<wsdl>http://www.marotz.se/scripts/zipinfo.exe/wsdl/ISwedishZipInfo</wsdl>
<name>ISwedishZipInfoTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -2233,6 +2402,7 @@
<service>
<wsdl>http://wavendon.dsdata.co.uk/axis/services/WhoisData?wsdl</wsdl>
<name>WhoisDataTest</name>
+ <serverType>Apache/2.0.39 (Win32) mod_jk/1.2.0 # </serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -2241,6 +2411,7 @@
<service>
<wsdl>http://www.xignite.com/xrealtime.asmx?WSDL</wsdl>
<name>xrealtimeTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -2251,6 +2422,7 @@
<service>
<wsdl>http://www.extensio.com:8080/ExtensioInfoServer/mbsoap/MBWSSoapServices.wsdl</wsdl>
<name>MBWSSoapServicesTest</name>
+ <serverType>Apache/1.3.27 (Unix) mod_jk/1.1.0 # </serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -2259,6 +2431,7 @@
<service>
<wsdl>http://www.xignite.com/xSurvey.asmx?WSDL</wsdl>
<name>xSurveyTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -2269,6 +2442,7 @@
<service>
<wsdl>http://www.abundanttech.com/webservices/deadoralive/deadoralive.wsdl</wsdl>
<name>deadoraliveTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -2287,6 +2461,7 @@
<service>
<wsdl>http://www.bindingpoint.com/ws/imalert/imalert.asmx?wsdl</wsdl>
<name>imalertTest</name>
+ <serverType>Microsoft-IIS/6.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -2297,6 +2472,7 @@
<service>
<wsdl>http://www.PerfectXML.net/WebServices/MusicTeachers/MusicTeachers.asmx?wsdl</wsdl>
<name>MusicTeachersTest</name>
+ <serverType>Microsoft-IIS/6.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -2319,14 +2495,9 @@
<clientTest>false</clientTest>
</service>
<service>
- <wsdl>http://www.interpressfact.net/webservices/getAds.asmx?wsdl</wsdl>
- <name>getAdsTest</name>
- <protocols />
- <clientTest>false</clientTest>
- </service>
- <service>
<wsdl>http://www.framewerks.com/WebServices/HTMLeMail/HTMLeMail.asmx?WSDL</wsdl>
<name>HTMLeMailTest</name>
+ <serverType>Microsoft-IIS/5.0 Geobytes-GeoSelect/2.1.0.1 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -2335,6 +2506,7 @@
<service>
<wsdl>http://www.quisque.com/fr/techno/eqimage/eqimage.asmx?WSDL</wsdl>
<name>eqimageTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -2343,6 +2515,7 @@
<service>
<wsdl>http://xml.nig.ac.jp/wsdl/Fasta.wsdl</wsdl>
<name>FastaTest</name>
+ <serverType>GLUE/3.2.1,Apache Coyote/1.0 # </serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -2351,6 +2524,7 @@
<service>
<wsdl>http://reto.checkit.ch/Scripts/Lotto.dll/wsdl/IgetNumbers</wsdl>
<name>IgetNumbersTest</name>
+ <serverType>Microsoft-IIS/6.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -2359,6 +2533,7 @@
<service>
<wsdl>http://www.webservicex.net/SendSMS.asmx?WSDL</wsdl>
<name>SendSMSTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -2369,6 +2544,7 @@
<service>
<wsdl>http://wavendon.dsdata.co.uk/axis/services/SpamKiller?wsdl</wsdl>
<name>SpamKillerTest</name>
+ <serverType>Apache/2.0.39 (Win32) mod_jk/1.2.0 # </serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -2377,6 +2553,7 @@
<service>
<wsdl>http://webservices.imacination.com/distance/Distance.jws?wsdl</wsdl>
<name>DistanceTest</name>
+ <serverType>Resin/2.1.7 # </serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -2385,6 +2562,7 @@
<service>
<wsdl>http://www.barnaland.is/dev/personlookup.asmx?WSDL</wsdl>
<name>personlookupTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -2395,6 +2573,7 @@
<service>
<wsdl>http://www.esynaps.com/WebServices/WhoIsService.asmx?WSDL</wsdl>
<name>WhoIsServiceTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -2411,6 +2590,7 @@
<service>
<wsdl>http://api.google.com/GoogleSearch.wsdl</wsdl>
<name>GoogleSearchTest</name>
+ <serverType>GFE/1.3 # </serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -2419,6 +2599,7 @@
<service>
<wsdl>http://www.esynaps.com/webservices/codegenerator.asmx?WSDL</wsdl>
<name>codegeneratorTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -2427,6 +2608,7 @@
<service>
<wsdl>http://www.flash-db.com/services/ws/barCodes.wsdl</wsdl>
<name>barCodesTest</name>
+ <serverType>Apache/1.3.28 (Unix) mod_auth_passthrough/1.8 mod_bwprotect/0.2 mod_bwlimited/1.2 PHP/4.3.3 mod_log_bytes/1.2 FrontPage/5.0.2.2634 # PHP/4.3.3</serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -2445,6 +2627,7 @@
<service>
<wsdl>http://server1.pointwsp.net/ws/finance/currency.asmx?WSDL</wsdl>
<name>currencyTest</name>
+ <serverType>Microsoft-IIS/5.0 # </serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -2455,6 +2638,7 @@
<service>
<wsdl>http://www.ebob42.com/cgi-bin/NumberToWordsInDutch.exe/wsdl/IDutch</wsdl>
<name>IDutchTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -2463,6 +2647,7 @@
<service>
<wsdl>http://www.lixusnet.com/lixusnet/HPcatalog.jws?wsdl</wsdl>
<name>HPcatalogTest</name>
+ <serverType>NGASI Managed Hosting Application Server/2.0,Apache Tomcat/4.0 (HTTP/1.1 Connector) # </serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -2471,6 +2656,7 @@
<service>
<wsdl>http://www.oakleaf.ws/cfrsearchws/cfrsearchws.asmx?wsdl</wsdl>
<name>cfrsearchwsTest</name>
+ <serverType>Microsoft-IIS/5.0 # </serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -2481,6 +2667,7 @@
<service>
<wsdl>http://glkev.webs.innerhost.com/glkev_ws/StockServices.asmx?WSDL</wsdl>
<name>StockServicesTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -2491,6 +2678,7 @@
<service>
<wsdl>http://ws.acrosscommunications.com/Fax.asmx?WSDL</wsdl>
<name>FaxTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -2499,6 +2687,7 @@
<service>
<wsdl>http://www.dl-me.com/etoaservice/engtoarabic.asmx?WSDL</wsdl>
<name>engtoarabicTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -2507,6 +2696,7 @@
<service>
<wsdl>http://www.webservicex.net/AustralianPostCode.asmx?WSDL</wsdl>
<name>AustralianPostCodeTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -2517,6 +2707,7 @@
<service>
<wsdl>http://www.webservicex.net/country.asmx?wsdl</wsdl>
<name>countryTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -2527,6 +2718,7 @@
<service>
<wsdl>http://www.esynaps.com/WebServices/SearchWS.asmx?WSDL</wsdl>
<name>SearchWSTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -2535,6 +2727,7 @@
<service>
<wsdl>http://www.flash-db.com/services/ws/flashBarChart.wsdl</wsdl>
<name>flashBarChartTest</name>
+ <serverType>Apache/1.3.28 (Unix) mod_auth_passthrough/1.8 mod_bwprotect/0.2 mod_bwlimited/1.2 PHP/4.3.3 mod_log_bytes/1.2 FrontPage/5.0.2.2634 # PHP/4.3.3</serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -2543,6 +2736,7 @@
<service>
<wsdl>http://ws.cdyne.com/SpellChecker/check.asmx?wsdl</wsdl>
<name>checkTest</name>
+ <serverType>Microsoft-IIS/6.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -2553,6 +2747,7 @@
<service>
<wsdl>http://www.xmethods.net/sd/2001/BabelFishService.wsdl</wsdl>
<name>BabelFishServiceTest</name>
+ <serverType>Apache/1.3.26 (Unix) Enhydra-Director/3 PHP/4.0.6 DAV/1.0.3 AuthNuSphere/1.0.0 # </serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -2561,6 +2756,7 @@
<service>
<wsdl>http://ws2.serviceobjects.net/sq/FastQuote.asmx?WSDL</wsdl>
<name>FastQuoteTest</name>
+ <serverType>Microsoft-IIS/5.0 # </serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -2571,6 +2767,7 @@
<service>
<wsdl>http://glkev.webs.innerhost.com/glkev_ws/Currencyws.asmx?WSDL</wsdl>
<name>CurrencywsTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -2581,6 +2778,7 @@
<service>
<wsdl>http://www.swanandmokashi.com/HomePage/WebServices/Horoscope.asmx?WSDL</wsdl>
<name>HoroscopeTest</name>
+ <serverType>Microsoft-IIS/5.0 # </serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -2601,6 +2799,7 @@
<service>
<wsdl>http://ws2.serviceobjects.net/uspo/USPatentOffice.asmx?WSDL</wsdl>
<name>USPatentOfficeTest</name>
+ <serverType>Microsoft-IIS/5.0 # </serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -2611,6 +2810,7 @@
<service>
<wsdl>http://ws.cdyne.com/ziptogeo/zip2geo.asmx?wsdl</wsdl>
<name>zip2geoTest</name>
+ <serverType>Microsoft-IIS/6.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -2621,6 +2821,7 @@
<service>
<wsdl>http://www.webservicex.net/icd9.asmx?WSDL</wsdl>
<name>icd9Test</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -2631,6 +2832,7 @@
<service>
<wsdl>http://www.xignite.com/xquotes.asmx?WSDL</wsdl>
<name>xquotesTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -2641,6 +2843,7 @@
<service>
<wsdl>http://www.webservicex.net/BibleWebservice.asmx?wsdl</wsdl>
<name>BibleWebserviceTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -2651,6 +2854,7 @@
<service>
<wsdl>http://ws.acrosscommunications.com/Phone.asmx?WSDL</wsdl>
<name>PhoneTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -2659,6 +2863,7 @@
<service>
<wsdl>http://www.esynaps.com/WebServices/NFLNews.asmx?WSDL</wsdl>
<name>NFLNewsTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -2667,6 +2872,7 @@
<service>
<wsdl>http://www.stgregorioschurchdc.org/wsdl/Calendar.wsdl</wsdl>
<name>CalendarTest</name>
+ <serverType>Apache/1.3.27 (Unix) PHP/4.2.3 FrontPage/5.0.2.2510 Rewrit/1.1a # </serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -2675,6 +2881,7 @@
<service>
<wsdl>http://www.xignite.com/xEdgar.asmx?WSDL</wsdl>
<name>xEdgarTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -2685,6 +2892,7 @@
<service>
<wsdl>http://www.webservicex.net/globalweather.asmx?WSDL</wsdl>
<name>globalweatherTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -2695,6 +2903,7 @@
<service>
<wsdl>http://www.abundanttech.com/webservices/bnprice/bnprice.wsdl</wsdl>
<name>bnpriceTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -2705,6 +2914,7 @@
<service>
<wsdl>http://ws2.serviceobjects.net/upc/UPC.asmx?WSDL</wsdl>
<name>UPCTest</name>
+ <serverType>Microsoft-IIS/5.0 # </serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -2715,6 +2925,7 @@
<service>
<wsdl>http://www.bitounis.com/IBAN/IBANFuncs.asmx?WSDL</wsdl>
<name>IBANFuncsTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -2735,6 +2946,7 @@
<service>
<wsdl>http://ws2.serviceobjects.net/ev/EmailValidate.asmx?WSDL</wsdl>
<name>EmailValidateTest</name>
+ <serverType>Microsoft-IIS/5.0 # </serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -2745,6 +2957,7 @@
<service>
<wsdl>http://www.webservicex.net/ValidateEmail.asmx?WSDL</wsdl>
<name>ValidateEmailTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -2763,6 +2976,7 @@
<service>
<wsdl>http://ws2.serviceobjects.net/whi/WhoIs.asmx?WSDL</wsdl>
<name>WhoIsTest</name>
+ <serverType>Microsoft-IIS/5.0 # </serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -2771,14 +2985,9 @@
<clientTest>false</clientTest>
</service>
<service>
- <wsdl>http://www.interpressfact.net/webservices/getJoke.asmx?wsdl</wsdl>
- <name>getJokeTest</name>
- <protocols />
- <clientTest>false</clientTest>
- </service>
- <service>
<wsdl>http://arcweb.esri.com/services/v2/MapImage.wsdl</wsdl>
<name>MapImageTest</name>
+ <serverType>Netscape-Enterprise/6.0 # </serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -2787,6 +2996,7 @@
<service>
<wsdl>http://xml.nig.ac.jp/wsdl/DDBJ.wsdl</wsdl>
<name>DDBJTest</name>
+ <serverType>GLUE/3.2.1,Apache Coyote/1.0 # </serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -2795,6 +3005,7 @@
<service>
<wsdl>http://urljr.com/soap</wsdl>
<name>urljrTest</name>
+ <serverType>Apache/2.0.44 (Win32) DAV/2 mod_ssl/2.0.43 OpenSSL/0.9.6g PHP/4.3.3 # </serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -2803,6 +3014,7 @@
<service>
<wsdl>http://localhost:8080/ConvDocEncBar.asmx?wsdl</wsdl>
<name>ConvDocEncBarTest</name>
+ <serverType>Mono-XSP Server/0.6.99.0 128 # Mono</serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -2813,6 +3025,7 @@
<service>
<wsdl>http://localhost:8080/ConvDocLitWra.asmx?wsdl</wsdl>
<name>ConvDocLitWraTest</name>
+ <serverType>Mono-XSP Server/0.6.99.0 128 # Mono</serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -2823,6 +3036,7 @@
<service>
<wsdl>http://localhost:8080/ConvDocLitBar.asmx?wsdl</wsdl>
<name>ConvDocLitBarTest</name>
+ <serverType>Mono-XSP Server/0.6.99.0 128 # Mono</serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -2833,6 +3047,7 @@
<service>
<wsdl>http://localhost:8080/ConvRpc.asmx?wsdl</wsdl>
<name>ConvRpcTest</name>
+ <serverType>Mono-XSP Server/0.6.99.0 128 # Mono</serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -2843,6 +3058,7 @@
<service>
<wsdl>http://localhost:8080/ConvDocEncWra.asmx?wsdl</wsdl>
<name>ConvDocEncWraTest</name>
+ <serverType>Mono-XSP Server/0.6.99.0 128 # Mono</serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -2853,6 +3069,7 @@
<service>
<wsdl>http://www.abctext.com/webservices/SMS.asmx?WSDL</wsdl>
<name>SMSTest2</name>
+ <serverType>Microsoft-IIS/6.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -2871,6 +3088,7 @@
<service>
<wsdl>http://www.webservicex.net/isbn.asmx?WSDL</wsdl>
<name>isbnTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
<protocol>HttpGet</protocol>
@@ -2881,6 +3099,7 @@
<service>
<wsdl>http://www.drbob42.co.uk/cgi-bin/Euro42/wsdl/IEuro</wsdl>
<name>IEuroTest</name>
+ <serverType>Apache/1.3.29 (Unix) mod_auth_passthrough/1.8 mod_log_bytes/1.2 mod_bwlimited/1.4 PHP/4.3.3 FrontPage/5.0.2.2634 mod_ssl/2.8.16 OpenSSL/0.9.7a # </serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -2889,6 +3108,7 @@
<service>
<wsdl>http://www.verbix.com/cgi-bin/soapx.exe/wsdl/IGetInflection</wsdl>
<name>IGetInflectionTest</name>
+ <serverType>Microsoft-IIS/5.0 # </serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -2897,6 +3117,7 @@
<service>
<wsdl>http://www.culand.net/WebServices/bin/WSMaze_Server.dll/wsdl/IWSMazeServer</wsdl>
<name>IWSMazeServerTest</name>
+ <serverType>Microsoft-IIS/5.1 # ASP.NET</serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -2905,6 +3126,7 @@
<service>
<wsdl>http://63.138.157.107/av/wsdl/ITAddressValidations</wsdl>
<name>ITAddressValidationsTest</name>
+ <serverType>Apache/1.3.28 (Win32) PHP/4.3.3 # </serverType>
<protocols>
<protocol>Soap</protocol>
</protocols>
@@ -2928,4 +3150,137 @@
</protocols>
<clientTest>false</clientTest>
</service>
+ <service>
+ <wsdl>http://greg.froh.ca/fun/random_bushism/soap/?wsdl</wsdl>
+ <name>Test</name>
+ <serverType>Apache/1.3.29 (Unix) PHP/4.3.3 # PHP/4.3.3</serverType>
+ <protocols>
+ <protocol>Soap</protocol>
+ </protocols>
+ <clientTest>false</clientTest>
+ </service>
+ <service>
+ <wsdl>http://lokeuei.malaysiandevelopers.net/magnum4d/results.asmx?WSDL</wsdl>
+ <name>resultsTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
+ <protocols>
+ <protocol>Soap</protocol>
+ </protocols>
+ <clientTest>false</clientTest>
+ </service>
+ <service>
+ <wsdl>http://www.geomonster.com/GeoServe.asmx?WSDL</wsdl>
+ <name>GeoServeTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
+ <protocols>
+ <protocol>Soap</protocol>
+ <protocol>HttpGet</protocol>
+ <protocol>HttpPost</protocol>
+ </protocols>
+ <clientTest>false</clientTest>
+ </service>
+ <service>
+ <wsdl>http://nagraj.hopto.org/axis/services/ZenQuoteService?wsdl</wsdl>
+ <name>ZenQuoteServiceTest</name>
+ <serverType>Apache-Coyote/1.1 # </serverType>
+ <protocols>
+ <protocol>Soap</protocol>
+ </protocols>
+ <clientTest>false</clientTest>
+ </service>
+ <service>
+ <wsdl>http://www.ghettodriveby.com/soap/?wsdl</wsdl>
+ <name>Test2</name>
+ <serverType>Apache/1.3.29 (Unix) PHP/4.3.3 # PHP/4.3.3</serverType>
+ <protocols>
+ <protocol>Soap</protocol>
+ </protocols>
+ <clientTest>false</clientTest>
+ </service>
+ <service>
+ <wsdl>http://ocean.cse.ucsc.edu/soap/getCAWeather.wsdl</wsdl>
+ <name>getCAWeatherTest</name>
+ <serverType>Apache/2.0.46 (Unix) mod_ssl/2.0.46 OpenSSL/0.9.6g DAV/2 SOAP/1.1 Catacomb/0.9.1-dev # </serverType>
+ <protocols>
+ <protocol>Soap</protocol>
+ </protocols>
+ <clientTest>false</clientTest>
+ </service>
+ <service>
+ <wsdl>http://localhost:8080/foo.asmx?wsdl</wsdl>
+ <name>fooTest</name>
+ <serverType>Mono-XSP Server/0.6.99.0 128 # Mono</serverType>
+ <protocols>
+ <protocol>Soap</protocol>
+ <protocol>HttpGet</protocol>
+ <protocol>HttpPost</protocol>
+ </protocols>
+ <clientTest>false</clientTest>
+ </service>
+ <service>
+ <wsdl>http://www.xignite.com/xInsider.asmx?WSDL</wsdl>
+ <name>xInsiderTest</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
+ <protocols>
+ <protocol>Soap</protocol>
+ <protocol>HttpGet</protocol>
+ <protocol>HttpPost</protocol>
+ </protocols>
+ <clientTest>false</clientTest>
+ </service>
+ <service>
+ <wsdl>http://webservices.geomonster.com/GeoServe.asmx?wsdl</wsdl>
+ <name>GeoServeTest2</name>
+ <serverType>Microsoft-IIS/5.0 # ASP.NET</serverType>
+ <protocols>
+ <protocol>Soap</protocol>
+ <protocol>HttpGet</protocol>
+ <protocol>HttpPost</protocol>
+ </protocols>
+ <clientTest>false</clientTest>
+ </service>
+ <service>
+ <wsdl>http://localhost:8080/TestBinding1.asmx?wsdl</wsdl>
+ <name>TestBinding1Test</name>
+ <serverType>Mono-XSP Server/0.6.99.0 128 # Mono</serverType>
+ <protocols>
+ <protocol>Soap</protocol>
+ <protocol>HttpGet</protocol>
+ <protocol>HttpPost</protocol>
+ </protocols>
+ <clientTest>false</clientTest>
+ </service>
+ <service>
+ <wsdl>http://localhost:8080/TestBinding2.asmx?wsdl</wsdl>
+ <name>TestBinding2Test</name>
+ <serverType>Mono-XSP Server/0.6.99.0 128 # Mono</serverType>
+ <protocols>
+ <protocol>Soap</protocol>
+ <protocol>HttpGet</protocol>
+ <protocol>HttpPost</protocol>
+ </protocols>
+ <clientTest>false</clientTest>
+ </service>
+ <service>
+ <wsdl>http://localhost:8080/TestBinding4.asmx?wsdl</wsdl>
+ <name>TestBinding4Test</name>
+ <serverType>Mono-XSP Server/0.6.99.0 128 # Mono</serverType>
+ <protocols>
+ <protocol>Soap</protocol>
+ <protocol>HttpGet</protocol>
+ <protocol>HttpPost</protocol>
+ </protocols>
+ <clientTest>true</clientTest>
+ </service>
+ <service>
+ <wsdl>http://localhost:8080/TestBinding3.asmx?wsdl</wsdl>
+ <name>TestBinding3Test</name>
+ <serverType>Mono-XSP Server/0.6.99.0 128 # Mono</serverType>
+ <protocols>
+ <protocol>Soap</protocol>
+ <protocol>HttpGet</protocol>
+ <protocol>HttpPost</protocol>
+ </protocols>
+ <clientTest>false</clientTest>
+ </service>
</services> \ No newline at end of file
diff --git a/mcs/class/System.Web.Services/Test/standalone/wsdl.ignore b/mcs/class/System.Web.Services/Test/standalone/wsdl.ignore
index 52d388c9cea..e114b9f3cfc 100644
--- a/mcs/class/System.Web.Services/Test/standalone/wsdl.ignore
+++ b/mcs/class/System.Web.Services/Test/standalone/wsdl.ignore
@@ -21,3 +21,13 @@ http://soapclient.com/xml/certService.wsdl # Wrong schema
http://ws.xara.com/navbar/navbar.wsdl # Wrong schema
http://www.cs.fsu.edu/~engelen/magic.wsdl # Wrong schema
http://www.agnisoft.com/soap/mssoapmp3search.xml # Wrong schema
+http://www.cs.fsu.edu/~engelen/lu.wsdl # Old schema version
+http://www.drouet-web.com/webservices/soap_cdtek.php?wsdl # Wrong WSDL (empty)
+http://www.dotnetisp.com/webservices/dotnetisp/src2html.asmx?WSDL # Not a wsdl doc
+http://www.dotnetisp.com/webservices/dotnetisp/ville.asmx?WSDL # Not a wsdl doc
+http://www.dotnetisp.com/webservices/dotnetisp/codepostal.asmx?WSDL # Not a wsdl doc
+http://interpressfact.net/webservices/promotionService.asmx?wsdl # Not a wsdl doc
+http://www.interpressfact.net/webservices/getAds.asmx?wsdl # Not a wsdl doc
+http://soap.prowizorka.com/spam/wsdl/ISpamCheck # Not working
+http://www.interpressfact.net/webservices/getJoke.asmx?wsdl # Not working
+http://www.transactionalweb.com/SOAP/geoserve.wsdl # Bug in Mono!!
diff --git a/mcs/class/System.Web.Services/Test/standalone/wstest.cs b/mcs/class/System.Web.Services/Test/standalone/wstest.cs
index 442c4804ac1..a25093ee971 100644
--- a/mcs/class/System.Web.Services/Test/standalone/wstest.cs
+++ b/mcs/class/System.Web.Services/Test/standalone/wstest.cs
@@ -102,10 +102,13 @@ public class Driver
foreach (string prot in sd.Protocols)
clientHash [GetProxyFile (sd, prot)] = sd;
+
+ clientHash [GetWsdlFile (sd)] = sd;
}
Clean (clientHash, GetClientPath ());
Clean (clientHash, GetProxyPath ());
+ Clean (clientHash, GetWsdlPath ());
}
static void Clean (Hashtable clientHash, string path)
@@ -161,37 +164,54 @@ public class Driver
ArrayList list = new ArrayList (client.References.Values);
foreach (DiscoveryReference re in list)
{
+ if (!(re is ContractReference)) continue;
+
bool ignore = ignoreList.Contains (re.Url);
+
ServiceData sd = FindService (re.Url);
- if (sd != null)
+
+ if (ignore)
{
- if (ignore) RemoveService (re.Url);
+ if (sd != null) RemoveService (re.Url);
continue;
}
- if (ignore) continue;
-
- Console.Write ("Resolving " + re.Url + " ");
- try
- {
- re.Resolve ();
- Console.WriteLine ("OK");
-
- ServiceDescription doc = client.Documents [re.Url] as ServiceDescription;
- if (doc != null)
- services.services.Add (CreateServiceData (re, doc));
- }
- catch (Exception ex)
+ if (sd == null || !File.Exists (GetWsdlFile(sd)))
{
- Console.WriteLine ("FAILED");
- ReportError ("Error resolving: " + re.Url, ex.ToString ());
+ Console.Write ("Resolving " + re.Url + " ");
+ try
+ {
+ DiscoveryClientProtocol contract = new DiscoveryClientProtocol ();
+ contract.DiscoverAny (re.Url);
+ if (sd == null)
+ {
+ sd = CreateServiceData (re, contract);
+ services.services.Add (sd);
+ }
+
+ string wsdlFile = GetWsdlFile (sd);
+ CreateFolderForFile (wsdlFile);
+
+ ServiceDescription doc = (ServiceDescription) contract.Documents [re.Url];
+ doc.Write (wsdlFile);
+
+ Console.WriteLine ("OK");
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine ("FAILED");
+ ReportError ("Error resolving: " + re.Url, ex.ToString ());
+ }
}
}
}
- public static ServiceData CreateServiceData (DiscoveryReference dref, ServiceDescription doc)
+ public static ServiceData CreateServiceData (DiscoveryReference dref, DiscoveryClientProtocol contract)
{
ServiceData sd = new ServiceData ();
+ ServiceDescriptionCollection col = new ServiceDescriptionCollection ();
+ foreach (object doc in contract.Documents.Values)
+ if (doc is ServiceDescription) col.Add ((ServiceDescription)doc);
string name = GetServiceName (dref);
sd.Name = name;
@@ -204,7 +224,7 @@ public class Driver
sd.Wsdl = dref.Url;
- string loc = GetLocation (doc);
+ string loc = GetLocation (col[0]);
if (loc != null)
{
WebResponse res = null;
@@ -223,16 +243,14 @@ public class Driver
}
}
- ArrayList bins = GetBindingTypes (doc);
+ ArrayList bins = GetBindingTypes (col);
sd.Protocols = (string[]) bins.ToArray(typeof(string));
return sd;
}
-
- static ArrayList GetBindingTypes (ServiceDescription doc)
+
+ static ArrayList GetBindingTypes (ServiceDescriptionCollection col)
{
- ServiceDescriptionCollection col = new ServiceDescriptionCollection ();
- col.Add (doc);
-
+ ServiceDescription doc = col [0];
ArrayList list = new ArrayList ();
foreach (Service s in doc.Services)
{
@@ -394,11 +412,13 @@ public class Driver
static void BuildProxy (ServiceData fd, bool rebuild, ArrayList proxies)
{
- string wsdl = fd.Wsdl;
+ string wsdl = GetWsdlFile (fd);
+ if (!File.Exists (wsdl))
+ return;
if (fd.Protocols == null)
{
- ReportError ("Client test '" + fd.Name + "': no protocols declared", null);
+ ReportError ("Client test '" + fd.Name + "': no protocols declared", "");
return;
}
@@ -414,36 +434,40 @@ public class Driver
Console.Write (prot + " proxy for " + wsdl + "... ");
Process proc = new Process ();
+ proc.StartInfo.UseShellExecute = false;
proc.StartInfo.RedirectStandardOutput = true;
proc.StartInfo.RedirectStandardError = true;
proc.StartInfo.FileName = "wsdl";
- proc.StartInfo.Arguments = "-out:" + pfile + " -nologo -namespace:" + ns + " -protocol:" + prot + " " + wsdl;
+ proc.StartInfo.Arguments = "/out:" + pfile + " /nologo /namespace:" + ns + " /protocol:" + prot + " " + wsdl;
proc.Start();
proc.WaitForExit ();
if (proc.ExitCode != 0)
{
- Console.WriteLine ("FAIL");
+ Console.WriteLine ("FAIL " + proc.ExitCode);
string err = proc.StandardOutput.ReadToEnd ();
err += "\n" + proc.StandardError.ReadToEnd ();
- if (proc.ExitCode == 1) {
- string fn = fd.Name + prot + "Proxy.cs";
- fn = Path.Combine (GetErrorPath(), fn);
- CreateFolderForFile (fn);
- File.Move (pfile, fn);
-
- StreamWriter sw = new StreamWriter (fn, true);
- sw.WriteLine ();
- sw.WriteLine ("// " + fd.Wsdl);
- sw.WriteLine ();
- sw.Close ();
-
+ if (File.Exists (pfile))
+ {
+ if (proc.ExitCode == 1) {
+ string fn = fd.Name + prot + "Proxy.cs";
+ fn = Path.Combine (GetErrorPath(), fn);
+ CreateFolderForFile (fn);
+ File.Move (pfile, fn);
+
+ StreamWriter sw = new StreamWriter (fn, true);
+ sw.WriteLine ();
+ sw.WriteLine ("// " + fd.Wsdl);
+ sw.WriteLine ();
+ sw.Close ();
+
+ }
+ else
+ File.Delete (pfile);
}
- else
- File.Delete (pfile);
-
+
ReportError ("Errors found while generating " + prot + " proxy for WSDL: " + wsdl, err);
}
else
@@ -517,6 +541,12 @@ public class Driver
return Path.Combine (GetClientPath(), sd.TestFile);
}
+ static string GetWsdlFile (ServiceData fd)
+ {
+ string fn = Path.Combine (new Uri (fd.Wsdl).Host, fd.Name + ".wsdl");
+ return Path.Combine (GetWsdlPath(), fn);
+ }
+
static void ReportError (string error, string detail)
{
string fn = Path.Combine (GetErrorPath(), "error.log");
@@ -545,6 +575,11 @@ public class Driver
return Path.Combine (basePath, "error");
}
+ static string GetWsdlPath ()
+ {
+ return Path.Combine (basePath, "wsdlcache");
+ }
+
static void CreateFolderForFile (string file)
{
string dir = Path.GetDirectoryName (file);
diff --git a/mcs/class/System.Web/ChangeLog b/mcs/class/System.Web/ChangeLog
index 1bb418073d5..4c7242a4471 100644
--- a/mcs/class/System.Web/ChangeLog
+++ b/mcs/class/System.Web/ChangeLog
@@ -1,3 +1,23 @@
+2004-01-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * System.Web.dll.sources: added new files in S.W.Configuration.
+
+2004-01-11 Andreas Nahr <ClassDevelopment@A-SoftTech.com>
+
+ * makefile: Dependency to EnterpriseServices.dll added
+ * System.Web.dll.sources: Added 4 files in System.Util, sorted Web.Util
+ file names.
+
+2004-01-10 Jackson Harper <jackson@ximian.com>
+
+ * System.Web.dll.sources: Add TraceConfig.cs and
+ TraceConfigurationHandler.cs to the build.
+
+2004-01-10 Jackson Harper <jackson@ximian.com>
+
+ * System.Web.dll.sources: Add TraceData.cs and TraceManager.cs to
+ build.
+
2003-12-18 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* System.Web.dll.sources: added HttpRequestValidationException.
diff --git a/mcs/class/System.Web/System.Web.Caching/Cache.cs b/mcs/class/System.Web/System.Web.Caching/Cache.cs
index a14829d17ba..05304b88d07 100644
--- a/mcs/class/System.Web/System.Web.Caching/Cache.cs
+++ b/mcs/class/System.Web/System.Web.Caching/Cache.cs
@@ -428,6 +428,16 @@ namespace System.Web.Caching
return objEntry.Item;
}
+ internal CacheEntry GetEntry (string strKey)
+ {
+ CacheEntry objEntry = UpdateCache (strKey, null, false, CacheItemRemovedReason.Expired);
+
+ if (objEntry == null)
+ return null;
+
+ return objEntry;
+ }
+
/// <summary>
/// Internal method used for removing, updating and adding CacheEntries into the cache.
/// </summary>
@@ -521,14 +531,14 @@ namespace System.Web.Caching
if (objEntry.HasAbsoluteExpiration || objEntry.HasSlidingExpiration)
_objExpires.Remove (objEntry);
}
-
- // Return the entry, it's not up to the UpdateCache to call Close on the entry
- return objEntry;
+ return null;
}
// If we have sliding expiration and we have a correct hit, update the expiration manager
- if (objEntry.HasSlidingExpiration)
+ if (objEntry.HasSlidingExpiration) {
_objExpires.Update (objEntry, ticksExpires);
+ objEntry.Expires = ticksExpires;
+ }
// Return the cache entry
return objEntry;
diff --git a/mcs/class/System.Web/System.Web.Caching/CacheDependency.cs b/mcs/class/System.Web/System.Web.Caching/CacheDependency.cs
index 7cc4c581cdd..7abbd0565a0 100644
--- a/mcs/class/System.Web/System.Web.Caching/CacheDependency.cs
+++ b/mcs/class/System.Web/System.Web.Caching/CacheDependency.cs
@@ -95,7 +95,7 @@ namespace System.Web.Caching
}
this.filenames = filenames;
-
+
if (cachekeys == null)
cachekeys = noStrings;
@@ -114,16 +114,25 @@ namespace System.Web.Caching
int nentries = cachekeys.Length + ((dependency.entries == null) ? 0 :
dependency.entries.Length);
+
if (nentries != 0) {
this.removedDelegate = new CacheItemRemovedCallback (CacheItemRemoved);
this.entries = new CacheEntry [nentries];
+
+ int i = 0;
if (dependency.entries != null) {
- int i = 0;
foreach (CacheEntry entry in dependency.entries) {
entry._onRemoved += removedDelegate;
- i++;
+ entries [i++] = entry;
}
}
+
+ Cache cache = HttpRuntime.Cache;
+ for (int c=0; c<cachekeys.Length; c++) {
+ CacheEntry entry = cache.GetEntry (cachekeys [c]);
+ entry._onRemoved += removedDelegate;
+ entries [i++] = entry;
+ }
}
if (filenames.Length > 0) {
diff --git a/mcs/class/System.Web/System.Web.Caching/CachedRawResponse.cs b/mcs/class/System.Web/System.Web.Caching/CachedRawResponse.cs
index b46e93940ec..6e315a55e28 100644
--- a/mcs/class/System.Web/System.Web.Caching/CachedRawResponse.cs
+++ b/mcs/class/System.Web/System.Web.Caching/CachedRawResponse.cs
@@ -17,16 +17,18 @@ namespace System.Web.Caching {
internal class CachedRawResponse {
private HttpCachePolicy policy;
- private Hashtable vparams;
+ private CachedVaryBy varyby;
private int status_code;
private string status_desc;
private int content_length;
private ArrayList headers;
+ private HttpResponseHeader date_header;
private byte[] buffer;
internal CachedRawResponse (HttpCachePolicy policy)
{
this.policy = policy;
+ this.varyby = varyby;
this.buffer = new byte [HttpWriter.MaxBufferSize];
}
@@ -34,7 +36,12 @@ namespace System.Web.Caching {
get { return policy; }
set { policy = value; }
}
-
+
+ internal CachedVaryBy VaryBy {
+ get { return varyby; }
+ set { varyby = value; }
+ }
+
internal int StatusCode {
get { return status_code; }
set { status_code = value; }
@@ -53,6 +60,11 @@ namespace System.Web.Caching {
internal ArrayList Headers {
get { return headers; }
}
+
+ internal HttpResponseHeader DateHeader {
+ get { return date_header; }
+ set { date_header = value; }
+ }
internal void SetHeaders (ArrayList headers) {
this.headers = headers;
@@ -62,13 +74,6 @@ namespace System.Web.Caching {
{
this.buffer = buffer;
}
-
-
- internal void SetResponseHeaders (HttpResponse response)
- {
- foreach (HttpResponseHeader hdr in headers)
- response.AppendHeader (hdr.Name, hdr.Value);
- }
internal byte[] GetData ()
{
diff --git a/mcs/class/System.Web/System.Web.Caching/CachedVaryBy.cs b/mcs/class/System.Web/System.Web.Caching/CachedVaryBy.cs
index 5c915e6377f..04242a27867 100644
--- a/mcs/class/System.Web/System.Web.Caching/CachedVaryBy.cs
+++ b/mcs/class/System.Web/System.Web.Caching/CachedVaryBy.cs
@@ -10,6 +10,7 @@
using System;
using System.Text;
+using System.Collections;
namespace System.Web.Caching {
@@ -18,15 +19,31 @@ namespace System.Web.Caching {
private string[] prms;
private string[] headers;
private string custom;
-
- internal CachedVaryBy (HttpCachePolicy policy)
+ private string key;
+ private ArrayList item_list;
+
+ internal CachedVaryBy (HttpCachePolicy policy, string key)
{
prms = policy.VaryByParams.GetParamNames ();
+ headers = policy.VaryByHeaders.GetHeaderNames ();
+ custom = policy.GetVaryByCustom ();
+ this.key = key;
+ item_list = new ArrayList ();
+ }
+
+ internal ArrayList ItemList {
+ get { return item_list; }
+ }
+
+ internal string Key {
+ get { return key; }
}
- internal string CreateKey (string file_path, HttpRequest request)
+ internal string CreateKey (string file_path, HttpContext context)
{
StringBuilder builder = new StringBuilder ();
+ HttpApplication app = context.ApplicationInstance;
+ HttpRequest request = context.Request;
builder.Append ("CachedRawResponse\n");
builder.Append (file_path);
@@ -45,9 +62,28 @@ namespace System.Web.Caching {
builder.Append ('\n');
}
}
+
+ if (headers != null) {
+ for (int i=0; i<headers.Length; i++) {
+ builder.Append ("VH:");
+ builder.Append (headers [i]);
+ builder.Append ('=');
+ builder.Append (request.Headers [headers [i]]);
+ builder.Append ('\n');
+ }
+ }
+
+ if (custom != null) {
+ string s = app.GetVaryByCustomString (context, custom);
+ builder.Append ("VC:");
+ builder.Append (custom);
+ builder.Append ('=');
+ builder.Append (s != null ? s : "__null__");
+ builder.Append ('\n');
+ }
return builder.ToString ();
}
- }
+ }
}
diff --git a/mcs/class/System.Web/System.Web.Caching/ChangeLog b/mcs/class/System.Web/System.Web.Caching/ChangeLog
index 172f97b784e..642a3ad6efb 100644
--- a/mcs/class/System.Web/System.Web.Caching/ChangeLog
+++ b/mcs/class/System.Web/System.Web.Caching/ChangeLog
@@ -1,3 +1,55 @@
+2004-01-14 Jackson Harper <jackson@ximian.com>
+
+ * Cache.cs: Return null when items are expired but have not been
+ removed yet.
+ * OutputCacheModule.cs: Handle sliding expirations. Remove hacks
+ checking if the item is expired, the cache no longer returns
+ expired items.
+
+2004-01-14 Jackson Harper <jackson@ximian.com>
+
+ * Cache.cs: When using sliding expiration update the cache objects
+ expires time as well as the expires entry expire time because the
+ objects expire time is checked when objects are pulled out. This
+ fixex bug #52778.
+
+2004-01-11 Jackson Harper <jackson@ximian.com>
+
+ * OutputCacheModule.cs: Remove varyby objects when there are no
+ more raw responses that belong to them.
+ * CachedRawResponse.cs: Keep a reference to the VaryBy object that
+ this response belongs to this is so the varyby can be cleaned up.
+ * CachedVaryBy.cs: Keep a reference to the keys that belong to the
+ varyby and a reference to the varyby's key.
+
+2004-01-04 Jackson Harper <jackson@ximian.com>
+
+ * OutputCacheModule.cs: Dont cache items when trace is enabled.
+
+2004-01-04 Jackson Harper <jackson@ximian.com>
+
+ * OutputCacheModule.cs: Update the date header value.
+ * CachedRawResponse.cs: Expose a ref to the date header, so it can
+ be easily set/updated. Remove unused methods and vars.
+
+2004-01-04 Jackson Harper <jackson@ximian.com>
+
+ * CacheDependency.cs: Copy all the entries into the entries array,
+ set on removed callback for items that we are dependent on.
+ * Cache.cs: Add method to get CacheEntry objects.
+ * OutputCacheModule.cs: Make raw repsonse entries dependent on
+ their varyby param entries.
+
+2004-01-04 Jackson Harper <jackson@ximian.com>
+
+ * OutputCacheModule.cs: VaryBy keys now need the HttpContext not just the request.
+ * CachedVaryBy.cs: Handle vary by headers, and vary by custom.
+
+2004-01-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ExpiresBuckets.cs: set _intPos when expanding the array. Fixes bug
+ 52541. Patch by Jan Jaros (mono-bug@jerryweb.info).
+
2003-11-21 Jackson Harper <jackson@ximian.com>
* OutputCacheModule.cs: Only cache a page if it has a 200 status
diff --git a/mcs/class/System.Web/System.Web.Caching/ExpiresBuckets.cs b/mcs/class/System.Web/System.Web.Caching/ExpiresBuckets.cs
index abcb2b8f238..ee6952b0bf3 100644
--- a/mcs/class/System.Web/System.Web.Caching/ExpiresBuckets.cs
+++ b/mcs/class/System.Web/System.Web.Caching/ExpiresBuckets.cs
@@ -101,6 +101,7 @@ namespace System.Web.Caching
_arrEntries.CopyTo(newlist, 0);
// Set last element to point to the next new empty element
+ _intNext = oldsize;
newlist[oldsize - 1]._intNext = oldsize;
// Initialize positions for the rest of new elements.
@@ -347,6 +348,7 @@ namespace System.Web.Caching
objEntry._objEntry.ExpiresBucket = CacheEntry.NoBucketHash;
objEntry._objEntry.ExpiresIndex = CacheEntry.NoIndexInBucket;
objEntry._objEntry = null;
+ _arrEntries [intPos] = objEntry;
}
finally
{
diff --git a/mcs/class/System.Web/System.Web.Caching/OutputCacheModule.cs b/mcs/class/System.Web/System.Web.Caching/OutputCacheModule.cs
index 8c392a6749f..d242c015ea7 100644
--- a/mcs/class/System.Web/System.Web.Caching/OutputCacheModule.cs
+++ b/mcs/class/System.Web/System.Web.Caching/OutputCacheModule.cs
@@ -8,10 +8,14 @@
//
using System.Web;
+using System.Web.Util;
+using System.Collections;
namespace System.Web.Caching {
internal sealed class OutputCacheModule : IHttpModule {
+
+ private CacheItemRemovedCallback response_removed;
public OutputCacheModule ()
{
@@ -30,13 +34,14 @@ namespace System.Web.Caching {
app.AddOnUpdateRequestCacheAsync (
new BeginEventHandler (OnBeginUpdateCache),
new EndEventHandler (OnEndUpdateCache));
+
+ response_removed = new CacheItemRemovedCallback (OnRawResponseRemoved);
}
IAsyncResult OnBeginRequestCache (object o, EventArgs args, AsyncCallback cb, object data)
{
HttpApplication app = (HttpApplication) o;
HttpContext context = app.Context;
-
string vary_key = context.Request.FilePath;
CachedVaryBy varyby = context.Cache [vary_key] as CachedVaryBy;
@@ -46,16 +51,18 @@ namespace System.Web.Caching {
if (varyby == null)
goto leave;
- key = varyby.CreateKey (vary_key, context.Request);
+ key = varyby.CreateKey (vary_key, context);
c = context.Cache [key] as CachedRawResponse;
- if (c != null && context.Timestamp < c.Policy.Expires) {
+ if (c != null) {
context.Response.ClearContent ();
context.Response.BinaryWrite (c.GetData (), 0, c.ContentLength);
context.Response.ClearHeaders ();
+ c.DateHeader.Value = TimeUtil.ToUtcTimeString (DateTime.Now);
context.Response.SetCachedHeaders (c.Headers);
+
context.Response.StatusCode = c.StatusCode;
context.Response.StatusDescription = c.StatusDescription;
@@ -81,7 +88,8 @@ namespace System.Web.Caching {
HttpContext context = app.Context;
HttpAsyncResult result;
- if (context.Response.IsCached && context.Response.StatusCode == 200)
+ if (context.Response.IsCached && context.Response.StatusCode == 200 &&
+ !context.Trace.IsEnabled)
DoCacheInsert (context);
result = new HttpAsyncResult (cb, this);
@@ -102,33 +110,47 @@ namespace System.Web.Caching {
bool lookup = true;
if (varyby == null) {
- varyby = new CachedVaryBy (context.Response.Cache);
+ varyby = new CachedVaryBy (context.Response.Cache, vary_key);
context.Cache.InsertPrivate (vary_key, varyby, null,
- Cache.NoAbsoluteExpiration, Cache.NoSlidingExpiration,
+ Cache.NoAbsoluteExpiration,
+ Cache.NoSlidingExpiration,
CacheItemPriority.Normal, null);
lookup = false;
}
- key = varyby.CreateKey (vary_key, context.Request);
-
+ key = varyby.CreateKey (vary_key, context);
+
if (lookup)
prev = context.Cache [key] as CachedRawResponse;
- if (IsExpired (context, prev)) {
+ if (prev == null) {
CachedRawResponse c = context.Response.GetCachedResponse ();
-
- context.Cache.InsertPrivate (key, c, null,
- context.Response.Cache.Expires,
- Cache.NoSlidingExpiration,
- CacheItemPriority.Normal, null);
+ string [] files = new string [0];
+ string [] keys = new string [] { vary_key };
+ bool sliding = context.Response.Cache.Sliding;
+
+ context.Cache.InsertPrivate (key, c, new CacheDependency (files, keys),
+ (sliding ? Cache.NoAbsoluteExpiration :
+ context.Response.Cache.Expires),
+ (sliding ? TimeSpan.FromSeconds (
+ context.Response.Cache.Duration) :
+ Cache.NoSlidingExpiration),
+ CacheItemPriority.Normal, response_removed);
+ c.VaryBy = varyby;
+ varyby.ItemList.Add (key);
}
}
- private bool IsExpired (HttpContext context, CachedRawResponse crr)
+ private void OnRawResponseRemoved (string key, object value, CacheItemRemovedReason reason)
{
- if (crr == null || context.Timestamp > crr.Policy.Expires)
- return true;
- return false;
+ CachedRawResponse c = (CachedRawResponse) value;
+
+ c.VaryBy.ItemList.Remove (key);
+ if (c.VaryBy.ItemList.Count != 0)
+ return;
+
+ Cache cache = HttpRuntime.Cache;
+ cache.Remove (c.VaryBy.Key);
}
}
}
diff --git a/mcs/class/System.Web/System.Web.Compilation/AspGenerator.cs b/mcs/class/System.Web/System.Web.Compilation/AspGenerator.cs
index b4bc8c981e5..a46ca59f521 100644
--- a/mcs/class/System.Web/System.Web.Compilation/AspGenerator.cs
+++ b/mcs/class/System.Web/System.Web.Compilation/AspGenerator.cs
@@ -11,6 +11,7 @@ using System.Collections;
using System.CodeDom.Compiler;
using System.IO;
using System.Text;
+using System.Web.Caching;
using System.Web.UI;
using System.Web.Util;
@@ -115,6 +116,7 @@ namespace System.Web.Compilation
RootBuilder rootBuilder;
bool inScript, javascript;
ILocation location;
+ bool isApplication;
static Hashtable emptyHash = new Hashtable ();
public AspGenerator (TemplateParser tparser)
@@ -156,6 +158,7 @@ namespace System.Web.Compilation
{
StreamReader reader = new StreamReader (filename, WebEncoding.FileEncoding);
AspParser parser = new AspParser (filename, reader);
+ reader.Close ();
parser.Error += new ParseErrorHandler (ParseError);
parser.TagParsed += new TagParsedHandler (TagParsed);
parser.TextParsed += new TextParsedHandler (TextParsed);
@@ -175,7 +178,14 @@ namespace System.Web.Compilation
public Type GetCompiledType ()
{
+ Type type = (Type) HttpRuntime.Cache.Get (tparser.InputFile);
+ if (type != null) {
+ return type;
+ }
+
+ isApplication = tparser.DefaultDirectiveName == "application";
InitParser (Path.GetFullPath (tparser.InputFile));
+
DoParse ();
#if DEBUG
PrintTree (rootBuilder, 0);
@@ -187,7 +197,12 @@ namespace System.Web.Compilation
BaseCompiler compiler = GetCompilerFromType ();
- return compiler.GetCompiledType ();
+ type = compiler.GetCompiledType ();
+ CacheDependency cd = new CacheDependency ((string[])
+ tparser.Dependencies.ToArray (typeof (string)));
+
+ HttpRuntime.Cache.Insert (tparser.InputFile, type, cd);
+ return type;
}
#if DEBUG
@@ -267,9 +282,15 @@ namespace System.Web.Compilation
case TagType.CodeRenderExpression:
goto case TagType.CodeRender;
case TagType.CodeRender:
+ if (isApplication)
+ throw new ParseException (location, "Invalid content for application file.");
+
ProcessCode (tagtype, tagid, location);
break;
case TagType.Include:
+ if (isApplication)
+ throw new ParseException (location, "Invalid content for application file.");
+
string file = attributes ["virtual"] as string;
bool isvirtual = (file != null);
if (!isvirtual)
@@ -330,6 +351,11 @@ namespace System.Web.Compilation
return false;
}
+ if (isApplication) {
+ if (String.Compare (tagid, "object", true) != 0)
+ throw new ParseException (location, "Invalid tag for application file.");
+ }
+
ControlBuilder parent = stack.Builder;
ControlBuilder builder = null;
BuilderLocation bl = null;
@@ -369,7 +395,12 @@ namespace System.Web.Compilation
}
stack.Push (builder, location);
} else {
- // FIXME:ObjectTags...
+ if (!isApplication && builder is ObjectTagBuilder) {
+ ObjectTagBuilder ot = (ObjectTagBuilder) builder;
+ if (ot.Scope != null && ot.Scope != "")
+ throw new ParseException (location, "Scope not allowed here");
+ }
+
parent.AppendSubBuilder (builder);
builder.CloseControl ();
}
@@ -466,6 +497,7 @@ namespace System.Web.Compilation
tparser.Language, lang));
}
}
+
// Used to get CodeRender tags in attribute values
class CodeRenderParser
{
diff --git a/mcs/class/System.Web/System.Web.Compilation/BaseCompiler.cs b/mcs/class/System.Web/System.Web.Compilation/BaseCompiler.cs
index 35cb78bd859..30e25783ca0 100644
--- a/mcs/class/System.Web/System.Web.Compilation/BaseCompiler.cs
+++ b/mcs/class/System.Web/System.Web.Compilation/BaseCompiler.cs
@@ -60,7 +60,9 @@ namespace System.Web.Compilation
}
AddInterfaces ();
+ AddClassAttributes ();
CreateStaticFields ();
+ AddApplicationAndSessionObjects ();
AddScripts ();
CreateConstructor (null, null);
}
@@ -73,7 +75,8 @@ namespace System.Web.Compilation
mainClass.Members.Add (fld);
}
- protected virtual void CreateConstructor (CodeStatementCollection localVars, CodeStatementCollection trueStmt)
+ protected virtual void CreateConstructor (CodeStatementCollection localVars,
+ CodeStatementCollection trueStmt)
{
CodeConstructor ctor = new CodeConstructor ();
ctor.Attributes = MemberAttributes.Public;
@@ -82,12 +85,15 @@ namespace System.Web.Compilation
if (localVars != null)
ctor.Statements.AddRange (localVars);
- CodeTypeReferenceExpression r = new CodeTypeReferenceExpression (mainNS.Name + "." + mainClass.Name);
- CodeFieldReferenceExpression intialized = new CodeFieldReferenceExpression (r, "__intialized");
+ CodeTypeReferenceExpression r;
+ r = new CodeTypeReferenceExpression (mainNS.Name + "." + mainClass.Name);
+ CodeFieldReferenceExpression intialized;
+ intialized = new CodeFieldReferenceExpression (r, "__intialized");
- CodeBinaryOperatorExpression bin = new CodeBinaryOperatorExpression (intialized,
- CodeBinaryOperatorType.ValueEquality,
- new CodePrimitiveExpression (false));
+ CodeBinaryOperatorExpression bin;
+ bin = new CodeBinaryOperatorExpression (intialized,
+ CodeBinaryOperatorType.ValueEquality,
+ new CodePrimitiveExpression (false));
CodeAssignStatement assign = new CodeAssignStatement (intialized,
new CodePrimitiveExpression (true));
@@ -125,9 +131,124 @@ namespace System.Web.Compilation
}
}
- protected virtual void ProcessObjectTag (ObjectTagBuilder tag)
+ protected virtual void AddClassAttributes ()
{
}
+
+ protected virtual void AddApplicationAndSessionObjects ()
+ {
+ }
+
+ /* Utility methods for <object> stuff */
+ protected void CreateApplicationOrSessionPropertyForObject (Type type,
+ string propName,
+ bool isApplication,
+ bool isPublic)
+ {
+ /* if isApplication this generates (the 'cachedapp' field is created earlier):
+ private MyNS.MyClass app {
+ get {
+ if ((this.cachedapp == null)) {
+ this.cachedapp = ((MyNS.MyClass)
+ (this.Application.StaticObjects.GetObject("app")));
+ }
+ return this.cachedapp;
+ }
+ }
+
+ else, this is for Session:
+ private MyNS.MyClass ses {
+ get {
+ return ((MyNS.MyClass) (this.Session.StaticObjects.GetObject("ses")));
+ }
+ }
+
+ */
+
+ CodeExpression result = null;
+
+ CodeMemberProperty prop = new CodeMemberProperty ();
+ prop.Type = new CodeTypeReference (type);
+ prop.Name = propName;
+ if (isPublic)
+ prop.Attributes = MemberAttributes.Public | MemberAttributes.Final;
+ else
+ prop.Attributes = MemberAttributes.Private | MemberAttributes.Final;
+
+ CodePropertyReferenceExpression p1;
+ if (isApplication)
+ p1 = new CodePropertyReferenceExpression (thisRef, "Application");
+ else
+ p1 = new CodePropertyReferenceExpression (thisRef, "Session");
+
+ CodePropertyReferenceExpression p2;
+ p2 = new CodePropertyReferenceExpression (p1, "StaticObjects");
+
+ CodeMethodReferenceExpression getobject;
+ getobject = new CodeMethodReferenceExpression (p2, "GetObject");
+
+ CodeMethodInvokeExpression invoker;
+ invoker = new CodeMethodInvokeExpression (getobject,
+ new CodePrimitiveExpression (propName));
+
+ CodeCastExpression cast = new CodeCastExpression (prop.Type, invoker);
+
+ if (isApplication) {
+ CodeFieldReferenceExpression field;
+ field = new CodeFieldReferenceExpression (thisRef, "cached" + propName);
+
+ CodeConditionStatement stmt = new CodeConditionStatement();
+ stmt.Condition = new CodeBinaryOperatorExpression (field,
+ CodeBinaryOperatorType.IdentityEquality,
+ new CodePrimitiveExpression (null));
+
+ CodeAssignStatement assign = new CodeAssignStatement ();
+ assign.Left = field;
+ assign.Right = cast;
+ stmt.TrueStatements.Add (assign);
+ prop.GetStatements.Add (stmt);
+ result = field;
+ } else {
+ result = cast;
+ }
+
+ prop.GetStatements.Add (new CodeMethodReturnStatement (result));
+ mainClass.Members.Add (prop);
+ }
+
+ protected string CreateFieldForObject (Type type, string name)
+ {
+ string fieldName = "cached" + name;
+ CodeMemberField f = new CodeMemberField (type, fieldName);
+ f.Attributes = MemberAttributes.Private;
+ mainClass.Members.Add (f);
+ return fieldName;
+ }
+
+ protected void CreatePropertyForObject (Type type, string propName, string fieldName, bool isPublic)
+ {
+ CodeFieldReferenceExpression field = new CodeFieldReferenceExpression (thisRef, fieldName);
+ CodeMemberProperty prop = new CodeMemberProperty ();
+ prop.Type = new CodeTypeReference (type);
+ prop.Name = propName;
+ if (isPublic)
+ prop.Attributes = MemberAttributes.Public | MemberAttributes.Final;
+ else
+ prop.Attributes = MemberAttributes.Private | MemberAttributes.Final;
+
+ CodeConditionStatement stmt = new CodeConditionStatement();
+ stmt.Condition = new CodeBinaryOperatorExpression (field,
+ CodeBinaryOperatorType.IdentityEquality,
+ new CodePrimitiveExpression (null));
+
+ CodeObjectCreateExpression create = new CodeObjectCreateExpression (prop.Type);
+ stmt.TrueStatements.Add (new CodeAssignStatement (field, create));
+ prop.GetStatements.Add (stmt);
+ prop.GetStatements.Add (new CodeMethodReturnStatement (field));
+
+ mainClass.Members.Add (prop);
+ }
+ /******/
void CheckCompilerErrors (CompilerResults results)
{
diff --git a/mcs/class/System.Web/System.Web.Compilation/ChangeLog b/mcs/class/System.Web/System.Web.Compilation/ChangeLog
index 8e59d3bbbe9..9618d79cbb9 100644
--- a/mcs/class/System.Web/System.Web.Compilation/ChangeLog
+++ b/mcs/class/System.Web/System.Web.Compilation/ChangeLog
@@ -1,3 +1,60 @@
+2004-01-30 Jackson Harper <jackson@ximian.com>
+
+ * TemplateControlCompiler.cs: Call ToString on the types hashcode,
+ the build method takes strings not ints.
+
+2004-01-28 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspGenerator.cs: handle more possible errors in global.asax file.
+
+ * BaseCompiler.cs: added utility methods for creating <object> related
+ properties and fields.
+
+ * GlobalAsaxCompiler.cs: keep around applications and session scope
+ objects builders. Also a list of imports and assemblies added in
+ global.asax.
+
+ * TemplateControlCompiler.cs: use base class methods for <object> stuff.
+
+2004-01-28 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspGenerator.cs: use the Cache to store compiled Types. Don't parse
+ pages more than once. Thanks to Eric Lindvall for pointing this out.
+
+2004-01-23 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * TemplateControlCompiler.cs: allow handling subproperties for other
+ types than Style and Font. Fixes bug #53217.
+
+2004-01-16 Jackson Harper <jackson@ximian.com>
+
+ * TagAttribute.cs: attributes can be stored as encoded html so we
+ decode them here.
+
+2004-01-14 Jackson Harper <jackson@ximian.com>
+
+ * TemplateControlCompiler.cs: Is a user control is cached and
+ shared use the controls type hashcode for the GUID so it will be
+ the same across instances.
+
+2004-01-13 Jackson Harper <jackson@ximian.com>
+
+ * TemplateControlCompiler.cs: If an item has the partial caching
+ attribute build a PartialCachingControl in the parents __Build method.
+ * BaseCompiler.cs: Add a method for adding class attributes to the
+ class.
+ * UserControlCompiler.cs: If caching is enabled on a user control
+ add the PartialCachingAttribute to it.
+
+2004-01-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * PageCompiler.cs: invoke Request.ValidateInput if required.
+
+2004-01-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AspGenerator.cs: don't rely on GC to close the files parsed. Fixes bug
+ #52521. Patch by liyul@hotmail.com.
+
2003-12-25 Jackson Harper <jackson@ximian.com>
* AspGenerator.cs: Allow scriptlets in javascript. This fixes bug
diff --git a/mcs/class/System.Web/System.Web.Compilation/GlobalAsaxCompiler.cs b/mcs/class/System.Web/System.Web.Compilation/GlobalAsaxCompiler.cs
index c841b643766..4f2b8039e82 100644
--- a/mcs/class/System.Web/System.Web.Compilation/GlobalAsaxCompiler.cs
+++ b/mcs/class/System.Web/System.Web.Compilation/GlobalAsaxCompiler.cs
@@ -5,8 +5,10 @@
// Gonzalo Paniagua Javier (gonzalo@ximian.com)
//
// (C) 2002,2003 Ximian, Inc (http://www.ximian.com)
+// (c) 2004 Novell, Inc. (http://www.novell.com)
//
using System;
+using System.Collections;
using System.Web.UI;
namespace System.Web.Compilation
@@ -14,23 +16,87 @@ namespace System.Web.Compilation
class GlobalAsaxCompiler : BaseCompiler
{
ApplicationFileParser parser;
+ static ArrayList applicationObjectTags = new ArrayList (1);
+ static ArrayList sessionObjectTags = new ArrayList (1);
+ static ArrayList imports;
+ static ArrayList assemblies;
public GlobalAsaxCompiler (ApplicationFileParser parser)
: base (parser)
{
+ applicationObjectTags.Clear ();
+ sessionObjectTags.Clear ();
+
+ if (imports != null)
+ imports.Clear ();
+
+ if (assemblies != null)
+ assemblies.Clear ();
+
this.parser = parser;
}
public static Type CompileApplicationType (ApplicationFileParser parser)
{
- GlobalAsaxCompiler compiler = new GlobalAsaxCompiler (parser);
- return compiler.GetCompiledType ();
+ AspGenerator generator = new AspGenerator (parser);
+ Type type = generator.GetCompiledType ();
+ imports = parser.Imports;
+ assemblies = parser.Assemblies;
+ return type;
+ }
+
+ protected override void CreateMethods ()
+ {
+ base.CreateMethods ();
+
+ ProcessObjects (parser.RootBuilder);
}
- [MonoTODO("Process application scope for object tags")]
- protected override void ProcessObjectTag (ObjectTagBuilder tag)
+ void ProcessObjects (ControlBuilder builder)
{
- //TODO
+ if (builder.Children == null)
+ return;
+
+ foreach (object t in builder.Children) {
+ if (!(t is ObjectTagBuilder))
+ continue;
+
+ ObjectTagBuilder tag = (ObjectTagBuilder) t;
+ if (tag.Scope == null) {
+ string fname = CreateFieldForObject (tag.Type, tag.ObjectID);
+ CreatePropertyForObject (tag.Type, tag.ObjectID, fname, true);
+ continue;
+ }
+
+ if (tag.Scope == "session") {
+ sessionObjectTags.Add (tag);
+ CreateApplicationOrSessionPropertyForObject (tag.Type, tag.ObjectID,
+ false, false);
+ } else if (tag.Scope == "application") {
+ applicationObjectTags.Add (tag);
+ CreateFieldForObject (tag.Type, tag.ObjectID);
+ CreateApplicationOrSessionPropertyForObject (tag.Type, tag.ObjectID,
+ true, false);
+ } else {
+ throw new ParseException (tag.location, "Invalid scope: " + tag.Scope);
+ }
+ }
+ }
+
+ internal static ArrayList ApplicationObjects {
+ get { return applicationObjectTags; }
+ }
+
+ internal static ArrayList SessionObjects {
+ get { return sessionObjectTags; }
+ }
+
+ internal static ArrayList Assemblies {
+ get { return assemblies; }
+ }
+
+ internal static ArrayList Imports {
+ get { return imports; }
}
}
}
diff --git a/mcs/class/System.Web/System.Web.Compilation/PageCompiler.cs b/mcs/class/System.Web/System.Web.Compilation/PageCompiler.cs
index 7c8b94558fa..9cd8933c61b 100644
--- a/mcs/class/System.Web/System.Web.Compilation/PageCompiler.cs
+++ b/mcs/class/System.Web/System.Web.Compilation/PageCompiler.cs
@@ -110,6 +110,16 @@ namespace System.Web.Compilation
stmt.Right = new CodeFieldReferenceExpression (tm, pageParser.TraceMode.ToString ());
method.Statements.Add (stmt);
}
+
+#if NET_1_1
+ if (pageParser.ValidateRequest) {
+ CodeMethodInvokeExpression expr = new CodeMethodInvokeExpression ();
+ CodePropertyReferenceExpression prop;
+ prop = new CodePropertyReferenceExpression (thisRef, "Request");
+ expr.Method = new CodeMethodReferenceExpression (prop, "ValidateInput");
+ method.Statements.Add (expr);
+ }
+#endif
base.AddStatementsToFrameworkInitialize (method);
}
diff --git a/mcs/class/System.Web/System.Web.Compilation/TagAttributes.cs b/mcs/class/System.Web/System.Web.Compilation/TagAttributes.cs
index 4f2f4037d35..d07400ae02c 100644
--- a/mcs/class/System.Web/System.Web.Compilation/TagAttributes.cs
+++ b/mcs/class/System.Web/System.Web.Compilation/TagAttributes.cs
@@ -57,6 +57,9 @@ namespace System.Web.Compilation
MakeHash ();
}
+ if (value != null)
+ value = HttpUtility.HtmlDecode (value.ToString ());
+
if (got_hashed) {
if (atts_hash.ContainsKey (key))
throw new HttpException ("Tag contains duplicated '" + key +
diff --git a/mcs/class/System.Web/System.Web.Compilation/TemplateControlCompiler.cs b/mcs/class/System.Web/System.Web.Compilation/TemplateControlCompiler.cs
index 0d48ac10f24..e572f9cbc7f 100644
--- a/mcs/class/System.Web/System.Web.Compilation/TemplateControlCompiler.cs
+++ b/mcs/class/System.Web/System.Web.Compilation/TemplateControlCompiler.cs
@@ -284,37 +284,39 @@ namespace System.Web.Compilation
if (0 == String.Compare (member.Name, id, true)){
AddCodeForPropertyOrField (builder, type, member.Name, attValue, isDataBound);
- is_processed = true;
- } else if (hyphen != -1 && (type == fontinfoType || type == styleType || type.IsSubclassOf (styleType))){
- //FIXME: x-y should not be limited to style and font
- string prop_field = id.Replace ("-", ".");
- string [] parts = prop_field.Split (new char [] {'.'});
- if (parts.Length != 2 || 0 != String.Compare (member.Name, parts [0], true))
- return false;
+ return true;
+ }
+
+ if (hyphen == -1)
+ return false;
- PropertyInfo [] subprops = type.GetProperties ();
- foreach (PropertyInfo subprop in subprops) {
- if (0 != String.Compare (subprop.Name, parts [1], true))
- continue;
+ string prop_field = id.Replace ("-", ".");
+ string [] parts = prop_field.Split (new char [] {'.'});
+ if (parts.Length != 2 || 0 != String.Compare (member.Name, parts [0], true))
+ return false;
- if (subprop.CanWrite == false)
- return false;
+ PropertyInfo [] subprops = type.GetProperties ();
+ foreach (PropertyInfo subprop in subprops) {
+ if (0 != String.Compare (subprop.Name, parts [1], true))
+ continue;
- bool is_bool = subprop.PropertyType == typeof (bool);
- if (!is_bool && attValue == null)
- return false; // Font-Size -> Font-Size="" as html
+ if (subprop.CanWrite == false)
+ return false;
- string value;
- if (attValue == null && is_bool)
- value = "true"; // Font-Bold <=> Font-Bold="true"
- else
- value = attValue;
+ bool is_bool = subprop.PropertyType == typeof (bool);
+ if (!is_bool && attValue == null)
+ return false; // Font-Size -> Font-Size="" as html
- AddCodeForPropertyOrField (builder, subprop.PropertyType,
- member.Name + "." + subprop.Name,
- value, isDataBound);
- is_processed = true;
- }
+ string value;
+ if (attValue == null && is_bool)
+ value = "true"; // Font-Bold <=> Font-Bold="true"
+ else
+ value = attValue;
+
+ AddCodeForPropertyOrField (builder, subprop.PropertyType,
+ member.Name + "." + subprop.Name,
+ value, isDataBound);
+ is_processed = true;
}
return is_processed;
@@ -429,6 +431,32 @@ namespace System.Web.Compilation
{
CodeMethodReferenceExpression m = new CodeMethodReferenceExpression (thisRef, child.method.Name);
CodeMethodInvokeExpression expr = new CodeMethodInvokeExpression (m);
+
+ object [] atts = child.ControlType.GetCustomAttributes (typeof (PartialCachingAttribute), true);
+ if (atts != null && atts.Length > 0) {
+ PartialCachingAttribute pca = (PartialCachingAttribute) atts [0];
+ CodeTypeReferenceExpression cc = new CodeTypeReferenceExpression("System.Web.UI.StaticPartialCachingControl");
+ CodeMethodInvokeExpression build = new CodeMethodInvokeExpression (cc, "BuildCachedControl");
+ build.Parameters.Add (new CodeArgumentReferenceExpression("__ctrl"));
+ build.Parameters.Add (new CodePrimitiveExpression (child.ID));
+ if (pca.Shared)
+ build.Parameters.Add (new CodePrimitiveExpression (child.ControlType.GetHashCode ().ToString ()));
+ else
+ build.Parameters.Add (new CodePrimitiveExpression (Guid.NewGuid ().ToString ()));
+ build.Parameters.Add (new CodePrimitiveExpression (pca.Duration));
+ build.Parameters.Add (new CodePrimitiveExpression (pca.VaryByParams));
+ build.Parameters.Add (new CodePrimitiveExpression (pca.VaryByControls));
+ build.Parameters.Add (new CodePrimitiveExpression (pca.VaryByCustom));
+ build.Parameters.Add (new CodeDelegateCreateExpression (
+ new CodeTypeReference (typeof (System.Web.UI.BuildMethod)),
+ thisRef, child.method.Name));
+
+ parent.method.Statements.Add (build);
+ if (parent.HasAspCode)
+ AddRenderControl (parent);
+ return;
+ }
+
if (child.isProperty || parent.ChildrenAsProperties) {
expr.Parameters.Add (new CodeFieldReferenceExpression (ctrlVar, child.TagName));
parent.method.Statements.Add (expr);
@@ -687,7 +715,7 @@ namespace System.Web.Compilation
CreateControlTree (parser.RootBuilder, false, false);
CreateFrameworkInitializeMethod ();
}
-
+
void CreateFrameworkInitializeMethod ()
{
CodeMemberMethod method = new CodeMemberMethod ();
@@ -712,36 +740,22 @@ namespace System.Web.Compilation
method.Statements.Add (new CodeExpressionStatement (expr));
}
- protected override void ProcessObjectTag (ObjectTagBuilder tag)
+ protected override void AddApplicationAndSessionObjects ()
{
- string name = tag.ObjectID;
- string className = tag.ClassName;
- Type t = parser.LoadType (className);
- if (t == null)
- throw new ParseException (tag.location, "Error loading type " + className);
-
- string fieldName = "cached" + name;
- CodeMemberField f = new CodeMemberField (t, fieldName);
- f.Attributes = MemberAttributes.Private;
- mainClass.Members.Add (f);
+ foreach (ObjectTagBuilder tag in GlobalAsaxCompiler.ApplicationObjects) {
+ CreateFieldForObject (tag.Type, tag.ObjectID);
+ CreateApplicationOrSessionPropertyForObject (tag.Type, tag.ObjectID, true, false);
+ }
- CodeFieldReferenceExpression field = new CodeFieldReferenceExpression (thisRef, fieldName);
+ foreach (ObjectTagBuilder tag in GlobalAsaxCompiler.SessionObjects) {
+ CreateApplicationOrSessionPropertyForObject (tag.Type, tag.ObjectID, false, false);
+ }
+ }
- CodeMemberProperty prop = new CodeMemberProperty ();
- prop.Type = new CodeTypeReference (t);
- prop.Name = name;
- prop.Attributes = MemberAttributes.Private | MemberAttributes.Final;
-
- CodeConditionStatement stmt = new CodeConditionStatement();
- stmt.Condition = new CodeBinaryOperatorExpression (field,
- CodeBinaryOperatorType.IdentityEquality,
- new CodePrimitiveExpression (null));
-
- CodeObjectCreateExpression create = new CodeObjectCreateExpression (prop.Type);
- stmt.TrueStatements.Add (new CodeAssignStatement (field, create));
- prop.GetStatements.Add (stmt);
- prop.GetStatements.Add (new CodeMethodReturnStatement (field));
- mainClass.Members.Add (prop);
+ protected void ProcessObjectTag (ObjectTagBuilder tag)
+ {
+ string fieldName = CreateFieldForObject (tag.Type, tag.ObjectID);
+ CreatePropertyForObject (tag.Type, tag.ObjectID, fieldName, false);
}
void CreateProperties ()
diff --git a/mcs/class/System.Web/System.Web.Compilation/UserControlCompiler.cs b/mcs/class/System.Web/System.Web.Compilation/UserControlCompiler.cs
index 15f439c4400..60d985092da 100644
--- a/mcs/class/System.Web/System.Web.Compilation/UserControlCompiler.cs
+++ b/mcs/class/System.Web/System.Web.Compilation/UserControlCompiler.cs
@@ -7,6 +7,7 @@
// (C) 2002,2003 Ximian, Inc (http://www.ximian.com)
//
using System;
+using System.CodeDom;
using System.Web.UI;
namespace System.Web.Compilation
@@ -26,6 +27,31 @@ namespace System.Web.Compilation
UserControlCompiler pc = new UserControlCompiler (userControlParser);
return pc.GetCompiledType ();
}
+
+ protected override void AddClassAttributes ()
+ {
+ if (parser.OutputCache)
+ AddOutputCacheAttribute ();
+
+ }
+
+ private void AddOutputCacheAttribute ()
+ {
+ CodeAttributeDeclaration cad = new CodeAttributeDeclaration ("System.Web.UI.PartialCachingAttribute");
+ AddPrimitiveAttribute (cad, parser.OutputCacheDuration);
+ AddPrimitiveAttribute (cad, parser.OutputCacheVaryByParam);
+ AddPrimitiveAttribute (cad, parser.OutputCacheVaryByControls);
+ AddPrimitiveAttribute (cad, parser.OutputCacheVaryByCustom);
+ AddPrimitiveAttribute (cad, parser.OutputCacheShared);
+ mainClass.CustomAttributes.Add (cad);
+ }
+
+ private void AddPrimitiveAttribute (CodeAttributeDeclaration cad, object obj)
+ {
+ cad.Arguments.Add (new CodeAttributeArgument (new CodePrimitiveExpression (obj)));
+ }
+
+
}
}
diff --git a/mcs/class/System.Web/System.Web.Configuration/AuthConfig.cs b/mcs/class/System.Web/System.Web.Configuration/AuthConfig.cs
index f8b8f13ccf4..8ad6968e74c 100755
--- a/mcs/class/System.Web/System.Web.Configuration/AuthConfig.cs
+++ b/mcs/class/System.Web/System.Web.Configuration/AuthConfig.cs
@@ -25,6 +25,10 @@ namespace System.Web.Configuration
FormsAuthPasswordFormat pwdFormat;
Hashtable credentialUsers;
bool has_parent;
+#if NET_1_1
+ bool requireSSL;
+ bool slidingExpiration;
+#endif
internal AuthConfig (object parent)
{
@@ -38,6 +42,10 @@ namespace System.Web.Configuration
protection = p.protection;
timeout = p.timeout;
pwdFormat = p.pwdFormat;
+#if NET_1_1
+ requireSSL = p.requireSSL;
+ slidingExpiration = p.slidingExpiration;
+#endif
credentialUsers = new Hashtable (p.CredentialUsers);
}
}
@@ -170,6 +178,18 @@ namespace System.Web.Configuration
return credentialUsers;
}
}
+
+#if NET_1_1
+ internal bool RequireSSL {
+ get { return requireSSL; }
+ set { requireSSL = value; }
+ }
+
+ internal bool SlidingExpiration {
+ get { return slidingExpiration; }
+ set { slidingExpiration = value; }
+ }
+#endif
}
}
diff --git a/mcs/class/System.Web/System.Web.Configuration/AuthenticationConfigHandler.cs b/mcs/class/System.Web/System.Web.Configuration/AuthenticationConfigHandler.cs
index 6f66b050fbc..2a9e10e2186 100755
--- a/mcs/class/System.Web/System.Web.Configuration/AuthenticationConfigHandler.cs
+++ b/mcs/class/System.Web/System.Web.Configuration/AuthenticationConfigHandler.cs
@@ -40,12 +40,33 @@ namespace System.Web.Configuration
config.LoginUrl = AttValue ("loginUrl", child);
config.SetProtection (AttValue ("protection", child));
config.SetTimeout (AttValue ("timeout", child));
+#if NET_1_1
+ string att = AttValue ("requireSSL", child);
+ if (att != null) {
+ if (att == "true")
+ config.RequireSSL = true;
+
+ if (att != "false")
+ HandlersUtil.ThrowException
+ ("Invalid value for RequireSSL", child);
+ }
+
+ att = AttValue ("slidingExpiration", child);
+ if (att != null) {
+ if (att == "true")
+ config.SlidingExpiration = true;
+
+ if (att != "false")
+ HandlersUtil.ThrowException
+ ("Invalid value for SlidingExpiration", child);
+ }
+#endif
+
ReadCredentials (child.ChildNodes, config);
continue;
}
if (child.Name == "passport") {
- Console.WriteLine ("**WARNING**: Passport not supported! Ignoring section.");
continue;
}
diff --git a/mcs/class/System.Web/System.Web.Configuration/ChangeLog b/mcs/class/System.Web/System.Web.Configuration/ChangeLog
index c1127441324..01aa6de55bd 100644
--- a/mcs/class/System.Web/System.Web.Configuration/ChangeLog
+++ b/mcs/class/System.Web/System.Web.Configuration/ChangeLog
@@ -1,3 +1,35 @@
+2004-01-23 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AuthConfig.cs:
+ * AuthenticationConfigHandler.cs: added RequireSSL and
+ SlidingExpiration.
+
+ * HandlerFactoryProxy.cs: not public.
+ * HandlerItem.cs: not public.
+
+2004-01-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * WebConfigurationSettings.cs: fix location path lookup. Closes bug
+ #53072.
+
+2004-01-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * System.Web.Configuration/GlobalizationConfiguration.cs: undo old fix.
+
+ * System.Web.Configuration/PagesConfiguration.cs:
+ * System.Web.Configuration/PagesConfigurationHandler.cs: new files for
+ processing system.web/pages section.
+
+2004-01-10 Jackson Harper <jackson@ximian.com>
+
+ * TraceConfig.cs: New class contains trace configuration data.
+ * TraceConfigurationHandler.cs: New class parses trace
+ configurations.
+
+2004-01-05 Jackson Harper <jackson@ximian.com>
+
+ * HandlerItem.cs: Fix typo so slashes are stripped from paths properly.
+
2003-12-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* CustomErrorsConfigHandler.cs: handle <system.web><customErrors />..
diff --git a/mcs/class/System.Web/System.Web.Configuration/GlobalizationConfiguration.cs b/mcs/class/System.Web/System.Web.Configuration/GlobalizationConfiguration.cs
index 8b9ddaab6a5..0960751740a 100644
--- a/mcs/class/System.Web/System.Web.Configuration/GlobalizationConfiguration.cs
+++ b/mcs/class/System.Web/System.Web.Configuration/GlobalizationConfiguration.cs
@@ -40,10 +40,8 @@ namespace System.Web.Configuration
if (context == null)
context = HttpContext.Context;
- //config = context.GetConfig ("system.web/globalization") as GlobalizationConfiguration;
try {
- config = HttpContext.GetAppConfig ("system.web/globalization")
- as GlobalizationConfiguration;
+ config = context.GetConfig ("system.web/globalization") as GlobalizationConfiguration;
} catch {
return null;
}
diff --git a/mcs/class/System.Web/System.Web.Configuration/HandlerFactoryProxy.cs b/mcs/class/System.Web/System.Web.Configuration/HandlerFactoryProxy.cs
index e152a35041c..2611dce1d65 100644
--- a/mcs/class/System.Web/System.Web.Configuration/HandlerFactoryProxy.cs
+++ b/mcs/class/System.Web/System.Web.Configuration/HandlerFactoryProxy.cs
@@ -8,7 +8,7 @@ using System;
namespace System.Web.Configuration {
[MonoTODO]
- public class HandlerFactoryProxy {
+ class HandlerFactoryProxy {
public HandlerFactoryProxy() {
}
}
diff --git a/mcs/class/System.Web/System.Web.Configuration/HandlerItem.cs b/mcs/class/System.Web/System.Web.Configuration/HandlerItem.cs
index 04d328ab906..db22a85c7eb 100644
--- a/mcs/class/System.Web/System.Web.Configuration/HandlerItem.cs
+++ b/mcs/class/System.Web/System.Web.Configuration/HandlerItem.cs
@@ -14,7 +14,7 @@ using System.Text.RegularExpressions;
namespace System.Web.Configuration
{
- public class HandlerItem
+ class HandlerItem
{
private Type _type;
private string _typeName;
@@ -67,7 +67,7 @@ namespace System.Web.Configuration
if (pathRegex.IsMatch (path))
return true;
- int slash = path.LastIndexOf (path);
+ int slash = path.LastIndexOf ('/');
if (slash != -1 && path.Length > slash + 1)
return pathRegex.IsMatch (path.Substring (slash + 1));
diff --git a/mcs/class/System.Web/System.Web.Configuration/PagesConfiguration.cs b/mcs/class/System.Web/System.Web.Configuration/PagesConfiguration.cs
new file mode 100644
index 00000000000..a7a5dc537f7
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Configuration/PagesConfiguration.cs
@@ -0,0 +1,60 @@
+//
+// System.Web.Configuration.PagesConfiguration
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (c) 2003 Ximian, Inc. (http://www.ximian.com)
+//
+
+using System.Globalization;
+using System.Text;
+
+namespace System.Web.Configuration
+{
+ class PagesConfiguration
+ {
+ internal bool Buffer = true;
+ internal string EnableSessionState = "true";
+ internal bool EnableViewState = true;
+ internal bool EnableViewStateMac = false;
+ internal bool SmartNavigation = false;
+ internal bool AutoEventWireup = true;
+ internal bool ValidateRequest = true;
+ internal string PageBaseType = "System.Web.UI.Page";
+ internal string UserControlBaseType = "System.Web.UI.UserControl";
+
+ internal PagesConfiguration (object p)
+ {
+ if (!(p is PagesConfiguration))
+ return;
+
+ PagesConfiguration parent = (PagesConfiguration) p;
+ Buffer = parent.Buffer;
+ EnableSessionState = parent.EnableSessionState;
+ EnableViewState = parent.EnableViewState;
+ EnableViewStateMac = parent.EnableViewStateMac;
+ SmartNavigation = parent.SmartNavigation;
+ AutoEventWireup = parent.AutoEventWireup;
+ ValidateRequest = parent.ValidateRequest;
+ PageBaseType = parent.PageBaseType;
+ UserControlBaseType = parent.UserControlBaseType;
+ }
+
+ static public PagesConfiguration GetInstance (HttpContext context)
+ {
+ PagesConfiguration config;
+ if (context == null)
+ context = HttpContext.Context;
+
+ try {
+ config = context.GetConfig ("system.web/pages") as PagesConfiguration;
+ } catch {
+ return null;
+ }
+ return config;
+ }
+
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Configuration/PagesConfigurationHandler.cs b/mcs/class/System.Web/System.Web.Configuration/PagesConfigurationHandler.cs
new file mode 100644
index 00000000000..503e7428642
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Configuration/PagesConfigurationHandler.cs
@@ -0,0 +1,105 @@
+//
+// System.Web.Configuration.PagesConfigurationHandler
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2004 Novell, Inc (http://www.novel.com)
+//
+
+using System.Configuration;
+using System.Xml;
+
+namespace System.Web.Configuration
+{
+ class PagesConfigurationHandler : IConfigurationSectionHandler
+ {
+ public object Create (object parent, object configContext, XmlNode section)
+ {
+ PagesConfiguration config = new PagesConfiguration (parent);
+
+ if (section.HasChildNodes)
+ HandlersUtil.ThrowException ("No child nodes allowed here.", section);
+
+ bool bvalue = false;
+ string attvalue = AttValue ("buffer", section);
+ if (attvalue != null)
+ config.Buffer = GetBool ("buffer", attvalue, section);
+
+ attvalue = AttValue ("enableSessionState", section);
+ if (attvalue != null) {
+ if (attvalue != "true" && attvalue != "false" && attvalue != "ReadOnly")
+ HandlersUtil.ThrowException ("Invalid value for 'enableSessionState'", section);
+
+ config.EnableSessionState = attvalue;
+ }
+
+ attvalue = AttValue ("enableViewState", section);
+ if (attvalue != null)
+ config.EnableViewState = GetBool ("enableViewState", attvalue, section);
+
+ attvalue = AttValue ("enableViewStateMac", section);
+ if (attvalue != null)
+ config.EnableViewStateMac = GetBool ("enableViewStateMac", attvalue, section);
+
+ attvalue = AttValue ("smartNavigation", section);
+ if (attvalue != null)
+ config.SmartNavigation = GetBool ("smartNavigation", attvalue, section);
+
+ attvalue = AttValue ("autoEventWireup", section);
+ if (attvalue != null)
+ config.AutoEventWireup = GetBool ("autoEventWireup", attvalue, section);
+
+ attvalue = AttValue ("validateRequest", section);
+ if (attvalue != null)
+ config.ValidateRequest = GetBool ("validateRequest", attvalue, section);
+
+ attvalue = AttValue ("pageBaseType", section);
+ if (attvalue != null) {
+ string v = attvalue.Trim ();
+ if (v.Length == 0)
+ HandlersUtil.ThrowException ("pageBaseType is empty.", section);
+
+ config.PageBaseType = v;
+ }
+
+ attvalue = AttValue ("userControlBaseType", section);
+ if (attvalue != null) {
+ string v = attvalue.Trim ();
+ if (v.Length == 0)
+ HandlersUtil.ThrowException ("userControlBaseType is empty.", section);
+
+ config.UserControlBaseType = v;
+ }
+
+ if (section.Attributes == null || section.Attributes.Count != 0)
+ HandlersUtil.ThrowException ("Unknown attribute(s).", section);
+
+ return config;
+ }
+
+ static bool GetBool (string name, string value, XmlNode section)
+ {
+ if (value == "true")
+ return true;
+
+ if (value != "false")
+ HandlersUtil.ThrowException ("Invalid boolean value for '" + name + "'", section);
+
+ return false;
+ }
+
+ // A few methods to save some typing
+ static string AttValue (string name, XmlNode node, bool optional)
+ {
+ return HandlersUtil.ExtractAttributeValue (name, node, optional);
+ }
+
+ static string AttValue (string name, XmlNode node)
+ {
+ return HandlersUtil.ExtractAttributeValue (name, node, true);
+ }
+ //
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Configuration/TraceConfig.cs b/mcs/class/System.Web/System.Web.Configuration/TraceConfig.cs
new file mode 100644
index 00000000000..e7a4f72395c
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Configuration/TraceConfig.cs
@@ -0,0 +1,54 @@
+//
+// System.Web.Configuration.TraceConfig
+//
+// Author(s):
+// Jackson Harper (jackson@ximian.com)
+//
+// (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+using System;
+using System.Web;
+
+namespace System.Web.Configuration {
+
+ internal class TraceConfig {
+
+ private bool enabled;
+ private bool local_only;
+ private bool page_output;
+ private int request_limit;
+ private TraceMode trace_mode;
+
+ public TraceConfig ()
+ {
+ request_limit = 10;
+ }
+
+ public bool Enabled {
+ get { return enabled; }
+ set { enabled = value; }
+ }
+
+ public bool LocalOnly {
+ get { return local_only; }
+ set { local_only = value; }
+ }
+
+ public bool PageOutput {
+ get { return page_output; }
+ set { page_output = value; }
+ }
+
+ public int RequestLimit {
+ get { return request_limit; }
+ set { request_limit = value; }
+ }
+
+ public TraceMode TraceMode {
+ get { return trace_mode; }
+ set { trace_mode = value; }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Configuration/TraceConfigurationHandler.cs b/mcs/class/System.Web/System.Web.Configuration/TraceConfigurationHandler.cs
new file mode 100644
index 00000000000..c55a0987018
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Configuration/TraceConfigurationHandler.cs
@@ -0,0 +1,89 @@
+//
+// System.Web.Configuation.TraceConfigurationHandler
+//
+// Author(s):
+// Jackson Harper (jackson@ximian.com)
+//
+// (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+using System;
+using System.Web;
+using System.Xml;
+using System.Configuration;
+
+namespace System.Web.Configuration {
+
+ internal class TraceConfigurationHandler : IConfigurationSectionHandler {
+
+ public object Create (object parent, object context, XmlNode section)
+ {
+ TraceConfig config = new TraceConfig ();
+
+ string enabled_str = AttValue ("enabled", section);
+ if (enabled_str != null) {
+ try {
+ config.Enabled = Boolean.Parse (enabled_str);
+ } catch {
+ ThrowException ("The 'enabled' attribute is case sensitive" +
+ " and must be set to 'true' or 'false'.", section);
+ }
+ }
+
+ string local_str = AttValue ("localOnly", section);
+ if (local_str != null) {
+ try {
+ config.LocalOnly = Boolean.Parse (local_str);
+ } catch {
+ ThrowException ("The 'localOnly' attribute is case sensitive" +
+ " and must be set to 'true' or 'false'.", section);
+ }
+ }
+
+ string page_str = AttValue ("pageOutput", section);
+ if (page_str != null) {
+ try {
+ config.PageOutput = Boolean.Parse (page_str);
+ } catch {
+ ThrowException ("The 'pageOutput' attribute is case sensitive" +
+ " and must be set to 'true' or 'false'.", section);
+ }
+ }
+
+ string limit_str = AttValue ("requestLimit", section);
+ if (limit_str != null) {
+ try {
+ config.RequestLimit = Int32.Parse (limit_str);
+ } catch {
+ ThrowException ("The 'requestLimit' attribute must be an integer value.",
+ section);
+ }
+ }
+
+ string trace_str = AttValue ("traceMode", section);
+ if (trace_str != null) {
+ try {
+ config.TraceMode = (TraceMode) Enum.Parse (typeof (TraceMode), trace_str);
+ } catch {
+ ThrowException ("The 'traceMode' attribute is case sensitive and must be" +
+ " one of the following values: SortByTime, SortByCategory.",
+ section);
+ }
+ }
+
+ return config;
+ }
+
+ // A few methods to save some typing
+ static string AttValue (string name, XmlNode node)
+ {
+ return HandlersUtil.ExtractAttributeValue (name, node, true);
+ }
+
+ static void ThrowException (string message, XmlNode node)
+ {
+ HandlersUtil.ThrowException (message, node);
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.Configuration/WebConfigurationSettings.cs b/mcs/class/System.Web/System.Web.Configuration/WebConfigurationSettings.cs
index 1f9224bee29..4a68a92caef 100644
--- a/mcs/class/System.Web/System.Web.Configuration/WebConfigurationSettings.cs
+++ b/mcs/class/System.Web/System.Web.Configuration/WebConfigurationSettings.cs
@@ -486,7 +486,24 @@ namespace System.Web.Configuration
{
if (locations != null && dirname != null) {
string reduced = UrlUtils.MakeRelative (context.Request.FilePath, dirname);
- Location location = locations [reduced] as Location;
+ string [] parts = reduced.Split ('/');
+ Location location = null;
+ int length = parts.Length;
+
+ string target = null;
+ for (int i = 0; i < parts.Length; i++) {
+ if (target == null)
+ target = parts [i];
+ else
+ target = target + "/" + parts [i];
+
+ if (locations.ContainsKey (target)) {
+ location = locations [target] as Location;
+ } else if (locations.ContainsKey (target + "/*")) {
+ location = locations [target + "/*"] as Location;
+ }
+ }
+
if (location == null) {
location = locations ["*"] as Location;
}
diff --git a/mcs/class/System.Web/System.Web.Handlers/ChangeLog b/mcs/class/System.Web/System.Web.Handlers/ChangeLog
index fb6b4e48e85..bf068bebde1 100644
--- a/mcs/class/System.Web/System.Web.Handlers/ChangeLog
+++ b/mcs/class/System.Web/System.Web.Handlers/ChangeLog
@@ -1,3 +1,11 @@
+2004-01-10 Jackson Harper <jackson@ximian.com>
+
+ * TraceHandler.cs: Obey localOnly attribute.
+
+2004-01-10 Jackson Harper <jackson@ximian.com>
+
+ * TraceHandler.cs: Implement.
+
2003-11-05 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* AssemblyResourceLoader.cs: fixed compilation under MS. Ben already
diff --git a/mcs/class/System.Web/System.Web.Handlers/TraceHandler.cs b/mcs/class/System.Web/System.Web.Handlers/TraceHandler.cs
index 1ee16a6c9e5..0138efc66a3 100644
--- a/mcs/class/System.Web/System.Web.Handlers/TraceHandler.cs
+++ b/mcs/class/System.Web/System.Web.Handlers/TraceHandler.cs
@@ -3,22 +3,48 @@
//
// Authors:
// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+// Jackson Harper (jackson@ximian.com)
//
// (C) 2002 Ximian, Inc (http://www.ximian.com)
+// (C) 2004 Novell, Inc (http://www.novell.com)
//
using System.Web;
+using System.Web.Util;
using System.Web.UI;
+using System.Web.UI.WebControls;
namespace System.Web.Handlers
{
public class TraceHandler : IHttpHandler
{
- [MonoTODO]
void IHttpHandler.ProcessRequest (HttpContext context)
{
- //TODO: This should generate the trace page.
- throw new NotImplementedException ();
+ TraceManager manager = HttpRuntime.TraceManager;
+
+ if (manager.LocalOnly && !context.Request.IsLocal) {
+ // Need to figure out the error message that goes here
+ // but I only have cassini for testing
+ return;
+ }
+
+ HtmlTextWriter output = new HtmlTextWriter (context.Response.Output);
+
+ if (context.Request.QueryString ["clear"] != null)
+ manager.Clear ();
+
+ string id_str = context.Request.QueryString ["id"];
+ int id = -1;
+ if (id_str != null)
+ id = Int32.Parse (id_str);
+
+ if (id > 0 && id <= manager.ItemCount) {
+ RenderItem (manager, output, id);
+ } else {
+ string dir = context.Server.MapPath (UrlUtils.GetDirectory (context.Request.FilePath));
+ RenderMenu (manager, output, dir);
+ }
+
}
bool IHttpHandler.IsReusable
@@ -27,6 +53,81 @@ namespace System.Web.Handlers
return false;
}
}
+
+ private void RenderMenu (TraceManager manager, HtmlTextWriter output, string dir)
+ {
+
+ output.RenderBeginTag (HtmlTextWriterTag.Html);
+
+ output.RenderBeginTag (HtmlTextWriterTag.Head);
+ TraceData.RenderStyleSheet (output);
+ output.RenderEndTag ();
+
+ RenderHeader (output, dir);
+
+ output.RenderBeginTag (HtmlTextWriterTag.Body);
+ output.AddAttribute ("class", "tracecontent");
+ output.RenderBeginTag (HtmlTextWriterTag.Span);
+
+ Table table = TraceData.CreateTable ();
+
+ table.Rows.Add (TraceData.AltRow ("Requests to the Application"));
+ table.Rows.Add (TraceData.SubHeadRow ("No", "Time of Request",
+ "File", "Status Code", "Verb", "&nbsp;"));
+
+ if (manager.TraceData != null) {
+ for (int i=0; i<manager.ItemCount; i++) {
+ int item = i + 1;
+ TraceData d = manager.TraceData [i];
+ TraceData.RenderAltRow (table, i, item.ToString (), d.RequestTime.ToString (),
+ d.RequestPath, d.StatusCode.ToString (), d.RequestType,
+ "<a href=\"Trace.axd?id=" + item + "\" class=\"tinylink\">" +
+ "<b><nobr>View Details</a>");
+ }
+ table.RenderControl (output);
+ }
+
+ output.RenderEndTag ();
+ output.RenderEndTag ();
+
+ output.RenderEndTag ();
+ }
+
+ private void RenderHeader (HtmlTextWriter output, string dir)
+ {
+ Table table = TraceData.CreateTable ();
+ TableRow row1 = new TableRow ();
+ TableRow row2 = new TableRow ();
+ TableCell cell1 = new TableCell ();
+ TableCell cell2 = new TableCell ();
+ TableCell cell3 = new TableCell ();
+ TableCell cell4 = new TableCell ();
+
+ cell1.Text = "<h1>Application Trace</h1>";
+ cell2.Text = "[ <a href=\"Trace.axd?clear=1\" class=\"link\">clear current trace</a> ]";
+
+ cell2.HorizontalAlign = HorizontalAlign.Right;
+ cell2.VerticalAlign = VerticalAlign.Bottom;
+
+ row1.Cells.Add (cell1);
+ row1.Cells.Add (cell2);
+
+ cell3.Text = "<h2><h2><p>"; // ummm, WTF?
+ cell4.Text = "<b>Physical Directory:</b>" + dir;
+
+ row2.Cells.Add (cell3);
+ row2.Cells.Add (cell4);
+
+ table.Rows.Add (row1);
+ table.Rows.Add (row2);
+
+ table.RenderControl (output);
+ }
+
+ private void RenderItem (TraceManager manager, HtmlTextWriter output, int item)
+ {
+ manager.TraceData [item - 1].Render (output);
+ }
}
}
diff --git a/mcs/class/System.Web/System.Web.Hosting/ChangeLog b/mcs/class/System.Web/System.Web.Hosting/ChangeLog
index 96e8991afcb..9736010265c 100644
--- a/mcs/class/System.Web/System.Web.Hosting/ChangeLog
+++ b/mcs/class/System.Web/System.Web.Hosting/ChangeLog
@@ -1,3 +1,13 @@
+2004-01-14 Andreas Nahr <ClassDevelopment@A-SoftTech.com>
+
+ * IISAPIRuntime.cs: Fixed wrong attribute
+
+2004-01-11 Andreas Nahr <ClassDevelopment@A-SoftTech.com>
+
+ * SimpleWorkerRequest.cs: Added missing attribute
+ * IISAPIRuntime.cs: Added attributes, fixed signature
+ * IAppDomainFactory.cs: Added attributes, fixed signature
+
2003-08-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* ApplicationHost.cs: set hostingInstallDir.
diff --git a/mcs/class/System.Web/System.Web.Hosting/IAppDomainFactory.cs b/mcs/class/System.Web/System.Web.Hosting/IAppDomainFactory.cs
index 2067260c4f4..0160dd3251d 100644
--- a/mcs/class/System.Web/System.Web.Hosting/IAppDomainFactory.cs
+++ b/mcs/class/System.Web/System.Web.Hosting/IAppDomainFactory.cs
@@ -8,17 +8,20 @@
//
using System;
+using System.Runtime.InteropServices;
namespace System.Web.Hosting
{
+ [Guid ("e6e21054-a7dc-4378-877d-b7f4a2d7e8ba")]
+ [InterfaceType (ComInterfaceType.InterfaceIsIUnknown)]
public interface IAppDomainFactory
{
- object Create (string module,
- string typeName,
- string appId,
- string appPath,
- string strUrlOfAppOrigin,
- int iZone);
+ object Create ([In] string module,
+ [In] string typeName,
+ [In] string appId,
+ [In] string appPath,
+ [In] string strUrlOfAppOrigin,
+ [In] int iZone);
}
}
diff --git a/mcs/class/System.Web/System.Web.Hosting/IISAPIRuntime.cs b/mcs/class/System.Web/System.Web.Hosting/IISAPIRuntime.cs
index cf4d7bf6937..6f553a3b0ca 100644
--- a/mcs/class/System.Web/System.Web.Hosting/IISAPIRuntime.cs
+++ b/mcs/class/System.Web/System.Web.Hosting/IISAPIRuntime.cs
@@ -8,13 +8,16 @@
//
using System;
+using System.Runtime.InteropServices;
namespace System.Web.Hosting
{
+ [Guid ("c4918956-485b-3503-bd10-9083e3f6b66c")]
+ [InterfaceType (ComInterfaceType.InterfaceIsIUnknown)]
public interface IISAPIRuntime
{
void DoGCCollect ();
- int ProcessRequest (IntPtr ecb, int useProcessModel);
+ int ProcessRequest ([In] IntPtr ecb, [In] int useProcessModel);
void StartProcessing ();
void StopProcessing ();
}
diff --git a/mcs/class/System.Web/System.Web.Hosting/SimpleWorkerRequest.cs b/mcs/class/System.Web/System.Web.Hosting/SimpleWorkerRequest.cs
index a92a1e8329d..d2faf4de3eb 100644
--- a/mcs/class/System.Web/System.Web.Hosting/SimpleWorkerRequest.cs
+++ b/mcs/class/System.Web/System.Web.Hosting/SimpleWorkerRequest.cs
@@ -1,5 +1,5 @@
//
-// System.Web.Hosting
+// System.Web.Hosting.SimpleWorkerRequest.cs
//
// Authors:
// Patrik Torstensson (Patrik.Torstensson@labs2.com)
@@ -9,11 +9,13 @@
using System;
using System.IO;
using System.Text;
+using System.Runtime.InteropServices;
using System.Web.Util;
namespace System.Web.Hosting
{
[MonoTODO("Implement security demands on the path usage functions (and review)")]
+ [ComVisible (false)]
public class SimpleWorkerRequest : HttpWorkerRequest
{
private string _Page;
diff --git a/mcs/class/System.Web/System.Web.Security/ChangeLog b/mcs/class/System.Web/System.Web.Security/ChangeLog
index babaef9f306..6a1f733ce22 100644
--- a/mcs/class/System.Web/System.Web.Security/ChangeLog
+++ b/mcs/class/System.Web/System.Web.Security/ChangeLog
@@ -1,3 +1,11 @@
+2004-01-23 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * FormsAuthentication.cs: added RequireSSL and SlidingExpiration.
+
+2004-01-11 Andreas Nahr <ClassDevelopment@A-SoftTech.com>
+
+ * PassportIdentity.cs: Added v 1.1 members
+
2003-11-25 Ben Maurer <bmaurer@users.sourceforge.net>
* AccessMembershipProvider.cs: New v2 file
diff --git a/mcs/class/System.Web/System.Web.Security/FormsAuthentication.cs b/mcs/class/System.Web/System.Web.Security/FormsAuthentication.cs
index 66e0320e227..2c06a7937a2 100644
--- a/mcs/class/System.Web/System.Web.Security/FormsAuthentication.cs
+++ b/mcs/class/System.Web/System.Web.Security/FormsAuthentication.cs
@@ -26,6 +26,10 @@ namespace System.Web.Security
static string cookiePath;
static int timeout;
static FormsProtectionEnum protection;
+#if NET_1_1
+ static bool requireSSL;
+ static bool slidingExpiration;
+#endif
// same names and order used in xsp
static string [] indexFiles = { "index.aspx",
@@ -240,11 +244,18 @@ namespace System.Web.Security
timeout = authConfig.Timeout;
cookiePath = authConfig.CookiePath;
protection = authConfig.Protection;
+#if NET_1_1
+ requireSSL = authConfig.RequireSSL;
+ slidingExpiration = authConfig.SlidingExpiration;
+#endif
} else {
cookieName = ".MONOAUTH";
timeout = 30;
cookiePath = "/";
protection = FormsProtectionEnum.All;
+#if NET_1_1
+ slidingExpiration = true;
+#endif
}
initialized = true;
@@ -332,6 +343,21 @@ namespace System.Web.Security
return cookiePath;
}
}
+#if NET_1_1
+ public static bool RequireSSL {
+ get {
+ Initialize ();
+ return requireSSL;
+ }
+ }
+
+ public static bool SlidingExpiration {
+ get {
+ Initialize ();
+ return slidingExpiration;
+ }
+ }
+#endif
}
}
diff --git a/mcs/class/System.Web/System.Web.Security/PassportIdentity.cs b/mcs/class/System.Web/System.Web.Security/PassportIdentity.cs
index 937e825eecc..80b4ab7be87 100644
--- a/mcs/class/System.Web/System.Web.Security/PassportIdentity.cs
+++ b/mcs/class/System.Web/System.Web.Security/PassportIdentity.cs
@@ -1,8 +1,9 @@
//
-// System.Web.Security.PassportIdentity
+// System.Web.Security.PassportIdentity.cs
//
// Authors:
-// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
//
// (C) 2002 Ximian, Inc (http://www.ximian.com)
//
@@ -24,13 +25,18 @@ namespace System.Web.Security
{
}
- [MonoTODO]
public string AuthUrl ()
{
- throw new NotImplementedException ();
+ return AuthUrl (null, -1, -1, null, -1, null, -1, -1);
}
- [MonoTODO]
+#if (!NET_1_0)
+ public string AuthUrl (String strReturnUrl)
+ {
+ return AuthUrl (strReturnUrl, -1, -1, null, -1, null, -1, -1);
+ }
+#endif
+
public string AuthUrl (string strReturnUrl,
int iTimeWindow,
bool fForceLogin,
@@ -40,7 +46,7 @@ namespace System.Web.Security
int iKPP,
bool bUseSecureAuth)
{
- throw new NotImplementedException ();
+ return AuthUrl (strReturnUrl, iTimeWindow, (fForceLogin ? 1 : 0), strCoBrandedArgs, iLangID, strNameSpace, iKPP, (bUseSecureAuth ? 1 : 0));
}
[MonoTODO]
@@ -56,13 +62,18 @@ namespace System.Web.Security
throw new NotImplementedException ();
}
- [MonoTODO]
public string AuthUrl2 ()
{
- throw new NotImplementedException ();
+ return AuthUrl2 (null, -1, -1, null, -1, null, -1, -1);
}
- [MonoTODO]
+#if (!NET_1_0)
+ public string AuthUrl2 (String strReturnUrl)
+ {
+ return AuthUrl2 (strReturnUrl, -1, -1, null, -1, null, -1, -1);
+ }
+#endif
+
public string AuthUrl2 (string strReturnUrl,
int iTimeWindow,
bool fForceLogin,
@@ -72,7 +83,7 @@ namespace System.Web.Security
int iKPP,
bool bUseSecureAuth)
{
- throw new NotImplementedException ();
+ return AuthUrl2 (strReturnUrl, iTimeWindow, (fForceLogin ? 1 : 0), strCoBrandedArgs, iLangID, strNameSpace, iKPP, (bUseSecureAuth ? 1 : 0));
}
[MonoTODO]
@@ -148,10 +159,9 @@ namespace System.Web.Security
throw new NotImplementedException ();
}
- [MonoTODO]
public bool GetIsAuthenticated (int iTimeWindow, bool bForceLogin, bool bCheckSecure)
{
- throw new NotImplementedException ();
+ return this.GetIsAuthenticated (iTimeWindow, (bForceLogin ? 1 : 0), (bCheckSecure ? 1 : 0));
}
[MonoTODO]
@@ -160,12 +170,18 @@ namespace System.Web.Security
throw new NotImplementedException ();
}
- [MonoTODO]
public string GetLoginChallenge ()
{
- throw new NotImplementedException ();
+ return GetLoginChallenge (null, -1, -1, null, -1, null, -1, -1, null);
}
+#if (!NET_1_0)
+ public string GetLoginChallenge (String strReturnUrl)
+ {
+ return GetLoginChallenge (strReturnUrl, -1, -1, null, -1, null, -1, -1, null);
+ }
+#endif
+
[MonoTODO]
public string GetLoginChallenge (string szRetURL,
int iTimeWindow,
@@ -210,13 +226,18 @@ namespace System.Web.Security
throw new NotImplementedException ();
}
- [MonoTODO]
public int LoginUser ()
{
- throw new NotImplementedException ();
+ return LoginUser (null, -1, -1, null, -1, null, -1, -1, null);
}
- [MonoTODO]
+#if (!NET_1_0)
+ public int LoginUser (String strReturnUrl)
+ {
+ return LoginUser (strReturnUrl, -1, -1, null, -1, null, -1, -1, null);
+ }
+#endif
+
public int LoginUser (string szRetURL,
int iTimeWindow,
bool fForceLogin,
@@ -227,7 +248,7 @@ namespace System.Web.Security
bool fUseSecureAuth,
object oExtraParams)
{
- throw new NotImplementedException ();
+ return LoginUser (szRetURL, iTimeWindow, (fForceLogin ? 1 : 0), szCOBrandArgs, iLangID, strNameSpace, iKPP, (fUseSecureAuth ? 1 : 0), null);
}
[MonoTODO]
@@ -244,13 +265,18 @@ namespace System.Web.Security
throw new NotImplementedException ();
}
- [MonoTODO]
public string LogoTag ()
{
- throw new NotImplementedException ();
+ return LogoTag (null, -1, -1, null, -1, -1, null, -1, -1);
}
- [MonoTODO]
+#if (!NET_1_0)
+ public string LogoTag (String strReturnUrl)
+ {
+ return LogoTag (strReturnUrl, -1, -1, null, -1, -1, null, -1, -1);
+ }
+#endif
+
public string LogoTag (string strReturnUrl,
int iTimeWindow,
bool fForceLogin,
@@ -261,7 +287,7 @@ namespace System.Web.Security
int iKPP,
bool bUseSecureAuth)
{
- throw new NotImplementedException ();
+ return LogoTag (strReturnUrl, iTimeWindow, (fForceLogin ? 1 : 0), strCoBrandedArgs, iLangID, (fSecure ? 1 : 0), strNameSpace, iKPP, (bUseSecureAuth ? 1 : 0));
}
[MonoTODO]
@@ -278,13 +304,18 @@ namespace System.Web.Security
throw new NotImplementedException ();
}
- [MonoTODO]
public string LogoTag2 ()
{
- throw new NotImplementedException ();
+ return LogoTag2 (null, -1, -1, null, -1, -1, null, -1, -1);
}
- [MonoTODO]
+#if (!NET_1_0)
+ public string LogoTag2 (String strReturnUrl)
+ {
+ return LogoTag2 (strReturnUrl, -1, -1, null, -1, -1, null, -1, -1);
+ }
+#endif
+
public string LogoTag2 (string strReturnUrl,
int iTimeWindow,
bool fForceLogin,
@@ -295,7 +326,7 @@ namespace System.Web.Security
int iKPP,
bool bUseSecureAuth)
{
- throw new NotImplementedException ();
+ return LogoTag2 (strReturnUrl, iTimeWindow, (fForceLogin ? 1 : 0), strCoBrandedArgs, iLangID, (fSecure ? 1 : 0), strNameSpace, iKPP, (bUseSecureAuth ? 1 : 0));
}
[MonoTODO]
@@ -312,10 +343,9 @@ namespace System.Web.Security
throw new NotImplementedException ();
}
- [MonoTODO]
public string LogoutURL ()
{
- throw new NotImplementedException ();
+ return LogoutURL (null, null, -1, null, -1);
}
[MonoTODO]
diff --git a/mcs/class/System.Web/System.Web.SessionState/ChangeLog b/mcs/class/System.Web/System.Web.SessionState/ChangeLog
index c78a61a3dc2..93bf1dd8433 100644
--- a/mcs/class/System.Web/System.Web.SessionState/ChangeLog
+++ b/mcs/class/System.Web/System.Web.SessionState/ChangeLog
@@ -1,3 +1,16 @@
+2004-01-23 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpSessionState.cs:
+ * SessionInProcHandler.cs: IsNewSession doesn't have a public setter.
+
+ * SessionStateModule.cs: doesn't implement IRequiresSessionState.
+ * StateServerItem.cs: not public.
+
+2004-01-05 Alon Gazit <along@mainsoft.com>
+
+ * SessionDictionary.cs: can't set item's value to null if the item is
+ new.
+
2003-12-25 Jackson Harper <jackson@ximian.com>
* SessionStateModule.cs: Handle SessionStateMode.Off properly in
diff --git a/mcs/class/System.Web/System.Web.SessionState/HttpSessionState.cs b/mcs/class/System.Web/System.Web.SessionState/HttpSessionState.cs
index 4a391e5720d..0d9e63d7346 100644
--- a/mcs/class/System.Web/System.Web.SessionState/HttpSessionState.cs
+++ b/mcs/class/System.Web/System.Web.SessionState/HttpSessionState.cs
@@ -80,7 +80,6 @@ public sealed class HttpSessionState : ICollection, IEnumerable
public bool IsNewSession {
get { return _newSession; }
- set { _newSession=value; }
}
public bool IsReadOnly {
@@ -139,6 +138,11 @@ public sealed class HttpSessionState : ICollection, IEnumerable
get { return _dict; }
}
+ internal void SetNewSession (bool value)
+ {
+ _newSession = value;
+ }
+
public void Abandon ()
{
_abandoned = true;
diff --git a/mcs/class/System.Web/System.Web.SessionState/SessionDictionary.cs b/mcs/class/System.Web/System.Web.SessionState/SessionDictionary.cs
index 957b3231283..d610569a576 100644
--- a/mcs/class/System.Web/System.Web.SessionState/SessionDictionary.cs
+++ b/mcs/class/System.Web/System.Web.SessionState/SessionDictionary.cs
@@ -106,8 +106,13 @@ internal class SessionDictionary : NameObjectCollectionBase
}
set {
- lock (this)
+ lock (this)
+ {
+ object obj = BaseGet(s);
+ if ((obj == null) && (value == null))
+ return;
BaseSet (s, value);
+ }
_dirty = true;
}
@@ -124,7 +129,12 @@ internal class SessionDictionary : NameObjectCollectionBase
}
set {
lock (this)
+ {
+ object obj = BaseGet(index);
+ if ((obj == null) && (value == null))
+ return;
BaseSet (index, value);
+ }
_dirty = true;
}
diff --git a/mcs/class/System.Web/System.Web.SessionState/SessionInProcHandler.cs b/mcs/class/System.Web/System.Web.SessionState/SessionInProcHandler.cs
index ac560d49458..072aa1ecab6 100644
--- a/mcs/class/System.Web/System.Web.SessionState/SessionInProcHandler.cs
+++ b/mcs/class/System.Web/System.Web.SessionState/SessionInProcHandler.cs
@@ -92,7 +92,7 @@ namespace System.Web.SessionState
// if we have a session, and it is not expired, set isNew to false and return it.
if (container!=null && container.SessionState!=null && !container.SessionState.IsAbandoned) {
// Can we do this? It feels safe, but what do I know.
- container.SessionState.IsNewSession = false;
+ container.SessionState.SetNewSession (false);
// update the timestamp.
container.Touch ();
// Can we do this? It feels safe, but what do I know.
@@ -119,7 +119,7 @@ namespace System.Web.SessionState
// and returns it.
context.SetSession (container.SessionState);
- context.Session.IsNewSession = true;
+ context.Session.SetNewSession (true);
// And we're done!
return true;
diff --git a/mcs/class/System.Web/System.Web.SessionState/SessionStateModule.cs b/mcs/class/System.Web/System.Web.SessionState/SessionStateModule.cs
index d125edb7a2a..a6beacaa44c 100644
--- a/mcs/class/System.Web/System.Web.SessionState/SessionStateModule.cs
+++ b/mcs/class/System.Web/System.Web.SessionState/SessionStateModule.cs
@@ -16,7 +16,7 @@ using System.Security.Cryptography;
namespace System.Web.SessionState
{
[MonoTODO]
- public sealed class SessionStateModule : IHttpModule, IRequiresSessionState
+ public sealed class SessionStateModule : IHttpModule
{
internal static readonly string CookieName = "ASPSESSION";
internal static readonly string HeaderName = "AspFilterSessionId";
diff --git a/mcs/class/System.Web/System.Web.SessionState/StateServerItem.cs b/mcs/class/System.Web/System.Web.SessionState/StateServerItem.cs
index 14ca097a327..0b6d26046f0 100644
--- a/mcs/class/System.Web/System.Web.SessionState/StateServerItem.cs
+++ b/mcs/class/System.Web/System.Web.SessionState/StateServerItem.cs
@@ -12,7 +12,7 @@ using System;
namespace System.Web.SessionState {
[Serializable]
- public class StateServerItem {
+ class StateServerItem {
private byte [] dict_data;
private byte [] sobjs_data;
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/ChangeLog b/mcs/class/System.Web/System.Web.UI.HtmlControls/ChangeLog
index adc7e4b2b14..8981c5e4b19 100644
--- a/mcs/class/System.Web/System.Web.UI.HtmlControls/ChangeLog
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/ChangeLog
@@ -1,3 +1,10 @@
+2004-01-15 Alon Gazit <along@mainsoft.com>
+ * HtmlForm.cs: The property name always return the value of the
+ property UniqueID.
+
+2003-12-28 Alon Gazit <along@mainsoft.com>
+ * HtmlSelect.cs: fix typo in LoadPostData().
+
2003-12-29 Alon Gazit <along@mainsoft.com>
* HtmlInputButton.cs: update the implementation of RenderAttributes().
Change the if statement that determines if the onclick script is rendered.
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlForm.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlForm.cs
index 2d2642a9fcb..df48792adb8 100644
--- a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlForm.cs
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlForm.cs
@@ -19,7 +19,7 @@ namespace System.Web.UI.HtmlControls{
public HtmlForm(): base("form"){}
protected override void RenderAttributes(HtmlTextWriter writer){
- writer.WriteAttribute("name", RenderedName);
+ writer.WriteAttribute("name", Name);
Attributes.Remove("name");
writer.WriteAttribute("method", Method);
Attributes.Remove("method");
@@ -158,27 +158,11 @@ namespace System.Web.UI.HtmlControls{
[WebCategory("Appearance")]
public virtual string Name{
get{
- string attr = Attributes["name"];
- if (attr != null){
- return attr;
- }
- return String.Empty;
+ return UniqueID;
}
set {
- Attributes ["Name"] = value;
- }
- }
-
- internal string RenderedName{
- get{
- string attr = Name;
- if (attr.Length > 0){
- return attr;
- }
- return UniqueID;
}
- }
-
+ }
} // class HtmlForm
} // namespace System.Web.UI.HtmlControls
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlSelect.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlSelect.cs
index c4c9e7a17c1..dbaeffdb3bc 100755
--- a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlSelect.cs
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlSelect.cs
@@ -211,7 +211,7 @@ namespace System.Web.UI.HtmlControls{
//test if everything went fine
if( postedValueCount == SelectedIndices.Length){
for (int i = 0; i < postedValueCount; i++)
- if(arr[i] == SelectedIndices[i])
+ if(arr[i] != SelectedIndices[i])
changed = true;
}
else
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/BulletedList.cs b/mcs/class/System.Web/System.Web.UI.WebControls/BulletedList.cs
index 24d8e9fef58..9ad78cd8ad1 100644
--- a/mcs/class/System.Web/System.Web.UI.WebControls/BulletedList.cs
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/BulletedList.cs
@@ -152,7 +152,6 @@ namespace System.Web.UI.WebControls {
public override ListItem SelectedItem {
get { return base.SelectedItem; }
- set { throw new NotSupportedException (String.Format ("This property is not supported in {0}", GetType ())); }
}
public virtual string BulletImageUrl {
@@ -271,4 +270,4 @@ namespace System.Web.UI.WebControls {
}
}
}
-#endif \ No newline at end of file
+#endif
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/Calendar.cs b/mcs/class/System.Web/System.Web.UI.WebControls/Calendar.cs
index bc6c67841ef..948e2ab0bab 100755
--- a/mcs/class/System.Web/System.Web.UI.WebControls/Calendar.cs
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/Calendar.cs
@@ -905,7 +905,7 @@ namespace System.Web.UI.WebControls
dow == DayOfWeek.Sunday ||
dow == DayOfWeek.Saturday,
currentDay == TodaysDate,
- selectedDates.Contains (currentDay),
+ SelectedDates.Contains (currentDay),
globCal.GetMonth (currentDay) != month,
dayString
);
@@ -937,21 +937,20 @@ namespace System.Web.UI.WebControls
currentDayStyle.HorizontalAlign = HorizontalAlign.Center;
}
- TableCell dayCell = new TableCell ();
- dayCell.ApplyStyle (currentDayStyle);
- calDay.IsSelectable = isActive;
- OnDayRender (dayCell, calDay);
- if (isActive)
- dayCell.Text = GetCalendarLinkText (
- "selectDay" + (crr * 7 + weekDay),
- dayString,
- dayCell.ForeColor,
- true);
- else
- dayCell.Text = dayString;
-
- dayCell.RenderControl (writer);
-
+ TableCell dayCell = new TableCell ();
+ dayCell.ApplyStyle (currentDayStyle);
+ dayCell.Controls.Add (new LiteralControl (dayString));
+ calDay.IsSelectable = isActive;
+ OnDayRender (dayCell, calDay);
+ if (calDay.IsSelectable)
+ dayCell.Text = GetCalendarLinkText (
+ "selectDay" + (crr * 7 + weekDay),
+ dayString,
+ dayCell.ForeColor,
+ isActive);
+
+ dayCell.RenderControl (writer);
+
currentDay = globCal.AddDays (currentDay, 1);
}
writer.Write("</tr>");
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog b/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog
index ea6aeeddde9..aaf12cb2c5a 100644
--- a/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog
@@ -1,3 +1,58 @@
+2004-02-01 Alon Gazit <along@mainsoft.com>
+
+ * DataGrid.cs: fixed a problem in the paging mechanism in the method
+ InitializePager().
+ the problem was when (PagerStyle.Mode == PagerMode.NumericPages),
+ while clicking the "..." link in the second page.
+
+2004-01-28 Alon Gazit <along@mainsoft.com>
+
+ * Calendar.cs: prevent NullReferenceException in RenderAllDays().
+
+2004-01-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Calendar.cs: when rendering days, add a LiteralControl containing the
+ day before OnDayRender is called. Only generate the default links for
+ days when IsSelectable is true after OnDayRender. Fixes bug #53372.
+
+2004-01-21 Martin Baulig <martin@ximian.com>
+
+ * XmlHierarchyData.cs: Make this compile with csc.
+
+ * BulletedList.cs (BulletedList.SelectedItem): Removed the `set'
+ accessor since the base class doesn't have one.
+
+2004-01-18 Alon Gazit <along@mainsoft.com>
+
+ * CheckBoxList.cs: fix problem with negative TabIndex (wasn't rendered).
+
+2004-01-18 Alon Gazit <along@mainsoft.com>
+
+ * Style.cs: CopyFrom method shouldn't copy a value that is equal to
+ Property default value.
+ * FontInfo.cs : CopyFrom method shouldn't copy a value that is equal to
+ Property default value.
+
+2004-01-15 Alon Gazit <along@mainsoft.com>
+
+ * RadioButtonList.cs: RepeatLayout property should affect the rendered
+ html.
+
+2004-01-15 Alon Gazit <along@mainsoft.com>
+ * FontInfo.cs: Add validation check to Size property.
+
+2004-01-07 Alon Gazit <along@mainsoft.com>
+ * DataGrid.cs: Fixed PrepareControlHierarchyForItem().
+ merge the column's style to the cell's style and not to
+ the item's(row) style.
+
+2004-01-04 Alon Gazit <along@mainsoft.com>
+ * RangeValidator.cs: Fixed ControlPropertiesValid().
+
+2004-01-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Xml.cs: mono-stylized and removed warnings.
+
2004-1-1 Alon Gazit <along@mainsoft.com>
* RadioButtonList.cs: update RenderItem() so that each RadioButton
is enabled or disabled like the RadioButtonList.
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/CheckBoxList.cs b/mcs/class/System.Web/System.Web.UI.WebControls/CheckBoxList.cs
index 3ecbd200d46..6ff35b3a54d 100644
--- a/mcs/class/System.Web/System.Web.UI.WebControls/CheckBoxList.cs
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/CheckBoxList.cs
@@ -169,7 +169,7 @@ namespace System.Web.UI.WebControls
bool dirtyFlag = false;
short tTabIndex = TabIndex;
Style s = (ControlStyleCreated ? ControlStyle : null);
- if(TabIndex > 0)
+ if(TabIndex != 0)
{
if(!ViewState.IsItemDirty("TabIndex"))
dirtyFlag = true;
@@ -179,7 +179,7 @@ namespace System.Web.UI.WebControls
ri.RepeatLayout = RepeatLayout;
ri.RepeatDirection = RepeatDirection;
ri.RenderRepeater(writer, this, s, this);
- if(tTabIndex > 0)
+ if(tTabIndex != 0)
{
TabIndex = tTabIndex;
}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DataGrid.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DataGrid.cs
index 6cead68a6f9..0c3b374fdb8 100644
--- a/mcs/class/System.Web/System.Web.UI.WebControls/DataGrid.cs
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DataGrid.cs
@@ -958,7 +958,7 @@ namespace System.Web.UI.WebControls
if (headerStyle != null)
item.MergeStyle (headerStyle);
- break;
+ goto case ListItemType.Separator;
case ListItemType.Footer:
if (!ShowFooter) {
item.Visible = false;
@@ -968,7 +968,7 @@ namespace System.Web.UI.WebControls
if (footerStyle != null)
item.MergeStyle (footerStyle);
- break;
+ goto case ListItemType.Separator;
case ListItemType.Item :
item.MergeStyle (itemStyle);
goto case ListItemType.Separator;
@@ -1033,8 +1033,11 @@ namespace System.Web.UI.WebControls
case ListItemType.Footer:
colStyle = cols [i].FooterStyleInternal;
break;
+ default:
+ colStyle = cols [i].ItemStyleInternal;
+ break;
}
- item.MergeStyle (colStyle);
+ cells[i].MergeStyle (colStyle);
} else {
cells [i].Visible = false;
}
@@ -1371,7 +1374,7 @@ namespace System.Web.UI.WebControls
LinkButton toAddBtn = new DataGridLinkButton();
toAddBtn.Text = "...";
toAddBtn.CommandName = "Page";
- toAddBtn.CommandArgument = (lastPageNumber - 1).ToString(NumberFormatInfo.InvariantInfo);
+ toAddBtn.CommandArgument = (firstPageNumber - 1).ToString(NumberFormatInfo.InvariantInfo);
toAddBtn.CausesValidation = false;
toAdd.Controls.Add(toAddBtn);
toAdd.Controls.Add(new LiteralControl("&nbsp;"));
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/FontInfo.cs b/mcs/class/System.Web/System.Web.UI.WebControls/FontInfo.cs
index dfdc23068fb..97d4786a97e 100755
--- a/mcs/class/System.Web/System.Web.UI.WebControls/FontInfo.cs
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/FontInfo.cs
@@ -145,6 +145,8 @@ namespace System.Web.UI.WebControls
}
set
{
+ if ((value.Type == FontSize.AsUnit) && (value.Unit.Value < 0))
+ throw new ArgumentOutOfRangeException("value");
infoOwner.ViewState["FontInfoSize"] = value;
infoOwner.Set(Style.FONT_SIZE);
}
@@ -232,15 +234,15 @@ namespace System.Web.UI.WebControls
{
if(source.Owner.IsSet(Style.FONT_NAMES))
Names = source.Names;
- if(source.Owner.IsSet(Style.FONT_BOLD))
+ if(source.Owner.IsSet(Style.FONT_BOLD)&& source.Bold)
Bold = source.Bold;
- if(source.Owner.IsSet(Style.FONT_ITALIC))
+ if(source.Owner.IsSet(Style.FONT_ITALIC)&& source.Italic)
Italic = source.Italic;
- if(source.Owner.IsSet(Style.FONT_STRIKE))
+ if(source.Owner.IsSet(Style.FONT_STRIKE)&& source.Strikeout)
Strikeout = source.Strikeout;
- if(source.Owner.IsSet(Style.FONT_OLINE))
+ if(source.Owner.IsSet(Style.FONT_OLINE)&& source.Overline)
Overline = source.Overline;
- if(source.Owner.IsSet(Style.FONT_ULINE))
+ if(source.Owner.IsSet(Style.FONT_ULINE)&& source.Underline)
Underline = source.Underline;
if(source.Owner.IsSet(Style.FONT_SIZE) && source.Size != FontUnit.Empty)
Size = source.Size;
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/RadioButtonList.cs b/mcs/class/System.Web/System.Web.UI.WebControls/RadioButtonList.cs
index d9bb2e9a230..1a0092409ba 100644
--- a/mcs/class/System.Web/System.Web.UI.WebControls/RadioButtonList.cs
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/RadioButtonList.cs
@@ -160,6 +160,7 @@ namespace System.Web.UI.WebControls
}
info.RepeatColumns = RepeatColumns;
info.RepeatDirection = RepeatDirection;
+ info.RepeatLayout = RepeatLayout;
info.RenderRepeater(writer, this, cStyle, this);
if(tabIndex != 0)
{
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/RangeValidator.cs b/mcs/class/System.Web/System.Web.UI.WebControls/RangeValidator.cs
index c4289e5fa3b..d0d4f900ae4 100644
--- a/mcs/class/System.Web/System.Web.UI.WebControls/RangeValidator.cs
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/RangeValidator.cs
@@ -86,7 +86,7 @@ namespace System.Web.UI.WebControls
fmt[3] = PropertyConverter.EnumToString(typeof(ValidationDataType), Type);
throw new HttpException(HttpRuntime.FormatResourceString("Validator_value_bad_type", fmt));
}
- string min = MaximumValue;
+ string min = MinimumValue;
if(!CanConvert(min, Type))
{
string[] fmt = new string[4];
@@ -97,7 +97,7 @@ namespace System.Web.UI.WebControls
throw new HttpException(HttpRuntime.FormatResourceString("Validator_value_bad_type", fmt));
}
- if(Compare(max, min, ValidationCompareOperator.GreaterThan, ValidationDataType.Double))
+ if(Compare(min,max, ValidationCompareOperator.GreaterThan, Type))
{
string[] fmt = new string[3];
fmt[0] = min;
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/Style.cs b/mcs/class/System.Web/System.Web.UI.WebControls/Style.cs
index 67819dc3cd7..133e1d6f900 100644
--- a/mcs/class/System.Web/System.Web.UI.WebControls/Style.cs
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/Style.cs
@@ -342,28 +342,28 @@ namespace System.Web.UI.WebControls
return;
Font.CopyFrom (source.Font);
- if (source.IsSet (HEIGHT))
+ if (source.IsSet (HEIGHT)&& (source.Height != Unit.Empty))
Height = source.Height;
- if (source.IsSet (WIDTH))
+ if (source.IsSet (WIDTH)&& (source.Width != Unit.Empty))
Width = source.Width;
- if (source.IsSet (BORDERCOLOR))
+ if (source.IsSet (BORDERCOLOR)&& (source.BorderColor != Color.Empty))
BorderColor = source.BorderColor;
- if (source.IsSet (BORDERWIDTH))
+ if (source.IsSet (BORDERWIDTH)&& (source.BorderWidth != Unit.Empty))
BorderWidth = source.BorderWidth;
if (source.IsSet (BORDERSTYLE))
BorderStyle = source.BorderStyle;
- if (source.IsSet (BACKCOLOR))
+ if (source.IsSet (BACKCOLOR)&& (source.BackColor != Color.Empty))
BackColor = source.BackColor;
if (source.IsSet (CSSCLASS))
CssClass = source.CssClass;
- if (source.IsSet (FORECOLOR))
+ if (source.IsSet (FORECOLOR)&& (source.ForeColor != Color.Empty))
ForeColor = source.ForeColor;
}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/Xml.cs b/mcs/class/System.Web/System.Web.UI.WebControls/Xml.cs
index e202b7cc5d3..8a0f4a12ef6 100644
--- a/mcs/class/System.Web/System.Web.UI.WebControls/Xml.cs
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/Xml.cs
@@ -9,236 +9,220 @@
// (c) 2002 Ximian, Inc. (http://www.ximian.com)
// (C) Gaurav Vaish (2002)
// (C) 2003 Andreas Nahr
-//
-
-using System;
+//
+
+using System;
using System.ComponentModel;
-using System.ComponentModel.Design;
-using System.IO;
-using System.Xml;
-using System.Xml.Xsl;
-using System.Xml.XPath;
-using System.Web;
-using System.Web.UI;
-
-namespace System.Web.UI.WebControls
-{
- [DefaultProperty("DocumentSource")]
+using System.ComponentModel.Design;
+using System.IO;
+using System.Xml;
+using System.Xml.Xsl;
+using System.Xml.XPath;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ [DefaultProperty("DocumentSource")]
[PersistChildren(false)]
[ControlBuilder (typeof (XmlBuilder))]
- [Designer ("System.Web.UI.Design.WebControls.XmlDesigner, " + Consts.AssemblySystem_Design, typeof (IDesigner))]
- public class Xml : Control
- {
- private XmlDocument document;
- private string documentContent;
- private string documentSource;
- private XslTransform transform;
- private XsltArgumentList transformArgumentList;
- private string transformSource;
-
- private XPathDocument xpathDoc;
-
- private static XslTransform defaultTransform;
-
- static Xml()
- {
- XmlTextReader reader = new XmlTextReader(new StringReader("<xsl:stylesheet version='1.0' " +
- "xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>" +
- "<xsl:template match=\"*\">" +
- "<xsl:copy-of select=\".\"/>" +
- "</xsl:template>" +
- "</xsl:stylesheet>"));
- defaultTransform = new XslTransform();
+ [Designer ("System.Web.UI.Design.WebControls.XmlDesigner, " + Consts.AssemblySystem_Design, typeof (IDesigner))]
+ public class Xml : Control
+ {
+ static XslTransform defaultTransform;
+
+ XmlDocument document;
+ string documentContent;
+ string documentSource;
+ XslTransform transform;
+ XsltArgumentList transformArgumentList;
+ string transformSource;
+ XPathDocument xpathDoc;
+
+ static Xml ()
+ {
+ XmlTextReader reader = new XmlTextReader (new StringReader("<xsl:stylesheet version='1.0' " +
+ "xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>" +
+ "<xsl:template match=\"*\">" +
+ "<xsl:copy-of select=\".\"/>" +
+ "</xsl:template>" +
+ "</xsl:stylesheet>"));
+
+ defaultTransform = new XslTransform();
#if NET_1_0
defaultTransform.Load (reader);
#else
defaultTransform.Load (reader, null, null);
#endif
- }
-
- public Xml(): base()
- {
- }
-
- [MonoTODO("security")]
- private void LoadXmlDoc ()
- {
- if (documentContent != null && documentContent.Length > 0) {
- document = new XmlDocument();
- document.LoadXml (documentContent);
- return;
- }
-
- if (documentSource != null && documentSource.Length != 0) {
- document = new XmlDocument();
- document.Load (documentSource);
- }
- }
+ }
+
+ public Xml ()
+ {
+ }
+
+ [MonoTODO("security")]
+ private void LoadXmlDoc ()
+ {
+ if (documentContent != null && documentContent.Length > 0) {
+ document = new XmlDocument ();
+ document.LoadXml (documentContent);
+ return;
+ }
+
+ if (documentSource != null && documentSource.Length != 0) {
+ document = new XmlDocument ();
+ document.Load (documentSource);
+ }
+ }
[Browsable (false), DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
- [WebSysDescription ("This is the XML document that is used for the XML Webcontrol.")]
- public XmlDocument Document
- {
- get
- {
- if(document == null)
- LoadXmlDoc();
- return document;
- }
- set
- {
- documentSource = null;
- documentContent = null;
- xpathDoc = null;
- document = value;
- }
- }
+ [WebSysDescription ("This is the XML document that is used for the XML Webcontrol.")]
+ public XmlDocument Document {
+ get {
+ if (document == null)
+ LoadXmlDoc ();
+ return document;
+ }
+ set {
+ documentSource = null;
+ documentContent = null;
+ xpathDoc = null;
+ document = value;
+ }
+ }
[Browsable (false), DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
- [WebSysDescription ("The XML content that is transformed for the XML Webcontrol.")]
- public string DocumentContent
- {
- get
- {
- return String.Empty;
- }
- set
- {
- document = null;
- xpathDoc = null;
- documentContent = value;
- }
- }
+ [WebSysDescription ("The XML content that is transformed for the XML Webcontrol.")]
+ public string DocumentContent {
+ get {
+ return String.Empty;
+ }
+ set {
+ document = null;
+ xpathDoc = null;
+ documentContent = value;
+ }
+ }
[DefaultValue (""), Bindable (true), WebCategory ("Behavior")]
[Editor ("System.Web.UI.Design.XmlUrlEditor, " + Consts.AssemblySystem_Design, typeof (System.Drawing.Design.UITypeEditor))]
- [WebSysDescription ("The URL or the source of the XML content that is transformed for the XML Webcontrol.")]
- public string DocumentSource
- {
- get
- {
- if(documentSource != null)
- return documentSource;
- return String.Empty;
- }
- set
- {
- document = null;
- documentContent = null;
- xpathDoc = null;
- documentSource = value;
- }
- }
+ [WebSysDescription ("The URL or the source of the XML content that is transformed for the XML Webcontrol.")]
+ public string DocumentSource {
+ get {
+ if (documentSource != null)
+ return documentSource;
+ return String.Empty;
+ }
+ set {
+ document = null;
+ documentContent = null;
+ xpathDoc = null;
+ documentSource = value;
+ }
+ }
[Browsable (false), DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
- [WebSysDescription ("The XSL transform that is applied to this XML Webcontrol.")]
- public XslTransform Transform
- {
- get
- {
- return transform;
- }
- set
- {
- transformSource = null;
- transform = value;
- }
- }
+ [WebSysDescription ("The XSL transform that is applied to this XML Webcontrol.")]
+ public XslTransform Transform {
+ get {
+ return transform;
+ }
+ set {
+ transformSource = null;
+ transform = value;
+ }
+ }
[DefaultValue (""), Bindable (true), WebCategory ("Behavior")]
[Editor ("System.Web.UI.Design.XmlUrlEditor, " + Consts.AssemblySystem_Design, typeof (System.Drawing.Design.UITypeEditor))]
- [WebSysDescription ("An URL specifying the source that is used for the XSL transformation.")]
- public string TransformSource
- {
- get
- {
- if(transformSource != null)
- return transformSource;
- return String.Empty;
- }
- set
- {
- transform = null;
- transformSource = value;
- }
- }
+ [WebSysDescription ("An URL specifying the source that is used for the XSL transformation.")]
+ public string TransformSource {
+ get {
+ if (transformSource != null)
+ return transformSource;
+ return String.Empty;
+ }
+ set {
+ transform = null;
+ transformSource = value;
+ }
+ }
[Browsable (false), DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
- [WebSysDescription ("Arguments that are used by the XSL Transform.")]
- public XsltArgumentList TransformArgumentList
- {
- get
- {
- return transformArgumentList;
- }
- set
- {
- transformArgumentList = value;
- }
- }
-
- protected override void AddParsedSubObject(object obj)
- {
- if(obj is LiteralControl)
- {
- DocumentContent = ((LiteralControl)obj).Text;
- return;
- }
- throw new HttpException (HttpRuntime.FormatResourceString (
- "Cannot_Have_Children_of_Type",
- "Xml",
- GetType().Name));
- }
-
- [MonoTODO("security")]
- private void LoadXpathDoc ()
- {
- if(documentContent != null && documentContent.Length > 0) {
- xpathDoc = new XPathDocument (new StringReader (documentContent));
- return;
- }
-
- if (documentSource != null && documentSource.Length != 0) {
- xpathDoc = new XPathDocument (MapPathSecure (documentSource));
- return;
- }
- }
-
- [MonoTODO("security")]
- private void LoadTransform ()
- {
- if (transform != null)
- return;
-
- if (transformSource != null && transformSource.Length != 0) {
- transform = new XslTransform ();
- transform.Load (MapPathSecure (transformSource));
- }
- }
-
- protected override void Render(HtmlTextWriter output)
- {
- if(document == null)
- {
- LoadXpathDoc();
- }
-
- LoadTransform();
- if(document == null && xpathDoc == null)
- {
- return;
- }
- if(transform == null)
- {
- transform = defaultTransform;
- }
- if(document != null)
- {
- Transform.Transform(document, transformArgumentList, output);
- return;
- }
- Transform.Transform(xpathDoc, transformArgumentList, output);
- }
- }
-}
-
+ [WebSysDescription ("Arguments that are used by the XSL Transform.")]
+ public XsltArgumentList TransformArgumentList {
+ get { return transformArgumentList; }
+ set { transformArgumentList = value; }
+ }
+
+ protected override void AddParsedSubObject (object obj)
+ {
+ if (obj is LiteralControl) {
+ DocumentContent = ((LiteralControl) obj).Text;
+ return;
+ }
+
+ throw new HttpException (HttpRuntime.FormatResourceString (
+ "Cannot_Have_Children_of_Type",
+ "Xml",
+ GetType().Name));
+ }
+
+ [MonoTODO("security")]
+ private void LoadXpathDoc ()
+ {
+ if (documentContent != null && documentContent.Length > 0) {
+ xpathDoc = new XPathDocument (new StringReader (documentContent));
+ return;
+ }
+
+ if (documentSource != null && documentSource.Length != 0) {
+ xpathDoc = new XPathDocument (MapPathSecure (documentSource));
+ return;
+ }
+ }
+
+ [MonoTODO("security")]
+ private void LoadTransform ()
+ {
+ if (transform != null)
+ return;
+
+ if (transformSource != null && transformSource.Length != 0) {
+ transform = new XslTransform ();
+ transform.Load (MapPathSecure (transformSource));
+ }
+ }
+
+ protected override void Render(HtmlTextWriter output)
+ {
+ if (document == null) {
+ LoadXpathDoc();
+ }
+
+ LoadTransform();
+ if (document == null && xpathDoc == null) {
+ return;
+ }
+
+ if (transform == null) {
+ transform = defaultTransform;
+ }
+
+ if (document != null) {
+#if NET_1_0
+ Transform.Transform(document, transformArgumentList, output);
+#else
+ Transform.Transform(document, transformArgumentList, output, null);
+#endif
+ return;
+ }
+#if NET_1_0
+ Transform.Transform(xpathDoc, transformArgumentList, output);
+#else
+ Transform.Transform(xpathDoc, transformArgumentList, output, null);
+#endif
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/XmlHierarchyData.cs b/mcs/class/System.Web/System.Web.UI.WebControls/XmlHierarchyData.cs
index 9e1a2b9a841..2470b56808e 100644
--- a/mcs/class/System.Web/System.Web.UI.WebControls/XmlHierarchyData.cs
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/XmlHierarchyData.cs
@@ -13,7 +13,7 @@ using System.Collections.Specialized;
using System.Text;
using System.Xml;
using System.ComponentModel;
-using AttributeCollection = System.ComponentModel.AttributeCollection;
+using AC = System.ComponentModel.AttributeCollection;
namespace System.Web.UI.WebControls {
public class XmlHierarchyData : IHierarchyData, ICustomTypeDescriptor {
@@ -28,9 +28,9 @@ namespace System.Web.UI.WebControls {
}
#region ICustomTypeDescriptor
- AttributeCollection ICustomTypeDescriptor.GetAttributes ()
+ AC ICustomTypeDescriptor.GetAttributes ()
{
- return AttributeCollection.Empty;
+ return AC.Empty;
}
string ICustomTypeDescriptor.GetClassName ()
diff --git a/mcs/class/System.Web/System.Web.UI/ApplicationFileParser.cs b/mcs/class/System.Web/System.Web.UI/ApplicationFileParser.cs
index 37904fb806d..28a34959676 100644
--- a/mcs/class/System.Web/System.Web.UI/ApplicationFileParser.cs
+++ b/mcs/class/System.Web/System.Web.UI/ApplicationFileParser.cs
@@ -5,8 +5,10 @@
// Gonzalo Paniagua Javier (gonzalo@ximian.com)
//
// (C) 2002,2003 Ximian, Inc (http://www.ximian.com)
+// (c) 2004 Novell, Inc. (http://www.novell.com)
//
using System;
+using System.Collections;
using System.Web;
using System.Web.Compilation;
@@ -22,21 +24,33 @@ namespace System.Web.UI
protected override Type CompileIntoType ()
{
- GlobalAsaxCompiler compiler = new GlobalAsaxCompiler (this);
- return compiler.GetCompiledType ();
+ return GlobalAsaxCompiler.CompileApplicationType (this);
}
internal static Type GetCompiledApplicationType (string inputFile, HttpContext context)
{
ApplicationFileParser parser = new ApplicationFileParser (inputFile, context);
- AspGenerator generator = new AspGenerator (parser);
- return generator.GetCompiledType ();
+ return GlobalAsaxCompiler.CompileApplicationType (parser);
+ }
+
+ internal override void AddDirective (string directive, Hashtable atts)
+ {
+ if (String.Compare (directive, "application", true) != 0 &&
+ String.Compare (directive, "Import", true) != 0 &&
+ String.Compare (directive, "Assembly", true) != 0)
+ ThrowParseException ("Invalid directive: " + directive);
+
+ base.AddDirective (directive, atts);
}
internal override Type DefaultBaseType {
get { return typeof (HttpApplication); }
}
+ internal override string DefaultBaseTypeName {
+ get { return "System.Web.HttpApplication"; }
+ }
+
internal override string DefaultDirectiveName {
get { return "application"; }
}
diff --git a/mcs/class/System.Web/System.Web.UI/BasePartialCachingControl.cs b/mcs/class/System.Web/System.Web.UI/BasePartialCachingControl.cs
index e39e4bf8dc6..fa8e1e46ffd 100644
--- a/mcs/class/System.Web/System.Web.UI/BasePartialCachingControl.cs
+++ b/mcs/class/System.Web/System.Web.UI/BasePartialCachingControl.cs
@@ -3,11 +3,15 @@
//
// Author:
// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+// Jackson Harper (jackson@ximian.com)
//
// (C) 2003 Andreas Nahr
+// (C) 2004 Novell, Inc (http://www.novell.com)
//
using System;
+using System.IO;
+using System.Text;
using System.ComponentModel;
using System.Web.Caching;
@@ -17,34 +21,144 @@ namespace System.Web.UI
public abstract class BasePartialCachingControl : Control
{
private CacheDependency dependency;
+ private string ctrl_id;
+ private string guid;
+ private int duration;
+ private string varyby_params;
+ private string varyby_controls;
+ private string varyby_custom;
+ private Control control;
+
protected BasePartialCachingControl()
{
}
+ internal string CtrlID {
+ get { return ctrl_id; }
+ set { ctrl_id = value; }
+ }
+
+ internal string Guid {
+ get { return guid; }
+ set { guid = value; }
+ }
+
+ internal int Duration {
+ get { return duration; }
+ set { duration = value; }
+ }
+
+ internal string VaryByParams {
+ get { return varyby_params; }
+ set { varyby_params = value; }
+ }
+
+ internal string VaryByControls {
+ get { return varyby_controls; }
+ set { varyby_controls = value; }
+ }
+
+ internal string VaryByCustom {
+ get { return varyby_custom; }
+ set { varyby_custom = value; }
+ }
+
internal abstract Control CreateControl ();
- [MonoTODO]
public override void Dispose ()
{
- throw new NotImplementedException ();
+ if (dependency != null) {
+ dependency.Dispose ();
+ dependency = null;
+ }
}
- [MonoTODO]
protected override void OnInit (EventArgs e)
{
- throw new NotImplementedException ();
+ control = CreateControl ();
+ Controls.Add (control);
}
- [MonoTODO]
protected override void Render (HtmlTextWriter output)
{
- throw new NotImplementedException ();
+ Cache cache = HttpRuntime.Cache;
+ string key = CreateKey ();
+ string data = cache [key] as string;
+
+ if (data != null) {
+ output.Write (data);
+ return;
+ }
+
+ HttpContext context = HttpContext.Current;
+ StringWriter writer = new StringWriter ();
+ TextWriter prev = context.Response.SetTextWriter (writer);
+ HtmlTextWriter txt_writer = new HtmlTextWriter (writer);
+ string text;
+ try {
+ control.RenderControl (txt_writer);
+ } finally {
+ text = writer.ToString ();
+ context.Response.SetTextWriter (prev);
+ output.Write (text);
+ }
+
+ context.Cache.InsertPrivate (key, text, dependency,
+ DateTime.Now.AddSeconds (duration),
+ Cache.NoSlidingExpiration,
+ CacheItemPriority.Normal, null);
}
public CacheDependency Dependency {
get {return dependency;}
set {dependency = value;}
}
+
+ private string CreateKey ()
+ {
+ StringBuilder builder = new StringBuilder ();
+ HttpContext context = HttpContext.Current;
+
+ builder.Append ("PartialCachingControl\n");
+ builder.Append ("GUID: " + guid + "\n");
+
+ if (varyby_params != null && varyby_params.Length > 0) {
+ string[] prms = varyby_params.Split (';');
+ for (int i=0; i<prms.Length; i++) {
+ string val = context.Request.Params [prms [i]];
+ builder.Append ("VP:");
+ builder.Append (prms [i]);
+ builder.Append ('=');
+ builder.Append (val != null ? val : "__null__");
+ builder.Append ('\n');
+ }
+ }
+
+ if (varyby_controls != null && varyby_params.Length > 0) {
+ string[] prms = varyby_controls.Split (';');
+ for (int i=0; i<prms.Length; i++) {
+ string val = context.Request.Params [prms [i]];
+ builder.Append ("VCN:");
+ builder.Append (prms [i]);
+ builder.Append ('=');
+ builder.Append (val != null ? val : "__null__");
+ builder.Append ('\n');
+ }
+ }
+
+ if (varyby_custom != null) {
+ string val = context.ApplicationInstance.GetVaryByCustomString (context,
+ varyby_custom);
+ builder.Append ("VC:");
+ builder.Append (varyby_custom);
+ builder.Append ('=');
+ builder.Append (val != null ? val : "__null__");
+ builder.Append ('\n');
+ }
+
+ return builder.ToString ();
+ }
}
}
+
diff --git a/mcs/class/System.Web/System.Web.UI/ChangeLog b/mcs/class/System.Web/System.Web.UI/ChangeLog
index 62700b9a07b..68c324bb225 100644
--- a/mcs/class/System.Web/System.Web.UI/ChangeLog
+++ b/mcs/class/System.Web/System.Web.UI/ChangeLog
@@ -1,3 +1,109 @@
+2004-01-30 Jackson Harper <jackson@ximian.com>
+
+ * Control.cs: Ensure that dynamically loaded controls are
+ initialized.
+
+2004-01-28 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ApplicationFileParser.cs: check for error in directives. Use
+ GlobalAsaxCompiler.CompileApplicationType for compiling.
+
+ * ObjectTagBuilder.cs: load the Type and check for errors.
+
+ * TemplateParser.cs: add assemblies and imports from global.asax.
+
+ Now we properly create accessors for session and application objects in
+ the application itself, pages and controls. First step for fixing
+ bug #53387.
+
+2004-01-28 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * TemplateControl.cs: small speedup for WireUpautomaticEvents. Thanks
+ to Eric Lindvall for pointing this out.
+
+2004-01-15 Jackson Harper <jackson@ximian.com>
+
+ * TemplateParser.cs: Detect if we are parsing a control or page
+ properly.
+ * Page.cs: vary by params and vary by headers can be null now.
+
+2004-01-15 Martin Willemoes Hansen <mwh@sysrq.dk>
+
+ * HtmlTextWriter.cs: Fixed OutputTab routine to generate correct
+ indention.
+
+2004-01-14 Jackson Harper <jackson@ximian.com>
+
+ * Page.cs: If we have a postback that wasn't sent through a
+ postback script (ie user hit submit on a input type=submit) call
+ Validate so page validation occurs. This fixes bug #52770.
+
+2004-01-14 Jackson Harper <jackson@ximian.com>
+
+ * Page.cs: Don't tell the response to cache anymore. This is done
+ when the cacheability is modified by a callback. Set the cache's
+ duration.
+
+2004-01-14 Jackson Harper <jackson@ximian.com>
+
+ * TemplateParser.cs: If varybyparam is set to "none" make it null
+ so we dont get a param named null in the outputcache key.
+
+2004-01-14 Jackson Harper <jackson@ximian.com>
+
+ * BasePartialCachingControl.cs: Use varyby attributes in key
+ generation.
+
+2004-01-14 Jackson Harper <jackson@ximian.com>
+
+ * TemplateParser.cs: Add all the outputcache attribute error
+ messages.
+
+2004-01-13 Jackson Harper <jackson@ximian.com>
+
+ * TemplateParser.cs: Add VaryByControls and Shared output cache
+ properties. These are not assigned yet.
+ * TemplateControlParser.cs: Do not ignore the OutputCache
+ attribute.
+ * BasePartialCachingControl.cs: Initial implementation. Keys are
+ still not created properly.
+ * StaticPartialCachingControl.cs: Assign properties in base class,
+ implement CreateControl.
+
+2004-01-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ApplicationFileParser.cs: adde DefaultBaseTypeName property.
+
+ * PageParser.cs: support validateRequest.
+
+ * TemplateControlParser.cs: get default values from system.web/pages
+ section.
+
+ * TemplateParser.cs: added separate method for changing base type
+ (Inherits or system.web/pages).
+
+ * UserControlParser.cs: support system.web/pages defined base type.
+
+2004-01-11 Andreas Nahr <ClassDevelopment@A-SoftTech.com>
+
+ * UserControl.cs: Added missing attribute, implemented method
+ * Page.cs: Added missing attribute, implemented method
+
+2004-01-10 Jackson Harper <jackson@ximian.com>
+
+ * Page.cs: Handle trace being enabled in the config file.
+
+2004-01-10 Jackson Harper <jackson@ximian.com>
+
+ * Page.cs: Save trace data before rendering it.
+ * System.Web.dll.sources: Add TraceData.cs
+
+2004-01-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Page.cs: removed a couple of MonoTODO on methods we're not gonna
+ implement. Applied patch from Jan Jaros (mono-bug@jerryweb.info) to
+ ensure that Unload event is raised. Fixes bug #52555.
+
2004-01-02 Zoltan Varga <vargaz@freemail.hu>
* KeyedList.cs: 'private' is not allowed on explicit interface
diff --git a/mcs/class/System.Web/System.Web.UI/Control.cs b/mcs/class/System.Web/System.Web.UI/Control.cs
index 93c737a1fcc..6a3fa648ce2 100644
--- a/mcs/class/System.Web/System.Web.UI/Control.cs
+++ b/mcs/class/System.Web/System.Web.UI/Control.cs
@@ -57,7 +57,7 @@ namespace System.Web.UI
private bool bindingContainer = true;
private bool autoEventWireup = true;
- bool inited;
+ bool inited, initing;
bool viewStateLoaded;
bool loaded;
bool prerendered;
@@ -377,7 +377,7 @@ namespace System.Web.UI
control._userId = nc.GetDefaultName () + "a";
}
- if (inited)
+ if (initing || inited)
control.InitRecursive (nc);
if (viewStateLoaded || loaded) {
@@ -829,9 +829,11 @@ namespace System.Web.UI
}
}
+ initing = true;
OnInit (EventArgs.Empty);
TrackViewState ();
inited = true;
+ initing = false;
}
internal object SaveViewStateRecursive ()
diff --git a/mcs/class/System.Web/System.Web.UI/HtmlTextWriter.cs b/mcs/class/System.Web/System.Web.UI/HtmlTextWriter.cs
index f78cffc1b6b..3d1a7ce4ae5 100644
--- a/mcs/class/System.Web/System.Web.UI/HtmlTextWriter.cs
+++ b/mcs/class/System.Web/System.Web.UI/HtmlTextWriter.cs
@@ -412,7 +412,7 @@ protected virtual bool OnTagRender(string name, HtmlTextWriterTag key){
protected virtual void OutputTabs(){
if (tabsPending) {
- for(int i=0; i <= indentLevel; i++) {
+ for(int i=0; i < indentLevel; i++) {
writer.Write(tabString);
}
tabsPending = false;
diff --git a/mcs/class/System.Web/System.Web.UI/ObjectTagBuilder.cs b/mcs/class/System.Web/System.Web.UI/ObjectTagBuilder.cs
index e1dedc5d4c7..176eb797630 100644
--- a/mcs/class/System.Web/System.Web.UI/ObjectTagBuilder.cs
+++ b/mcs/class/System.Web/System.Web.UI/ObjectTagBuilder.cs
@@ -17,7 +17,7 @@ namespace System.Web.UI
{
string id;
string scope;
- string className;
+ Type type;
public ObjectTagBuilder ()
{
@@ -43,23 +43,37 @@ namespace System.Web.UI
if (attribs == null)
throw new ParseException (parser.Location, "Error in ObjectTag.");
+ attribs.Remove ("runat");
this.id = attribs ["id"] as string;
+ attribs.Remove ("id");
if (this.id == null || this.id.Trim () == "")
throw new ParseException (parser.Location, "Object tag must have a valid ID.");
scope = attribs ["scope"] as string;
- className = attribs ["class"] as string;
+ string className = attribs ["class"] as string;
attribs.Remove ("scope");
attribs.Remove ("class");
if (className == null || className.Trim () == "")
throw new ParseException (parser.Location, "Object tag must have 'class' attribute.");
+ this.type = parser.LoadType (className);
+ if (this.type == null)
+ throw new ParseException (parser.Location, "Type " + className + " not found.");
if (attribs ["progid"] != null || attribs ["classid"] != null)
throw new ParseException (parser.Location, "ClassID and ProgID are not supported.");
-
- base.Init (parser, parentBuilder, type, tagName, this.id, attribs);
- // class, id, scope
+
+ if (attribs.Count > 0)
+ throw new ParseException (parser.Location, "Unknown attribute");
+ }
+
+ public override bool HasBody ()
+ {
+ return false;
+ }
+
+ internal Type Type {
+ get { return type; }
}
internal string ObjectID {
@@ -69,10 +83,6 @@ namespace System.Web.UI
internal string Scope {
get { return scope; }
}
-
- internal string ClassName {
- get { return className; }
- }
}
}
diff --git a/mcs/class/System.Web/System.Web.UI/Page.cs b/mcs/class/System.Web/System.Web.UI/Page.cs
index 98700998cba..78a0502f34d 100755
--- a/mcs/class/System.Web/System.Web.UI/Page.cs
+++ b/mcs/class/System.Web/System.Web.UI/Page.cs
@@ -29,7 +29,7 @@ using System.Web.Util;
namespace System.Web.UI
{
-// TODO FIXME missing the IRootDesigner Attribute
+[MonoTODO ("FIXME missing the IRootDesigner Attribute")]
[DefaultEvent ("Load"), DesignerCategory ("ASPXCodeBehind")]
[ToolboxItem (false)]
[Designer ("System.Web.UI.Design.ControlDesigner, " + Consts.AssemblySystem_Design, typeof (IDesigner))]
@@ -304,6 +304,7 @@ public class Page : TemplateControl, IHttpHandler
}
[MonoTODO ("Use this when encrypting/decrypting ViewState")]
+ [Browsable (false)]
public string ViewStateUserKey {
get { return viewStateUserKey; }
set { viewStateUserKey = value; }
@@ -320,7 +321,6 @@ public class Page : TemplateControl, IHttpHandler
#region Methods
- [MonoTODO]
[EditorBrowsable (EditorBrowsableState.Never)]
protected IAsyncResult AspCompatBeginProcessRequest (HttpContext context,
AsyncCallback cb,
@@ -329,7 +329,6 @@ public class Page : TemplateControl, IHttpHandler
throw new NotImplementedException ();
}
- [MonoTODO]
[EditorBrowsable (EditorBrowsableState.Never)]
protected void AspCompatEndProcessRequest (IAsyncResult result)
{
@@ -342,11 +341,10 @@ public class Page : TemplateControl, IHttpHandler
return new HtmlTextWriter (tw);
}
- [MonoTODO]
[EditorBrowsable (EditorBrowsableState.Never)]
public void DesignerInitialize ()
{
- throw new NotImplementedException ();
+ InitRecursive (null);
}
[EditorBrowsable (EditorBrowsableState.Advanced)]
@@ -437,8 +435,8 @@ public class Page : TemplateControl, IHttpHandler
case OutputCacheLocation.Server:
if (varyByCustom != null)
cache.SetVaryByCustom (varyByCustom);
-
- if (varyByParam.Length > 0) {
+
+ if (varyByParam != null && varyByParam.Length > 0) {
string[] prms = varyByParam.Split (';');
foreach (string p in prms)
cache.VaryByParams [p.Trim ()] = true;
@@ -447,16 +445,17 @@ public class Page : TemplateControl, IHttpHandler
cache.VaryByParams.IgnoreParams = true;
}
- if (varyByHeader != null) {
+ if (varyByHeader != null && varyByHeader.Length > 0) {
string[] hdrs = varyByHeader.Split (';');
foreach (string h in hdrs)
cache.VaryByHeaders [h.Trim ()] = true;
}
- _context.Response.CacheResponse (_context.Request);
+
break;
case OutputCacheLocation.None:
break;
}
+ cache.Duration = duration;
cache.SetExpires (_context.Timestamp.AddSeconds (duration));
}
@@ -669,6 +668,9 @@ public class Page : TemplateControl, IHttpHandler
try {
InternalProcessRequest ();
} finally {
+ try {
+ UnloadRecursive (true);
+ } catch {}
Thread.CurrentThread.CurrentCulture = culture;
Thread.CurrentThread.CurrentUICulture = uiculture;
}
@@ -718,14 +720,19 @@ public class Page : TemplateControl, IHttpHandler
RenderTrace (output);
_context = null;
- UnloadRecursive (true);
}
private void RenderTrace (HtmlTextWriter output)
{
- if (!Trace.IsEnabled)
+ TraceManager manager = HttpRuntime.TraceManager;
+
+ if (!Trace.IsEnabled && !manager.Enabled)
return;
- Trace.Render (output);
+
+ Trace.SaveData ();
+
+ if (Trace.IsEnabled || manager.PageOutput)
+ Trace.Render (output);
}
internal void RaisePostBackEvents ()
@@ -740,8 +747,10 @@ public class Page : TemplateControl, IHttpHandler
return;
string eventTarget = postdata [postEventSourceID];
- if (eventTarget == null || eventTarget.Length == 0)
+ if (eventTarget == null || eventTarget.Length == 0) {
+ Validate ();
return;
+ }
IPostBackEventHandler target = FindControl (eventTarget) as IPostBackEventHandler;
if (target == null)
diff --git a/mcs/class/System.Web/System.Web.UI/PageParser.cs b/mcs/class/System.Web/System.Web.UI/PageParser.cs
index a9c0910b6ac..acb958abe23 100644
--- a/mcs/class/System.Web/System.Web.UI/PageParser.cs
+++ b/mcs/class/System.Web/System.Web.UI/PageParser.cs
@@ -29,6 +29,8 @@ namespace System.Web.UI
string culture;
string uiculture;
string errorPage;
+ bool validateRequest;
+ Type baseType = typeof (Page);
public PageParser ()
{
@@ -53,7 +55,8 @@ namespace System.Web.UI
internal override void ProcessMainAttributes (Hashtable atts)
{
- string enabless = GetString (atts, "EnableSessionState", null);
+ SetBaseType (PagesConfig.PageBaseType);
+ string enabless = GetString (atts, "EnableSessionState", PagesConfig.EnableSessionState);
if (enabless != null) {
readonlySessionState = (String.Compare (enabless, "readonly", true) == 0);
if (readonlySessionState == true || String.Compare (enabless, "true", true) == 0) {
@@ -187,13 +190,13 @@ namespace System.Web.UI
}
errorPage = GetString (atts, "ErrorPage", null);
+ validateRequest = GetBool (atts, "ValidateRequest", PagesConfig.ValidateRequest);
// Ignored by now
GetString (atts, "Buffer", null);
GetString (atts, "ClientTarget", null);
GetString (atts, "EnableViewStateMac", null);
GetString (atts, "SmartNavigation", null);
- GetBool (atts, "ValidateRequest", true);
base.ProcessMainAttributes (atts);
}
@@ -231,7 +234,11 @@ namespace System.Web.UI
}
internal override Type DefaultBaseType {
- get { return typeof (Page); }
+ get { return baseType; }
+ }
+
+ internal override string DefaultBaseTypeName {
+ get { return "System.Web.UI.Page"; }
}
internal override string DefaultDirectiveName {
@@ -265,6 +272,10 @@ namespace System.Web.UI
internal string ErrorPage {
get { return errorPage; }
}
+
+ internal bool ValidateRequest {
+ get { return validateRequest; }
+ }
}
}
diff --git a/mcs/class/System.Web/System.Web.UI/SimpleWebHandlerParser.cs b/mcs/class/System.Web/System.Web.UI/SimpleWebHandlerParser.cs
index 9a14eb25489..d0ca97b39c3 100644
--- a/mcs/class/System.Web/System.Web.UI/SimpleWebHandlerParser.cs
+++ b/mcs/class/System.Web/System.Web.UI/SimpleWebHandlerParser.cs
@@ -242,8 +242,12 @@ namespace System.Web.UI
string [] binDlls = Directory.GetFiles (PrivateBinPath, "*.dll");
foreach (string dll in binDlls) {
- Assembly assembly = Assembly.LoadFrom (dll);
- AddAssembly (assembly, true);
+ try {
+ Assembly assembly = Assembly.LoadFrom (dll);
+ AddAssembly (assembly, true);
+ } catch (Exception e) {
+ throw new Exception ("Error while loading " + dll, e);
+ }
}
}
diff --git a/mcs/class/System.Web/System.Web.UI/StaticPartialCachingControl.cs b/mcs/class/System.Web/System.Web.UI/StaticPartialCachingControl.cs
index 619954c8f4b..e21e9e2b40f 100644
--- a/mcs/class/System.Web/System.Web.UI/StaticPartialCachingControl.cs
+++ b/mcs/class/System.Web/System.Web.UI/StaticPartialCachingControl.cs
@@ -17,26 +17,35 @@ namespace System.Web.UI
private BuildMethod buildMethod;
- [MonoTODO]
- public StaticPartialCachingControl (string ctrlID, string guid, int duration, string varyByParams, string varyByControls, string varyByCustom, BuildMethod buildMethod)
+ public StaticPartialCachingControl (string ctrlID, string guid, int duration,
+ string varyByParams, string varyByControls, string varyByCustom,
+ BuildMethod buildMethod)
{
- // TODO add the missing items to base class
+ CtrlID = ctrlID;
+ Guid = guid;
+ Duration = duration;
+ VaryByParams = varyByParams;
+ VaryByControls = varyByControls;
+ VaryByCustom = varyByCustom;
+
this.buildMethod = buildMethod;
}
- public static void BuildCachedControl (Control parent, string ctrlID, string guid, int duration, string varyByParams, string varyByControls, string varyByCustom, BuildMethod buildMethod)
+ public static void BuildCachedControl (Control parent, string ctrlID, string guid,
+ int duration, string varyByParams, string varyByControls,
+ string varyByCustom, BuildMethod buildMethod)
{
StaticPartialCachingControl NewControl =
- new StaticPartialCachingControl (ctrlID, guid, duration, varyByParams, varyByControls, varyByCustom, buildMethod);
+ new StaticPartialCachingControl (ctrlID, guid, duration,
+ varyByParams, varyByControls, varyByCustom,
+ buildMethod);
+
parent.Controls.Add (NewControl);
}
- [MonoTODO]
internal override Control CreateControl()
{
- //TODO invoke the build method
- //return buildMethod.Invoke ();
- throw new NotImplementedException ();
+ return buildMethod ();
}
}
}
diff --git a/mcs/class/System.Web/System.Web.UI/TemplateControl.cs b/mcs/class/System.Web/System.Web.UI/TemplateControl.cs
index 937eb299ba1..d17c809bedc 100755
--- a/mcs/class/System.Web/System.Web.UI/TemplateControl.cs
+++ b/mcs/class/System.Web/System.Web.UI/TemplateControl.cs
@@ -76,14 +76,9 @@ namespace System.Web.UI {
return;
Type type = GetType ();
- foreach (MethodInfo method in type.GetMethods (bflags)) {
- int pos = Array.IndexOf (methodNames, method.Name);
- if (pos == -1)
- continue;
-
- string name = methodNames [pos];
- pos = name.IndexOf ("_");
- if (pos == -1 || pos + 1 == name.Length)
+ foreach (string methodName in methodNames) {
+ MethodInfo method = type.GetMethod (methodName, bflags);
+ if (method == null)
continue;
if (method.ReturnType != typeof (void))
@@ -92,22 +87,25 @@ namespace System.Web.UI {
ParameterInfo [] parms = method.GetParameters ();
int length = parms.Length;
bool noParams = (length == 0);
- if (!noParams && (parms.Length != 2 ||
+ if (!noParams && (length != 2 ||
parms [0].ParameterType != typeof (object) ||
parms [1].ParameterType != typeof (EventArgs)))
continue;
- string eventName = name.Substring (pos + 1);
+ int pos = methodName.IndexOf ("_");
+ string eventName = methodName.Substring (pos + 1);
EventInfo evt = type.GetEvent (eventName);
- if (evt == null)
+ if (evt == null) {
+ /* This should never happen */
continue;
+ }
if (noParams) {
- NoParamsInvoker npi = new NoParamsInvoker (this, method.Name);
+ NoParamsInvoker npi = new NoParamsInvoker (this, methodName);
evt.AddEventHandler (this, npi.FakeDelegate);
} else {
evt.AddEventHandler (this, Delegate.CreateDelegate (
- typeof (EventHandler), this, method.Name));
+ typeof (EventHandler), this, methodName));
}
}
}
diff --git a/mcs/class/System.Web/System.Web.UI/TemplateControlParser.cs b/mcs/class/System.Web/System.Web.UI/TemplateControlParser.cs
index a53915c6e2d..c30c4caf231 100644
--- a/mcs/class/System.Web/System.Web.UI/TemplateControlParser.cs
+++ b/mcs/class/System.Web/System.Web.UI/TemplateControlParser.cs
@@ -26,8 +26,8 @@ namespace System.Web.UI
internal override void ProcessMainAttributes (Hashtable atts)
{
- autoEventWireup = GetBool (atts, "AutoEventWireup", true);
- enableViewState = GetBool (atts, "EnableViewState", true);
+ autoEventWireup = GetBool (atts, "AutoEventWireup", PagesConfig.AutoEventWireup);
+ enableViewState = GetBool (atts, "EnableViewState", PagesConfig.EnableViewState);
atts.Remove ("TargetSchema"); // Ignored
@@ -136,8 +136,6 @@ namespace System.Web.UI
return;
}
-
- atts.Remove ("OutputCache"); // ignored
base.AddDirective (directive, atts);
}
diff --git a/mcs/class/System.Web/System.Web.UI/TemplateParser.cs b/mcs/class/System.Web/System.Web.UI/TemplateParser.cs
index 6f1886907ef..3e9712ad752 100755
--- a/mcs/class/System.Web/System.Web.UI/TemplateParser.cs
+++ b/mcs/class/System.Web/System.Web.UI/TemplateParser.cs
@@ -14,6 +14,7 @@ using System.IO;
using System.Reflection;
using System.Web;
using System.Web.Compilation;
+using System.Web.Configuration;
using System.Web.Util;
namespace System.Web.UI
@@ -38,8 +39,10 @@ namespace System.Web.UI
string language;
bool output_cache;
int oc_duration;
- string oc_header, oc_custom, oc_param;
+ string oc_header, oc_custom, oc_param, oc_controls;
+ bool oc_shared;
OutputCacheLocation oc_location;
+ Assembly srcAssembly;
internal TemplateParser ()
{
@@ -64,6 +67,21 @@ namespace System.Web.UI
AddAssembliesInBin ();
language = CompilationConfig.DefaultLanguage;
+ if (GlobalAsaxCompiler.Assemblies != null) {
+ foreach (string assembly in GlobalAsaxCompiler.Assemblies) {
+ if (!assemblies.Contains (assembly)) {
+ AddAssemblyByName (assembly);
+ }
+ }
+ }
+
+ if (GlobalAsaxCompiler.Imports != null) {
+ foreach (string import in GlobalAsaxCompiler.Imports) {
+ if (!imports.Contains (import)) {
+ imports.Add (import);
+ }
+ }
+ }
}
internal void AddApplicationAssembly ()
@@ -167,11 +185,13 @@ namespace System.Web.UI
case "duration":
oc_duration = Int32.Parse ((string) entry.Value);
if (oc_duration < 1)
- ThrowParseException ("The 'd uration' attribute must be set " +
+ ThrowParseException ("The 'duration' attribute must be set " +
"to a positive integer value");
break;
case "varybyparam":
oc_param = (string) entry.Value;
+ if (String.Compare (oc_param, "none") == 0)
+ oc_param = null;
break;
case "varybyheader":
oc_header = (string) entry.Value;
@@ -180,8 +200,34 @@ namespace System.Web.UI
oc_custom = (string) entry.Value;
break;
case "location":
- oc_location = (OutputCacheLocation) Enum.Parse (typeof (OutputCacheLocation),
- (string) entry.Value);
+ if (!(this is PageParser))
+ goto default;
+
+ try {
+ oc_location = (OutputCacheLocation) Enum.Parse (
+ typeof (OutputCacheLocation), (string) entry.Value, true);
+ } catch {
+ ThrowParseException ("The 'location' attribute is case sensitive and " +
+ "must be one of the following values: Any, Client, " +
+ "Downstream, Server, None, ServerAndClient.");
+ }
+ break;
+ case "varybycontrol":
+ if (this is PageParser)
+ goto default;
+
+ oc_controls = (string) entry.Value;
+ break;
+ case "shared":
+ if (this is PageParser)
+ goto default;
+
+ try {
+ oc_shared = Boolean.Parse ((string) entry.Value);
+ } catch {
+ ThrowParseException ("The 'shared' attribute is case sensitive" +
+ " and must be set to 'true' or 'false'.");
+ }
break;
default:
ThrowParseException ("The '" + key + "' attribute is not " +
@@ -339,26 +385,12 @@ namespace System.Web.UI
compilerOptions = GetString (atts, "CompilerOptions", null);
language = GetString (atts, "Language", CompilationConfig.DefaultLanguage);
string src = GetString (atts, "Src", null);
- Assembly srcAssembly = null;
if (src != null)
srcAssembly = GetAssemblyFromSource (src);
string inherits = GetString (atts, "Inherits", null);
- if (inherits != null) {
- Type parent;
- if (srcAssembly != null)
- parent = srcAssembly.GetType (inherits);
- else
- parent = LoadType (inherits);
-
- if (parent == null)
- ThrowParseException ("Cannot find type " + inherits);
-
- if (!DefaultBaseType.IsAssignableFrom (parent))
- ThrowParseException ("The parent type does not derive from " + DefaultBaseType);
-
- baseType = parent;
- }
+ if (inherits != null)
+ SetBaseType (inherits);
className = GetString (atts, "ClassName", null);
if (className != null && !CodeGenerator.IsValidLanguageIndependentIdentifier (className))
@@ -368,6 +400,27 @@ namespace System.Web.UI
ThrowParseException ("Unknown attribute: " + GetOneKey (atts));
}
+ internal void SetBaseType (string type)
+ {
+ if (type == DefaultBaseTypeName)
+ return;
+
+ Type parent = null;
+ if (srcAssembly != null)
+ parent = srcAssembly.GetType (type);
+
+ if (parent == null)
+ parent = LoadType (type);
+
+ if (parent == null)
+ ThrowParseException ("Cannot find type " + type);
+
+ if (!DefaultBaseType.IsAssignableFrom (parent))
+ ThrowParseException ("The parent type does not derive from " + DefaultBaseType);
+
+ baseType = parent;
+ }
+
Assembly GetAssemblyFromSource (string vpath)
{
vpath = UrlUtils.Combine (BaseVirtualDir, vpath);
@@ -389,7 +442,7 @@ namespace System.Web.UI
}
internal abstract Type DefaultBaseType { get; }
-
+ internal abstract string DefaultBaseTypeName { get; }
internal abstract string DefaultDirectiveName { get; }
internal string InputFile
@@ -501,6 +554,14 @@ namespace System.Web.UI
get { return oc_custom; }
}
+ internal string OutputCacheVaryByControls {
+ get { return oc_controls; }
+ }
+
+ internal bool OutputCacheShared {
+ get { return oc_shared; }
+ }
+
internal OutputCacheLocation OutputCacheLocation {
get { return oc_location; }
}
@@ -508,6 +569,10 @@ namespace System.Web.UI
internal string OutputCacheVaryByParam {
get { return oc_param; }
}
+
+ internal PagesConfiguration PagesConfig {
+ get { return PagesConfiguration.GetInstance (Context); }
+ }
}
}
diff --git a/mcs/class/System.Web/System.Web.UI/UserControl.cs b/mcs/class/System.Web/System.Web.UI/UserControl.cs
index 7270cb174cc..a19843cab42 100644
--- a/mcs/class/System.Web/System.Web.UI/UserControl.cs
+++ b/mcs/class/System.Web/System.Web.UI/UserControl.cs
@@ -20,6 +20,7 @@ namespace System.Web.UI
[DefaultEvent ("Load"), DesignerCategory ("ASPXCodeBehind")]
[ToolboxItem (false), ParseChildren (true)]
[Designer ("System.Web.UI.Design.UserControlDesigner, " + Consts.AssemblySystem_Design, typeof (IDesigner))]
+ [Designer ("Microsoft.VSDesigner.WebForms.WebFormDesigner, " + Consts.AssemblyMicrosoft_VSDesigner, typeof (IRootDesigner))]
[RootDesignerSerializer ("Microsoft.VSDesigner.WebForms.RootCodeDomSerializer, " + Consts.AssemblyMicrosoft_VSDesigner, "System.ComponentModel.Design.Serialization.CodeDomSerializer, " + Consts.AssemblySystem_Design, true)]
public class UserControl : TemplateControl, IAttributeAccessor, IUserControlDesignerAccessor
{
@@ -147,11 +148,10 @@ namespace System.Web.UI
}
}
- [MonoTODO]
[EditorBrowsable (EditorBrowsableState.Never)]
public void DesignerInitialize ()
{
- throw new NotImplementedException ();
+ InitRecursive (null);
}
[EditorBrowsable (EditorBrowsableState.Never)]
diff --git a/mcs/class/System.Web/System.Web.UI/UserControlParser.cs b/mcs/class/System.Web/System.Web.UI/UserControlParser.cs
index 6a3d73a57dd..1870ad989a4 100644
--- a/mcs/class/System.Web/System.Web.UI/UserControlParser.cs
+++ b/mcs/class/System.Web/System.Web.UI/UserControlParser.cs
@@ -7,6 +7,7 @@
// (C) 2002,2003 Ximian, Inc (http://www.ximian.com)
//
using System;
+using System.Collections;
using System.IO;
using System.Web;
using System.Web.Compilation;
@@ -36,18 +37,22 @@ namespace System.Web.UI
return generator.GetCompiledType ();
}
- internal override Type DefaultBaseType
+ internal override void ProcessMainAttributes (Hashtable atts)
{
- get {
- return typeof (UserControl);
- }
+ SetBaseType (PagesConfig.UserControlBaseType);
+ base.ProcessMainAttributes (atts);
+ }
+
+ internal override Type DefaultBaseType {
+ get { return typeof (UserControl); }
}
- internal override string DefaultDirectiveName
- {
- get {
- return "control";
- }
+ internal override string DefaultBaseTypeName {
+ get { return "System.Web.UI.UserControl"; }
+ }
+
+ internal override string DefaultDirectiveName {
+ get { return "control"; }
}
}
}
diff --git a/mcs/class/System.Web/System.Web.Util/ChangeLog b/mcs/class/System.Web/System.Web.Util/ChangeLog
index ac5916923f2..0f7b8d21b16 100644
--- a/mcs/class/System.Web/System.Web.Util/ChangeLog
+++ b/mcs/class/System.Web/System.Web.Util/ChangeLog
@@ -1,4 +1,27 @@
+2004-02-01 Alon Gazit <along@mainsoft.com>
+ * UrlUtils.cs: little fix in GetDirectory ().
+
+2004-01-11 Andreas Nahr <ClassDevelopment@A-SoftTech.com>
+
+ * TransactedCallback.cs:
+ * WorkItemCallback.cs:
+ * WorkItem.cs:
+ * Transactions.cs: Added and stubbed/ implemented
+
+2004-01-11 Andreas Nahr <ClassDevelopment@A-SoftTech.com>
+
+ * WebEqualComparer.cs:
+ * WebHashCodeProvider.cs:
+ * FileAction.cs:
+ * FileChangeEventHandler.cs:
+ * NativeFileChangeEventHandler.cs: Monostyled header, internalized
+
+2004-01-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * UrlUtils.cs: make reduce not to throw an exception for '../'. Fixes
+ bug #52599.
+
2003-12-03 Jackson Harper <jackson@ximian.com>
* UrlUtils.cs: Some methods for working with session ids in urls.
diff --git a/mcs/class/System.Web/System.Web.Util/FileAction.cs b/mcs/class/System.Web/System.Web.Util/FileAction.cs
index 1a727011e25..667bc4d17d2 100644
--- a/mcs/class/System.Web/System.Web.Util/FileAction.cs
+++ b/mcs/class/System.Web/System.Web.Util/FileAction.cs
@@ -1,19 +1,15 @@
-/**
- * Namespace: System.Web.Util
- * Class: FileAction
- *
- * Author: Gaurav Vaish
- * Maintainer: gvaish@iitk.ac.in
- * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
- * Implementation: yes
- * Status: ??%
- *
- * (C) Gaurav Vaish (2001)
- */
+//
+// System.Web.Util.FileAction.cs
+//
+// Authors:
+// Gaurav Vaish (my_scripts2001@yahoo.com, gvaish@iitk.ac.in)
+//
+// (c) Gaurav Vaish 2001
+//
namespace System.Web.Util
{
- public enum FileAction
+ internal enum FileAction
{
Overwhleming,
Added,
diff --git a/mcs/class/System.Web/System.Web.Util/FileChangeEventHandler.cs b/mcs/class/System.Web/System.Web.Util/FileChangeEventHandler.cs
index 88bcf46e99b..4b315d6fe25 100644
--- a/mcs/class/System.Web/System.Web.Util/FileChangeEventHandler.cs
+++ b/mcs/class/System.Web/System.Web.Util/FileChangeEventHandler.cs
@@ -1,17 +1,13 @@
-/**
- * Namespace: System.Web.Util
- * Class: FileChangeEventHandler
- *
- * Author: Gaurav Vaish
- * Maintainer: gvaish@iitk.ac.in
- * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
- * Implementation: yes
- * Status: 100%
- *
- * (C) Gaurav Vaish (2001)
- */
+//
+// System.Web.Util.FileChangeEventHandler.cs
+//
+// Authors:
+// Gaurav Vaish (my_scripts2001@yahoo.com, gvaish@iitk.ac.in)
+//
+// (c) Gaurav Vaish 2001
+//
namespace System.Web.Util
{
- public delegate void FileChangeEventHandler(object sender, int method);
+ internal delegate void FileChangeEventHandler(object sender, int method);
}
diff --git a/mcs/class/System.Web/System.Web.Util/NativeFileChangeEventHandler.cs b/mcs/class/System.Web/System.Web.Util/NativeFileChangeEventHandler.cs
index 13a88dc0c1e..b0176395df5 100644
--- a/mcs/class/System.Web/System.Web.Util/NativeFileChangeEventHandler.cs
+++ b/mcs/class/System.Web/System.Web.Util/NativeFileChangeEventHandler.cs
@@ -1,17 +1,13 @@
-/**
- * Namespace: System.Web.Util
- * Class: NativeFileChangeEventHandler
- *
- * Author: Gaurav Vaish
- * Maintainer: gvaish@iitk.ac.in
- * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
- * Implementation: yes
- * Status: 100%
- *
- * (C) Gaurav Vaish (2001)
- */
+//
+// System.Web.Util.NativeFileChangeEventHandler.cs
+//
+// Authors:
+// Gaurav Vaish (my_scripts2001@yahoo.com, gvaish@iitk.ac.in)
+//
+// (c) Gaurav Vaish 2001
+//
namespace System.Web.Util
{
- public delegate void NativeFileChangeEventHandler(object sender, int method);
+ internal delegate void NativeFileChangeEventHandler(object sender, int method);
}
diff --git a/mcs/class/System.Web/System.Web.Util/TransactedCallback.cs b/mcs/class/System.Web/System.Web.Util/TransactedCallback.cs
new file mode 100644
index 00000000000..21b2cbf7a6d
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Util/TransactedCallback.cs
@@ -0,0 +1,11 @@
+//
+// System.Web.Util.TransactedCallback.cs
+//
+// Author:
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+//
+
+namespace System.Web.Util
+{
+ public delegate void TransactedCallback ();
+}
diff --git a/mcs/class/System.Web/System.Web.Util/Transactions.cs b/mcs/class/System.Web/System.Web.Util/Transactions.cs
new file mode 100644
index 00000000000..2c65717fe36
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Util/Transactions.cs
@@ -0,0 +1,32 @@
+//
+// System.Web.Util.Transactions.cs
+//
+// Author:
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+//
+
+using System;
+using System.EnterpriseServices;
+
+namespace System.Web.Util
+{
+ public class Transactions
+ {
+ public Transactions ()
+ {
+ }
+
+ public static void InvokeTransacted (TransactedCallback callback, TransactionOption mode)
+ {
+ bool abortedTransaction = false;
+ InvokeTransacted (callback, mode, ref abortedTransaction);
+ }
+
+ public static void InvokeTransacted (TransactedCallback callback,
+ TransactionOption mode,
+ ref bool transactionAborted)
+ {
+ throw new PlatformNotSupportedException ("Not supported on mono");
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.Util/UrlUtils.cs b/mcs/class/System.Web/System.Web.Util/UrlUtils.cs
index 2e56956e60e..18386eb9673 100644
--- a/mcs/class/System.Web/System.Web.Util/UrlUtils.cs
+++ b/mcs/class/System.Web/System.Web.Util/UrlUtils.cs
@@ -135,11 +135,11 @@ namespace System.Web.Util
return Reduce (basePath + slash + relPath);
}
- if (basePath == null || basePath == "") {
+ if (basePath == null || basePath == "")
basePath = HttpRuntime.AppDomainAppVirtualPath;
- if (basePath.Length <= 1)
- basePath = String.Empty;
- }
+
+ if (basePath.Length <= 1)
+ basePath = String.Empty;
return Reduce (basePath + "/" + relPath);
}
@@ -241,12 +241,16 @@ namespace System.Web.Util
int end = parts.Length;
for (int i = 0; i < end; i++) {
string current = parts [i];
- if (current == "" || current == ".")
- continue;
+ if (current == "" || current == "." )
+ continue;
if (current == "..") {
- if (result.Count == 0)
- throw new HttpException ("Invalid path.");
+ if (result.Count == 0) {
+ if (i == 1) // see bug 52599
+ continue;
+
+ throw new HttpException ("Invalid path.");
+ }
result.RemoveAt (result.Count - 1);
continue;
@@ -272,7 +276,7 @@ namespace System.Web.Util
{
return String.Empty;
}
- url.Replace('\\','/');
+ url = url.Replace('\\','/');
string baseDir = "";
int last = url.LastIndexOf ('/');
diff --git a/mcs/class/System.Web/System.Web.Util/WebEqualComparer.cs b/mcs/class/System.Web/System.Web.Util/WebEqualComparer.cs
index 9ab223bcbd4..8a1359880b9 100644
--- a/mcs/class/System.Web/System.Web.Util/WebEqualComparer.cs
+++ b/mcs/class/System.Web/System.Web.Util/WebEqualComparer.cs
@@ -1,15 +1,11 @@
-/**
- * Namespace: System.Web.Util
- * Class: WebEqualComparer
- *
- * Author: Gaurav Vaish
- * Maintainer: gvaish@iitk.ac.in
- * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
- * Implementation: yes
- * Status: ??%
- *
- * (C) Gaurav Vaish (2001)
- */
+//
+// System.Web.Util.WebEqualComparer.cs
+//
+// Authors:
+// Gaurav Vaish (my_scripts2001@yahoo.com, gvaish@iitk.ac.in)
+//
+// (c) Gaurav Vaish 2001
+//
using System;
using System.Globalization;
@@ -17,7 +13,7 @@ using System.Collections;
namespace System.Web.Util
{
- public class WebEqualComparer : IComparer
+ internal class WebEqualComparer : IComparer
{
private static IComparer defC;
diff --git a/mcs/class/System.Web/System.Web.Util/WebHashCodeProvider.cs b/mcs/class/System.Web/System.Web.Util/WebHashCodeProvider.cs
index 57ddd4dd632..2a10481644a 100644
--- a/mcs/class/System.Web/System.Web.Util/WebHashCodeProvider.cs
+++ b/mcs/class/System.Web/System.Web.Util/WebHashCodeProvider.cs
@@ -1,32 +1,18 @@
-/**
-
- * Namespace: System.Web.Util
- * Class: WebHashCodeProvider
- *
-
- * Author: Gaurav Vaish
-
- * Maintainer: gvaish@iitk.ac.in
-
- * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
-
- * Implementation: yes
-
- * Status: ??%
-
- *
-
- * (C) Gaurav Vaish (2001)
-
- */
-
+//
+// System.Web.Util.WebHashCodeProvider.cs
+//
+// Authors:
+// Gaurav Vaish (my_scripts2001@yahoo.com, gvaish@iitk.ac.in)
+//
+// (c) Gaurav Vaish 2001
+//
using System.Collections;
using System.Globalization;
namespace System.Web.Util
{
- public class WebHashCodeProvider : IHashCodeProvider
+ internal class WebHashCodeProvider : IHashCodeProvider
{
private static IHashCodeProvider defHcp;
diff --git a/mcs/class/System.Web/System.Web.Util/WorkItem.cs b/mcs/class/System.Web/System.Web.Util/WorkItem.cs
new file mode 100644
index 00000000000..ce85a88ddee
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Util/WorkItem.cs
@@ -0,0 +1,23 @@
+//
+// System.Web.Util.WorkItem.cs
+//
+// Author:
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+//
+
+using System;
+
+namespace System.Web.Util
+{
+ public class WorkItem
+ {
+ public WorkItem ()
+ {
+ }
+
+ public static void Post (WorkItemCallback callback)
+ {
+ throw new PlatformNotSupportedException ("Not supported on mono");
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.Util/WorkItemCallback.cs b/mcs/class/System.Web/System.Web.Util/WorkItemCallback.cs
new file mode 100644
index 00000000000..e590cc33a3f
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Util/WorkItemCallback.cs
@@ -0,0 +1,11 @@
+//
+// System.Web.Util.WorkItemCallback.cs
+//
+// Authors:
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+//
+
+namespace System.Web.Util
+{
+ public delegate void WorkItemCallback ();
+}
diff --git a/mcs/class/System.Web/System.Web.dll.sources b/mcs/class/System.Web/System.Web.dll.sources
index d7f7124ec47..f5f163a6e7a 100755
--- a/mcs/class/System.Web/System.Web.dll.sources
+++ b/mcs/class/System.Web/System.Web.dll.sources
@@ -59,6 +59,8 @@ System.Web/TODOAttribute.cs
System.Web/TimeoutManager.cs
System.Web/TraceContext.cs
System.Web/TraceMode.cs
+System.Web/TraceData.cs
+System.Web/TraceManager.cs
System.Web/WebCategoryAttribute.cs
System.Web/WebSysDescriptionAttribute.cs
System.Web/HttpResponse.cs
@@ -121,6 +123,10 @@ System.Web.Configuration/AuthenticationConfigHandler.cs
System.Web.Configuration/MachineKeyConfig.cs
System.Web.Configuration/AuthorizationConfig.cs
System.Web.Configuration/GlobalizationConfigurationHandler.cs
+System.Web.Configuration/PagesConfiguration.cs
+System.Web.Configuration/PagesConfigurationHandler.cs
+System.Web.Configuration/TraceConfig.cs
+System.Web.Configuration/TraceConfigurationHandler.cs
System.Web.Configuration/WebCompiler.cs
System.Web.Configuration/WebConfigurationSettings.cs
System.Web.Configuration/WebControlsSectionHandler.cs
@@ -440,6 +446,7 @@ System.Web.UI.WebControls/WebControl.cs
System.Web.UI.WebControls/DataGridLinkButton.cs
System.Web.UI.WebControls/DataGridColumn.cs
System.Web.UI.WebControls/DataSourceInternal.cs
+System.Web.Util/AltSerialization.cs
System.Web.Util/ApacheVersionInfo.cs
System.Web.Util/DataSourceHelper.cs
System.Web.Util/FileAction.cs
@@ -450,13 +457,16 @@ System.Web.Util/FilePathParser.cs
System.Web.Util/ICalls.cs
System.Web.Util/IISVersionInfo.cs
System.Web.Util/NativeFileChangeEventHandler.cs
+System.Web.Util/TimeUtil.cs
+System.Web.Util/TransactedCallback.cs
+System.Web.Util/Transactions.cs
System.Web.Util/UrlUtils.cs
+System.Web.Util/WebEncoding.cs
System.Web.Util/WebEqualComparer.cs
System.Web.Util/WebHashCodeProvider.cs
System.Web.Util/WebTrace.cs
-System.Web.Util/WebEncoding.cs
-System.Web.Util/TimeUtil.cs
-System.Web.Util/AltSerialization.cs
+System.Web.Util/WorkItem.cs
+System.Web.Util/WorkItemCallback.cs
System.Web.UI/IHierarchicalEnumerable.cs
System.Web.UI/IHierarchyData.cs
System.Web.UI/INavigateUIData.cs
diff --git a/mcs/class/System.Web/System.Web/ChangeLog b/mcs/class/System.Web/System.Web/ChangeLog
index 49cb4b71c06..d3a70958980 100644
--- a/mcs/class/System.Web/System.Web/ChangeLog
+++ b/mcs/class/System.Web/System.Web/ChangeLog
@@ -1,3 +1,135 @@
+2004-01-28 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpApplicationFactory.cs: fixlet for session events hook.
+
+2004-01-28 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpApplicationFactory.cs: attach all events from Type and BaseType
+ at the same time. Fixes bug #53454.
+
+2004-01-27 Jackson Harper <jackson@ximian.com>
+
+ * HttpCachePolicy.cs: varybyparams::GetResponseHeader can return
+ null now, dont hadd the header if it does.
+ * HttpCacheVaryByParams.cs: Return null if there are no items.
+
+2004-01-23 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpCachePolicy.cs: it's not public.
+ * HttpRuntime.cs: wait for requests before disposing the queue.
+
+2004-01-15 Jackson Harper <jackson@ximian.com>
+
+ * HttpCachePolicy.cs: Fix typo causing varyby params headers to be
+ created when they shouldn't be.
+
+2004-01-14 Jackson Harper <jackson@ximian.com>
+
+ * TraceData.cs: Fix some typos in the output text. Fix control
+ position when adding controls recursively.
+
+2004-01-14 Jackson Harper <jackson@ximian.com>
+
+ * HttpCachePolicy.cs: Expose duration and sliding properties.
+
+2004-01-14 Jackson Harper <jackson@ximian.com>
+
+ * HttpCachePolicy.cs: Add an event that is fired when the
+ cacheability is updated. The response uses this to determine
+ whether or not it needs to cache itself.
+ * HttpResponse.cs: When the cacheability is updated either create
+ or dispose of the cached raw response based on whether or not we
+ wil need it. This allows output caching to be controlled
+ programatically.
+
+2004-01-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpContext.cs: add setter for ConfigTimeout.
+ * HttpException.cs: added Description property and HTML encode some
+ unescaped values.
+
+ * HttpRequest.cs: support request validation.
+
+ * HttpRequestValidationException.cs: added message and description.
+
+ * HttpServerUtility.cs: implemented ScriptTimeout.
+
+2004-01-11 Jackson Harper <jackson@ximian.com>
+
+ * TraceManager.cs: Dont crash if there is no trace config element.
+
+2004-01-11 Jackson Harper <jackson@ximian.com>
+
+ * HttpRequest.cs: Add property for determining if the request is
+ local or not.
+
+2004-01-10 Jackson Harper <jackson@ximian.com>
+
+ * TraceContext.cs: Handle tracing when it is enabled in the config
+ file but not on the page.
+ * TraceManager.cs: Get settings from the configuration object.
+ * HttpRuntime.cs: Create trace manager in the first request start
+ so it can get configuration settings.
+
+2004-01-10 Jackson Harper <jackson@ximian.com>
+
+ * TraceContext.cs: Save the request path in the trace data.
+ * TraceData.cs: Add RequestPath property, make some rendering
+ methods internal static so the TraceHandler can use them.
+ * TraceManager.cs: Expose trace data, add a method for clearing
+ trace data.
+
+2004-01-10 Jackson Harper <jackson@ximian.com>
+
+ * HttpRuntime.cs: Add trace manager
+ * TraceManager.cs: New class for handling trace configuration and
+ storing trace data objects.
+ * TraceContext.cs: Save trace data to the trace manager. Fix typo.
+
+2004-01-10 Jackson Harper <jackson@ximian.com>
+
+ * TraceData.cs: New class for storing trace data. Data is stored
+ here instead of the trace context so it can be saved and accessed
+ from the trace handler.
+ * TraceContext.cs: Save data in the TraceData object, let the
+ trace data object handle the rendering.
+
+2004-01-08 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpRequest.cs: use ContentEncoding for QueryString. Fixes bug #52577.
+ Thanks to Jan Jaros (mono-bug@jerryweb.info).
+
+ * HttpRequestValidationException.cs: fix comment.
+
+2004-01-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpException.cs: default to error 500. Fixes bug #52623.
+
+2004-01-04 Jackson Harper <jackson@ximian.com>
+
+ * TraceContext.cs: Store and render trace info times. Also render
+ cookie sizes. Remove debug code.
+
+2004-01-04 Jackson Harper <jackson@ximian.com>
+
+ * HttpResponse.cs: Set the cached response date header so it can
+ be updated.
+ * HttpResponseHeader.cs: Let values be set so we can update cached
+ response header values.
+
+2004-01-04 Jackson Harper <jackson@ximian.com>
+
+ * HttpResponse.cs: Implement RemoveOutputCacheItem.
+
+2004-01-04 Jackson Harper <jackson@ximian.com>
+
+ * HttpCachePolicy.cs: Add internal method to get the vary by custom string
+ * HttpCacheVaryByHeaders.cs: Add internal method to get the header names.
+
+2004-01-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpRuntime.cs: implemented MachineConfigurationDirectory,
+
2004-1-1 Alon Gazit <along@mainsoft.com>
* HttpWriter.cs: add check in Write() in order to prevent
NullReferenceException.
diff --git a/mcs/class/System.Web/System.Web/HttpApplicationFactory.cs b/mcs/class/System.Web/System.Web/HttpApplicationFactory.cs
index 2e618e20d28..ee0b2574d79 100644
--- a/mcs/class/System.Web/System.Web/HttpApplicationFactory.cs
+++ b/mcs/class/System.Web/System.Web/HttpApplicationFactory.cs
@@ -110,7 +110,6 @@ namespace System.Web {
ArrayList evtMethods = new ArrayList ();
BindingFlags flags = BindingFlags.Public |
BindingFlags.NonPublic |
- BindingFlags.DeclaredOnly |
BindingFlags.Instance |
BindingFlags.Static;
@@ -120,18 +119,6 @@ namespace System.Web {
AddEvent (m, appTypeEventHandlers);
}
- Type baseType = appType.BaseType;
- if (baseType == typeof (HttpApplication))
- return appTypeEventHandlers;
-
- flags = BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Instance;
-
- methods = appType.GetMethods (flags);
- foreach (MethodInfo m in methods) {
- if (IsEventHandler (m))
- AddEvent (m, appTypeEventHandlers);
- }
-
return appTypeEventHandlers;
}
@@ -246,7 +233,7 @@ namespace System.Web {
string moduleName = key.Substring (0, pos);
object target;
- if (moduleName == "Application")
+ if (moduleName == "Application" || moduleName == "Session")
target = app;
else
target = app.Modules [moduleName];
diff --git a/mcs/class/System.Web/System.Web/HttpApplicationState.cs b/mcs/class/System.Web/System.Web/HttpApplicationState.cs
index 6131f07c776..e86e1fdfa21 100644
--- a/mcs/class/System.Web/System.Web/HttpApplicationState.cs
+++ b/mcs/class/System.Web/System.Web/HttpApplicationState.cs
@@ -1,232 +1,227 @@
-//
-// System.Web.HttpApplicationState
-//
-// Author:
-// Patrik Torstensson (Patrik.Torstensson@labs2.com)
-//
-using System;
-using System.Threading;
-using System.Web;
-using System.Collections.Specialized;
-
-namespace System.Web {
-
- [MonoTODO("Performance - Use SWMR lock here")]
- public sealed class HttpApplicationState : NameObjectCollectionBase {
- private HttpStaticObjectsCollection _AppObjects;
- private HttpStaticObjectsCollection _SessionObjects;
-
- // TODO : Change to ReadWriteLock when ready
- private Mutex _Lock;
-
- private void LockRead() {
- Monitor.Enter(this);
- }
-
- private void LockWrite() {
- Monitor.Enter(this);
- }
-
- private void UnlockRead() {
- Monitor.Exit(this);
- }
-
- private void UnlockWrite() {
- Monitor.Exit(this);
- }
-
- internal HttpApplicationState() {
- _AppObjects = new HttpStaticObjectsCollection();
- _SessionObjects = new HttpStaticObjectsCollection();
- _Lock = new Mutex();
- }
-
- internal HttpApplicationState(HttpStaticObjectsCollection AppObj, HttpStaticObjectsCollection SessionObj) {
- if (null != AppObj) {
- _AppObjects = AppObj;
- } else {
- _AppObjects = new HttpStaticObjectsCollection();
- }
-
- if (null != SessionObj) {
- _SessionObjects = SessionObj;
- } else {
- _SessionObjects = new HttpStaticObjectsCollection();
- }
- _Lock = new Mutex();
- }
-
- public void Add(string name, object value) {
-
- LockWrite();
- try {
- BaseAdd(name, value);
- }
- finally {
- UnlockWrite();
- }
- }
-
- public void Clear() {
-
- LockWrite();
- try {
- BaseClear();
- }
- finally {
- UnlockWrite();
- }
- }
-
- public object Get(string name) {
- object ret = null;
-
- LockRead();
- try {
- ret = BaseGet(name);
- }
- finally {
- UnlockRead();
- }
-
- return ret;
- }
-
- public object Get(int index) {
- object ret = null;
-
- LockRead();
- try {
- ret = BaseGet(index);
- }
- finally {
- UnlockRead();
- }
-
- return ret;
- }
-
- public string GetKey(int index) {
- string ret = null;
-
- LockRead();
- try {
- ret = BaseGetKey(index);
- }
- finally {
- UnlockRead();
- }
-
- return ret;
- }
-
- public void Lock() {
- LockWrite();
- }
-
- public void Remove(string name) {
- LockWrite();
- try {
- BaseRemove(name);
- }
- finally {
- UnlockWrite();
- }
- }
-
- public void RemoveAll() {
- Clear();
- }
-
- public void RemoveAt(int index) {
- LockWrite();
- try {
- BaseRemoveAt(index);
- }
- finally {
- UnlockWrite();
- }
- }
-
- public void Set(string name, object value) {
- LockWrite();
- try {
- BaseSet(name, value);
- }
- finally {
- UnlockWrite();
- }
- }
-
- public void UnLock() {
- UnlockWrite();
- }
-
- public string [] AllKeys {
- get {
- string [] ret = null;
-
- LockRead();
- try {
- ret = BaseGetAllKeys();
- }
- finally {
- UnlockRead();
- }
-
- return ret;
- }
- }
-
- public HttpApplicationState Contents {
- get {
- return this;
- }
- }
-
- override public int Count {
- get {
- int ret = 0;
-
- LockRead();
- try {
- ret = base.Count;
- }
- finally {
- UnlockRead();
- }
-
- return ret;
- }
- }
-
- public object this[string name] {
- get {
- return Get(name);
- }
- set {
- Set(name, value);
- }
- }
-
- public object this[int index] {
- get {
- return Get(index);
- }
- }
-
- // ASP Session based objects
- internal HttpStaticObjectsCollection SessionObjects {
- get {
- return _SessionObjects;
- }
- }
-
- // ASP App based objects
- public HttpStaticObjectsCollection StaticObjects {
- get {
- return _AppObjects;
- }
- }
- }
-}
+//
+// System.Web.HttpApplicationState
+//
+// Author:
+// Patrik Torstensson (Patrik.Torstensson@labs2.com)
+//
+using System;
+using System.Threading;
+using System.Web;
+using System.Collections.Specialized;
+
+namespace System.Web {
+
+ [MonoTODO("Performance - Use SWMR lock here")]
+ public sealed class HttpApplicationState : NameObjectCollectionBase {
+ private HttpStaticObjectsCollection _AppObjects;
+ private HttpStaticObjectsCollection _SessionObjects;
+
+ // TODO : Change to ReadWriteLock when ready
+ private Mutex _Lock;
+
+ private void LockRead ()
+ {
+ Monitor.Enter (this);
+ }
+
+ private void LockWrite ()
+ {
+ Monitor.Enter (this);
+ }
+
+ private void UnlockRead ()
+ {
+ Monitor.Exit (this);
+ }
+
+ private void UnlockWrite ()
+ {
+ Monitor.Exit (this);
+ }
+
+ internal HttpApplicationState ()
+ {
+ _AppObjects = new HttpStaticObjectsCollection ();
+ _SessionObjects = new HttpStaticObjectsCollection ();
+ _Lock = new Mutex ();
+ }
+
+ internal HttpApplicationState (HttpStaticObjectsCollection AppObj,
+ HttpStaticObjectsCollection SessionObj)
+ {
+ if (null != AppObj) {
+ _AppObjects = AppObj;
+ } else {
+ _AppObjects = new HttpStaticObjectsCollection ();
+ }
+
+ if (null != SessionObj) {
+ _SessionObjects = SessionObj;
+ } else {
+ _SessionObjects = new HttpStaticObjectsCollection ();
+ }
+ _Lock = new Mutex ();
+ }
+
+ public void Add (string name, object value)
+ {
+ LockWrite ();
+ try {
+ BaseAdd (name, value);
+ } finally {
+ UnlockWrite ();
+ }
+ }
+
+ public void Clear ()
+ {
+ LockWrite ();
+ try {
+ BaseClear ();
+ } finally {
+ UnlockWrite ();
+ }
+ }
+
+ public object Get (string name)
+ {
+ object ret = null;
+
+ LockRead ();
+ try {
+ ret = BaseGet (name);
+ } finally {
+ UnlockRead ();
+ }
+
+ return ret;
+ }
+
+ public object Get (int index)
+ {
+ object ret = null;
+
+ LockRead ();
+ try {
+ ret = BaseGet (index);
+ } finally {
+ UnlockRead ();
+ }
+
+ return ret;
+ }
+
+ public string GetKey (int index)
+ {
+ string ret = null;
+
+ LockRead ();
+ try {
+ ret = BaseGetKey (index);
+ } finally {
+ UnlockRead ();
+ }
+
+ return ret;
+ }
+
+ public void Lock ()
+ {
+ LockWrite ();
+ }
+
+ public void Remove (string name)
+ {
+ LockWrite ();
+ try {
+ BaseRemove (name);
+ } finally {
+ UnlockWrite ();
+ }
+ }
+
+ public void RemoveAll ()
+ {
+ Clear ();
+ }
+
+ public void RemoveAt (int index)
+ {
+ LockWrite ();
+ try {
+ BaseRemoveAt (index);
+ } finally {
+ UnlockWrite ();
+ }
+ }
+
+ public void Set (string name, object value)
+ {
+ LockWrite ();
+ try {
+ BaseSet (name, value);
+ } finally {
+ UnlockWrite ();
+ }
+ }
+
+ public void UnLock ()
+ {
+ UnlockWrite ();
+ }
+
+ public string [] AllKeys {
+ get {
+ string [] ret = null;
+
+ LockRead ();
+ try {
+ ret = BaseGetAllKeys ();
+ } finally {
+ UnlockRead ();
+ }
+
+ return ret;
+ }
+ }
+
+ public HttpApplicationState Contents {
+ get { return this; }
+ }
+
+ public override int Count {
+ get {
+ int ret = 0;
+
+ LockRead();
+ try {
+ ret = base.Count;
+ } finally {
+ UnlockRead ();
+ }
+
+ return ret;
+ }
+ }
+
+ public object this [string name] {
+ get { return Get (name); }
+ set { Set (name, value); }
+ }
+
+ public object this [int index] {
+ get { return Get (index); }
+ }
+
+ // ASP Session based objects
+ internal HttpStaticObjectsCollection SessionObjects {
+ get { return _SessionObjects; }
+ }
+
+ // ASP App based objects
+ public HttpStaticObjectsCollection StaticObjects {
+ get { return _AppObjects; }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web/HttpCachePolicy.cs b/mcs/class/System.Web/System.Web/HttpCachePolicy.cs
index 79650f632c3..bbfa80891c3 100644
--- a/mcs/class/System.Web/System.Web/HttpCachePolicy.cs
+++ b/mcs/class/System.Web/System.Web/HttpCachePolicy.cs
@@ -13,6 +13,19 @@ using System.Web.UI;
using System.Web.Util;
namespace System.Web {
+
+ class CacheabilityUpdatedEventArgs : EventArgs {
+
+ public readonly HttpCacheability Cacheability;
+
+ public CacheabilityUpdatedEventArgs (HttpCacheability cacheability)
+ {
+ Cacheability = cacheability;
+ }
+ }
+
+ internal delegate void CacheabilityUpdatedCallback (object sender, CacheabilityUpdatedEventArgs args);
+
public sealed class HttpCachePolicy {
internal HttpCachePolicy ()
@@ -46,11 +59,14 @@ namespace System.Web {
TimeSpan proxyMaxAge;
ArrayList fields;
bool slidingExpiration;
-
+ int duration;
+
#endregion
+ internal event CacheabilityUpdatedCallback CacheabilityUpdated;
+
#region Properties
-
+
public HttpCacheVaryByHeaders VaryByHeaders {
get { return varyByHeaders; }
}
@@ -62,7 +78,16 @@ namespace System.Web {
internal DateTime Expires {
get { return expireDate; }
}
-
+
+ internal int Duration {
+ get { return duration; }
+ set { duration = value; }
+ }
+
+ internal bool Sliding {
+ get { return slidingExpiration; }
+ }
+
#endregion // Properties
#region Methods
@@ -98,6 +123,9 @@ namespace System.Web {
return;
this.cacheability = cacheability;
+
+ if (CacheabilityUpdated != null)
+ CacheabilityUpdated (this, new CacheabilityUpdatedEventArgs (cacheability));
}
public void SetCacheability (HttpCacheability cacheability, string field)
@@ -232,6 +260,11 @@ namespace System.Web {
varyByCustom = custom;
}
+ internal string GetVaryByCustom ()
+ {
+ return varyByCustom;
+ }
+
[MonoTODO]
public void SetAllowResponseInBrowserHistory (bool allow)
{
@@ -260,8 +293,11 @@ namespace System.Web {
headers.Add (new HttpResponseHeader ("Last-Modified",
TimeUtil.ToUtcTimeString (lastModified)));
- if (varyByParams.IgnoreParams)
- headers.Add (varyByParams.GetResponseHeader ());
+ if (!varyByParams.IgnoreParams) {
+ HttpResponseHeader vb = varyByParams.GetResponseHeader ();
+ if (vb != null)
+ headers.Add (vb);
+ }
}
diff --git a/mcs/class/System.Web/System.Web/HttpCacheVaryByHeaders.cs b/mcs/class/System.Web/System.Web/HttpCacheVaryByHeaders.cs
index 93ee07a0afe..1652853f5e7 100644
--- a/mcs/class/System.Web/System.Web/HttpCacheVaryByHeaders.cs
+++ b/mcs/class/System.Web/System.Web/HttpCacheVaryByHeaders.cs
@@ -106,5 +106,18 @@ namespace System.Web {
this["Accept-Language"] = value;
}
}
+
+ internal string [] GetHeaderNames ()
+ {
+ if (_Items == null)
+ return null;
+
+ string[] headers = new string [_Items.Count];
+ int i = 0;
+ foreach (string header in _Items.Keys)
+ headers [i++] = header;
+
+ return headers;
+ }
}
}
diff --git a/mcs/class/System.Web/System.Web/HttpCacheVaryByParams.cs b/mcs/class/System.Web/System.Web/HttpCacheVaryByParams.cs
index a745e8b4f76..f8815db0329 100644
--- a/mcs/class/System.Web/System.Web/HttpCacheVaryByParams.cs
+++ b/mcs/class/System.Web/System.Web/HttpCacheVaryByParams.cs
@@ -43,6 +43,9 @@ namespace System.Web {
if (_Wildcard)
return new HttpResponseHeader ("Vary", "*");
+ if (_Items == null)
+ return null;
+
StringBuilder builder = new StringBuilder ();
foreach (string item in _Items.Keys) {
if (!(bool) _Items [item])
diff --git a/mcs/class/System.Web/System.Web/HttpContext.cs b/mcs/class/System.Web/System.Web/HttpContext.cs
index a846db0ccba..cd26da75e27 100644
--- a/mcs/class/System.Web/System.Web/HttpContext.cs
+++ b/mcs/class/System.Web/System.Web/HttpContext.cs
@@ -301,6 +301,9 @@ namespace System.Web
return (TimeSpan) configTimeout;
}
+ set {
+ configTimeout = value;
+ }
}
internal string ErrorPage {
diff --git a/mcs/class/System.Web/System.Web/HttpException.cs b/mcs/class/System.Web/System.Web/HttpException.cs
index 673997f1c22..e130317c0e5 100644
--- a/mcs/class/System.Web/System.Web/HttpException.cs
+++ b/mcs/class/System.Web/System.Web/HttpException.cs
@@ -23,7 +23,7 @@ namespace System.Web
#endif
public class HttpException : ExternalException
{
- int http_code;
+ int http_code = 500;
int hr;
string fileName;
@@ -92,6 +92,10 @@ namespace System.Web
return GetHtmlizedErrorMessage ();
}
+ internal virtual string Description {
+ get { return "Error processing request."; }
+ }
+
string GetDefaultErrorMessage ()
{
StringBuilder builder = new StringBuilder ("<html>\r\n<title>");
@@ -102,10 +106,12 @@ namespace System.Web
builder.AppendFormat ("</title><body bgcolor=\"white\">" +
"<h1><font color=\"red\">Server error in '{0}' " +
"application</font></h1><hr>\r\n",
- HttpRuntime.AppDomainAppVirtualPath);
+ HtmlEncode (HttpRuntime.AppDomainAppVirtualPath));
+
+ builder.AppendFormat ("<h2><font color=\"maroon\"><i>{0}</i></font></h2>\r\n",
+ HtmlEncode (Message));
- builder.AppendFormat ("<h2><font color=\"maroon\"><i>{0}</i></font></h2>\r\n", Message);
- builder.AppendFormat ("<b>Description: </b>{0}\r\n<p>\r\n", "Error processing request.");
+ builder.AppendFormat ("<b>Description: </b>{0}\r\n<p>\r\n", Description);
builder.Append ("<b>Error Message: </b>");
if (http_code != 0)
builder.AppendFormat ("HTTP {0}. ", http_code);
diff --git a/mcs/class/System.Web/System.Web/HttpRequest.cs b/mcs/class/System.Web/System.Web/HttpRequest.cs
index dca2aa5fb44..ae2f9cd4f51 100644
--- a/mcs/class/System.Web/System.Web/HttpRequest.cs
+++ b/mcs/class/System.Web/System.Web/HttpRequest.cs
@@ -1,13 +1,14 @@
-//
-// System.Web.HttpRequest
-//
-// Authors:
-// Patrik Torstensson (Patrik.Torstensson@labs2.com)
-// Gonzalo Paniagua Javier (gonzalo@ximian.com)
-//
-// (c) 2001, 2002 Patrick Torstensson
-// (c) 2002 Ximian, Inc. (http://www.ximian.com)
-//
+//
+// System.Web.HttpRequest
+//
+// Authors:
+// Patrik Torstensson (Patrik.Torstensson@labs2.com)
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (c) 2001, 2002 Patrick Torstensson
+// (c) 2002,2003 Ximian, Inc. (http://www.ximian.com)
+// (c) 2004 Novell, Inc. (http://www.novell.com)
+//
using System;
using System.Collections;
using System.Collections.Specialized;
@@ -65,6 +66,11 @@ namespace System.Web {
private bool rewritten;
Stream userFilter;
HttpRequestStream requestFilter;
+#if NET_1_1
+ bool validateCookies;
+ bool validateForm;
+ bool validateQueryString;
+#endif
public HttpRequest(string Filename, string Url, string Querystring) {
_iContentLength = -1;
@@ -213,9 +219,6 @@ namespace System.Web {
private void ParseFormData ()
{
- if (_oFormData != null)
- return;
-
string contentType = ContentType;
if (0 == String.Compare (contentType, "application/x-www-form-urlencoded", true)) {
byte [] arrData = GetRawContent ();
@@ -523,6 +526,10 @@ namespace System.Web {
cookies = new HttpCookieCollection (null, false);
if (_WorkerRequest != null)
GetCookies ();
+#if NET_1_1
+ if (validateCookies)
+ ValidateCookieCollection (cookies);
+#endif
}
return cookies;
@@ -582,10 +589,10 @@ namespace System.Web {
if (multipartContent != null) return multipartContent;
byte [] raw = GetRawContent ();
- byte [] boundary = Encoding.ASCII.GetBytes (("--" + GetValueFromHeader (ContentType, "boundary")).ToCharArray ());
+ byte [] boundary = Encoding.ASCII.GetBytes (("--" + GetValueFromHeader (ContentType, "boundary")));
return multipartContent = HttpMultipartContentParser.Parse (raw, boundary, ContentEncoding);
- }
-
+ }
+
public Stream Filter {
get {
if (userFilter != null)
@@ -606,15 +613,20 @@ namespace System.Web {
}
}
-
- public NameValueCollection Form {
- get {
- ParseFormData();
-
- return (NameValueCollection) _oFormData;
- }
- }
-
+ public NameValueCollection Form {
+ get {
+ if (_oFormData == null) {
+ ParseFormData ();
+#if NET_1_1
+ if (validateForm)
+ ValidateNameValueCollection ("Form", _oFormData);
+#endif
+ }
+
+ return _oFormData;
+ }
+ }
+
public NameValueCollection Headers {
get {
if (_oHeaders == null) {
@@ -801,17 +813,26 @@ namespace System.Web {
}
}
- public NameValueCollection QueryString {
- get {
- if (_oQueryString == null) {
- _oQueryString = new HttpValueCollection(QueryStringRaw, true,
- Encoding.ASCII);
- }
-
- return _oQueryString;
- }
- }
-
+ public NameValueCollection QueryString {
+ get {
+ if (_oQueryString == null) {
+ try {
+ _oQueryString = new HttpValueCollection(QueryStringRaw, true,
+ ContentEncoding);
+ } catch {
+ _oQueryString = new HttpValueCollection(QueryStringRaw, true,
+ Encoding.ASCII);
+ }
+#if NET_1_1
+ if (validateQueryString)
+ ValidateNameValueCollection ("QueryString", _oQueryString);
+#endif
+ }
+
+ return _oQueryString;
+ }
+ }
+
// Used to parse the querystring
internal string QueryStringRaw {
get {
@@ -1010,8 +1031,14 @@ namespace System.Web {
return baseVirtualDir;
}
- }
-
+ }
+
+ internal bool IsLocal {
+ get {
+ return _WorkerRequest.GetLocalAddress () == "127.0.0.1";
+ }
+ }
+
public byte [] BinaryRead(int count) {
int iSize = TotalBytes;
if (iSize == 0) {
@@ -1139,10 +1166,11 @@ namespace System.Web {
}
#if NET_1_1
- [MonoTODO]
public void ValidateInput ()
{
- throw new NotImplementedException ();
+ validateCookies = true;
+ validateQueryString = true;
+ validateForm = true;
}
#endif
@@ -1168,5 +1196,59 @@ namespace System.Web {
headers [name] = value;
headers.MakeReadOnly ();
}
+
+#if NET_1_1
+ static void ValidateNameValueCollection (string name, NameValueCollection coll)
+ {
+ if (coll == null)
+ return;
+
+ foreach (string key in coll.Keys) {
+ string val = coll [key];
+ if (CheckString (val))
+ ThrowValidationException (name, key, val);
+ }
+ }
+
+ static void ValidateCookieCollection (HttpCookieCollection cookies)
+ {
+ if (cookies == null)
+ return;
+
+ foreach (HttpCookie cookie in cookies) {
+ if (CheckString (cookie.Value))
+ ThrowValidationException ("Cookies", cookie.Name, cookie.Value);
+ }
+ }
+
+ static void ThrowValidationException (string name, string key, string value)
+ {
+ string v = "\"" + value + "\"";
+ if (v.Length > 20)
+ v = v.Substring (16) + "...\"";
+
+ string msg = String.Format ("A potentially dangerous Request.{0} value was " +
+ "detected from the client ({1}={2}).", name, key, v);
+
+ throw new HttpRequestValidationException (msg);
+ }
+
+ static char [] dangerousChars = "<>".ToCharArray ();
+ static bool CheckString (string val)
+ {
+ if (val == null)
+ return false;
+
+ //TODO: More checks
+ if (val.IndexOfAny (dangerousChars) != -1 && val.Length > 1) {
+ foreach (char c in val)
+ if (Array.IndexOf (dangerousChars, c) != -1)
+ return true;
+ }
+
+ return false;
+ }
+#endif
}
}
+
diff --git a/mcs/class/System.Web/System.Web/HttpRequestValidationException.cs b/mcs/class/System.Web/System.Web/HttpRequestValidationException.cs
index 707b69d3e7e..f17cba03ef1 100644
--- a/mcs/class/System.Web/System.Web/HttpRequestValidationException.cs
+++ b/mcs/class/System.Web/System.Web/HttpRequestValidationException.cs
@@ -1,5 +1,5 @@
//
-// System.Web.HttpRequest
+// System.Web.HttpRequestValidationException
//
// Authors:
// Gonzalo Paniagua Javier (gonzalo@ximian.com)
@@ -11,9 +11,24 @@ namespace System.Web
{
public sealed class HttpRequestValidationException : HttpException
{
- internal HttpRequestValidationException ()
+ internal HttpRequestValidationException (string msg) : base (msg)
{
}
+
+ internal override string Description {
+ get {
+ return "Request validation detected a potentially dangerous input value " +
+ "from the client and aborted the request. This might be an attemp of " +
+ "using cross-site scripting to compromise the security of your site. " +
+ "You can disable request validation using the 'validateRequest=false' " +
+ "attribute in your page or setting it in your machine.config or web.config " +
+ "configuration files. If you disable it, you're encouraged to properly " +
+ "check the input values you get from the client.<br>\r\n" +
+ "You can get more information on input validation " +
+ "<a href=\"http://www.cert.org/tech_tips/malicious_code_mitigation.html\">" +
+ "here</a>.";
+ }
+ }
}
}
#endif
diff --git a/mcs/class/System.Web/System.Web/HttpResponse.cs b/mcs/class/System.Web/System.Web/HttpResponse.cs
index 1c8b0d3a038..6d7f8898bfd 100644
--- a/mcs/class/System.Web/System.Web/HttpResponse.cs
+++ b/mcs/class/System.Web/System.Web/HttpResponse.cs
@@ -148,10 +148,6 @@ namespace System.Web
internal bool IsCached {
get { return cached_response != null; }
}
-
- internal void CacheResponse (HttpRequest request) {
- cached_response = new CachedRawResponse (_CachePolicy);
- }
internal CachedRawResponse GetCachedResponse () {
cached_response.StatusCode = StatusCode;
@@ -175,7 +171,11 @@ namespace System.Web
Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
string date = DateTime.Now.ToUniversalTime ().ToString ("ddd, d MMM yyyy HH:mm:ss ");
- oHeaders.Add (new HttpResponseHeader ("Date", date + "GMT"));
+ HttpResponseHeader date_header = new HttpResponseHeader ("Date", date + "GMT");
+ oHeaders.Add (date_header);
+
+ if (IsCached)
+ cached_response.DateHeader = date_header;
Thread.CurrentThread.CurrentCulture = oSavedInfo;
@@ -375,13 +375,24 @@ namespace System.Web
public HttpCachePolicy Cache
{
get {
- if (null == _CachePolicy)
+ if (null == _CachePolicy) {
_CachePolicy = new HttpCachePolicy ();
+ _CachePolicy.CacheabilityUpdated += new CacheabilityUpdatedCallback (
+ OnCacheabilityUpdated);
+ }
return _CachePolicy;
}
}
+ private void OnCacheabilityUpdated (object sender, CacheabilityUpdatedEventArgs e)
+ {
+ if (e.Cacheability >= HttpCacheability.Server && !IsCached)
+ cached_response = new CachedRawResponse (_CachePolicy);
+ else if (e.Cacheability <= HttpCacheability.Private)
+ cached_response = null;
+ }
+
[MonoTODO("Set status in the cache policy")]
public string CacheControl
{
@@ -920,10 +931,17 @@ namespace System.Web
_TextWriter.Write (buffer, index, count);
}
- [MonoTODO()]
public static void RemoveOutputCacheItem (string path)
{
- throw new NotImplementedException ();
+ if (path == null)
+ throw new ArgumentNullException ("path");
+
+ if (!UrlUtils.IsRooted (path))
+ throw new ArgumentException ("Invalid path for HttpResponse.RemoveOutputCacheItem '" +
+ path + "'. An absolute virtual path is expected.");
+
+ Cache cache = HttpRuntime.Cache;
+ cache.Remove (path);
}
public void SetCookie (HttpCookie cookie)
diff --git a/mcs/class/System.Web/System.Web/HttpResponseHeader.cs b/mcs/class/System.Web/System.Web/HttpResponseHeader.cs
index c8cc64a5767..20a39ae304e 100644
--- a/mcs/class/System.Web/System.Web/HttpResponseHeader.cs
+++ b/mcs/class/System.Web/System.Web/HttpResponseHeader.cs
@@ -36,6 +36,9 @@ namespace System.Web {
get {
return _sValue;
}
+ set {
+ _sValue = value;
+ }
}
internal void SendContent(HttpWorkerRequest WorkerRequest) {
diff --git a/mcs/class/System.Web/System.Web/HttpRuntime.cs b/mcs/class/System.Web/System.Web/HttpRuntime.cs
index 592fdb36d38..1da447dc1de 100644
--- a/mcs/class/System.Web/System.Web/HttpRuntime.cs
+++ b/mcs/class/System.Web/System.Web/HttpRuntime.cs
@@ -7,6 +7,7 @@
//
using System;
using System.Collections;
+using System.IO;
using System.Text;
using System.Security;
using System.Security.Permissions;
@@ -47,10 +48,10 @@ namespace System.Web {
private Exception _initError;
private TimeoutManager timeoutManager;
private QueueManager queueManager;
+ private TraceManager traceManager;
private WaitCallback doRequestCallback;
private int pendingCallbacks;
-
static HttpRuntime ()
{
appPathDiscoveryStackWalk = null;
@@ -80,7 +81,6 @@ namespace System.Web {
timeoutManager = new TimeoutManager ();
// TODO: Load all app domain data
- // TODO: Trace manager
_endOfSendCallback = new HttpWorkerRequest.EndOfSendNotification(OnEndOfSend);
_handlerCallback = new AsyncCallback(OnHandlerReady);
_appDomainCallback = new WaitCallback(OnAppDomainUnload);
@@ -96,6 +96,7 @@ namespace System.Web {
try {
WebConfigurationSettings.Init (context);
+ traceManager = new TraceManager (context);
queueManager = new QueueManager ();
} catch (Exception e) {
_initError = e;
@@ -225,9 +226,9 @@ namespace System.Web {
[MonoTODO ("Move timeout value to config")]
internal void Dispose() {
+ WaitForRequests(5000);
queueManager.Dispose (); // Send a 503 to all queued requests
queueManager = null;
- WaitForRequests(5000);
_cache = null;
HttpApplicationFactory.EndApplication();
@@ -415,10 +416,9 @@ namespace System.Web {
}
}
- [MonoTODO]
public static string MachineConfigurationDirectory {
get {
- throw new NotImplementedException ();
+ return Path.GetDirectoryName (WebConfigurationSettings.MachineConfigPath);
}
}
@@ -428,6 +428,12 @@ namespace System.Web {
}
}
+ internal static TraceManager TraceManager {
+ get {
+ return HttpRuntime._runtime.traceManager;
+ }
+ }
+
public static void Close ()
{
_runtime.Dispose();
diff --git a/mcs/class/System.Web/System.Web/HttpServerUtility.cs b/mcs/class/System.Web/System.Web/HttpServerUtility.cs
index 9bd1e666cef..b89410ff7e1 100644
--- a/mcs/class/System.Web/System.Web/HttpServerUtility.cs
+++ b/mcs/class/System.Web/System.Web/HttpServerUtility.cs
@@ -60,16 +60,15 @@ namespace System.Web
}
}
- /// <summary>
- /// Gets and sets the request time-out in seconds.
- /// </summary>
- [MonoTODO()]
public int ScriptTimeout {
get {
- throw new NotImplementedException ();
+ return (int) _Context.ConfigTimeout.TotalSeconds;
}
set {
- throw new NotImplementedException ();
+ if (value <= 0)
+ throw new ArgumentOutOfRangeException ("value");
+
+ _Context.ConfigTimeout = new TimeSpan (0, 0, value);
}
}
diff --git a/mcs/class/System.Web/System.Web/TraceContext.cs b/mcs/class/System.Web/System.Web/TraceContext.cs
index 4c8675787c6..f6b7fdc50e1 100644
--- a/mcs/class/System.Web/System.Web/TraceContext.cs
+++ b/mcs/class/System.Web/System.Web/TraceContext.cs
@@ -19,9 +19,9 @@ namespace System.Web {
private HttpContext _Context;
private bool _Enabled;
private TraceMode _Mode;
- private DataTable info;
- private int control_pos;
-
+ private TraceData data;
+ private bool data_saved;
+
public TraceContext(HttpContext Context) {
_Context = Context;
_Enabled = false;
@@ -33,8 +33,8 @@ namespace System.Web {
}
set {
- if (value && info == null)
- InitInfoTable ();
+ if (value && data == null)
+ data = new TraceData ();
_Enabled = value;
}
}
@@ -73,283 +73,61 @@ namespace System.Web {
Write(category, msg, error, false);
}
- [MonoTODO("Save the data into a web dataset directly...")]
private void Write(string category, string msg, Exception error, bool Warning) {
- if (!_Enabled)
+ if (!_Enabled && !HttpRuntime.TraceManager.Enabled)
return;
- DataRow r = info.NewRow ();
- r ["Category"] = category;
- r ["Message"] = msg;
- r ["Exception"] = (error != null ? error.ToString () : null);
- r ["IsWarning"] = Warning;
-
- info.Rows.Add (r);
+ if (data == null)
+ data = new TraceData ();
+ data.Write (category, msg, error, Warning);
}
- private void InitInfoTable ()
- {
- info = new DataTable ();
- info.Columns.Add (new DataColumn ("Category", typeof (string)));
- info.Columns.Add (new DataColumn ("Message", typeof (string)));
- info.Columns.Add (new DataColumn ("Exception", typeof (string)));
- info.Columns.Add (new DataColumn ("IsWarning", typeof (bool)));
- }
-
+ internal void SaveData ()
+ {
+ if (data == null)
+ data = new TraceData ();
+ SetRequestDetails ();
+ data.AddControlTree ((Page) _Context.Handler);
+ AddCookies ();
+ AddHeaders ();
+ AddServerVars ();
+ HttpRuntime.TraceManager.AddTraceData (data);
+ data_saved = true;
+ }
+
internal void Render (HtmlTextWriter output)
{
- output.AddAttribute ("id", "__asptrace");
- output.RenderBeginTag (HtmlTextWriterTag.Div);
-
- RenderStyleSheet (output);
-
- output.AddAttribute ("class", "tracecontent");
- output.RenderBeginTag (HtmlTextWriterTag.Span);
-
- RenderRequestDetails (output);
- RenderTraceInfo (output);
- RenderControlTree (output);
- RenderCookies (output);
- RenderHeaders (output);
- RenderServerVars (output);
-
- output.RenderEndTag ();
- output.RenderEndTag ();
+ if (!data_saved)
+ SaveData ();
+ data.Render (output);
}
- private void RenderRequestDetails (HtmlTextWriter output)
+ private void SetRequestDetails ()
{
- Table table = CreateTable ();
-
- table.Rows.Add (AltRow ("Request Details:"));
- table.Rows.Add (InfoRow2 ("Session Id:", _Context.Session.SessionID,
- "Request Type", _Context.Request.RequestType));
- table.Rows.Add (InfoRow2 ("Time of Request:", _Context.Timestamp.ToString (),
- "State Code:", _Context.Response.StatusCode.ToString ()));
- table.Rows.Add (InfoRow2 ("Request Encoding:", _Context.Request.ContentEncoding.EncodingName,
- "Response Encoding:", _Context.Response.ContentEncoding.EncodingName));
- table.RenderControl (output);
+ data.RequestPath = _Context.Request.FilePath;
+ data.SessionID = (_Context.Session != null ? _Context.Session.SessionID : String.Empty);
+ data.RequestType = _Context.Request.RequestType;
+ data.RequestTime = _Context.Timestamp;
+ data.StatusCode = _Context.Response.StatusCode;
+ data.RequestEncoding = _Context.Request.ContentEncoding;
+ data.ResponseEncoding = _Context.Response.ContentEncoding;
}
- private void RenderTraceInfo (HtmlTextWriter output)
- {
- Table table = CreateTable ();
-
- table.Rows.Add (AltRow ("Trace Information"));
- table.Rows.Add (SubHeadRow ("Category", "Message", "From First(s)", "From Lasts(s)"));
-
- int pos = 0;
- foreach (DataRow r in info.Rows)
- RenderTraceInfoRow (table, r, pos++);
-
- table.RenderControl (output);
- }
-
- private void RenderControlTree (HtmlTextWriter output)
- {
- Table table = CreateTable ();
-
- table.Rows.Add (AltRow ("Control Tree"));
- table.Rows.Add (SubHeadRow ("Control Id", "Type",
- "Render Size Bytes (including children)",
- "Viewstate Size Bytes (excluding children)"));
-
- Page page = (Page) _Context.Handler;
- control_pos = 0;
- RenderControl (table, page, "__PAGE", "", control_pos);
-
- table.RenderControl (output);
- }
-
- private void RenderCookies (HtmlTextWriter output)
+ private void AddCookies ()
{
- Table table = CreateTable ();
-
- table.Rows.Add (AltRow ("Cookies Collection"));
- table.Rows.Add (SubHeadRow ("Name", "Value", "Size"));
-
- int pos = 0;
foreach (string key in _Context.Request.Cookies.Keys)
- RenderCookie (table, _Context.Request.Cookies [key], pos++);
-
- table.RenderControl (output);
+ data.AddCookie (key, _Context.Request.Cookies [key].Value);
}
- private void RenderHeaders (HtmlTextWriter output)
+ private void AddHeaders ()
{
- Table table = CreateTable ();
-
- table.Rows.Add (AltRow ("Headers Collection"));
- table.Rows.Add (SubHeadRow ("Name", "Value"));
-
- int pos = 0;
foreach (string key in _Context.Request.Headers.Keys)
- RenderHeader (table, key, _Context.Request.Headers [key], pos++);
-
- table.RenderControl (output);
+ data.AddHeader (key, _Context.Request.Headers [key]);
}
- private void RenderServerVars (HtmlTextWriter output)
+ private void AddServerVars ()
{
- Table table = CreateTable ();
-
- table.Rows.Add (AltRow ("Server Variables"));
- table.Rows.Add (SubHeadRow ("Name", "Value"));
-
- int pos = 0;
foreach (string key in _Context.Request.ServerVariables)
- RenderServerVar (table, key, _Context.Request.ServerVariables [key], pos++);
-
- table.RenderControl (output);
- }
-
- private void RenderServerVar (Table table, string name, string value, int pos)
- {
- RenderAltRow (table, pos, name, value);
- }
-
- private void RenderHeader (Table table, string name, string value, int pos)
- {
- RenderAltRow (table, pos, name, value);
- }
-
- private void RenderCookie (Table table, HttpCookie c, int pos)
- {
- RenderAltRow (table, pos, c.Name, c.Value, "&nbsp;");
- }
-
- private void RenderControl (Table table, Control c, string id, string p, int pos)
- {
- Console.WriteLine ("pos: " + pos);
- RenderAltRow (table, pos, p + id, c.GetType ().FullName, "&nbsp;", "&nbsp;");
-
- foreach (Control child in c.Controls)
- RenderControl (table, child, c.UniqueID, p + "&nbsp;&nbsp;&nbsp;&nbsp;", ++control_pos);
- }
-
- private TableRow AltRow (string title)
- {
- TableRow row = new TableRow ();
- TableHeaderCell header = new TableHeaderCell ();
- header.CssClass = "alt";
- header.HorizontalAlign = HorizontalAlign.Left;
- header.Attributes ["colspan"] = "10";
- header.Text = "<h3><b>" + title + "</b></h3>";
-
- row.Cells.Add (header);
- return row;
- }
-
- private TableRow RenderTraceInfoRow (Table table, DataRow r, int pos)
- {
- string open, close;
- open = close = String.Empty;
- if ((bool) r ["IsWarning"]) {
- open = "<font color=\"Red\">";
- close = "</font>";
- }
-
- return RenderAltRow (table, pos, open + (string) r ["Category"] + close,
- open + (string) r ["Message"] + close,
- "&nbsp;", "&nbsp;");
- }
-
- private TableRow SubHeadRow (params string[] cells)
- {
- TableRow row = new TableRow ();
- foreach (string s in cells) {
- TableHeaderCell cell = new TableHeaderCell ();
- cell.Text = s;
- row.Cells.Add (cell);
- }
-
- row.CssClass = "subhead";
- row.HorizontalAlign = HorizontalAlign.Left;
-
- return row;
- }
-
- private TableRow RenderAltRow (Table table, int pos, params string[] cells)
- {
- TableRow row = new TableRow ();
- foreach (string s in cells) {
- TableCell cell = new TableCell ();
- cell.Text = s;
- row.Cells.Add (cell);
- }
-
- if ((pos % 2) != 0)
- row.CssClass = "alt";
-
- table.Rows.Add (row);
- return row;
- }
-
- private TableRow InfoRow2 (string title1, string info1, string title2, string info2)
- {
- TableRow row = new TableRow ();
- TableHeaderCell header1 = new TableHeaderCell ();
- TableHeaderCell header2 = new TableHeaderCell ();
- TableCell cell1 = new TableCell ();
- TableCell cell2 = new TableCell ();
-
- header1.Text = title1;
- header2.Text = title2;
- cell1.Text = info1;
- cell2.Text = info2;
-
- row.Cells.Add (header1);
- row.Cells.Add (cell1);
- row.Cells.Add (header2);
- row.Cells.Add (cell2);
-
- row.HorizontalAlign = HorizontalAlign.Left;
-
- return row;
- }
-
- private Table CreateTable ()
- {
- Table table = new Table ();
-
- table.Width = Unit.Percentage (100);
- table.CellSpacing = 0;
- table.CellPadding = 0;
-
- return table;
- }
-
- private void RenderStyleSheet (HtmlTextWriter o)
- {
- o.WriteLine ("<style type=\"text/css\">");
- o.Write ("span.tracecontent { background-color:white; ");
- o.WriteLine ("color:black;font: 10pt verdana, arial; }");
- o.Write ("span.tracecontent table { font: 10pt verdana, ");
- o.WriteLine ("arial; cellspacing:0; cellpadding:0; margin-bottom:25}");
- o.WriteLine ("span.tracecontent tr.subhead { background-color:cccccc;}");
- o.WriteLine ("span.tracecontent th { padding:0,3,0,3 }");
- o.WriteLine ("span.tracecontent th.alt { background-color:black; color:white; padding:3,3,2,3; }");
- o.WriteLine ("span.tracecontent td { padding:0,3,0,3 }");
- o.WriteLine ("span.tracecontent tr.alt { background-color:eeeeee }");
- o.WriteLine ("span.tracecontent h1 { font: 24pt verdana, arial; margin:0,0,0,0}");
- o.WriteLine ("span.tracecontent h2 { font: 18pt verdana, arial; margin:0,0,0,0}");
- o.WriteLine ("span.tracecontent h3 { font: 12pt verdana, arial; margin:0,0,0,0}");
- o.WriteLine ("span.tracecontent th a { color:darkblue; font: 8pt verdana, arial; }");
- o.WriteLine ("span.tracecontent a { color:darkblue;text-decoration:none }");
- o.WriteLine ("span.tracecontent a:hover { color:darkblue;text-decoration:underline; }");
- o.WriteLine ("span.tracecontent div.outer { width:90%; margin:15,15,15,15}");
- o.Write ("span.tracecontent table.viewmenu td { background-color:006699; ");
- o.WriteLine ("color:white; padding:0,5,0,5; }");
- o.WriteLine ("span.tracecontent table.viewmenu td.end { padding:0,0,0,0; }");
- o.WriteLine ("span.tracecontent table.viewmenu a {color:white; font: 8pt verdana, arial; }");
- o.WriteLine ("span.tracecontent table.viewmenu a:hover {color:white; font: 8pt verdana, arial; }");
- o.WriteLine ("span.tracecontent a.tinylink {color:darkblue; font: 8pt verdana, ");
- o.WriteLine ("arial;text-decoration:underline;}");
- o.WriteLine ("span.tracecontent a.link {color:darkblue; text-decoration:underline;}");
- o.WriteLine ("span.tracecontent div.buffer {padding-top:7; padding-bottom:17;}");
- o.WriteLine ("span.tracecontent .small { font: 8pt verdana, arial }");
- o.WriteLine ("span.tracecontent table td { padding-right:20 }");
- o.WriteLine ("span.tracecontent table td.nopad { padding-right:5 }");
- o.WriteLine ("</style>");
+ data.AddServerVar (key, _Context.Request.ServerVariables [key]);
}
}
}
diff --git a/mcs/class/System.Web/System.Web/TraceData.cs b/mcs/class/System.Web/System.Web/TraceData.cs
new file mode 100644
index 00000000000..cd6d97bd82b
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/TraceData.cs
@@ -0,0 +1,427 @@
+//
+// System.Web.TraceData
+//
+// Author(s):
+// Jackson Harper (jackson@ximian.com)
+//
+// (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+
+using System;
+using System.Text;
+using System.Data;
+using System.Web.UI;
+using System.Web.UI.WebControls;
+
+namespace System.Web {
+
+ internal class TraceData {
+
+ private bool is_first_time;
+ private DateTime first_time;
+ private double prev_time;
+
+ private DataTable info;
+ private DataTable control_data;
+ private DataTable cookie_data;
+ private DataTable header_data;
+ private DataTable servervar_data;
+
+ private string request_path;
+ private string session_id;
+ private DateTime request_time;
+ private Encoding request_encoding;
+ private Encoding response_encoding;
+ private string request_type;
+ private int status_code;
+
+ public TraceData ()
+ {
+ info = new DataTable ();
+ info.Columns.Add (new DataColumn ("Category", typeof (string)));
+ info.Columns.Add (new DataColumn ("Message", typeof (string)));
+ info.Columns.Add (new DataColumn ("Exception", typeof (string)));
+ info.Columns.Add (new DataColumn ("TimeSinceFirst", typeof (double)));
+ info.Columns.Add (new DataColumn ("IsWarning", typeof (bool)));
+
+ control_data = new DataTable ();
+ control_data.Columns.Add (new DataColumn ("ControlId", typeof (string)));
+ control_data.Columns.Add (new DataColumn ("Type", typeof (System.Type)));
+ control_data.Columns.Add (new DataColumn ("RenderSize", typeof (int)));
+ control_data.Columns.Add (new DataColumn ("ViewstateSize", typeof (int)));
+ control_data.Columns.Add (new DataColumn ("Depth", typeof (int)));
+
+ cookie_data = new DataTable ();
+ cookie_data.Columns.Add (new DataColumn ("Name", typeof (string)));
+ cookie_data.Columns.Add (new DataColumn ("Value", typeof (string)));
+
+ header_data = new DataTable ();
+ header_data.Columns.Add (new DataColumn ("Name", typeof (string)));
+ header_data.Columns.Add (new DataColumn ("Value", typeof (string)));
+
+ servervar_data = new DataTable ();
+ servervar_data.Columns.Add (new DataColumn ("Name", typeof (string)));
+ servervar_data.Columns.Add (new DataColumn ("Value", typeof (string)));
+
+ is_first_time = true;
+ }
+
+ public string RequestPath {
+ get { return request_path; }
+ set { request_path = value; }
+ }
+
+ public string SessionID {
+ get { return session_id; }
+ set { session_id = value; }
+ }
+
+ public DateTime RequestTime {
+ get { return request_time; }
+ set { request_time = value; }
+ }
+
+ public Encoding RequestEncoding {
+ get { return request_encoding; }
+ set { request_encoding = value; }
+ }
+
+ public Encoding ResponseEncoding {
+ get { return response_encoding; }
+ set { response_encoding = value; }
+ }
+
+ public string RequestType {
+ get { return request_type; }
+ set { request_type = value; }
+ }
+
+ public int StatusCode {
+ get { return status_code; }
+ set { status_code = value; }
+ }
+
+ public void Write (string category, string msg, Exception error, bool Warning)
+ {
+ double time;
+ if (is_first_time) {
+ time = 0;
+ is_first_time = false;
+ first_time = DateTime.Now;
+ } else
+ time = (DateTime.Now - first_time).TotalSeconds;
+
+ DataRow r = info.NewRow ();
+ r ["Category"] = category;
+ r ["Message"] = msg;
+ r ["Exception"] = (error != null ? error.ToString () : null);
+ r ["TimeSinceFirst"] = time;
+ r ["IsWarning"] = Warning;
+
+ info.Rows.Add (r);
+ }
+
+ public void AddControlTree (Page page)
+ {
+ AddControl (page, 0);
+ }
+
+ private void AddControl (Control c, int control_pos)
+ {
+ DataRow r = control_data.NewRow ();
+ r ["ControlId"] = c.UniqueID;
+ r ["Type"] = c.GetType ();
+ r ["Depth"] = control_pos;
+
+ control_data.Rows.Add (r);
+
+ foreach (Control child in c.Controls)
+ AddControl (child, control_pos + 1);
+ }
+
+ public void AddCookie (string name, string value)
+ {
+ DataRow r = cookie_data.NewRow ();
+
+ r ["Name"] = name;
+ r ["Value"] = value;
+
+ cookie_data.Rows.Add (r);
+ }
+
+ public void AddHeader (string name, string value)
+ {
+ DataRow r = header_data.NewRow ();
+
+ r ["Name"] = name;
+ r ["Value"] = value;
+
+ header_data.Rows.Add (r);
+ }
+
+ public void AddServerVar (string name, string value)
+ {
+ DataRow r = servervar_data.NewRow ();
+
+ r ["Name"] = name;
+ r ["Value"] = value;
+
+ servervar_data.Rows.Add (r);
+ }
+
+ public void Render (HtmlTextWriter output)
+ {
+ output.AddAttribute ("id", "__asptrace");
+ output.RenderBeginTag (HtmlTextWriterTag.Div);
+
+ RenderStyleSheet (output);
+
+ output.AddAttribute ("class", "tracecontent");
+ output.RenderBeginTag (HtmlTextWriterTag.Span);
+
+ RenderRequestDetails (output);
+ RenderTraceInfo (output);
+ RenderControlTree (output);
+ RenderCookies (output);
+ RenderHeaders (output);
+ RenderServerVars (output);
+
+ output.RenderEndTag ();
+ output.RenderEndTag ();
+ }
+
+ private void RenderRequestDetails (HtmlTextWriter output)
+ {
+ Table table = CreateTable ();
+
+ table.Rows.Add (AltRow ("Request Details:"));
+ table.Rows.Add (InfoRow2 ("Session Id:", session_id,
+ "Request Type", request_type));
+ table.Rows.Add (InfoRow2 ("Time of Request:", request_time.ToString (),
+ "State Code:", status_code.ToString ()));
+ table.Rows.Add (InfoRow2 ("Request Encoding:", request_encoding.EncodingName,
+ "Response Encoding:", response_encoding.EncodingName));
+ table.RenderControl (output);
+ }
+
+ private void RenderTraceInfo (HtmlTextWriter output)
+ {
+ Table table = CreateTable ();
+
+ table.Rows.Add (AltRow ("Trace Information"));
+ table.Rows.Add (SubHeadRow ("Category", "Message", "From First(s)", "From Lasts(s)"));
+
+ int pos = 0;
+ foreach (DataRow r in info.Rows)
+ RenderTraceInfoRow (table, r, pos++);
+
+ table.RenderControl (output);
+ }
+
+ private void RenderControlTree (HtmlTextWriter output)
+ {
+ Table table = CreateTable ();
+
+ table.Rows.Add (AltRow ("Control Tree"));
+ table.Rows.Add (SubHeadRow ("Control Id", "Type",
+ "Render Size Bytes (including children)",
+ "View state Size Bytes (excluding children)"));
+
+ int pos = 0;
+ foreach (DataRow r in control_data.Rows) {
+ int depth = (int) r ["Depth"];
+ string prefix = String.Empty;
+ for (int i=0; i<depth; i++)
+ prefix += "&nbsp;&nbsp;&nbsp;&nbsp;";
+ RenderAltRow (table, pos++, prefix + r ["ControlId"],
+ r ["Type"].ToString (), "&nbsp;", "&nbsp;");
+ }
+
+ table.RenderControl (output);
+ }
+
+ private void RenderCookies (HtmlTextWriter output)
+ {
+ Table table = CreateTable ();
+
+ table.Rows.Add (AltRow ("Cookies Collection"));
+ table.Rows.Add (SubHeadRow ("Name", "Value", "Size"));
+
+ int pos = 0;
+ foreach (DataRow r in cookie_data.Rows) {
+ string name = (string) r ["Name"];
+ string value = (string) r ["Value"];
+ int length = name.Length + (value == null ? 0 : value.Length);
+ RenderAltRow (table, pos++, name, value, length.ToString ());
+ }
+
+ table.RenderControl (output);
+ }
+
+ private void RenderHeaders (HtmlTextWriter output)
+ {
+ Table table = CreateTable ();
+
+ table.Rows.Add (AltRow ("Headers Collection"));
+ table.Rows.Add (SubHeadRow ("Name", "Value"));
+
+ int pos = 0;
+ foreach (DataRow r in header_data.Rows)
+ RenderAltRow (table, pos++, (string) r ["Name"], (string) r ["Value"]);
+
+ table.RenderControl (output);
+ }
+
+ private void RenderServerVars (HtmlTextWriter output)
+ {
+ Table table = CreateTable ();
+
+ table.Rows.Add (AltRow ("Server Variables"));
+ table.Rows.Add (SubHeadRow ("Name", "Value"));
+
+ int pos = 0;
+ foreach (DataRow r in servervar_data.Rows)
+ RenderAltRow (table, pos++, (string) r ["Name"], (string) r ["Value"]);
+
+ table.RenderControl (output);
+ }
+
+ internal static TableRow AltRow (string title)
+ {
+ TableRow row = new TableRow ();
+ TableHeaderCell header = new TableHeaderCell ();
+ header.CssClass = "alt";
+ header.HorizontalAlign = HorizontalAlign.Left;
+ header.Attributes [" colspan"] = "10";
+ header.Text = "<h3><b>" + title + "</b></h3>";
+
+ row.Cells.Add (header);
+ return row;
+ }
+
+ private TableRow RenderTraceInfoRow (Table table, DataRow r, int pos)
+ {
+ string open, close;
+ open = close = String.Empty;
+ if ((bool) r ["IsWarning"]) {
+ open = "<font color=\"Red\">";
+ close = "</font>";
+ }
+
+ double t = (double) r ["TimeSinceFirst"];
+ string t1, t2;
+ if (t == 0) {
+ t1 = t2 = String.Empty;
+ prev_time = 0;
+ } else {
+ t1 = t.ToString ("0.000000");
+ t2 = (t - prev_time).ToString ("0.000000");
+ prev_time = t;
+ }
+
+ return RenderAltRow (table, pos, open + (string) r ["Category"] + close,
+ open + (string) r ["Message"] + close, t1, t2);
+ }
+
+ internal static TableRow SubHeadRow (params string[] cells)
+ {
+ TableRow row = new TableRow ();
+ foreach (string s in cells) {
+ TableHeaderCell cell = new TableHeaderCell ();
+ cell.Text = s;
+ row.Cells.Add (cell);
+ }
+
+ row.CssClass = "subhead";
+ row.HorizontalAlign = HorizontalAlign.Left;
+
+ return row;
+ }
+
+ internal static TableRow RenderAltRow (Table table, int pos, params string[] cells)
+ {
+ TableRow row = new TableRow ();
+ foreach (string s in cells) {
+ TableCell cell = new TableCell ();
+ cell.Text = s;
+ row.Cells.Add (cell);
+ }
+
+ if ((pos % 2) != 0)
+ row.CssClass = "alt";
+
+ table.Rows.Add (row);
+ return row;
+ }
+
+ private TableRow InfoRow2 (string title1, string info1, string title2, string info2)
+ {
+ TableRow row = new TableRow ();
+ TableHeaderCell header1 = new TableHeaderCell ();
+ TableHeaderCell header2 = new TableHeaderCell ();
+ TableCell cell1 = new TableCell ();
+ TableCell cell2 = new TableCell ();
+
+ header1.Text = title1;
+ header2.Text = title2;
+ cell1.Text = info1;
+ cell2.Text = info2;
+
+ row.Cells.Add (header1);
+ row.Cells.Add (cell1);
+ row.Cells.Add (header2);
+ row.Cells.Add (cell2);
+
+ row.HorizontalAlign = HorizontalAlign.Left;
+
+ return row;
+ }
+
+ internal static Table CreateTable ()
+ {
+ Table table = new Table ();
+
+ table.Width = Unit.Percentage (100);
+ table.CellSpacing = 0;
+ table.CellPadding = 0;
+
+ return table;
+ }
+
+ internal static void RenderStyleSheet (HtmlTextWriter o)
+ {
+ o.WriteLine ("<style type=\"text/css\">");
+ o.Write ("span.tracecontent { background-color:white; ");
+ o.WriteLine ("color:black;font: 10pt verdana, arial; }");
+ o.Write ("span.tracecontent table { font: 10pt verdana, ");
+ o.WriteLine ("arial; cellspacing:0; cellpadding:0; margin-bottom:25}");
+ o.WriteLine ("span.tracecontent tr.subhead { background-color:cccccc;}");
+ o.WriteLine ("span.tracecontent th { padding:0,3,0,3 }");
+ o.WriteLine ("span.tracecontent th.alt { background-color:black; color:white; padding:3,3,2,3; }");
+ o.WriteLine ("span.tracecontent td { padding:0,3,0,3 }");
+ o.WriteLine ("span.tracecontent tr.alt { background-color:eeeeee }");
+ o.WriteLine ("span.tracecontent h1 { font: 24pt verdana, arial; margin:0,0,0,0}");
+ o.WriteLine ("span.tracecontent h2 { font: 18pt verdana, arial; margin:0,0,0,0}");
+ o.WriteLine ("span.tracecontent h3 { font: 12pt verdana, arial; margin:0,0,0,0}");
+ o.WriteLine ("span.tracecontent th a { color:darkblue; font: 8pt verdana, arial; }");
+ o.WriteLine ("span.tracecontent a { color:darkblue;text-decoration:none }");
+ o.WriteLine ("span.tracecontent a:hover { color:darkblue;text-decoration:underline; }");
+ o.WriteLine ("span.tracecontent div.outer { width:90%; margin:15,15,15,15}");
+ o.Write ("span.tracecontent table.viewmenu td { background-color:006699; ");
+ o.WriteLine ("color:white; padding:0,5,0,5; }");
+ o.WriteLine ("span.tracecontent table.viewmenu td.end { padding:0,0,0,0; }");
+ o.WriteLine ("span.tracecontent table.viewmenu a {color:white; font: 8pt verdana, arial; }");
+ o.WriteLine ("span.tracecontent table.viewmenu a:hover {color:white; font: 8pt verdana, arial; }");
+ o.WriteLine ("span.tracecontent a.tinylink {color:darkblue; font: 8pt verdana, ");
+ o.WriteLine ("arial;text-decoration:underline;}");
+ o.WriteLine ("span.tracecontent a.link {color:darkblue; text-decoration:underline;}");
+ o.WriteLine ("span.tracecontent div.buffer {padding-top:7; padding-bottom:17;}");
+ o.WriteLine ("span.tracecontent .small { font: 8pt verdana, arial }");
+ o.WriteLine ("span.tracecontent table td { padding-right:20 }");
+ o.WriteLine ("span.tracecontent table td.nopad { padding-right:5 }");
+ o.WriteLine ("</style>");
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web/TraceManager.cs b/mcs/class/System.Web/System.Web/TraceManager.cs
new file mode 100644
index 00000000000..4a584ed38a0
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/TraceManager.cs
@@ -0,0 +1,103 @@
+//
+// System.Web.TraceManager
+//
+// Author(s):
+// Jackson Harper (jackson@ximian.com)
+//
+// (C) 2004 Novell, Inc (http://www.novell.com)
+//
+
+
+using System;
+using System.Collections;
+using System.Web.Configuration;
+
+namespace System.Web {
+
+ internal class TraceManager {
+
+ private static string traceConfigPath = "system.web/trace";
+ private bool enabled = false;
+ private bool local_only = true;
+ private bool page_output = false;
+ private TraceMode mode;
+ private int request_limit = 10;
+
+ private int cur_item;
+ private TraceData[] data;
+
+ public TraceManager (HttpContext context)
+ {
+ TraceConfig config = (TraceConfig) context.GetConfig (traceConfigPath);
+
+ if (config == null)
+ return;
+
+ enabled = config.Enabled;
+ local_only = config.LocalOnly;
+ page_output = config.PageOutput;
+ mode = config.TraceMode;
+ request_limit = config.RequestLimit;
+ }
+
+ public bool Enabled {
+ get { return enabled; }
+ set { enabled = value; }
+ }
+
+ public bool LocalOnly {
+ get { return local_only; }
+ set { local_only = value; }
+ }
+
+ public bool PageOutput {
+ get { return page_output; }
+ set { page_output = value; }
+ }
+
+ public int RequestLimit {
+ get { return request_limit; }
+ set {
+ if (request_limit == value)
+ return;
+ TraceData[] swap = new TraceData [value];
+ Array.Copy (data, swap, (cur_item > value ? value : cur_item));
+ if (cur_item > value)
+ cur_item = value;
+ request_limit = value;
+ }
+ }
+
+ public TraceMode TraceMode {
+ get { return mode; }
+ set { mode = value; }
+ }
+
+ public TraceData[] TraceData {
+ get { return data; }
+ }
+
+ public void AddTraceData (TraceData item)
+ {
+ if (data == null)
+ data = new TraceData [request_limit];
+ if (cur_item == request_limit)
+ return;
+ data [cur_item++] = item;
+ }
+
+ public void Clear ()
+ {
+ if (data == null)
+ return;
+
+ Array.Clear (data, 0, data.Length);
+ cur_item = 0;
+ }
+
+ public int ItemCount {
+ get { return cur_item; }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/makefile b/mcs/class/System.Web/makefile
index 82108bbf501..ee3408834f3 100644
--- a/mcs/class/System.Web/makefile
+++ b/mcs/class/System.Web/makefile
@@ -9,7 +9,8 @@ LIB_MCS_FLAGS = \
/r:System.dll \
/r:System.Drawing.dll \
/r:System.Data.dll \
- /r:System.Xml.dll
+ /r:System.Xml.dll \
+ /r:System.EnterpriseServices.dll
NO_TEST = yes
include ../../build/library.make
diff --git a/mcs/class/System.Windows.Forms/ChangeLog b/mcs/class/System.Windows.Forms/ChangeLog
index a9cd14a1cd8..7865f7fdb49 100644
--- a/mcs/class/System.Windows.Forms/ChangeLog
+++ b/mcs/class/System.Windows.Forms/ChangeLog
@@ -1,3 +1,8 @@
+2004-01-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * System.Resources/ResXResourceReader.cs: read empty tags properly.
+ Fixes bug #53174. Patch by Tomasz Kaszuba.
+
2003-08-31 Jerome Laban <jlaban@wanadoo.fr>
* Label.cs: Fixed Text property not redrawing the label correctly.
diff --git a/mcs/class/System.Windows.Forms/Gtk/Appearance.cs b/mcs/class/System.Windows.Forms/Gtk/Appearance.cs
new file mode 100644
index 00000000000..64cfba8f898
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/Gtk/Appearance.cs
@@ -0,0 +1,19 @@
+//
+// System.Windows.Forms.Appearance.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum Appearance {
+ Button = 0,
+ Normal = 1
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/Gtk/Application.cs b/mcs/class/System.Windows.Forms/Gtk/Application.cs
index e7aed3b47b1..e74e41fe3d5 100644
--- a/mcs/class/System.Windows.Forms/Gtk/Application.cs
+++ b/mcs/class/System.Windows.Forms/Gtk/Application.cs
@@ -16,6 +16,7 @@ using System.Globalization;
using System.Reflection;
using System.Collections;
using System.Runtime.CompilerServices;
+using System.IO;
namespace System.Windows.Forms
{
@@ -43,9 +44,16 @@ namespace System.Windows.Forms
[MonoTODO]
public static string CommonAppDataPath{
- get{
- //FIXME:
- return "";
+ get{
+ String cadp = Environment.GetFolderPath(
+ Environment.SpecialFolder.CommonApplicationData);
+ if (cadp == "")
+ cadp = Environment.GetFolderPath(
+ Environment.SpecialFolder.ApplicationData);
+ char c = Path.DirectorySeparatorChar;
+ cadp += c + CompanyName + c + ProductName +c + ProductVersion;
+ return cadp;
+
}
}
@@ -57,37 +65,53 @@ namespace System.Windows.Forms
[MonoTODO]
public static string CompanyName{
get{
- AssemblyCompanyAttribute[] attrs =(AssemblyCompanyAttribute[]) Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCompanyAttribute),true);
- if (attrs != null && attrs[0] != null)
- return attrs[0].Company;
- return "";
+ Type t = Assembly.GetEntryAssembly().EntryPoint.ReflectedType;
+ String ret1 = (t.Namespace == "") ?
+ t.Name :
+ t.Namespace.Substring (0,t.Namespace.IndexOf('.'));
+
+ try{
+ AssemblyCompanyAttribute[] attrs =(AssemblyCompanyAttribute[]) Assembly.GetEntryAssembly().GetCustomAttributes(typeof(AssemblyCompanyAttribute),true);
+ if ((attrs != null) && (attrs[0] != null))
+ return attrs[0].Company;
+ }
+ catch (Exception){
+
+ }
+ return ret1;
+
}
}
[MonoTODO]
public static CultureInfo CurrentCulture
{
- get{return CultureInfo.CurrentCulture;}
- set{Thread.CurrentThread.CurrentCulture = value;}
+ get{ return CultureInfo.CurrentCulture; }
+ set{ Thread.CurrentThread.CurrentCulture = value; }
}
- //[MonoTODO]
- //public static InputLanguage CurrentInputLanguage
- //{
- // get { throw new NotImplementedException (); }
- // set {return;}
- //}
+ [MonoTODO]
+ public static InputLanguage CurrentInputLanguage {
+ get { throw new NotImplementedException (); }
+ set {return;}
+ }
[MonoTODO]
public static string ExecutablePath{
- get {return Assembly.GetExecutingAssembly().Location;}
+ get { return Assembly.GetExecutingAssembly().Location; }
}
[MonoTODO]
public static string LocalUserAppDataPath {
get{
- //FIXME:
- return "";
+ String cadp = Environment.GetFolderPath(
+ Environment.SpecialFolder.LocalApplicationData);
+ if (cadp == "")
+ cadp = Environment.GetFolderPath(
+ Environment.SpecialFolder.ApplicationData);
+ char c = Path.DirectorySeparatorChar;
+ cadp += c + CompanyName + c + ProductName +c + ProductVersion;
+ return cadp;
}
}
@@ -99,21 +123,28 @@ namespace System.Windows.Forms
[MonoTODO]
public static string ProductName{
- get{
- AssemblyProductAttribute[] attrs =(AssemblyProductAttribute[]) Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyProductAttribute),true);
- if (attrs != null && attrs[0] != null)
- return attrs[0].Product;
- return "";
+ get{
+
+ Type t = Assembly.GetEntryAssembly().EntryPoint.ReflectedType;
+ String ret1 = (t.Namespace == "") ?
+ t.Name :
+ t.Namespace.Substring (t.Namespace.LastIndexOf('.')+1);
+
+ try{
+ AssemblyProductAttribute[] attrs =(AssemblyProductAttribute[]) Assembly.GetEntryAssembly().GetCustomAttributes(typeof(AssemblyProductAttribute),true);
+ if (attrs != null && attrs[0] != null)
+ return attrs[0].Product;
+ }
+ catch (Exception){
+ }
+ return ret1;
}
}
[MonoTODO]
public static string ProductVersion{
get {
- AssemblyVersionAttribute[] attrs =(AssemblyVersionAttribute[]) Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyVersionAttribute),true);
- if (attrs != null && attrs[0] != null)
- return attrs[0].Version;
- return "";
+ return Assembly.GetEntryAssembly().GetName().Version.ToString();
}
}
@@ -126,17 +157,21 @@ namespace System.Windows.Forms
[MonoTODO]
public static string StartupPath {
get{
- //FIXME:
- return "";
+ String exe = Assembly.GetEntryAssembly().GetName().CodeBase;
+ //Remove "file://"
+ exe = exe.Substring (7);
+ return new FileInfo(exe).DirectoryName;
}
}
[MonoTODO]
public static string UserAppDataPath{
- get
- {
- //FIXME:
- return "";
+ get{
+ String cadp = Environment.GetFolderPath(
+ Environment.SpecialFolder.ApplicationData);
+ char c = Path.DirectorySeparatorChar;
+ cadp += c + CompanyName + c + ProductName +c + ProductVersion;
+ return cadp;
}
}
@@ -154,7 +189,6 @@ namespace System.Windows.Forms
public static void DoEvents (){
while (Gtk.Application.EventsPending())
Gtk.Application.RunIteration();
-
}
[MonoTODO]
//.NET version 1.1
@@ -250,7 +284,6 @@ namespace System.Windows.Forms
public static void Run (Form mainForm){
// Documents say this parameter name should be mainform,
// but the verifier says context.
- //mainForm.CreateControl ();
ApplicationContext context = new ApplicationContext (mainForm);
Run (context);
}
diff --git a/mcs/class/System.Windows.Forms/Gtk/ButtonBase.cs b/mcs/class/System.Windows.Forms/Gtk/ButtonBase.cs
index a90971fe288..ca23c3419ca 100644
--- a/mcs/class/System.Windows.Forms/Gtk/ButtonBase.cs
+++ b/mcs/class/System.Windows.Forms/Gtk/ButtonBase.cs
@@ -32,12 +32,12 @@ namespace System.Windows.Forms {
bool isDefault;
bool isPushed;
- protected Label label;
+ protected Label label = new Label();
//
// // --- Constructor ---
protected ButtonBase() : base(){
- label = new Label();
+ //label = new Label();
label.Text = Text;
label.Visible = true;
flatStyle = FlatStyle.Standard;
@@ -72,9 +72,7 @@ namespace System.Windows.Forms {
set{label.Font = value;}
}
protected override Size DefaultSize {
- get {
- return new Size(75,23);// default size for button.
- }
+ get { return new Size(75,23); }
}
[MonoTODO]
public FlatStyle FlatStyle {
diff --git a/mcs/class/System.Windows.Forms/Gtk/ChangeLog b/mcs/class/System.Windows.Forms/Gtk/ChangeLog
index ce6121766c8..2c2e0e8f186 100644
--- a/mcs/class/System.Windows.Forms/Gtk/ChangeLog
+++ b/mcs/class/System.Windows.Forms/Gtk/ChangeLog
@@ -1,3 +1,35 @@
+Thu Jan 16 19:20:00 GMT+2 2003 Joel Basson <jstrike@mweb.co.za>
+ * Applied patch from Alberto Fernandez with the following changes...
+ Finished ProgressBar (Events?)
+ Finished HScrollBar VScrollBar and ScrollBar
+ Finished FolderBrowserDialog
+ Base ComboBox
+ Added DrawMode.cs
+ Added ComboBoxStyle.cs
+ Added Appearance.cs
+ Added CheckState.cs
+ Added TabAlignment
+ Added TabAppearance.cs
+ Added TabDrawMode.cs
+ Added TabSizeMode.cs
+ Added Panel.cs
+ Added TabPage.cs
+ Added TabControl.cs
+ Added Cursors.cs
+ Added MessageBoxDefaultButton.cs
+ Added MessageBoxIcon.cs
+ Added MessageBoxOptions.cs
+ Changes in MessageBoxButtons.cs (Added values)
+ Changes in MessageBox (Completed all functions, added return values).
+ "Finished" CheckBox.cs
+ "Finished" ComboBox.cs
+ "Finished" RadioButton
+ "Finished" GroupBox
+ "Finished" Panel
+ Changes in Form to work with new RadioButton.
+ Fix double Click reported on MenuItems.
+ "Finished" Application
+
Tue Dec 16 12:15:00 GMT+2 2003 Joel Basson <jstrike@mweb.co.za>
* Applied patch from Alberto Fernandez with the following changes...
diff --git a/mcs/class/System.Windows.Forms/Gtk/CheckBox.cs b/mcs/class/System.Windows.Forms/Gtk/CheckBox.cs
index 710c8bca9be..e6b67dca92b 100644
--- a/mcs/class/System.Windows.Forms/Gtk/CheckBox.cs
+++ b/mcs/class/System.Windows.Forms/Gtk/CheckBox.cs
@@ -2,11 +2,13 @@
// System.Windows.Forms.CheckBox
//
// Author:
-// Joel Basson (jstrike@mweb.co.za)
+// Joel Basson (jstrike@mweb.co.za)
+// Alberto Fernandez (infjaf00@yahoo.es)
//
//
using System.Drawing;
+using System.ComponentModel;
namespace System.Windows.Forms {
@@ -17,23 +19,140 @@ namespace System.Windows.Forms {
public class CheckBox: ButtonBase{
- public CheckBox () : base ()
- {
- }
+ private bool autocheck = false;
+ private bool threeState = false;
+ private CheckState checkState;
- internal override Gtk.Widget CreateWidget () {
- Gtk.CheckButton cbox = new Gtk.CheckButton();
- cbox.Add (label.Widget);
- return cbox;
- }
-
- public bool Checked {
- get {
- return ((Gtk.CheckButton)Widget).Active;
+ public CheckBox () : base (){
+ AutoCheck = true;
+ Checked = false;
+ ThreeState = false;
+ }
+ public Appearance Appearance{
+ get{
+ if ( (Widget as Gtk.CheckButton).DrawIndicator)
+ return Appearance.Normal;
+ return Appearance.Button;
}
+ set{
+ if (!Enum.IsDefined (typeof(Appearance), value) )
+ throw new InvalidEnumArgumentException();
+ if (value != Appearance){
+ if (value == Appearance.Normal)
+ (Widget as Gtk.CheckButton).DrawIndicator = true;
+ else
+ (Widget as Gtk.CheckButton).DrawIndicator = false;
+ OnAppearanceChanged (EventArgs.Empty);
+ }
+ }
+ }
+ public bool AutoCheck {
+ get { return autocheck; }
+ set { autocheck = value; }
+ }
+ [MonoTODO]
+ public ContentAlignment CheckAlign {
+ get { return ContentAlignment.MiddleLeft; }
set {
- ((Gtk.CheckButton)Widget).Active = value;
+ if (!Enum.IsDefined (typeof (ContentAlignment), value)){
+ throw new InvalidEnumArgumentException ("CheckAlign");
+ }
+ }
+ }
+ public bool Checked {
+ get { return (this.CheckState != CheckState.Unchecked); }
+ set { this.CheckState = (value) ? CheckState.Checked : CheckState.Unchecked;}
+ }
+ public CheckState CheckState{
+ get{ return checkState; }
+ set{
+ if (! Enum.IsDefined ( typeof(CheckState), value) )
+ throw new InvalidEnumArgumentException();
+ checkState = value;
+ switch (value){
+ case CheckState.Indeterminate:
+ (Widget as Gtk.CheckButton).Inconsistent = true;
+ break;
+ case CheckState.Checked:
+ (Widget as Gtk.CheckButton).Inconsistent = false;
+ (Widget as Gtk.CheckButton).Active = true;
+ break;
+ case CheckState.Unchecked:
+ (Widget as Gtk.CheckButton).Inconsistent = false;
+ (Widget as Gtk.CheckButton).Active = false;
+ break;
+ }
+
}
}
+ protected override Size DefaultSize {
+ get{ return new Size(104, 24);}
+ }
+ public bool ThreeState {
+ get { return threeState; }
+ set { threeState = value; }
+ }
+ protected virtual void OnAppearanceChanged( EventArgs e){
+ if (AppearanceChanged != null)
+ AppearanceChanged (this, e);
+ }
+ protected virtual void OnCheckedChanged( EventArgs e){
+ if (CheckedChanged != null)
+ CheckedChanged (this, e);
+ }
+ protected virtual void OnCheckStateChanged(EventArgs e){
+ if (CheckStateChanged != null)
+ CheckStateChanged (this, e);
+ }
+ public override string ToString(){
+ return "System.Windows.Forms.CheckBox, CheckState: " +
+ (int) this.CheckState;
+ }
+
+ public event EventHandler AppearanceChanged;
+ public event EventHandler CheckedChanged;
+ public event EventHandler CheckStateChanged;
+ public new event EventHandler DoubleClick;
+
+
+
+ internal override Gtk.Widget CreateWidget () {
+ Gtk.CheckButton cbox = new Gtk.CheckButton();
+ cbox.Add (label.Widget);
+ return cbox;
+ }
+ internal override void ConnectEvents(){
+ (Widget as Gtk.CheckButton).Toggled += new EventHandler (GtkToggled);
+ }
+
+ // Lock variable.
+ private bool started = false;
+ private void GtkToggled (object o, EventArgs e){
+ if (started)
+ return;
+ started = true;
+ if (AutoCheck){
+ if (this.CheckState == CheckState.Indeterminate){
+ this.CheckState = CheckState.Unchecked;
+ OnCheckedChanged(e);
+ OnCheckStateChanged(e);
+ }
+ else if ((this.CheckState == CheckState.Checked) && (this.ThreeState)) {
+ this.CheckState = CheckState.Indeterminate;
+ OnCheckStateChanged (e);
+ }
+ else{
+ this.Checked = !this.Checked;
+ OnCheckedChanged(e);
+ OnCheckStateChanged(e);
+ }
+
+ }
+ else{
+ this.CheckState = checkState;
+ }
+ started = false;
+
+ }
}
}
diff --git a/mcs/class/System.Windows.Forms/Gtk/CheckState.cs b/mcs/class/System.Windows.Forms/Gtk/CheckState.cs
new file mode 100644
index 00000000000..a7bf2bc9208
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/Gtk/CheckState.cs
@@ -0,0 +1,26 @@
+//
+// System.Windows.Forms.CheckState.cs
+//
+// Author:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+
+ /// <summary>
+ /// Specifies the state of a control, such as a check box,
+ /// that can be checked, unchecked, or set to an indeterminate state.
+ /// </summary>
+ public enum CheckState {
+
+ //Values were verified with enumcheck.
+ Unchecked = 0,
+ Checked = 1,
+ Indeterminate = 2,
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/Gtk/ComboBox.cs b/mcs/class/System.Windows.Forms/Gtk/ComboBox.cs
index 4e1e7b614e4..69439a8ae75 100644
--- a/mcs/class/System.Windows.Forms/Gtk/ComboBox.cs
+++ b/mcs/class/System.Windows.Forms/Gtk/ComboBox.cs
@@ -2,11 +2,14 @@
// System.Windows.Forms.ComboBox
//
// Author:
-// Joel Basson (jstrike@mweb.co.za)
+// Joel Basson (jstrike@mweb.co.za)
+// Alberto Fernandez (infjaf00@yahoo.es)
//
//
+using System.Collections;
using System.Drawing;
+using System.ComponentModel;
using System.Runtime.InteropServices;
namespace System.Windows.Forms {
@@ -16,97 +19,489 @@ namespace System.Windows.Forms {
///
/// </summary>
- public class ComboBox: Control{
+ public class ComboBox: ListControl{
- private int menusize;
- private bool UpdateState;
- public ItemCollection Items;
+ public ObjectCollection items;
GLib.List list = new GLib.List (IntPtr.Zero, typeof (string));
System.Collections.ArrayList alist = new System.Collections.ArrayList();
- public class ItemCollection {
-
- ComboBox owner;
-
- public ItemCollection (ComboBox owner){
-
- this.owner = owner;
+ private bool sorted = false;
+ private int maxDropDownItems = 8;
+ private ComboBoxStyle dropDownStyle = ComboBoxStyle.DropDown;
+ private bool updating = false;
+ private bool disableChanging = false;
+
+ public ComboBox () : base (){
+ }
+
+ protected override Size DefaultSize {
+ get {return new Size (121, 20); }
+ }
+ [MonoTODO]
+ public DrawMode DrawMode {
+ get{return DrawMode.Normal;}
+ set{
+ if (!Enum.IsDefined (typeof (DrawMode), value))
+ throw new InvalidEnumArgumentException ("DrawMode");
+ }
+ }
+ [MonoTODO]
+ public ComboBoxStyle DropDownStyle {
+ get{return dropDownStyle;}
+ set{
+ if (!Enum.IsDefined (typeof(ComboBoxStyle), value))
+ throw new InvalidEnumArgumentException ("DropDownStyle");
+
+ if (dropDownStyle == value)
+ return;
+
+ switch (value){
+ case ComboBoxStyle.Simple:
+ case ComboBoxStyle.DropDown:
+ (Widget as Gtk.Combo).Entry.Editable = true;
+ break;
+ case ComboBoxStyle.DropDownList:
+ (Widget as Gtk.Combo).Entry.Editable = false;
+ break;
+ }
+ dropDownStyle = value;
+ OnDropDownStyleChanged (EventArgs.Empty);
+ }
+ }
+ [MonoTODO]
+ public int DropDownWidth {
+ get{ throw new NotImplementedException(); }
+ set{
+ if (value < 1)
+ throw new ArgumentException();
+ throw new NotImplementedException();}
+ }
+
+ [MonoTODO]
+ public bool DroppedDown {
+ get{ return false; }
+ set{ return; }
+ }
+ [MonoTODO]
+ public bool IntegralHeight {
+ get{throw new NotImplementedException();}
+ set{throw new NotImplementedException();}
+ }
+ [MonoTODO]
+ public int ItemHeight {
+ get{throw new NotImplementedException();}
+ set{throw new NotImplementedException();}
+ }
+ public ComboBox.ObjectCollection Items{
+ get{
+ if (items == null)
+ items = new ObjectCollection(this);
+ return items;
}
-
- public void Add(String value){
- owner.alist.Add(value);
- owner.list.Append (Marshal.StringToHGlobalAnsi (value));
- if ( owner.UpdateState == false ) {owner.Update();}
+ }
+ [MonoTODO]
+ public int MaxDropDownItems {
+ get{ return MaxDropDownItems; }
+ set{
+ if ((value < 1) || (value > 100))
+ throw new ArgumentException();
+ maxDropDownItems = value;
}
-
- public void AddRange(object[] items) {
- owner.alist.AddRange(items);
- foreach (object o in items)
- {string s = (string)o;
- owner.list.Append (Marshal.StringToHGlobalAnsi (s));}
- owner.Update();
+ }
+ [MonoTODO]
+ public int MaxLength {
+ get{ return (Widget as Gtk.Combo).Entry.MaxLength; }
+ set{
+ if (value < 0)
+ value = 0;
+ (Widget as Gtk.Combo).Entry.MaxLength = value;
}
}
-
- public ComboBox () : base (){
- Items = new ItemCollection(this);
-
- UpdateState = false;
+ [MonoTODO]
+ public int PreferredHeight {
+ get{throw new NotImplementedException();}
}
-
- internal override Gtk.Widget CreateWidget () {
- Gtk.Combo com1 = new Gtk.Combo();
- com1.SetPopdownStrings("");
- return com1;
+ [MonoTODO]
+ public override int SelectedIndex{
+ get{ return Items.IndexOf(((Gtk.Combo)Widget).Entry.Text);}
+ set{
+ if ((value < -2) || (value > Items.Count))
+ throw new ArgumentException ("SelectedIndex");
+
+ if (SelectedIndex == value)
+ return;
+
+ disableChanging = true;
+ ((Gtk.Combo)Widget).Entry.Text = (string)Items [value];
+ OnSelectedIndexChanged(EventArgs.Empty);
+ disableChanging = false;
+ }
+ }
+ [MonoTODO]
+ public Object SelectedItem{
+ get{ return Items[this.SelectedIndex];}
+ set{ this.SelectedIndex = Items.IndexOf (value);}
+ }
+ [MonoTODO]
+ public string SelectedText {
+ get{
+ if (this.DropDownStyle == ComboBoxStyle.DropDownList)
+ return String.Empty;
+ else{
+ int start, end;
+ if ( (Widget as Gtk.Combo).Entry.GetSelectionBounds(out start, out end))
+ return (Widget as Gtk.Combo).Entry.GetChars (start, end);
+ else
+ return String.Empty;
+ }
+ }
+ set{(Widget as Gtk.Combo).Entry.InsertText (value);}
+ }
+ [MonoTODO]
+ public int SelectionLength {
+ get{ return this.SelectedText.Length; }
+ set{
+ if (value < 0)
+ throw new ArgumentException ("SelectionLength");
+ if ((SelectionStart + value) > Text.Length){
+ value = Text.Length - SelectionStart;
+ }
+ (Widget as Gtk.Combo).Entry.SelectRegion (
+ SelectionStart, SelectionStart + value);
+ }
+ }
+ [MonoTODO]
+ public int SelectionStart {
+ get{
+ int start, end;
+
+ if ( (Widget as Gtk.Combo).Entry.GetSelectionBounds(out start, out end))
+ return start;
+ else
+ return (Widget as Gtk.Combo).Entry.Position;
+
+ }
+ set{
+ if (value < 0)
+ throw new ArgumentException ("SelectionStart");
+ if (value > this.Text.Length)
+ value = this.Text.Length;
+
+ int length = SelectionLength;
+
+ if ((value + length) > Text.Length)
+ length = Text.Length - value;
+ (Widget as Gtk.Combo).Entry.SelectRegion (value, length);
+
+
+ }
+ }
+
+ [MonoTODO]
+ public bool Sorted {
+ get{return sorted;}
+ set{
+ if (! sorted && value )
+ Items.Sort();
+ sorted = value;
+ }
+ }
+ [MonoTODO]
+ public override string Text{
+ get{ return (Widget as Gtk.Combo).Entry.Text; }
+ set{
+ disableChanging = true;
+ if ((value == null) || (value == String.Empty))
+ this.SelectedIndex = -1;
+ else
+ (Widget as Gtk.Combo).Entry.Text = value;
+ disableChanging = false;
+ }
}
-
- public void Update () {
- ((Gtk.Combo)Widget).PopdownStrings = list;
+
+ [MonoTODO]
+ protected virtual void AddItemsCore( object[] value){
}
-
+ [MonoTODO]
public void BeginUpdate () {
-
- UpdateState = true;
+ updating = true;
}
-
+ [MonoTODO]
+ protected override void Dispose( bool disposing){
+ base.Dispose(disposing);
+ }
+ [MonoTODO]
public void EndUpdate () {
-
- UpdateState = false;
+ updating = false;
Update();
}
-
- public int FindString (string value){
-
- //return alist.BinarySearch(value);
+ [MonoTODO]
+ public int FindString (string value){
return alist.IndexOf(value);
}
+ [MonoTODO]
+ public int FindString(string s, int startIndex){
+ throw new NotImplementedException();
+ }
+ [MonoTODO]
+ public int FindStringExact( string s){
+ throw new NotImplementedException();
+ }
+ [MonoTODO]
+ public int FindStringExact( string s, int startIndex){
+ throw new NotImplementedException();
+ }
+ [MonoTODO]
+ public int GetItemHeight(int index){
+ throw new NotImplementedException();
+ }
- public int SelectedIndex{
- get{
- return alist.IndexOf(((Gtk.Combo)Widget).Entry.Text);
- }
- set{
- ((Gtk.Combo)Widget).Entry.Text = (string)alist[value];
+ protected virtual void OnDrawItem(DrawItemEventArgs e){
+ if (DrawItem != null)
+ DrawItem (this,e);
+ }
+ protected virtual void OnDropDown( EventArgs e){
+ if (DropDown != null)
+ DropDown (this, e);
+ }
+ protected virtual void OnDropDownStyleChanged( EventArgs e){
+ if (DropDownStyleChanged != null)
+ DropDownStyleChanged (this, e);
+ }
+
+ protected virtual void OnMeasureItem(MeasureItemEventArgs e){
+ if (MeasureItem != null)
+ MeasureItem (this, e);
+ }
+
+ protected override void OnSelectedIndexChanged(EventArgs e){
+ base.OnSelectedIndexChanged(e);
+ if (SelectedIndexChanged != null)
+ SelectedIndexChanged (this, e);
+ }
+
+ // Don't use
+ [MonoTODO]
+ protected virtual void OnSelectedItemChanged(EventArgs e){
+
+ }
+ protected override void OnSelectedValueChanged (EventArgs e){
+ base.OnSelectedValueChanged (e);
+ }
+ protected virtual void OnSelectionChangeCommitted( EventArgs e){
+ if (SelectionChangeCommitted != null)
+ SelectionChangeCommitted (this, e);
+ }
+ [MonoTODO]
+ protected override void RefreshItem(int index){
+ }
+ [MonoTODO]
+ public void Select(int start, int length){
+ }
+ [MonoTODO]
+ public void SelectAll(){
+ }
+ [MonoTODO]
+ protected override void SetItemCore( int index, object value){
+ }
+ [MonoTODO]
+ protected override void SetItemsCore( IList value){
+ }
+ public override string ToString(){
+ return "System.Windows.Forms.ComboBox, Items.Count: " + Items.Count;
+ }
+
+ // ?
+ [MonoTODO]
+ public override void Update () {
+ disableChanging = true;
+ String tmp = (Widget as Gtk.Combo).Entry.Text;
+ String[] strings = new String [this.Items.Count];
+ int i=0;
+ foreach (String s in Items){
+ strings[i++] = s;
}
+ if (strings.Length > 0)
+ (Widget as Gtk.Combo).SetPopdownStrings(strings);
+ else
+ (Widget as Gtk.Combo).SetPopdownStrings("");
+
+ (Widget as Gtk.Combo).Entry.Text = tmp;
+ disableChanging = false;
}
-
- public Object SelectedItem{
- get{
- return alist[this.SelectedIndex];
+
+ public event DrawItemEventHandler DrawItem;
+ public event EventHandler DropDown;
+ public event EventHandler DropDownStyleChanged;
+ public event MeasureItemEventHandler MeasureItem;
+ public event EventHandler SelectedIndexChanged;
+ public event EventHandler SelectionChangeCommitted;
+
+
+
+
+ internal override Gtk.Widget CreateWidget () {
+ Gtk.Combo com1 = new Gtk.Combo();
+ com1.SetPopdownStrings("");
+ com1.DisableActivate();
+ com1.Entry.Changed += new EventHandler (OnEntryChanged);
+ return com1;
+ }
+ internal void OnEntryChanged (object o, EventArgs args){
+ if (disableChanging)
+ return;
+ if (this.SelectedIndex != -1){
+ OnSelectionChangeCommitted (EventArgs.Empty);
+ OnSelectedIndexChanged (EventArgs.Empty);
}
- set{
- throw new NotImplementedException ();
+ }
+
+ /// sub-class: ComboBox.ObjectCollection
+ /// <summary>
+ /// Represents the collection of items in a ComboBox.
+ /// </summary>
+ [MonoTODO]
+ public class ObjectCollection : IList, ICollection, IEnumerable {
+ private ArrayList collection_ = new ArrayList ();
+ private ComboBox owner_ = null;
+
+ /// --- ObjectCollection.constructor ---
+
+ public ObjectCollection (ComboBox owner) {
+ owner_ = owner;
+ }
+
+ /// --- ObjectCollection Properties ---
+
+ public int Count {
+ get { return collection_.Count; }
+ }
+ public bool IsReadOnly {
+ get { return collection_.IsReadOnly; }
+ }
+ [MonoTODO]
+ object IList.this[int index] {
+ get { return collection_[index]; }
+ set {
+ collection_[index] = value;
+ if (!owner_.updating)
+ owner_.Update();
+ }
+ }
+ [MonoTODO]
+ public object this[int index] {
+ get { return collection_[index]; }
+ set {
+ collection_[index] = value;
+ if (!owner_.updating)
+ owner_.Update();
+ }
}
- }
- public int DropDownWidth {
- get {
- return menusize;
+ /// --- ICollection properties ---
+ bool IList.IsFixedSize {
+ get { return collection_.IsFixedSize; }
+ }
+ object ICollection.SyncRoot {
+ get { return collection_.SyncRoot; }
+ }
+ bool ICollection.IsSynchronized {
+ get { return collection_.IsSynchronized; }
+ }
+
+ /// --- methods ---
+ /// --- ObjectCollection Methods ---
+ /// Note: IList methods are stubbed out, otherwise IList interface cannot be implemented
+ [MonoTODO]
+ public int Add(object item) {
+ int idx=0;
+ if ( owner_.Sorted){
+ idx = collection_.BinarySearch(item, ComboBoxComparer.Instance);
+ if (idx < 0)
+ idx = ~idx;
+ collection_.Insert (idx, item);
+ }
+ else {
+ idx = collection_.Add (item);
+ }
+ if (!owner_.updating)
+ owner_.Update();
+ return idx;
+ }
+
+ [MonoTODO]
+ public void AddRange(object[] items){
+ owner_.BeginUpdate();
+ foreach(object item in items) {
+ Add(item);
+ }
+ owner_.EndUpdate();
+ }
+ [MonoTODO]
+ public void Clear(){
+ collection_.Clear();
+ owner_.Update();
+ }
+ public bool Contains(object value){
+ return collection_.Contains(value);
}
- set {
- menusize = value;
+ public void CopyTo(object[] dest,int arrayIndex){
+ collection_.CopyTo(dest, arrayIndex);
+ }
+
+ /// for ICollection:
+ void ICollection.CopyTo(Array dest,int index){
+ collection_.CopyTo(dest, index);
+ }
+ public IEnumerator GetEnumerator(){
+ return collection_.GetEnumerator();
+ }
+ public int IndexOf(object value){
+ return collection_.IndexOf(value);
+ }
+ [MonoTODO]
+ public void Insert(int index,object item){
+ collection_.Insert (index, item);
+ if (! owner_.updating)
+ owner_.Update();
+ }
+ public void Remove(object value){
+ collection_.Remove(value);
+ if (! owner_.updating)
+ owner_.Update();
+ }
+
+ [MonoTODO]
+ public void RemoveAt(int index){
+ collection_.RemoveAt (index);
+ if (!owner_.updating)
+ owner_.Update();
+ }
+
+ internal void Sort(){
+ collection_.Sort(ComboBoxComparer.Instance);
+ owner_.Update();
+ }
+ } // --- end of ComboBox.ObjectCollection ---
+
+ internal class ComboBoxComparer : System.Collections.IComparer {
+ private static ComboBoxComparer instance = null;
+ private ComboBoxComparer(){
+ }
+ public static ComboBoxComparer Instance{
+ get{
+ if (instance == null)
+ instance = new ComboBoxComparer();
+ return instance;
+ }
+ }
+
+ public int Compare (object x, object y){
+ string s1 = (x as string).ToUpper();
+ string s2 = (y as string).ToUpper();
+
+ return Comparer.Default.Compare (s1, s2);
}
}
-
}
}
diff --git a/mcs/class/System.Windows.Forms/Gtk/ComboBoxStyle.cs b/mcs/class/System.Windows.Forms/Gtk/ComboBoxStyle.cs
new file mode 100644
index 00000000000..bef45a26180
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/Gtk/ComboBoxStyle.cs
@@ -0,0 +1,20 @@
+//
+// System.Windows.Forms.ComboBoxStyle.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum ComboBoxStyle {
+ DropDown = 1,
+ DropDownList = 2,
+ Simple = 0
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/Gtk/CommonDialog.cs b/mcs/class/System.Windows.Forms/Gtk/CommonDialog.cs
index d27b6fc2bf5..c83d19863fd 100644
--- a/mcs/class/System.Windows.Forms/Gtk/CommonDialog.cs
+++ b/mcs/class/System.Windows.Forms/Gtk/CommonDialog.cs
@@ -54,7 +54,7 @@ namespace System.Windows.Forms {
}
public DialogResult ShowDialog(IWin32Window owner){
- bool res = RunDialog ( owner.Handle );
+ bool res = RunDialog ( IntPtr.Zero );
return res ? DialogResult.OK : DialogResult.Cancel;
}
public event EventHandler HelpRequest;
@@ -64,30 +64,43 @@ namespace System.Windows.Forms {
get {
if (dialog == null){
dialog = CreateDialog();
+ dialog.Modal = true;
+ dialog.Response += new GtkSharp.ResponseHandler (OnResponse);
+ dialog.DeleteEvent += new GtkSharp.DeleteEventHandler (OnDelete);
}
return dialog;
}
}
- // TODO: Change to abstract.
+
internal abstract Gtk.Dialog CreateDialog();
internal void OnDelete (object sender, GtkSharp.DeleteEventArgs args){
Gtk.Window d = (Gtk.Window) sender;
d.Hide ();
+ dialogRetValue = false;
+ OnCancel();
args.RetVal = true;
}
- internal void OnResponse (object o, GtkSharp.ResponseArgs args){
- Console.WriteLine ("OnResponse {0}" ,args.ResponseId);
+ internal virtual void OnResponse (object o, GtkSharp.ResponseArgs args){
switch (args.ResponseId){
case (int)Gtk.ResponseType.Accept:
case (int)Gtk.ResponseType.Ok:
case (int)Gtk.ResponseType.Yes:
case (int)Gtk.ResponseType.Apply:
dialogRetValue = true;
+ OnAccept();
+ Dialog.Hide();
break;
default:dialogRetValue = false;
+ OnCancel();
+ Dialog.Hide();
break;
}
}
+ internal virtual void OnCancel(){
+
+ }
+ internal virtual void OnAccept (){
+ }
}
}
diff --git a/mcs/class/System.Windows.Forms/Gtk/ContextMenu.cs b/mcs/class/System.Windows.Forms/Gtk/ContextMenu.cs
index ad0e6dcc0b3..5d4f42ea9b4 100644
--- a/mcs/class/System.Windows.Forms/Gtk/ContextMenu.cs
+++ b/mcs/class/System.Windows.Forms/Gtk/ContextMenu.cs
@@ -1,6 +1,9 @@
//
// System.Windows.Forms.ContextMenu
//
+// Author:
+// Alberto Fernandez (infjaf00@yahoo.es)
+//
using System;
using System.ComponentModel;
diff --git a/mcs/class/System.Windows.Forms/Gtk/Control.cs b/mcs/class/System.Windows.Forms/Gtk/Control.cs
index 0d37aa686e3..1c1ba5a360f 100644
--- a/mcs/class/System.Windows.Forms/Gtk/Control.cs
+++ b/mcs/class/System.Windows.Forms/Gtk/Control.cs
@@ -141,7 +141,7 @@ namespace System.Windows.Forms{
[MonoTODO]
public virtual Rectangle Bounds{
get {throw new NotImplementedException ();}
- set{throw new NotImplementedException ();}
+ set {throw new NotImplementedException ();}
}
[MonoTODO]
public virtual bool CanFocus{
@@ -160,7 +160,7 @@ namespace System.Windows.Forms{
[MonoTODO]
public virtual bool CausesValidation{
get{return true;}
- set{throw new NotImplementedException ();}
+ set{}
}
[MonoTODO]
public virtual Rectangle ClientRectangle {
@@ -193,19 +193,19 @@ namespace System.Windows.Forms{
public virtual ControlCollection Controls{
get {
if (controls == null)
- controls = new ControlCollection (this);
+ controls = CreateControlsInstance();
return controls;
+
}
}
[MonoTODO]
- public virtual bool Created
- {
+ public virtual bool Created{
get{return true;}
}
[MonoTODO]
public virtual Cursor Cursor{
get{throw new NotImplementedException ();}
- set{throw new NotImplementedException ();}
+ set{}
}
[MonoTODO]
@@ -264,8 +264,7 @@ namespace System.Windows.Forms{
public virtual bool HasChildren{
get{return (Controls.Count > 0);}
}
- public int Height
- {
+ public int Height{
get {return Size.Height;}
set {
Size s = Size;
@@ -285,8 +284,7 @@ namespace System.Windows.Forms{
}
[MonoTODO]
- public virtual bool InvokeRequired
- {
+ public virtual bool InvokeRequired{
get {return false;}
}
@@ -296,18 +294,15 @@ namespace System.Windows.Forms{
set{return; }
}
[MonoTODO]
- public bool IsDisposed
- {
+ public bool IsDisposed{
get{return false;}
}
[MonoTODO]
- public bool IsHandleCreated
- {
+ public bool IsHandleCreated{
get {return true;}
}
- public int Left
- {
+ public int Left{
get{return Location.X;}
set{
Point p = Location;
@@ -315,13 +310,11 @@ namespace System.Windows.Forms{
this.Location = p;
}
}
-
- public Point Location
- {
+ public Point Location{
get{return location;}
set{
location = value;
- OnLocationChanged (EventArgs.Empty);
+ OnLocationChanged (EventArgs.Empty);
}
}
[MonoTODO]
@@ -334,6 +327,7 @@ namespace System.Windows.Forms{
}
[MonoTODO]
public static Point MousePosition{
+
get{ return new Point (0, 0);}
}
public virtual string Name{
@@ -343,8 +337,6 @@ namespace System.Windows.Forms{
Widget.Name = value;
}
}
-
- [MonoTODO]
public virtual Control Parent{
get{return parent;}
set{
@@ -373,7 +365,7 @@ namespace System.Windows.Forms{
[MonoTODO]
public virtual Region Region{
get{throw new NotImplementedException ();}
- set{throw new NotImplementedException ();}
+ set{}
}
public virtual int Right{
get{ return Left + Width;}
@@ -437,7 +429,7 @@ namespace System.Windows.Forms{
set{Widget.Visible = value;}
}
- [MonoTODO] public virtual int Width{
+ public virtual int Width{
get {return Size.Width;}
set {
Size s = this.Size;
@@ -454,7 +446,7 @@ namespace System.Windows.Forms{
}
[MonoTODO]
protected virtual ImeMode DefaultImeMode{
- get {return ImeMode.Disable;}
+ get {return ImeMode.Inherit;}
}
protected virtual Size DefaultSize{
@@ -463,12 +455,12 @@ namespace System.Windows.Forms{
[MonoTODO]
protected virtual int FontHeight{
get {throw new NotImplementedException ();}
- set {throw new NotImplementedException ();}
+ set {}
}
[MonoTODO]
protected virtual bool ResizeRedraw{
get{throw new NotImplementedException ();}
- set{throw new NotImplementedException ();}
+ set{}
}
[MonoTODO]
protected virtual bool ShowFocusCues{
@@ -497,9 +489,12 @@ namespace System.Windows.Forms{
[MonoTODO]
public virtual void BringToFront (){
}
- [MonoTODO]
public virtual bool Contains (Control c){
- throw new NotImplementedException ();
+ foreach (Control control in Controls){
+ if ( (control == c) || control.Contains(c))
+ return true;
+ }
+ return false;
}
[MonoTODO]
protected virtual AccessibleObject CreateAccessibilityInstance (){
@@ -509,8 +504,8 @@ namespace System.Windows.Forms{
public virtual void CreateControl (){
}
[MonoTODO]
- protected virtual ControlCollection CreateControlInstance (){
- throw new NotImplementedException ();
+ protected virtual ControlCollection CreateControlsInstance (){
+ return new ControlCollection (this);
}
[MonoTODO]
public virtual Graphics CreateGraphics (){
@@ -1466,7 +1461,7 @@ namespace System.Windows.Forms{
// owner.OnControlAdded (new ControlEventArgs (value));
//}
}
- public virtual void AddRange (Control[]controls){
+ public virtual void AddRange (Control[] controls){
// Because we really do have to check for a few
// special cases we cannot use the AddRange and
// will have to check each Control that we add
@@ -1519,7 +1514,7 @@ namespace System.Windows.Forms{
int IList.Add (object value){
return list.Add (value);
}
- public void Clear (){
+ public virtual void Clear (){
list.Clear ();
}
bool IList.Contains (object value){
diff --git a/mcs/class/System.Windows.Forms/Gtk/Cursor.cs b/mcs/class/System.Windows.Forms/Gtk/Cursor.cs
index 5c9db7f2a6a..01766fdc33d 100644
--- a/mcs/class/System.Windows.Forms/Gtk/Cursor.cs
+++ b/mcs/class/System.Windows.Forms/Gtk/Cursor.cs
@@ -1,3 +1,10 @@
+//
+// System.Windows.Forms.Cursor
+//
+// Author:
+// Alberto Fernandez (infjaf00@yahoo.es)
+//
+
namespace System.Windows.Forms{
@@ -7,6 +14,9 @@ namespace System.Windows.Forms{
using System.IO;
public sealed class Cursor : IDisposable, ISerializable {
+
+ internal Cursor(){
+ }
[MonoTODO]
public Cursor (IntPtr handle){
if (handle == IntPtr.Zero){
@@ -69,7 +79,7 @@ namespace System.Windows.Forms{
throw new NotImplementedException();
}
[MonoTODO]
- public bool Equals (Object obj){
+ public override bool Equals (Object obj){
throw new NotImplementedException();
}
[MonoTODO]
@@ -95,9 +105,8 @@ namespace System.Windows.Forms{
public override String ToString(){
return base.ToString();
}
-
public static bool operator==(Cursor left, Cursor right){
- throw new NotImplementedException();
+ return left.Equals(right);
}
public static bool operator!=(Cursor left, Cursor right) {
return ( !(left == right));
diff --git a/mcs/class/System.Windows.Forms/Gtk/Cursors.cs b/mcs/class/System.Windows.Forms/Gtk/Cursors.cs
new file mode 100644
index 00000000000..d971ecffc16
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/Gtk/Cursors.cs
@@ -0,0 +1,160 @@
+//
+// System.Windows.Forms.Cursors.cs
+//
+// Author:
+// stubbed out by Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+// Aleksey Ryabchuk (ryabchuk@yahoo.com)
+//
+// (C) Ximian, Inc., 2002
+//
+
+using System.ComponentModel;
+using System.Runtime.Serialization;
+using System.IO;
+using System.Drawing;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// Provides a collection of Cursor objects for use by a Windows Forms application.
+ /// </summary>
+ // It does nothing but returning a default cursor.
+ // We need to implement Cursor before working on this class.
+
+ public sealed class Cursors{
+
+ private Cursors(){//for signtute compatablity
+ }
+
+ [MonoTODO]
+ public static Cursor AppStarting {
+ get { return new Cursor(); }
+ }
+ [MonoTODO]
+ public static Cursor Arrow {
+ get { return new Cursor(); }
+ }
+ [MonoTODO]
+ public static Cursor Cross {
+ get { return new Cursor(); }
+ }
+
+ [MonoTODO]
+ public static Cursor Default {
+ get { return new Cursor(); }
+ }
+
+ [MonoTODO]
+ public static Cursor Hand {
+ get { return new Cursor(); }
+ }
+
+ [MonoTODO]
+ public static Cursor Help {
+ get { return new Cursor(); }
+ }
+
+ [MonoTODO]
+ public static Cursor HSplit {
+ get { return new Cursor(); }
+ }
+
+ [MonoTODO]
+ public static Cursor IBeam {
+ get { return new Cursor(); }
+ }
+ [MonoTODO]
+ public static Cursor No {
+ get { return new Cursor(); }
+ }
+
+ [MonoTODO]
+ public static Cursor NoMove2D {
+ get { return new Cursor(); }
+ }
+
+ [MonoTODO]
+ public static Cursor NoMoveHoriz {
+ get { return new Cursor(); }
+ }
+
+ [MonoTODO]
+ public static Cursor NoMoveVert {
+ get { return new Cursor(); }
+ }
+
+ [MonoTODO]
+ public static Cursor PanEast {
+ get { return new Cursor(); }
+ }
+
+ [MonoTODO]
+ public static Cursor PanNE {
+ get { return new Cursor(); }
+ }
+
+ [MonoTODO]
+ public static Cursor PanNorth {
+ get { return new Cursor(); }
+ }
+
+ [MonoTODO]
+ public static Cursor PanNW {
+ get { return new Cursor(); }
+ }
+
+ [MonoTODO]
+ public static Cursor PanSE {
+ get { return new Cursor(); }
+ }
+
+ [MonoTODO]
+ public static Cursor PanSouth {
+ get { return new Cursor(); }
+ }
+
+ [MonoTODO]
+ public static Cursor PanSW {
+ get { return new Cursor(); }
+ }
+
+ [MonoTODO]
+ public static Cursor PanWest {
+ get { return new Cursor(); }
+ }
+ [MonoTODO]
+ public static Cursor SizeAll {
+ get { return new Cursor(); }
+ }
+ [MonoTODO]
+ public static Cursor SizeNESW {
+ get { return new Cursor(); }
+ }
+ [MonoTODO]
+ public static Cursor SizeNS {
+ get { return new Cursor(); }
+ }
+ [MonoTODO]
+ public static Cursor SizeNWSE {
+ get { return new Cursor(); }
+ }
+ [MonoTODO]
+ public static Cursor SizeWE {
+ get { return new Cursor(); }
+ }
+ [MonoTODO]
+ public static Cursor UpArrow {
+ get { return new Cursor(); }
+ }
+
+ [MonoTODO]
+ public static Cursor VSplit {
+ get { return new Cursor(); }
+ }
+ [MonoTODO]
+ public static Cursor WaitCursor {
+ get { return new Cursor(); }
+ }
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/Gtk/DataGrid.cs b/mcs/class/System.Windows.Forms/Gtk/DataGrid.cs
index 49c255f19e0..a773ebd4ae2 100644
--- a/mcs/class/System.Windows.Forms/Gtk/DataGrid.cs
+++ b/mcs/class/System.Windows.Forms/Gtk/DataGrid.cs
@@ -972,10 +972,10 @@ namespace System.Windows.Forms {
// FIXME: does not belong in base method
// define the columns in the treeview store
// based on the schema of the result
- uint[] theTypes = new uint[pdc.Count];
+ GLib.GType[] theTypes = new GLib.GType[pdc.Count];
for (int col = 0; col < pdc.Count; col++) {
- theTypes[col] = (int) TypeFundamentals.TypeString;
+ theTypes[col] = GType.String;
}
store.SetColumnTypes (theTypes);
@@ -1049,7 +1049,7 @@ namespace System.Windows.Forms {
private TreeIter NewRow ()
{
TreeIter rowTreeIter = new TreeIter();
- store.Append (out rowTreeIter);
+ rowTreeIter = store.Append ();
return rowTreeIter;
}
@@ -1098,10 +1098,10 @@ namespace System.Windows.Forms {
if (store != null) {
store.Clear ();
store = null;
- store = new ListStore ((int)TypeFundamentals.TypeString);
+ store = new ListStore (typeof (string));
}
else
- store = new ListStore ((int)TypeFundamentals.TypeString);
+ store = new ListStore (typeof (string));
if (gridColumns != null) {
for (int c = 0; c < gridColumns.Length; c++) {
diff --git a/mcs/class/System.Windows.Forms/Gtk/DrawMode.cs b/mcs/class/System.Windows.Forms/Gtk/DrawMode.cs
new file mode 100644
index 00000000000..31ea9357a63
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/Gtk/DrawMode.cs
@@ -0,0 +1,26 @@
+//
+// System.Windows.Forms.DrawMode.cs
+//
+// Author:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+
+ /// <summary>
+ /// Specifies how the elements of a control are drawn.
+ /// </summary>
+
+ public enum DrawMode {
+
+ //Values were verified with enumcheck.
+ Normal = 0,
+ OwnerDrawFixed = 1,
+ OwnerDrawVariable = 2,
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/Gtk/FileDialog.cs b/mcs/class/System.Windows.Forms/Gtk/FileDialog.cs
index 0560e266467..f742bbe443b 100644
--- a/mcs/class/System.Windows.Forms/Gtk/FileDialog.cs
+++ b/mcs/class/System.Windows.Forms/Gtk/FileDialog.cs
@@ -19,27 +19,26 @@ namespace System.Windows.Forms {
public abstract class FileDialog : CommonDialog {
- private string fileName = String.Empty;
- private bool addExtension=true;
- private bool checkFileExists = false;
- private bool checkPathExists = true;
- private string defaultExt = "";
- private bool dereferenceLinks = true;
+ private string fileName;
+ private bool addExtension;
+ private bool checkFileExists;
+ private bool checkPathExists;
+ private string defaultExt;
+ private bool dereferenceLinks;
int filterIndex;
string filter;
bool showHelp;
- string title;
string initialDirectory;
bool restoreDirectory;
bool validateNames;
- // Don't use,
+ // Don't use, ?
//protected static readonly object EventFileOk;
- protected FileDialog ( ){
-
+ protected FileDialog ( ):base(){
+ this.Reset();
}
public bool AddExtension {
@@ -79,24 +78,12 @@ namespace System.Windows.Forms {
[MonoTODO]
public string[] FileNames {
- get {
- return new String[0];
- //throw new NotImplementedException ();
- }
+ get {return new String[]{this.FileName};}
}
public string Filter {
get { return filter; }
- set {
- /*if ( value.Length > 0 ) {
- int sepNum = getSeparatorsCount ( value );
- if ( ( sepNum / 2 ) * 2 == sepNum ) {
- // number of separators should be odd
- throw new ArgumentException ("Parameter format is invalid");
- }
- }*/
- filter = value;
- }
+ set { filter = value;}
}
public int FilterIndex {
@@ -120,8 +107,8 @@ namespace System.Windows.Forms {
}
public string Title {
- get { return title; }
- set { title = value;}
+ get { return Dialog.Title; }
+ set { Dialog.Title = value;}
}
public bool ValidateNames {
@@ -139,7 +126,6 @@ namespace System.Windows.Forms {
checkPathExists = true;
dereferenceLinks = true;
showHelp = false;
- title = string.Empty;
initialDirectory = string.Empty;
restoreDirectory = false;
validateNames = true;
@@ -147,9 +133,9 @@ namespace System.Windows.Forms {
[MonoTODO]
public override string ToString(){
- //FIXME:
return base.ToString();
}
+
public event CancelEventHandler FileOk;
diff --git a/mcs/class/System.Windows.Forms/Gtk/FolderBrowserDialog.cs b/mcs/class/System.Windows.Forms/Gtk/FolderBrowserDialog.cs
index ef07f4975d6..3af69c1304b 100644
--- a/mcs/class/System.Windows.Forms/Gtk/FolderBrowserDialog.cs
+++ b/mcs/class/System.Windows.Forms/Gtk/FolderBrowserDialog.cs
@@ -3,23 +3,27 @@
//
// Author:
// Dennis Hayes (dennish@raytek.com)
+// Gtk.
+// Alberto Fernandez (infjaf00@yahoo.es)
//
// (C) 2002 Ximian, Inc
//
+using System.Runtime.Remoting;
+using System.ComponentModel;
+
namespace System.Windows.Forms {
// <summary>
//
// </summary>
- using System.Runtime.Remoting;
- using System.ComponentModel;
+
// Beta specs do not specify what class to defrive from.
// Using CommonDialog because
public class FolderBrowserDialog : CommonDialog {
-
+ string folder;
string description;
//
@@ -27,7 +31,8 @@ namespace System.Windows.Forms {
//
[MonoTODO]
public FolderBrowserDialog() {
- description = "";
+ description = String.Empty;
+ folder = (Dialog as Gtk.FileSelection).Filename;
}
[MonoTODO]
@@ -37,7 +42,9 @@ namespace System.Windows.Forms {
[MonoTODO]
protected override bool RunDialog(IntPtr hWndOwner){
- throw new NotImplementedException ();
+ this.Dialog.Run();
+ folder = (Dialog as Gtk.FileSelection).Filename;
+ return dialogRetValue;
}
//
@@ -45,75 +52,45 @@ namespace System.Windows.Forms {
//
public string Description {
- get {
- return description;
- }
- set {
- description = value;
- }
+ get { return description; }
+ set { description = value; }
}
- //beta docs do not have accessor.
- //protected bool DesignMode {
- //}
-
- //protected EventHandlerList Events {
- //}
-
+ [MonoTODO]
public Environment.SpecialFolder RootFolder {
- get {
- throw new NotImplementedException ();
- }
+ get { return Environment.SpecialFolder.Desktop; }
set {
- //FIXME:
+ if (! Enum.IsDefined (typeof (Environment.SpecialFolder), value)){
+ throw new InvalidEnumArgumentException();
+ }
}
}
public string SelectedPath {
- get {
- throw new NotImplementedException ();
- }
- set {
- //FIXME:
- }
+ get { return (this.Dialog as Gtk.FileSelection).Filename; }
+ set { (this.Dialog as Gtk.FileSelection).Filename = value; }
}
public bool ShowNewFolderButton {
- get {
- throw new NotImplementedException ();
- }
- set {
- //FIXME:
- }
+ get { return (this.Dialog as Gtk.FileSelection).FileopCDir.Visible; }
+ set { (this.Dialog as Gtk.FileSelection).FileopCDir.Visible = value;}
+ }
+ public override String ToString(){
+ return "System.Windows.Forms.FolderBrowserDialog";
}
-
- //public virtual System.ComponentModel.IContainer Container {
- // get {
- // throw new NotImplementedException ();
- // }
- //}
-
- // FIXME: beta 1.1 says the following should be public virtual ISite Site {
- // but the compiler gives warning that it must be new.
- // Probably system.component needs to change to be beta 1.1 compliant
- // looks fixed on 9/28/2003
-/* public virtual ISite Site {
- get {
- throw new NotImplementedException ();
- }
- set {
- //FIXME:
- }
- }*/
-
- //Specs seem to say they need to be here, but adding them conflicts with commondialog : component.disposed/helprequest
- //public event EventHandler Disposed;
- //public event EventHandler HelpRequest;
[MonoTODO]
internal override Gtk.Dialog CreateDialog (){
- return new Gtk.Dialog();
+ Gtk.FileSelection f = new Gtk.FileSelection(String.Empty);
+ f.FileList.Sensitive = false;
+ f.FileopDelFile.Visible = false;
+ f.FileopRenFile.Visible = false;
+ f.SelectionEntry.Visible = false;
+ return f;
}
+ internal override void OnCancel (){
+ (Dialog as Gtk.FileSelection).Filename = folder;
+ }
}
}
diff --git a/mcs/class/System.Windows.Forms/Gtk/FontDialog.cs b/mcs/class/System.Windows.Forms/Gtk/FontDialog.cs
index 18b257bae78..149033d0ef9 100644
--- a/mcs/class/System.Windows.Forms/Gtk/FontDialog.cs
+++ b/mcs/class/System.Windows.Forms/Gtk/FontDialog.cs
@@ -154,12 +154,7 @@ namespace System.Windows.Forms
[MonoTODO]
public event EventHandler Apply;
-
- //[MonoTODO]
- /*protected override IntPtr HookProc( IntPtr hWnd, int msg, IntPtr wparam, IntPtr lparam )
- {
- return base.HookProc(hWnd, msg, wparam,lparam);
- }*/
+
[MonoTODO]
protected override bool RunDialog(IntPtr hWndOwner){
Dialog.Run();
@@ -167,10 +162,7 @@ namespace System.Windows.Forms
}
[MonoTODO]
internal override Gtk.Dialog CreateDialog(){
- //TODO: I18N
- Gtk.FontSelectionDialog diag = new Gtk.FontSelectionDialog("FontSelectionDialog");
-
- return diag;
+ return new Gtk.FontSelectionDialog("");
}
}
diff --git a/mcs/class/System.Windows.Forms/Gtk/Form.cs b/mcs/class/System.Windows.Forms/Gtk/Form.cs
index e81bb3f03ab..8144e9fd8d3 100644
--- a/mcs/class/System.Windows.Forms/Gtk/Form.cs
+++ b/mcs/class/System.Windows.Forms/Gtk/Form.cs
@@ -21,8 +21,10 @@ using GtkSharp;
namespace System.Windows.Forms
{
- public class Form:ContainerControl
+ public class Form : ContainerControl
{
+ private Gtk.RadioButton firstRadioButton;
+ private int radioButtonsCount = 0;
internal Gtk.Window win;
@@ -57,7 +59,7 @@ namespace System.Windows.Forms
Activated (o, args);
}
- internal void ConnectEvents (){
+ internal override void ConnectEvents (){
win.DefaultActivated += new EventHandler (activate_cb);
win.DeleteEvent += new DeleteEventHandler (delete_cb);
win.Realized += new EventHandler (load_cb);
@@ -306,24 +308,7 @@ namespace System.Windows.Forms
public MainMenu Menu{
- /*else if (value.GetType () ==
- * typeof (System.Windows.Forms.
- * MainMenu))
- * {
- * MainMenu m = (MainMenu) value;
- * this.owner.vbox.PackStart (m.mb,
- * false,
- * false, 0);
- * m.mb.ShowAll ();
- * this.owner.vbox.ReorderChild (m.mb,
- * 0);
- * this.owner.vbox.ShowAll ();
- * list.Add (value);
- * } */
- get{
- return mainMenu;
- //throw new NotImplementedException ();
- }
+ get{ return mainMenu; }
set{
if (value == mainMenu){
return;
@@ -332,7 +317,6 @@ namespace System.Windows.Forms
this.vbox.Remove (mainMenu.Widget);
this.vbox.ShowAll();
mainMenu.RemoveFromForm();
- // Quitar el menu de la ventana.
}
if (value != null){
this.vbox.PackStart(value.Widget, false, false, 0);
@@ -341,11 +325,7 @@ namespace System.Windows.Forms
value.AddToForm (this);
}
- mainMenu = value;
-
-
- //throw new NotImplementedException ();
-
+ mainMenu = value;
}
}
@@ -640,6 +620,8 @@ namespace System.Windows.Forms
protected override Size DefaultSize{
get{return new Size (300, 300);}
}
+
+
[MonoTODO]
protected Rectangle MaximizedBounds{
@@ -685,6 +667,21 @@ namespace System.Windows.Forms
DialogResult = DialogResult.Cancel;
}
}
+ protected override void OnControlAdded (ControlEventArgs e){
+ base.OnControlAdded(e);
+ if (e.Control is RadioButton){
+ if (radioButtonsCount == 0)
+ firstRadioButton = e.Control.Widget as Gtk.RadioButton;
+ else
+ (e.Control.Widget as Gtk.RadioButton).Group =
+ firstRadioButton.Group;
+ radioButtonsCount++;
+ }
+ }
+ [MonoTODO]
+ protected override void OnControlRemoved (ControlEventArgs e){
+ base.OnControlRemoved (e);
+ }
protected override void OnCreateControl (){
}
diff --git a/mcs/class/System.Windows.Forms/Gtk/GroupBox.cs b/mcs/class/System.Windows.Forms/Gtk/GroupBox.cs
index 2e8e1f5f8d3..55c5a68ecad 100644
--- a/mcs/class/System.Windows.Forms/Gtk/GroupBox.cs
+++ b/mcs/class/System.Windows.Forms/Gtk/GroupBox.cs
@@ -2,10 +2,14 @@
// System.Windows.Forms.GroupBox
//
// Author:
-// Joel Bason (jstrike@mweb.co.za)
+// Joel Bason (jstrike@mweb.co.za)
+// Alberto Fernandez (infjaf00@yahoo.es)
//
//
+using System.Drawing;
+using System.ComponentModel;
+
namespace System.Windows.Forms {
/// <summary>
@@ -14,31 +18,67 @@ namespace System.Windows.Forms {
/// </summary>
public class GroupBox : Control {
-
- [MonoTODO]
- public FlatStyle FlatStyle{
- get{ return FlatStyle.Standard; }
- set{}
- }
- public GroupBox () : base ()
- {
- }
-
- internal override Gtk.Widget CreateWidget () {
- Gtk.Frame gbox1 = new Gtk.Frame(null);
- return gbox1;
- }
+ private Gtk.RadioButton firstRadioButton;
+ private int radioButtonsCount = 0;
- public override string Text {
- get {
- return ((Gtk.Frame)Widget).Label;
+
+ public GroupBox () : base (){
}
- set {
- ((Gtk.Frame)Widget).Label = value;
- }
+ protected override Size DefaultSize {
+ get { return new Size (200,100); }
+ }
+ [MonoTODO]
+ public FlatStyle FlatStyle{
+ get{ return FlatStyle.Standard; }
+ set{
+ if (! Enum.IsDefined (typeof (FlatStyle), value))
+ throw new InvalidEnumArgumentException();
+ }
+ }
+ public override string Text {
+ get { return ((Gtk.Frame)Widget).Label; }
+ set { ((Gtk.Frame)Widget).Label = value;}
+ }
+
+ protected override void OnControlAdded (ControlEventArgs e){
+ base.OnControlAdded(e);
+ if (e.Control is RadioButton){
+ if (radioButtonsCount == 0)
+ firstRadioButton = e.Control.Widget as Gtk.RadioButton;
+ else
+ (e.Control.Widget as Gtk.RadioButton).Group =
+ firstRadioButton.Group;
+ radioButtonsCount++;
+ }
+ }
+ [MonoTODO]
+ protected override void OnControlRemoved (ControlEventArgs e){
+ base.OnControlRemoved (e);
+ }
+
+ public override string ToString(){
+ return "System.Windows.Forms.GroupBox, Text: " + this.Text;
+ }
+
+ public new event EventHandler Click;
+ public new event EventHandler DoubleClick;
+ public new event KeyEventHandler KeyDown;
+ public new event KeyPressEventHandler KeyPress;
+ public new event KeyEventHandler KeyUp;
+ public new event MouseEventHandler MouseDown;
+ public new event EventHandler MouseEnter;
+ public new event EventHandler MouseLeave;
+ public new event MouseEventHandler MouseMove;
+ public new event MouseEventHandler MouseUp;
+ public new event EventHandler TabStopChanged;
- }
+ internal override Gtk.Widget CreateWidget () {
+ Gtk.Widget contents = base.CreateWidget();
+ Gtk.Frame gbox1 = new Gtk.Frame(null);
+ gbox1.Add (contents);
+ return gbox1;
+ }
}
}
diff --git a/mcs/class/System.Windows.Forms/Gtk/HScrollBar.cs b/mcs/class/System.Windows.Forms/Gtk/HScrollBar.cs
index bcb30d64020..790f17aedcf 100644
--- a/mcs/class/System.Windows.Forms/Gtk/HScrollBar.cs
+++ b/mcs/class/System.Windows.Forms/Gtk/HScrollBar.cs
@@ -6,20 +6,34 @@
// (C) 2002 Ximian, Inc. http://www.ximian.com
//
+using System.Drawing;
+
namespace System.Windows.Forms {
public class HScrollBar : ScrollBar {
- private Gtk.HScrollbar bar;
+ //private Gtk.HScrollbar bar;
// --- Properties ---
internal override Gtk.Widget CreateWidget () {
- return bar;
+ return new Gtk.HScrollbar(this.adj);
}
// --- Constructor ---
- public HScrollBar() : base ()
- {
- this.bar = new Gtk.HScrollbar ( adj );
+ public HScrollBar() : base (){
+ }
+
+ protected override Size DefaultSize{
+ get{ return new System.Drawing.Size (80,17); }
+ }
+
+ public override string ToString(){
+ String ret = String.Format (
+ "System.Windows.Forms.HScrollBar, " +
+ "Minimum: {0}, Maximum: {1}, Value: {2}",
+ this.Minimum,
+ this.Maximum,
+ this.Value);
+ return ret;
}
}
}
diff --git a/mcs/class/System.Windows.Forms/Gtk/InputLanguage.cs b/mcs/class/System.Windows.Forms/Gtk/InputLanguage.cs
index 8146730f5ee..c7cf3cc50c3 100644
--- a/mcs/class/System.Windows.Forms/Gtk/InputLanguage.cs
+++ b/mcs/class/System.Windows.Forms/Gtk/InputLanguage.cs
@@ -23,62 +23,45 @@ namespace System.Windows.Forms {
//
[MonoTODO]
public CultureInfo Culture {
- get {
- throw new NotImplementedException ();
- }
+ get {throw new NotImplementedException ();}
}
[MonoTODO]
public static InputLanguage CurrentInputLanguage {
- get {
- throw new NotImplementedException ();
- }
- set {
- throw new NotImplementedException ();
- }
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
}
[MonoTODO]
public static InputLanguage DefaultInputLanguage {
- get {
- throw new NotImplementedException ();
- }
+ get { throw new NotImplementedException (); }
}
[MonoTODO]
public IntPtr Handle {
- get {
- throw new NotImplementedException ();
- }
+ get { throw new NotImplementedException (); }
}
[MonoTODO]
public static InputLanguageCollection InstalledInputLanguages {
- get {
- throw new NotImplementedException ();
- }
+ get { throw new NotImplementedException (); }
}
[MonoTODO]
public string LayoutName {
- get {
- throw new NotImplementedException ();
- }
+ get { throw new NotImplementedException (); }
}
//
// --- Public Methods
//
[MonoTODO]
- public override bool Equals(object value)
- {
+ public override bool Equals(object value){
//FIXME:
return base.Equals(value);
}
[MonoTODO]
- public static InputLanguage FromCulture(CultureInfo culture)
- {
+ public static InputLanguage FromCulture(CultureInfo culture){
throw new NotImplementedException ();
}
[MonoTODO]
- public override int GetHashCode()
- {
+ public override int GetHashCode(){
//FIXME:
return base.GetHashCode();
}
diff --git a/mcs/class/System.Windows.Forms/Gtk/Label.cs b/mcs/class/System.Windows.Forms/Gtk/Label.cs
index b819dcfcef9..0610493254f 100644
--- a/mcs/class/System.Windows.Forms/Gtk/Label.cs
+++ b/mcs/class/System.Windows.Forms/Gtk/Label.cs
@@ -8,8 +8,11 @@
// (C) 2002 Ximian, Inc
//
+using System.Drawing;
+using System.ComponentModel;
+
namespace System.Windows.Forms {
- using System.Drawing;
+
// <summary>
//
@@ -17,58 +20,44 @@ namespace System.Windows.Forms {
public class Label : Control {
+ private bool autoSize;
+ private ContentAlignment textAlign = ContentAlignment.TopLeft;
+
public Label () : base (){
this.Text = " ";
- // AutoSize = false;
- // BorderStyle = BorderStyle.None;
+ AutoSize = false;
}
protected override void OnTextChanged (EventArgs e){
((Gtk.Label) Widget).Text = Text;
- }
- protected override void OnMouseUp (MouseEventArgs e){
- Console.WriteLine ("Mouse up label");
- if (e.Clicks == 2) {
- Console.WriteLine ("Doble-click label");
- OnDoubleClick (EventArgs.Empty);
- }
- if (e.Clicks == 1){
- Console.WriteLine ("Single-click label");
- OnClick (EventArgs.Empty);
- }
- base.OnMouseUp (e);
- //if (MouseUp != null){
- // MouseUp (this, e);
- //}
- }
-
+ }
internal override Gtk.Widget CreateWidget () {
return new Gtk.Label (Text);
- //base.ConnectEvents();
}
[MonoTODO]
public virtual bool AutoSize{
- get { throw new NotImplementedException(); }
- set { throw new NotImplementedException(); }
+ get { return autoSize;}
+ set { autoSize = value;}
}
[MonoTODO]
public virtual BorderStyle BorderStyle{
get{ return BorderStyle.None; }
set{
- //InvalidEnumArgumentException
- //throw new NotImplementedException ();
+ if (!Enum.IsDefined (typeof(BorderStyle), value)){
+ throw new InvalidEnumArgumentException();
+ }
+ //InvalidEnumArgumentException
}
- }
+ }
+ protected override Size DefaultSize{
+ get{ return new Size (100,23); }
+ }
+
[MonoTODO]
public FlatStyle FlatStyle {
- get {
- throw new NotImplementedException ();
- }
- set {
- //InvalidEnumArgumentException
- throw new NotImplementedException ();
- }
+ get { return FlatStyle.Standard;}
+ set {}
}
[MonoTODO]
public Image Image {
@@ -108,64 +97,38 @@ namespace System.Windows.Forms {
throw new NotImplementedException ();
}
}
- //[MonoTODO]
- //public ImeMode ImeMode {
- // get {
- // throw new NotImplementedException ();
- // }
- // set {
- // throw new NotImplementedException ();
- // }
- //}
+
[MonoTODO]
- public int PreferredHeight {
- get {
- throw new NotImplementedException ();
- }
+ public virtual int PreferredHeight {
+ get {throw new NotImplementedException ();}
}
[MonoTODO]
- public int PreferredWidth {
- get {
- throw new NotImplementedException ();
- }
+ public virtual int PreferredWidth {
+ get {throw new NotImplementedException ();}
}
[MonoTODO]
public virtual bool RenderTransparent {
get { return false; }
- set { return; }
- //get{ throw new NotImplementedException(); }
- //set{ throw new NotImplementedException (); }
+ set { }
}
- //[MonoTODO]
- //public override bool TabStop {
- // get {
- // throw new NotImplementedException ();
- // }
- // set {
- // throw new NotImplementedException ();
- // }
- //}
[MonoTODO]
public virtual ContentAlignment TextAlign {
- get {
- //throw new NotImplementedException ();
- return ContentAlignment.TopLeft;
- }
+ get {return textAlign;}
set {
- //throw new NotImplementedException ();
-
+
+ if (!Enum.IsDefined(typeof(ContentAlignment), value)){
+ throw new InvalidEnumArgumentException();
+ }
+ textAlign = value;
}
}
[MonoTODO]
+ // default = true
public bool UseMnemonic {
- get {
- throw new NotImplementedException ();
- }
- set {
- throw new NotImplementedException ();
- }
+ get {throw new NotImplementedException ();}
+ set {throw new NotImplementedException ();}
}
//
@@ -187,34 +150,16 @@ namespace System.Windows.Forms {
// throw new NotImplementedException ();
//}
//[MonoTODO]
- //public override string ToString()
- //{
- // throw new NotImplementedException ();
- //}
+ public override string ToString(){
+ return "System.Windows.Forms.Label, Text:" + this.Text;
+ }
//
// --- Public Events
//
public event EventHandler AutoSizeChanged;
public event EventHandler TextAlignChanged;
- //[MonoTODO]
- //public event EventHandler AutoSizeChanged {
- // add {
- // throw new NotImplementedException ();
- // }
- // remove {
- // throw new NotImplementedException ();
- // }
- //}
- //[MonoTODO]
- //public event EventHandler TextAlignChanged {
- // add {
- // throw new NotImplementedException ();
- // }
- // remove {
- // throw new NotImplementedException ();
- // }
- //}
+
//
// --- Protected Methods
@@ -226,29 +171,23 @@ namespace System.Windows.Forms {
}
//[MonoTODO]
- //protected override AccessibleObject CreateAccessibilityInstance()
- //{
- // throw new NotImplementedException ();
- //}
-
- //[MonoTODO]
- //protected void Dispose()
- //{
- // throw new NotImplementedException ();
- //}
- //[MonoTODO]
//protected override void Dispose(bool val)
//{
// throw new NotImplementedException ();
//}
[MonoTODO]
- protected void DrawImage( Graphics g, Image img, Rectangle r, ContentAlignment align)
- {
+ protected void DrawImage( Graphics g, Image img, Rectangle r, ContentAlignment align) {
throw new NotImplementedException ();
}
- [MonoTODO]
+
protected virtual void OnAutoSizeChanged (EventArgs e){
- throw new NotImplementedException ();
+ if (AutoSizeChanged != null)
+ AutoSizeChanged (this, e);
+ }
+
+ protected virtual void OnTextAlignChanged (EventArgs e){
+ if (TextAlignChanged != null)
+ TextAlignChanged (this, e);
}
//[MonoTODO]
diff --git a/mcs/class/System.Windows.Forms/Gtk/ListBox.cs b/mcs/class/System.Windows.Forms/Gtk/ListBox.cs
index 78fc0b499d2..e09e6855753 100644
--- a/mcs/class/System.Windows.Forms/Gtk/ListBox.cs
+++ b/mcs/class/System.Windows.Forms/Gtk/ListBox.cs
@@ -6,6 +6,7 @@
//
//
using System;
+using System.Collections;
using System.Drawing;
using Gtk;
using GtkSharp;
@@ -33,26 +34,27 @@ namespace System.Windows.Forms {
public ItemCollection (ListBox owner){
this.owner = owner;
- owner.store = new ListStore ((int)TypeFundamentals.TypeString);
+ owner.store = new ListStore (typeof (string));
}
public void Add(String items){
Value value = new Value(items);
- owner.store.Append (out iter);
+ iter = owner.store.Append ();
owner.store.SetValue (iter, 0, value);
owner.UpdateStore();
}
}
+ protected override void SetItemsCore(IList items){}
public ListBox () : base (){
this.Items = new ItemCollection(this);
}
internal override Gtk.Widget CreateWidget () {
- ListStore store = new ListStore ((int)TypeFundamentals.TypeString);
+ ListStore store = new ListStore (typeof (string));
TreeView tv = new TreeView ();
tv.HeadersVisible = true;
tv.HeadersClickable = false;
diff --git a/mcs/class/System.Windows.Forms/Gtk/ListControl.cs b/mcs/class/System.Windows.Forms/Gtk/ListControl.cs
index a2ee92f7f46..b63bd9d92bb 100644
--- a/mcs/class/System.Windows.Forms/Gtk/ListControl.cs
+++ b/mcs/class/System.Windows.Forms/Gtk/ListControl.cs
@@ -1,180 +1,101 @@
-//
-// System.Windows.Forms.ListControl.cs
-//
-// Author:
-// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
-// Dennis Hayes (dennish@raytek.com)
-// (C) 2002/3 Ximian, Inc
-//
-using System;
-using System.Drawing;
-using System.Collections;
-using System.Reflection;
-
-namespace System.Windows.Forms {
-
- // <summary>
- //
- // </summary>
-
- public abstract class ListControl : Control {
-
- protected string DisplayMember_ = String.Empty;
-
- //ControlStyles controlStyles;
- //
- // --- Public Properties
- //
- [MonoTODO]
- public object DataSource {
- get {
- throw new NotImplementedException ();
- }
- set {
- //FIXME:
- }
- }
- [MonoTODO]
- public string DisplayMember {
- get {
- return DisplayMember_;
- }
- set {
- if( DisplayMember_ != value) {
- DisplayMember_ = value;
- OnDisplayMemberChanged(new EventArgs());
- }
- }
- }
-
- internal string getDisplayMemberOfObj( object obj) {
- string objectString = String.Empty;
- Type t = obj.GetType();
- if( DisplayMember != String.Empty) {
- if( t != null) {
- PropertyInfo prop = t.GetProperty(DisplayMember);
- if( prop != null) {
- objectString = prop.GetValue(obj, null).ToString();
- }
- }
- }
- if( objectString == String.Empty) {
- objectString = obj.ToString();
- }
- return objectString;
- }
-
- internal class ListControlComparer : IComparer {
- private ListControl owner_ = null;
- public ListControlComparer(ListControl owner) {
- owner_ = owner;
- }
-
- public int Compare(object x, object y) {
- return owner_.getDisplayMemberOfObj(x).CompareTo(owner_.getDisplayMemberOfObj(y));
- }
- }
-
-
- [MonoTODO]
- public abstract int SelectedIndex {get;set;}
-
- [MonoTODO]
- public object SelectedValue {
- get {
- throw new NotImplementedException ();
- }
- set {
- //FIXME:
- }
- }
- [MonoTODO]
- public string ValueMember {
- get {
- throw new NotImplementedException ();
- }
- set {
- //FIXME:
- }
- }
-
- //
- // --- Public Methods
- //
-
- [MonoTODO]
- public string GetItemText(object item)
- {
- throw new NotImplementedException ();
- }
-
- //
- // --- Public Events
- //
- [MonoTODO]
- public event EventHandler DataSourceChanged;
- [MonoTODO]
- public event EventHandler DisplayMemberChanged;
-
- //
- // --- Protected Constructor
- //
- [MonoTODO]
- protected ListControl()
- {
-
- }
-
- //
- // --- Protected Properties
- //
- [MonoTODO]
- //protected CurrencyManager DataManager {
- // get {
- // throw new NotImplementedException ();
- // }
- //}
-
- //
- // --- Protected Methods
- //
- [MonoTODO]
- //protected override bool IsInputKey(Keys keyData)
- //{
- // //FIXME:
- // return base.IsInputKey(keyData);
- //}
- [MonoTODO]
- protected virtual void OnDataSourceChanged(EventArgs e) {
- //FIXME:
- }
- [MonoTODO]
- protected virtual void OnDisplayMemberChanged(EventArgs e) {
- //FIXME:
- }
-
- [MonoTODO]
- protected virtual void OnSelectedIndexChanged(EventArgs e) {
- //FIXME:
- }
-
- [MonoTODO]
- protected virtual void OnSelectedValueChanged(EventArgs e){
- //FIXME:
- }
-
- public event EventHandler SelectedValueChanged;
- public event EventHandler ValueMemberChanged;
-
- [MonoTODO]
- protected override void OnBindingContextChanged(EventArgs e)
- {
- //FIXME:
- base.OnBindingContextChanged(e);
- }
-
- [MonoTODO]
- protected abstract void RefreshItem(int index);
-
- }
+//
+// System.Windows.Forms.ListControl
+//
+// Author:
+// Alberto Fernandez (infjaf00@yahoo.es)
+//
+
+
+
+using System;
+using System.Collections;
+
+namespace System.Windows.Forms{
+
+ public abstract class ListControl : Control{
+ [MonoTODO]
+ protected ListControl(){
+ }
+ [MonoTODO]
+ protected CurrencyManager DataManager {
+ get { throw new NotImplementedException(); }
+ }
+ [MonoTODO]
+ public object DataSource {
+ get {throw new NotImplementedException();}
+ set {}
+ }
+ [MonoTODO]
+ public string DisplayMember {
+ get { throw new NotImplementedException();}
+ set {}
+ }
+ public abstract int SelectedIndex {get; set;}
+
+ [MonoTODO]
+ public object SelectedValue {
+ get {throw new NotImplementedException();}
+ set {}
+ }
+ [MonoTODO]
+ public string ValueMember {
+ get { throw new NotImplementedException(); }
+ set {}
+ }
+
+ // No usar
+ protected object FilterItemOnProperty(object item){
+ throw new NotImplementedException();
+ }
+ protected object FilterItemOnProperty( object item, string field){
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ public string GetItemText(object item){
+ throw new NotImplementedException();
+ }
+ [MonoTODO]
+ protected override bool IsInputKey( Keys keyData){
+ return base.IsInputKey (keyData);
+ }
+ [MonoTODO]
+ protected override void OnBindingContextChanged(EventArgs e){
+
+ }
+ protected virtual void OnDataSourceChanged(EventArgs e){
+ if (DataSourceChanged != null)
+ DataSourceChanged (this,e);
+ }
+ protected virtual void OnDisplayMemberChanged( EventArgs e){
+ if (DisplayMemberChanged != null)
+ DisplayMemberChanged (this,e);
+ }
+ protected virtual void OnSelectedIndexChanged(EventArgs e){
+ if (SelectedValueChanged != null)
+ SelectedValueChanged (this, e);
+ }
+ protected virtual void OnSelectedValueChanged(EventArgs e){
+ if (SelectedValueChanged != null)
+ SelectedValueChanged (this, e);
+ }
+ protected virtual void OnValueMemberChanged(EventArgs e){
+ if (ValueMemberChanged != null)
+ ValueMemberChanged (this, e);
+ }
+ protected abstract void RefreshItem(int index);
+
+ // Don't use
+ [MonoTODO]
+ protected virtual void SetItemCore(int index, object value){
+ }
+ // Don't use
+ protected abstract void SetItemsCore(IList items);
+
+
+ public event EventHandler DataSourceChanged;
+ public event EventHandler DisplayMemberChanged;
+ public event EventHandler SelectedValueChanged;
+ public event EventHandler ValueMemberChanged;
+ }
}
diff --git a/mcs/class/System.Windows.Forms/Gtk/MainMenu.cs b/mcs/class/System.Windows.Forms/Gtk/MainMenu.cs
index 49ef076404a..850781b9935 100644
--- a/mcs/class/System.Windows.Forms/Gtk/MainMenu.cs
+++ b/mcs/class/System.Windows.Forms/Gtk/MainMenu.cs
@@ -1,10 +1,14 @@
//
// System.Windows.Forms.MainMenu
//
+// Author:
+// Alberto Fernandez (infjaf00@yahoo.es)
+//
using System;
using System.ComponentModel;
-namespace System.Windows.Forms{
+
+namespace System.Windows.Forms{
public class MainMenu:Menu{
private RightToLeft rightToLeft = RightToLeft.Inherit;
@@ -47,7 +51,7 @@ namespace System.Windows.Forms{
}
[MonoTODO]
protected override void Dispose (bool disposing){
- base.Dispose (disposing);
+ base.Dispose (disposing);
}
public virtual Form GetForm (){
return ownerForm;
@@ -58,9 +62,7 @@ namespace System.Windows.Forms{
return base.ToString () + ", GetForm: " +
ownerForm.ToString ();
}
- else{
- return base.ToString ();
- }
+ return base.ToString ();
}
@@ -80,11 +82,10 @@ namespace System.Windows.Forms{
}
internal override void OnNewMenuItemAdd (MenuItem item){
- ((Gtk.MenuBar)Widget).Add (item.Widget);
+ ((Gtk.MenuBar)Widget).Append (item.Widget);
}
internal override void OnRemoveMenuItem (MenuItem item){
((Gtk.MenuBar)Widget).Remove (item.Widget);
- }
-
+ }
}
}
diff --git a/mcs/class/System.Windows.Forms/Gtk/Makefile b/mcs/class/System.Windows.Forms/Gtk/Makefile
index 16cec4618ca..ecc49c30e8f 100644
--- a/mcs/class/System.Windows.Forms/Gtk/Makefile
+++ b/mcs/class/System.Windows.Forms/Gtk/Makefile
@@ -14,171 +14,188 @@ EXES = demo.exe Demo2.exe Demo3.exe singlewidget.exe
LIBRARY = System.Windows.Forms.dll
LIB_MCS_FLAGS = /r:Accessibility /r:glib-sharp.dll /r:gdk-sharp.dll /r:gtk-sharp.dll \
- /r:gnome-sharp.dll /r:System.Drawing.dll /r:pango-sharp.dll \
- -L `pkg-config --variable=prefix gtk-sharp`/lib
+ /r:gnome-sharp.dll /r:System.Drawing.dll /r:pango-sharp.dll \
+ -L `pkg-config --variable=prefix gtk-sharp`/lib
EXE_MCS_FLAGS = /r:$(LIBRARY) /r:System.Drawing.dll /r:System.Data /r:ByteFX.Data.dll
LIB_SOURCES = \
+ ConvertEventHandler.cs \
+ ApplicationContext.cs \
+ IDataObject.cs \
+ FontDialog.cs \
+ DragDropEffects.cs \
AccessibleEvents.cs \
- AccessibleNavigation.cs \
- AccessibleObject.cs \
- AccessibleRole.cs \
- AccessibleSelection.cs \
- AccessibleStates.cs \
AnchorStyles.cs \
- ApplicationContext.cs \
- Application.cs \
- BaseCollection.cs \
- BindingContext.cs \
- Binding.cs \
- BindingManagerBase.cs \
- BindingMemberInfo.cs \
- BindingsCollection.cs \
- BorderStyle.cs \
- BoundsSpecified.cs \
- ButtonBase.cs \
+ StatusBarPanel.cs \
Button.cs \
- CheckBox.cs \
- ColorDialog.cs \
- ComboBox.cs \
- CommonDialog.cs \
- ComVisible.cs \
- ContainerControl.cs \
- ContextMenu.cs \
- ControlBindingsCollection.cs \
- Control.cs \
- ControlEventArgs.cs \
- ControlEventHandler.cs \
+ MouseButtons.cs \
+ DataGridLineStyle.cs \
+ FileDialog.cs \
+ MainMenu.cs \
+ GiveFeedbackEventArgs.cs \
+ KeyPressEventHandler.cs \
ControlStyles.cs \
- ConvertEventArgs.cs \
- ConvertEventHandler.cs \
- CreateParams.cs \
+ RadioButton.cs \
+ InputLanguageChangingEventHandler.cs \
+ ScrollEventType.cs \
CurrencyManager.cs \
- Cursor.cs \
- DataGridBoolColumn.cs \
- DataGridCell.cs \
- DataGridColumnStyle.cs \
- DataGrid.cs \
- DataGridLineStyle.cs \
- DataGridParentRowsLabelStyle.cs \
- DataGridPreferredColumnWidthTypeConverter.cs \
- DataGridTableStyle.cs \
- DataGridTextBoxColumn.cs \
- DataGridTextBox.cs \
- DialogResult.cs \
- DockStyle.cs \
- DragAction.cs \
- DragDropEffects.cs \
- DragEventArgs.cs \
- DragEventHandler.cs \
- DrawItemEventArgs.cs \
- DrawItemEventHandler.cs \
+ VScrollBar.cs \
DrawItemState.cs \
- FileDialog.cs \
- FlatStyle.cs \
- FolderBrowserDialog.cs \
- FontDialog.cs \
+ DataGridPreferredColumnWidthTypeConverter.cs \
FormBorderStyle.cs \
- Form.cs \
- FormStartPosition.cs \
FormWindowState.cs \
- GiveFeedbackEventArgs.cs \
- GiveFeedbackEventHandler.cs \
- GridColumnStylesCollection.cs \
- GridTableStylesCollection.cs \
- GroupBox.cs \
- HelpEventArgs.cs \
- HelpEventHandler.cs \
- HorizontalAlignment.cs \
- HScrollBar.cs \
- IButtonControl.cs \
- IContainerControl.cs \
+ PaintEventHandler.cs \
IDataGridColumnStyleEditingNotificationService.cs \
- IDataGridEditingService.cs \
- IDataObject.cs \
- ImageList.cs \
- ImeMode.cs \
- IMessageFilter.cs \
- InputLanguageChangedEventArgs.cs \
- InputLanguageChangedEventHandler.cs \
- InputLanguageChangingEventArgs.cs \
- InputLanguageChangingEventHandler.cs \
- InputLanguageCollection.cs \
- InputLanguage.cs \
- InvalidateEventArgs.cs \
+ KeyPressEventArgs.cs \
+ ScrollableControl.cs \
+ NavigateEventHandler.cs \
+ DataGridBoolColumn.cs \
InvalidateEventHandler.cs \
- ItemChangedEventArgs.cs \
- ItemChangedEventHandler.cs \
- IWin32Window.cs \
- KeyEventArgs.cs \
+ InputLanguageChangedEventArgs.cs \
+ ScrollBar.cs \
+ UICues.cs \
+ NavigateEventArgs.cs \
+ ScrollEventArgs.cs \
+ DataGridTextBox.cs \
+ ComVisible.cs \
+ StatusBarPanelBorderStyle.cs \
+ PictureBox.cs \
KeyEventHandler.cs \
- KeyPressEventArgs.cs \
- KeyPressEventHandler.cs \
- Keys.cs \
- Label.cs \
- LayoutEventArgs.cs \
- LayoutEventHandler.cs \
- LeftRightAlignment.cs \
- ListBox.cs \
+ AccessibleObject.cs \
+ PaintEventArgs.cs \
+ BoundsSpecified.cs \
+ GroupBox.cs \
+ DataGridTableStyle.cs \
ListControl.cs \
- MainMenu.cs \
+ DataGrid.cs \
+ Cursor.cs \
+ DrawItemEventArgs.cs \
+ ScrollBars.cs \
+ DragEventHandler.cs \
+ ScrollEventHandler.cs \
+ InvalidateEventArgs.cs \
+ StatusBarDrawItemEventHandler.cs \
+ QueryAccessibilityHelpEventArgs.cs \
+ GiveFeedbackEventHandler.cs \
+ Label.cs \
+ AccessibleStates.cs \
+ Binding.cs \
MdiLayout.cs \
- MeasureItemEventArgs.cs \
+ ButtonBase.cs \
+ ProgressBar.cs \
+ StatusBarPanelClickEventArgs.cs \
+ GridColumnStylesCollection.cs \
+ Keys.cs \
+ MessageBox.cs \
+ LeftRightAlignment.cs \
+ QueryContinueDragEventArgs.cs \
+ FlatStyle.cs \
+ AccessibleNavigation.cs \
+ IWin32Window.cs \
+ BindingMemberInfo.cs \
+ ConvertEventArgs.cs \
+ Control.cs \
+ StatusBarPanelAutoSize.cs \
+ StatusBarPanelCollection.cs \
+ CheckBox.cs \
+ DragEventArgs.cs \
+ MouseEventArgs.cs \
+ StatusBarPanelClickEventHandler.cs \
+ IButtonControl.cs \
+ MessageBoxButtons.cs \
+ KeyEventArgs.cs \
+ TextBox.cs \
+ DialogResult.cs \
+ Application.cs \
+ ControlEventHandler.cs \
+ StatusBarPanelStyle.cs \
+ RightToLeft.cs \
+ UICuesEventArgs.cs \
+ Shortcut.cs \
+ TODOAttribute.cs \
+ AccessibleSelection.cs \
MeasureItemEventHandler.cs \
Menu.cs \
+ ImeMode.cs \
+ DockStyle.cs \
+ HScrollBar.cs \
+ ControlBindingsCollection.cs \
+ DataGridColumnStyle.cs \
+ StatusBar.cs \
+ PictureBoxSizeMode.cs \
+ SWFGtkConv.cs \
+ ContainerControl.cs \
+ CreateParams.cs \
+ ContextMenu.cs \
+ ListBox.cs \
+ ComboBox.cs \
+ IMessageFilter.cs \
+ InputLanguageCollection.cs \
+ LayoutEventHandler.cs \
+ DrawItemEventHandler.cs \
MenuItem.cs \
+ InputLanguage.cs \
+ DataGridTextBoxColumn.cs \
+ HorizontalAlignment.cs \
+ ColorDialog.cs \
+ UICuesEventHandler.cs \
+ Form.cs \
+ DragAction.cs \
+ QueryContinueDragEventHandler.cs \
+ IDataGridEditingService.cs \
+ BindingManagerBase.cs \
+ ImageList.cs \
+ FormStartPosition.cs \
+ QueryAccessibilityHelpEventHandler.cs \
+ LayoutEventArgs.cs \
+ BaseCollection.cs \
+ BorderStyle.cs \
+ ControlEventArgs.cs \
+ ItemChangedEventHandler.cs \
+ AccessibleRole.cs \
+ MouseEventHandler.cs \
+ StatusBarDrawItemEventArgs.cs \
+ IContainerControl.cs \
+ InputLanguageChangingEventArgs.cs \
MenuMerge.cs \
- MessageBoxButtons.cs \
- MessageBox.cs \
+ TextBoxBase.cs \
+ ItemChangedEventArgs.cs \
+ BindingContext.cs \
+ DataGridParentRowsLabelStyle.cs \
+ GridTableStylesCollection.cs \
+ MeasureItemEventArgs.cs \
+ HelpEventHandler.cs \
+ SizeGripStyle.cs \
+ DataGridCell.cs \
+ BindingsCollection.cs \
+ HelpEventArgs.cs \
Message.cs \
- MouseButtons.cs \
- MouseEventArgs.cs \
- MouseEventHandler.cs \
- NavigateEventArgs.cs \
- NavigateEventHandler.cs \
+ InputLanguageChangedEventHandler.cs \
+ CommonDialog.cs \
OpenFileDialog.cs \
+ SaveFileDialog.cs \
+ FolderBrowserDialog.cs \
PageSetupDialog.cs \
- PaintEventArgs.cs \
- PaintEventHandler.cs \
- PictureBox.cs \
- PictureBoxSizeMode.cs \
PrintDialog.cs \
- ProgressBar.cs \
- QueryAccessibilityHelpEventArgs.cs \
- QueryAccessibilityHelpEventHandler.cs \
- QueryContinueDragEventArgs.cs \
- QueryContinueDragEventHandler.cs \
- RadioButton.cs \
- RightToLeft.cs \
- SaveFileDialog.cs \
- ScrollableControl.cs \
- ScrollBar.cs \
- ScrollBars.cs \
- ScrollEventArgs.cs \
- ScrollEventHandler.cs \
- ScrollEventType.cs \
- Shortcut.cs \
- SizeGripStyle.cs \
- StatusBar.cs \
- StatusBarDrawItemEventArgs.cs \
- StatusBarDrawItemEventHandler.cs \
- StatusBarPanelAutoSize.cs \
- StatusBarPanelBorderStyle.cs \
- StatusBarPanelClickEventArgs.cs \
- StatusBarPanelClickEventHandler.cs \
- StatusBarPanelCollection.cs \
- StatusBarPanel.cs \
- StatusBarPanelStyle.cs \
- SWFGtkConv.cs \
- TextBoxBase.cs \
- TextBox.cs \
Timer.cs \
- TODOAttribute.cs \
- UICues.cs \
- UICuesEventArgs.cs \
- UICuesEventHandler.cs \
- VScrollBar.cs
+ DrawMode.cs \
+ ComboBoxStyle.cs \
+ Appearance.cs \
+ CheckState.cs \
+ Panel.cs \
+ TabPage.cs \
+ TabControl.cs \
+ TabAlignment.cs \
+ TabAppearance.cs \
+ TabDrawMode.cs \
+ TabSizeMode.cs \
+ Cursors.cs \
+ MessageBoxDefaultButton.cs \
+ MessageBoxIcon.cs \
+ MessageBoxOptions.cs
+
+
all-local: $(LIBRARY) $(EXES)
diff --git a/mcs/class/System.Windows.Forms/Gtk/Menu.cs b/mcs/class/System.Windows.Forms/Gtk/Menu.cs
index 6d5b3e2c412..ae028e5d4bf 100644
--- a/mcs/class/System.Windows.Forms/Gtk/Menu.cs
+++ b/mcs/class/System.Windows.Forms/Gtk/Menu.cs
@@ -1,6 +1,9 @@
//
// System.Windows.Forms.Menu
//
+// Author:
+// Alberto Fernandez (infjaf00@yahoo.es)
+//
using System;
using System.ComponentModel;
@@ -81,24 +84,23 @@ namespace System.Windows.Forms{
return (ContextMenu)menu;
}
public virtual MainMenu GetMainMenu(){
- Menu menu = this;
- while((menu != null) && !(menu is MainMenu)){
- if(menu is System.Windows.Forms.MenuItem){
- menu = ((System.Windows.Forms.MenuItem)menu).Parent;
- }
- else{
- return null;
- }
+ Menu menu = this;
+ while((menu != null) && !(menu is MainMenu)){
+ if(menu is System.Windows.Forms.MenuItem){
+ menu = ((System.Windows.Forms.MenuItem)menu).Parent;
}
- return (MainMenu)menu;
+ else{
+ return null;
+ }
+ }
+ return (MainMenu)menu;
}
[MonoTODO]
public virtual void MergeMenu (Menu menuSrc){
if (menuSrc == this){
throw new Exception ();
- }
-
+ }
}
// Don't use
@@ -146,20 +148,6 @@ namespace System.Windows.Forms{
public MenuItemCollection (Menu m) {
parentMenu_ = m;
}
-
- /*[MonoTODO]
- internal void MoveItemToIndex( int index, MenuItem mi) {
- if( index >= items_.Count){
- // FIXME: Set exception parameters
- throw new ArgumentException();
- }
- else if( items_.Count != 1){
- items_.Remove (mi);
- items_.Insert (index, mi);
- mi.Index = index;
- }
- }*/
-
//
// -- Public Methods
//
@@ -250,15 +238,15 @@ namespace System.Windows.Forms{
}
}
- public override bool Equals(object o) {
- return base.Equals(o);
- }
+ //public override bool Equals(object o) {
+ // return base.Equals(o);
+ //}
[MonoTODO]
- public override int GetHashCode() {
+ //public override int GetHashCode() {
//FIXME add our proprities
- return base.GetHashCode();
- }
+ // return base.GetHashCode();
+ //}
public IEnumerator GetEnumerator() {
return items_.GetEnumerator();
@@ -287,7 +275,6 @@ namespace System.Windows.Forms{
public override string ToString() {
return base.ToString();
- //throw new NotImplementedException ();
}
//
@@ -304,41 +291,27 @@ namespace System.Windows.Forms{
//
public int Count {
- get {
- return items_.Count;
- }
+ get {return items_.Count;}
}
/// <summary>
/// IList Interface implmentation.
/// </summary>
bool IList.IsReadOnly {
- get {
- // We allow addition, removeal, and editing of
- // items after creation of the list.
- return false;
- }
+ get { return items_.IsReadOnly; }
}
bool IList.IsFixedSize {
- get {
- // We allow addition and removeal of
- // items after creation of the list.
- return false;
- }
+ get { return false; }
}
public MenuItem this[int index] {
- get {
- return items_[index] as MenuItem;
- }
+ get { return items_[index] as MenuItem; }
}
//[MonoTODO]
object IList.this[int index] {
- get {
- return items_[index];
- }
+ get { return items_[index]; }
set {
// FIXME: Set exception members
throw new System.NotSupportedException();
@@ -394,19 +367,13 @@ namespace System.Windows.Forms{
/// ICollection Interface implmentation.
/// </summary>
int ICollection.Count {
- get {
- return Count;
- }
+ get { return Count; }
}
bool ICollection.IsSynchronized {
- get {
- throw new NotImplementedException ();
- }
+ get { return items_.IsSynchronized; }
}
object ICollection.SyncRoot {
- get {
- throw new NotImplementedException ();
- }
+ get { return items_.SyncRoot; }
}
void ICollection.CopyTo(Array array, int index){
CopyTo(array, index);
diff --git a/mcs/class/System.Windows.Forms/Gtk/MenuItem.cs b/mcs/class/System.Windows.Forms/Gtk/MenuItem.cs
index 2fcf337e665..8efec0b4f54 100644
--- a/mcs/class/System.Windows.Forms/Gtk/MenuItem.cs
+++ b/mcs/class/System.Windows.Forms/Gtk/MenuItem.cs
@@ -1,6 +1,9 @@
//
// System.Windows.Forms.MenuItem
//
+// Author:
+// Alberto Fernandez (infjaf00@yahoo.es)
+//
using System;
@@ -127,7 +130,7 @@ namespace System.Windows.Forms{
[MonoTODO]
public virtual bool OwnerDraw{
get{return false;}
- set{throw new NotImplementedException ();}
+ set{}
}
public virtual Menu Parent{
@@ -252,7 +255,7 @@ namespace System.Windows.Forms{
[MonoTODO]
internal void ConnectEvents(){
GtkMyMenuItem w = (GtkMyMenuItem)Widget;
- w.Activated += new EventHandler (OnGtkActivated);
+ w.GtkActivated += new EventHandler (OnGtkActivated);
w.Selected += new EventHandler (OnGtkSelected);
// TODO: Connect Events:
// DrawItem
@@ -371,9 +374,22 @@ namespace System.Windows.Forms{
enabled = value;
}
}
+ public event EventHandler GtkActivated;
+
+ private void OnGtkActivated(EventArgs args){
+ if (GtkActivated != null)
+ GtkActivated (this, args);
+ }
+ // Lock variable
+ private bool tog = false;
private void OnToggled (object sender, EventArgs args){
+ if (tog)
+ return;
+ tog = true;
this.Active = Checked;
+ OnGtkActivated (args);
+ tog = false;
}
internal void OnShowShortcutChange (bool value){
diff --git a/mcs/class/System.Windows.Forms/Gtk/MessageBox.cs b/mcs/class/System.Windows.Forms/Gtk/MessageBox.cs
index 8c1cad51b81..2b5197360ec 100644
--- a/mcs/class/System.Windows.Forms/Gtk/MessageBox.cs
+++ b/mcs/class/System.Windows.Forms/Gtk/MessageBox.cs
@@ -2,129 +2,302 @@
// System.Windows.Forms.ComboBox
//
// Author:
-// Joel Basson (jstrike@mweb.co.za)
+// Joel Basson (jstrike@mweb.co.za)
+// Alberto Fernandez (infjaf00@yahoo.es)
//
//
-
+using System;
using System.Drawing;
+using System.ComponentModel;
+
using Gtk;
using GtkSharp;
namespace System.Windows.Forms{
- public class MessageBox : Control {
-
- Gtk.MessageDialog dialog;
+ [MonoTODO]
+ public class MessageBox{
+ static MessageBox (){
+ Gtk.Application.Init();
+ }
private MessageBox (){
}
- public static void Show (String text) {
-
- Gtk.MessageDialog dialog = new Gtk.MessageDialog(null, Gtk.DialogFlags.DestroyWithParent, Gtk.MessageType.Info, Gtk.ButtonsType.Ok, text);
- dialog.Run();
- dialog.Destroy();
+ public static DialogResult Show (String text) {
+ return Show ((IWin32Window) null, text, "");
}
-
- public static void Show (Form myform, String text) {
-
- Gtk.MessageDialog dialog = new Gtk.MessageDialog(myform.win, Gtk.DialogFlags.DestroyWithParent, Gtk.MessageType.Info, Gtk.ButtonsType.Ok, text);
- dialog.Run();
- dialog.Destroy();
+ public static DialogResult Show (IWin32Window owner, String text){
+ return Show (owner, text, "");
}
-
-
- public static void Show (String text, String caption) {
-
- Gtk.MessageDialog dialog = new Gtk.MessageDialog(null, Gtk.DialogFlags.DestroyWithParent, Gtk.MessageType.Info, Gtk.ButtonsType.Ok, text);
- dialog.Title = caption;
- dialog.Run();
- dialog.Destroy();
+ public static DialogResult Show (String text, String caption) {
+ return Show ((IWin32Window) null, text, caption);
}
-
- public static void Show (Form myform, String text, String caption) {
-
- Gtk.MessageDialog dialog = new Gtk.MessageDialog(myform.win, Gtk.DialogFlags.DestroyWithParent, Gtk.MessageType.Info, Gtk.ButtonsType.Ok, text);
+ public static DialogResult Show (IWin32Window owner, String text, String caption){
+
+ Gtk.Window w = (owner == null) ? null : (owner as Form).win;
+
+ Gtk.MessageDialog dialog = new Gtk.MessageDialog(
+ w,
+ Gtk.DialogFlags.DestroyWithParent,
+ Gtk.MessageType.Info,
+ Gtk.ButtonsType.Ok,
+ text);
dialog.Title = caption;
dialog.Run();
dialog.Destroy();
+
+ return DialogResult.OK;
}
-
- public static void Show (String text, String caption, MessageBoxButtons but) {
-
- if (but == MessageBoxButtons.OK){
- Gtk.MessageDialog dialog = new Gtk.MessageDialog(null, Gtk.DialogFlags.DestroyWithParent, Gtk.MessageType.Info, Gtk.ButtonsType.Ok, text);
- dialog.Title = caption;
- dialog.Run();
- dialog.Destroy();
- }
- if (but == MessageBoxButtons.OKCancel){
- Gtk.MessageDialog dialog = new Gtk.MessageDialog(null, Gtk.DialogFlags.DestroyWithParent, Gtk.MessageType.Info, Gtk.ButtonsType.OkCancel, text);
- dialog.Title = caption;
- dialog.Run();
- dialog.Destroy();
- }
- if (but == MessageBoxButtons.YesNo){
- Gtk.MessageDialog dialog = new Gtk.MessageDialog(null, Gtk.DialogFlags.DestroyWithParent, Gtk.MessageType.Info, Gtk.ButtonsType.YesNo, text);
- dialog.Title = caption;
- dialog.Run();
- dialog.Destroy();
- }
- if (but == MessageBoxButtons.YesNoCancel){
- Gtk.MessageDialog dialog = new Gtk.MessageDialog(null, Gtk.DialogFlags.DestroyWithParent, Gtk.MessageType.Info, Gtk.ButtonsType.YesNo, text);
- dialog.Title = caption;
- dialog.AddButton(Gtk.Stock.Cancel, 2);
- dialog.Run();
- dialog.Destroy();
- }
- if (but == MessageBoxButtons.RetryCancel){
- Gtk.MessageDialog dialog = new Gtk.MessageDialog(null, Gtk.DialogFlags.DestroyWithParent, Gtk.MessageType.Info, Gtk.ButtonsType.None, text);
- dialog.Title = caption;
- dialog.AddButton(Gtk.Stock.Redo, 4);
- dialog.AddButton(Gtk.Stock.Cancel, 2);
- dialog.Run();
- dialog.Destroy();
- }
+
+
+
+ public static DialogResult Show (
+ String text,
+ String caption,
+ MessageBoxButtons buttons){
+
+ return Show (
+ (IWin32Window) null,
+ text,
+ caption,
+ buttons);
+ }
+ public static DialogResult Show (
+ IWin32Window owner,
+ string text,
+ string caption,
+ MessageBoxButtons buttons){
+
+ return Show (
+ owner,
+ text,
+ caption,
+ buttons,
+ MessageBoxIcon.None);
+ }
+ public static DialogResult Show (
+ string text,
+ string caption,
+ MessageBoxButtons buttons,
+ MessageBoxIcon icon){
+
+ return Show (
+ (IWin32Window) null,
+ text,
+ caption,
+ buttons,
+ icon);
+ }
+
+ public static DialogResult Show (
+ IWin32Window owner,
+ string text,
+ string caption,
+ MessageBoxButtons buttons,
+ MessageBoxIcon icon){
+
+ return Show (
+ owner,
+ text,
+ caption,
+ buttons,
+ icon,
+ MessageBoxDefaultButton.Button1);
+ }
+
+ public static DialogResult Show (
+ string text,
+ string caption,
+ MessageBoxButtons buttons,
+ MessageBoxIcon icon,
+ MessageBoxDefaultButton defaultButton){
+
+ return Show (
+ (IWin32Window) null,
+ text,
+ caption,
+ buttons,
+ icon,
+ defaultButton);
}
- public static void Show (Form myform ,String text, String caption, MessageBoxButtons but) {
-
- if (but == MessageBoxButtons.OK){
- Gtk.MessageDialog dialog = new Gtk.MessageDialog(myform.win, Gtk.DialogFlags.DestroyWithParent, Gtk.MessageType.Info, Gtk.ButtonsType.Ok, text);
- dialog.Title = caption;
- dialog.Run();
- dialog.Destroy();
- }
- if (but == MessageBoxButtons.OKCancel){
- Gtk.MessageDialog dialog = new Gtk.MessageDialog(myform.win, Gtk.DialogFlags.DestroyWithParent, Gtk.MessageType.Info, Gtk.ButtonsType.OkCancel, text);
- dialog.Title = caption;
- dialog.Run();
- dialog.Destroy();
+
+ public static DialogResult Show (
+ IWin32Window owner,
+ string text,
+ string caption,
+ MessageBoxButtons buttons,
+ MessageBoxIcon icon,
+ MessageBoxDefaultButton defaultButton){
+
+ return Show (
+ owner,
+ text,
+ caption,
+ buttons,
+ icon,
+ defaultButton,
+ MessageBoxOptions.DefaultDesktopOnly);
+ }
+
+ public static DialogResult Show (
+ string text,
+ string caption,
+ MessageBoxButtons buttons,
+ MessageBoxIcon icon,
+ MessageBoxDefaultButton defaultButton,
+ MessageBoxOptions options){
+
+ return Show (
+ (IWin32Window) null,
+ text,
+ caption,
+ buttons,
+ icon,
+ defaultButton,
+ options);
+ }
+
+ public static DialogResult Show (
+ IWin32Window owner,
+ string text,
+ string caption,
+ MessageBoxButtons buttons,
+ MessageBoxIcon icon,
+ MessageBoxDefaultButton defaultButton,
+ MessageBoxOptions options){
+
+ if (! Enum.IsDefined (typeof(MessageBoxButtons), buttons)){
+ throw new InvalidEnumArgumentException("buttons");
+ }
+ if (! Enum.IsDefined (typeof (MessageBoxIcon), icon)){
+ throw new InvalidEnumArgumentException ("icon");
}
- if (but == MessageBoxButtons.YesNo){
- Gtk.MessageDialog dialog = new Gtk.MessageDialog(myform.win, Gtk.DialogFlags.DestroyWithParent, Gtk.MessageType.Info, Gtk.ButtonsType.YesNo, text);
- dialog.Title = caption;
- dialog.Run();
- dialog.Destroy();
+ if (! Enum.IsDefined (typeof (MessageBoxDefaultButton), defaultButton)){
+ throw new InvalidEnumArgumentException ("defaultButton");
}
- if (but == MessageBoxButtons.YesNoCancel){
- Gtk.MessageDialog dialog = new Gtk.MessageDialog(myform.win, Gtk.DialogFlags.DestroyWithParent, Gtk.MessageType.Info, Gtk.ButtonsType.YesNo, text);
- dialog.Title = caption;
- dialog.AddButton(Gtk.Stock.Cancel, 2);
- dialog.Run();
- dialog.Destroy();
- }
- if (but == MessageBoxButtons.RetryCancel){
- Gtk.MessageDialog dialog = new Gtk.MessageDialog(myform.win, Gtk.DialogFlags.DestroyWithParent, Gtk.MessageType.Info, Gtk.ButtonsType.None, text);
- dialog.Title = caption;
- dialog.AddButton(Gtk.Stock.Redo, 4);
- dialog.AddButton(Gtk.Stock.Cancel, 2);
- dialog.Run();
- dialog.Destroy();
- }
+
+ //ArgumentException - options contiene tanto DefaultDesktopOnly como ServiceNotification o
+
+ Gtk.MessageType mType = Gtk.MessageType.Info;
+
+ switch (icon){
+ case MessageBoxIcon.Information:
+ mType = Gtk.MessageType.Info;
+ break;
+
+ case MessageBoxIcon.Question:
+ mType = Gtk.MessageType.Question;
+ break;
+
+ case MessageBoxIcon.Warning:
+ mType = Gtk.MessageType.Warning;
+ break;
+
+ case MessageBoxIcon.Error:
+ mType = Gtk.MessageType.Error;
+ break;
+ default:
+ mType = Gtk.MessageType.Info;
+ break;
+ }
+
+ Gtk.MessageDialog dialog = null;
+ Gtk.Window w = (owner == null) ? null : (owner as Form).win;
+
+ switch (buttons){
+ case MessageBoxButtons.OK:
+ dialog = new Gtk.MessageDialog (
+ w,
+ Gtk.DialogFlags.DestroyWithParent,
+ mType,
+ Gtk.ButtonsType.Ok,
+ text);
+ break;
+ case MessageBoxButtons.OKCancel:
+ dialog = new Gtk.MessageDialog(
+ w,
+ Gtk.DialogFlags.DestroyWithParent,
+ mType,
+ Gtk.ButtonsType.OkCancel,
+ text);
+ break;
+ case MessageBoxButtons.YesNo:
+ dialog = new Gtk.MessageDialog(
+ w,
+ Gtk.DialogFlags.DestroyWithParent,
+ mType,
+ Gtk.ButtonsType.YesNo,
+ text);
+ break;
+ case MessageBoxButtons.YesNoCancel:
+ dialog = new Gtk.MessageDialog(
+ w,
+ Gtk.DialogFlags.DestroyWithParent,
+ mType,
+ Gtk.ButtonsType.YesNo,
+ text);
+ dialog.AddButton(Gtk.Stock.Cancel, (int) Gtk.ResponseType.Cancel);
+ break;
+ case MessageBoxButtons.RetryCancel:
+ dialog = new Gtk.MessageDialog(
+ w,
+ Gtk.DialogFlags.DestroyWithParent,
+ mType,
+ Gtk.ButtonsType.None,
+ text);
+ //dialog.AddButton(Gtk.Stock.Redo, 4);
+ dialog.AddButton ("Retry", 4);
+ dialog.AddButton(Gtk.Stock.Cancel, (int) Gtk.ResponseType.Cancel);
+ break;
+ case MessageBoxButtons.AbortRetryIgnore:
+ break;
+ dialog = new Gtk.MessageDialog (
+ w,
+ Gtk.DialogFlags.DestroyWithParent,
+ mType,
+ Gtk.ButtonsType.None,
+ text);
+ //dialog.AddButton (Gtk.Stock.Redo, 4);
+ dialog.AddButton ("Abort", 3);
+ dialog.AddButton ("Retry", 4);
+ dialog.AddButton ("Ignore", 5);
+ default:
+ break;
+ }
+
+ int ret = dialog.Run ();
+ dialog.Destroy();
+
+ switch (ret){
+ case (int) Gtk.ResponseType.None:
+ return DialogResult.None;
+ //case (int) Gtk.ResponseType.Reject:
+ //case (int) Gtk.ResponseType.Accept:
+
+ case (int) Gtk.ResponseType.DeleteEvent:
+ return DialogResult.Cancel;
+ case (int) Gtk.ResponseType.Ok:
+ return DialogResult.OK;
+ case (int) Gtk.ResponseType.Cancel:
+ return DialogResult.Cancel;
+ case (int) Gtk.ResponseType.Close:
+ return DialogResult.Cancel;
+ case (int) Gtk.ResponseType.Yes:
+ return DialogResult.Yes;
+ case (int) Gtk.ResponseType.No:
+ return DialogResult.No;
+ case (int) Gtk.ResponseType.Apply:
+ return DialogResult.OK;
+ case (int) Gtk.ResponseType.Help:
+ return DialogResult.OK;
+ default:
+ return (DialogResult) ret;
+
+ }
}
-
}
-}
+}
diff --git a/mcs/class/System.Windows.Forms/Gtk/MessageBoxButtons.cs b/mcs/class/System.Windows.Forms/Gtk/MessageBoxButtons.cs
index bca72acb3ea..06526bb2b05 100644
--- a/mcs/class/System.Windows.Forms/Gtk/MessageBoxButtons.cs
+++ b/mcs/class/System.Windows.Forms/Gtk/MessageBoxButtons.cs
@@ -2,17 +2,17 @@
// System.Windows.Forms.ComboBox
//
// Author:
-// Joel Basson (jstrike@mweb.co.za)
+// Joel Basson (jstrike@mweb.co.za)
//
//
-using System;
-
-namespace System.Windows.Forms
-{
+namespace System.Windows.Forms{
public enum MessageBoxButtons{
-
- OK, OKCancel, RetryCancel, YesNo, YesNoCancel, AbortRetryIgnore
-
- }
+ OK = 0,
+ OKCancel = 1,
+ AbortRetryIgnore = 2,
+ YesNoCancel = 3,
+ YesNo = 4,
+ RetryCancel = 5
+ }
}
diff --git a/mcs/class/System.Windows.Forms/Gtk/MessageBoxDefaultButton.cs b/mcs/class/System.Windows.Forms/Gtk/MessageBoxDefaultButton.cs
new file mode 100644
index 00000000000..618937d0f07
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/Gtk/MessageBoxDefaultButton.cs
@@ -0,0 +1,20 @@
+//
+// System.Windows.Forms.MessageBoxDefaultButton.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum MessageBoxDefaultButton {
+ Button1 = 0,
+ Button2 = 256,
+ Button3 = 512
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/Gtk/MessageBoxIcon.cs b/mcs/class/System.Windows.Forms/Gtk/MessageBoxIcon.cs
new file mode 100644
index 00000000000..6aff0e89e4a
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/Gtk/MessageBoxIcon.cs
@@ -0,0 +1,26 @@
+//
+// System.Windows.Forms.MessageBoxIcon.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum MessageBoxIcon {
+ Asterisk = 64,
+ Error = 16,
+ Exclamation = 48,
+ Hand = 16,
+ Information = 64,
+ None = 0,
+ Question = 32,
+ Stop = 16,
+ Warning = 48
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/Gtk/MessageBoxOptions.cs b/mcs/class/System.Windows.Forms/Gtk/MessageBoxOptions.cs
new file mode 100644
index 00000000000..8a1e2931b69
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/Gtk/MessageBoxOptions.cs
@@ -0,0 +1,21 @@
+//
+// System.Windows.Forms.MessageBoxOptions.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum MessageBoxOptions {
+ DefaultDesktopOnly = 131072,
+ RightAlign = 524288,
+ RtlReading = 1048576,
+ ServiceNotification = 2097152
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/Gtk/OpenFileDialog.cs b/mcs/class/System.Windows.Forms/Gtk/OpenFileDialog.cs
index 9390169b6d8..82de97dc03d 100644
--- a/mcs/class/System.Windows.Forms/Gtk/OpenFileDialog.cs
+++ b/mcs/class/System.Windows.Forms/Gtk/OpenFileDialog.cs
@@ -41,7 +41,6 @@ namespace System.Windows.Forms {
get { return showReadOnly; }
set { showReadOnly = value;}
}
-
[MonoTODO]
public Stream OpenFile() {
return new FileStream ( FileName, FileMode.Open, FileAccess.Read );
@@ -54,21 +53,17 @@ namespace System.Windows.Forms {
ShowReadOnly = false;
ReadOnlyChecked = false;
}
+ public override string ToString(){
+ return String.Format (
+ "System.Windows.Forms.OpenFileDialog: Title: {0}, FileName: {1}",
+ this.Title,
+ this.FileName);
+ }
[MonoTODO]
internal override Gtk.Dialog CreateDialog (){
- Gtk.FileSelection s = new Gtk.FileSelection ("FileSelection - Open");
- s.CancelButton.Clicked += new EventHandler (BtnCancelClicked);
- s.OkButton.Clicked += new EventHandler (BtnOkClicked);
- s.DeleteEvent += new GtkSharp.DeleteEventHandler (OnDelete);
- s.Response += new GtkSharp.ResponseHandler (OnResponse);
- return s;
- }
- [MonoTODO]
- internal void BtnCancelClicked (object sender, EventArgs args){
- }
- [MonoTODO]
- internal void BtnOkClicked (object sender, EventArgs args){
+ return new Gtk.FileSelection (String.Empty);
}
+
}
}
diff --git a/mcs/class/System.Windows.Forms/Gtk/Panel.cs b/mcs/class/System.Windows.Forms/Gtk/Panel.cs
new file mode 100644
index 00000000000..01f97ae3df0
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/Gtk/Panel.cs
@@ -0,0 +1,61 @@
+//
+// System.Windows.Forms.Panel
+//
+// Author:
+// Alberto Fernandez (infjaf00@yahoo.es)
+//
+
+using System.Drawing;
+
+
+namespace System.Windows.Forms{
+
+ public class Panel : ScrollableControl {
+
+ private Gtk.RadioButton firstRadioButton;
+ private int radioButtonsCount = 0;
+
+ [MonoTODO]
+ public Panel(){
+ }
+ [MonoTODO]
+ public BorderStyle BorderStyle {
+ get {return BorderStyle.None; }
+ set {}
+ }
+ protected override Size DefaultSize {
+ get { return new Size (200,100); }
+ }
+ //public new bool TabStop {get; set;}
+ //public override string Text {get; set;}
+
+ protected override void OnControlAdded (ControlEventArgs e){
+ base.OnControlAdded(e);
+ if (e.Control is RadioButton){
+ if (radioButtonsCount == 0)
+ firstRadioButton = e.Control.Widget as Gtk.RadioButton;
+ else
+ (e.Control.Widget as Gtk.RadioButton).Group =
+ firstRadioButton.Group;
+ radioButtonsCount++;
+ }
+ }
+ [MonoTODO]
+ protected override void OnControlRemoved (ControlEventArgs e){
+ base.OnControlRemoved (e);
+ }
+ //protected override void OnResize(EventArgs eventargs);
+ public override string ToString(){
+ return String.Format ("{0}, BorderStyle: {1}",
+ "System.Windows.Forms.Panel",
+ this.BorderStyle);
+ }
+
+ public new event KeyEventHandler KeyDown;
+ public new event KeyPressEventHandler KeyPress;
+ public new event KeyEventHandler KeyUp;
+ public new event EventHandler TextChanged;
+
+ }
+
+}
diff --git a/mcs/class/System.Windows.Forms/Gtk/ProgressBar.cs b/mcs/class/System.Windows.Forms/Gtk/ProgressBar.cs
index 9dbdf544004..f6485f5c19d 100644
--- a/mcs/class/System.Windows.Forms/Gtk/ProgressBar.cs
+++ b/mcs/class/System.Windows.Forms/Gtk/ProgressBar.cs
@@ -4,6 +4,7 @@
// Author:
// stubbed out by Jaak Simm (jaaksimm@firm.ee)
// Remco de Jong (rdj@rdj.cg.nu)
+// Alberto Fernandez (infjaf00@yahoo.es)
//
// (C) Ximian, Inc., 2002
//
@@ -30,20 +31,16 @@ namespace System.Windows.Forms {
#endregion
#region Constructor
- [MonoTODO]
- public ProgressBar()
- {
+
+ public ProgressBar(){
maximum=100;
minimum=0;
step=10;
val=0;
+ this.Size = this.DefaultSize;
}
#endregion
-
- internal override Gtk.Widget CreateWidget () {
- Gtk.ProgressBar pbar = new Gtk.ProgressBar ();
- return pbar;
- }
+
/* #region Properties
[MonoTODO]
@@ -72,10 +69,6 @@ namespace System.Windows.Forms {
get { throw new NotImplementedException (); }
}
- [MonoTODO]
- protected override Size DefaultSize {
- get { throw new NotImplementedException (); }
- }
[MonoTODO]
public override Font Font {
@@ -83,25 +76,48 @@ namespace System.Windows.Forms {
set { throw new NotImplementedException (); }
}
*/
+ protected override Size DefaultSize {
+ get { return new System.Drawing.Size (100, 23); }
+ }
/// This member supports the .NET Framework infrastructure and is not intended to be used directly from your code.
/// public new ImeMode ImeMode {get; set;}
public int Maximum {
- get {
- return maximum;
- }
+ get { return maximum;}
set {
+ if (value < 0){
+ String st = String.Format (
+ "'{0}' is not a valid value for Maximum."+
+ "It should be >= 0", value
+ );
+ throw new ArgumentException (st);
+ }
maximum=value;
+ if (value < minimum)
+ minimum = value;
+ if (value < val)
+ val = value;
+ UpdateGtkProgressBar();
}
}
public int Minimum {
- get {
- return minimum;
- }
+ get { return minimum; }
set {
+ if (value < 0){
+ String st = String.Format (
+ "'{0}' is not a valid value for Minimum."+
+ "It should be >= 0", value
+ );
+ throw new ArgumentException (st);
+ }
minimum=value;
+ if (value > maximum)
+ maximum = value;
+ if (value > val)
+ val = value;
+ UpdateGtkProgressBar();
}
}
@@ -114,29 +130,27 @@ namespace System.Windows.Forms {
}
*/
public int Step {
- get {
- return step;
- }
- set {
- step=value;
- }
+ get { return step; }
+ set { step=value; }
}
- protected override void OnTextChanged(EventArgs e)
- {
- ((Gtk.ProgressBar)Widget).Text = Text;
- }
+
public int Value {
get {
return val;
}
set {
- if (val <= maximum) {
- val=value;
- float fraction = ((float) val / (float) maximum);
- ((Gtk.ProgressBar)Widget).Fraction = fraction;
+ if ((value > maximum) || (value < minimum)){
+ String st = String.Format (
+ "'{0}' is not a valid value for Value."+
+ " It should be betwen Minimum and Maximum", value);
+
+ throw new ArgumentException (st);
}
+
+ val=value;
+ UpdateGtkProgressBar();
}
}
// #endregion
@@ -151,10 +165,11 @@ namespace System.Windows.Forms {
throw new NotImplementedException ();
}
*/
- [MonoTODO]
- public void Increment(int value)
- {
- Value += value;
+ public void Increment(int value) {
+ int tmp = Value + value;
+ tmp = (tmp < Minimum) ? Minimum : tmp;
+ tmp = (tmp > Maximum) ? Maximum : tmp;
+ Value = tmp;
}
/* [MonoTODO]
@@ -163,17 +178,18 @@ namespace System.Windows.Forms {
throw new NotImplementedException ();
}
*/
- [MonoTODO]
- public void PerformStep()
- {
- Value += step;
+ public void PerformStep(){
+ this.Increment (this.Step);
}
- [MonoTODO]
- public override string ToString()
- {
- return base.ToString();
- //throw new NotImplementedException ();
+ public override string ToString(){
+ String ret = String.Format (
+ "System.Windows.Forms.ProgressBar, " +
+ "Minimum: {0}, Maximum: {1}, Value: {2}",
+ this.Minimum,
+ this.Maximum,
+ this.Value);
+ return ret;
}
// #endregion
@@ -192,5 +208,16 @@ namespace System.Windows.Forms {
public new event PaintEventHandler Paint;
*/
#endregion
+ internal override Gtk.Widget CreateWidget () {
+ Gtk.ProgressBar pbar = new Gtk.ProgressBar ();
+ return pbar;
+ }
+ protected override void OnTextChanged(EventArgs e){
+ ((Gtk.ProgressBar)Widget).Text = Text;
+ }
+ internal void UpdateGtkProgressBar(){
+ float fraction = ((float) val / (float) maximum);
+ (Widget as Gtk.ProgressBar).Fraction = fraction;
+ }
}
}
diff --git a/mcs/class/System.Windows.Forms/Gtk/RadioButton.cs b/mcs/class/System.Windows.Forms/Gtk/RadioButton.cs
index 73d123a4754..e8a478beaec 100644
--- a/mcs/class/System.Windows.Forms/Gtk/RadioButton.cs
+++ b/mcs/class/System.Windows.Forms/Gtk/RadioButton.cs
@@ -1,49 +1,101 @@
-//
-// System.Windows.Forms.Frame
+//
+// System.Windows.Forms.Frame
//
-// Author:
-// Joel Basson (jstrike@mweb.co.za)
+// Author:
+// Joel Basson (jstrike@mweb.co.za)
+// Alberto Fernandez (infjaf00@yahoo.es)
//
//
using System;
+using System.Drawing;
+using System.ComponentModel;
+
+namespace System.Windows.Forms{
-namespace System.Windows.Forms {
-
/// <summary>
/// Represents a Windows RadioButton control.
///
/// </summary>
-
-
- public class RadioButton : CheckBox {
- private static int initialized;
- static Gtk.RadioButton first_radio_button;
+
+ public class RadioButton : ButtonBase {
+
+ private bool autocheck = true;
- public RadioButton(){
+ [MonoTODO]
+ public RadioButton (){
+ }
+ public Appearance Appearance{
+ get{
+ if ( (Widget as Gtk.RadioButton).DrawIndicator)
+ return Appearance.Normal;
+ return Appearance.Button;
+ }
+ set{
+ if (!Enum.IsDefined (typeof(Appearance), value) )
+ throw new InvalidEnumArgumentException();
+ if (value != Appearance){
+ if (value == Appearance.Normal)
+ (Widget as Gtk.RadioButton).DrawIndicator = true;
+ else
+ (Widget as Gtk.RadioButton).DrawIndicator = false;
+ OnAppearanceChanged (EventArgs.Empty);
+ }
+ }
+ }
+ [MonoTODO]
+ public bool AutoCheck {
+ get { return autocheck; }
+ set { autocheck = value; }
+ }
+ [MonoTODO]
+ public ContentAlignment CheckAlign {
+ get { return ContentAlignment.MiddleLeft; }
+ set {
+ if (!Enum.IsDefined (typeof (ContentAlignment), value))
+ throw new InvalidEnumArgumentException ("CheckAlign");
+ }
+ }
+ public bool Checked {
+ get { return (Widget as Gtk.RadioButton).Active; }
+ set { (Widget as Gtk.RadioButton).Active = value; }
+ }
+ protected override Size DefaultSize {
+ get { return new Size (104,24); }
+ }
+ public override string Text{
+ get{ return ((Gtk.RadioButton) Widget).Label; }
+ set{ ((Gtk.RadioButton) Widget).Label = value; }
+ }
+ // Not in docs?
+ protected virtual void OnAppearanceChanged( EventArgs e){
+ if (AppearanceChanged != null)
+ AppearanceChanged (this, e);
+ }
+ protected virtual void OnCheckedChanged( EventArgs e){
+ if (CheckedChanged != null)
+ CheckedChanged (this, e);
+ }
+ public void PerformClick(){
+ (Widget as Gtk.RadioButton).Click();
+ }
+ public override string ToString(){
+ return "System.Windows.Forms.RadioButton, Checked: " + Checked;
+ }
- }
-
- internal override Gtk.Widget CreateWidget() {
- initialized = initialized + 1;
- if ( initialized == 1 ) {
- first_radio_button = new Gtk.RadioButton(null, "");
- return first_radio_button;
- }
- else {
- return Gtk.RadioButton.NewWithLabelFromWidget(first_radio_button, "");
- }
- }
-
- public override string Text {
- get {
- return ((Gtk.RadioButton)Widget).Label;
- }
- set {
- ((Gtk.RadioButton)Widget).Label = value;
+ public event EventHandler AppearanceChanged;
+ public event EventHandler CheckedChanged;
+ public new event EventHandler DoubleClick;
+
+ internal override Gtk.Widget CreateWidget (){
+ Gtk.RadioButton rb = new Gtk.RadioButton (null, "");
+ rb.Toggled += new EventHandler (GtkToggled);
+ return rb;
+ }
+ private void GtkToggled (object sender, EventArgs args){
+ OnCheckedChanged(args);
}
}
- }
}
diff --git a/mcs/class/System.Windows.Forms/Gtk/SWFGtkConv.cs b/mcs/class/System.Windows.Forms/Gtk/SWFGtkConv.cs
index 1d168187514..80d6f518d7b 100644
--- a/mcs/class/System.Windows.Forms/Gtk/SWFGtkConv.cs
+++ b/mcs/class/System.Windows.Forms/Gtk/SWFGtkConv.cs
@@ -72,30 +72,14 @@ namespace System.Windows.Forms{
return ret;
}
+
+ // Font not implemented.
[MonoTODO]
public static Pango.FontDescription Font (System.Drawing.Font f){
-
- // TODO: Font Size.
- // TODO: Font Family/Name
-
FontDescription ret = new FontDescription();
- ret.Weight = (f.Bold) ? Pango.Weight.Bold : Pango.Weight.Normal;
- ret.Family = f.FontFamily.Name;
- //ret.Family = f.Name;
-
-
- //GdiCharSet
- //GdiVerticalFont
- //Height
- ret.Style = (f.Italic) ? Pango.Style.Italic : Pango.Style.Normal;
- //Italic
- //Name
- //Size
- //SizeInPoints
- //Strikeout
- //Style
- //Underline
- //Unit
+ //ret.Weight = (f.Bold) ? Pango.Weight.Bold : Pango.Weight.Normal;
+ //ret.Family = f.FontFamily.Name;
+ //ret.Style = (f.Italic) ? Pango.Style.Italic : Pango.Style.Normal;
return ret;
}
diff --git a/mcs/class/System.Windows.Forms/Gtk/SaveFileDialog.cs b/mcs/class/System.Windows.Forms/Gtk/SaveFileDialog.cs
index 80d4d141d1b..823976eef49 100644
--- a/mcs/class/System.Windows.Forms/Gtk/SaveFileDialog.cs
+++ b/mcs/class/System.Windows.Forms/Gtk/SaveFileDialog.cs
@@ -7,6 +7,8 @@
//
// (C) 2002 Ximian, Inc
//
+
+using System.ComponentModel;
using System.IO;
namespace System.Windows.Forms {
@@ -32,11 +34,13 @@ namespace System.Windows.Forms {
//
// --- Public Properties
//
+ // pregunta si queremos crear un archivo nuevo.
[MonoTODO]
public bool CreatePrompt {
get {return createPrompt;}
set {createPrompt = value;}
}
+ // pregunta si queremos sobreescribir.
[MonoTODO]
public bool OverwritePrompt {
get {return overwritePrompt;}
@@ -56,22 +60,18 @@ namespace System.Windows.Forms {
base.Reset();
CheckFileExists = false;
}
+ public override string ToString(){
+ return String.Format (
+ "System.Windows.Forms.SaveFileDialog: Title: {0}, FileName: {1}",
+ this.Title,
+ this.FileName);
+ }
[MonoTODO]
internal override Gtk.Dialog CreateDialog (){
- Gtk.FileSelection s = new Gtk.FileSelection ("FileSelection - Save");
- s.CancelButton.Clicked += new EventHandler (BtnCancelClicked);
- s.OkButton.Clicked += new EventHandler (BtnOkClicked);
- s.DeleteEvent += new GtkSharp.DeleteEventHandler (OnDelete);
- s.Response += new GtkSharp.ResponseHandler (OnResponse);
- return s;
- }
- [MonoTODO]
- internal void BtnCancelClicked (object sender, EventArgs args){
- }
- [MonoTODO]
- internal void BtnOkClicked (object sender, EventArgs args){
+ return new Gtk.FileSelection (String.Empty);
}
+
}
}
diff --git a/mcs/class/System.Windows.Forms/Gtk/ScrollBar.cs b/mcs/class/System.Windows.Forms/Gtk/ScrollBar.cs
index c90b53341b6..da5d1fd06c0 100644
--- a/mcs/class/System.Windows.Forms/Gtk/ScrollBar.cs
+++ b/mcs/class/System.Windows.Forms/Gtk/ScrollBar.cs
@@ -12,12 +12,12 @@ using System.Drawing;
namespace System.Windows.Forms {
- // <summary>
- // </summary>
+ /// <summary>
+ /// </summary>
public class ScrollBar : Control {
internal Gtk.Adjustment adj;
- private double value;
+ private double val;
private double lower;
private double upper;
private double step_increment;
@@ -28,22 +28,18 @@ namespace System.Windows.Forms {
// --- Constructor
//
- public ScrollBar() : base()
- {
+ public ScrollBar() : base(){
// Defaults
this.upper = 100;
this.lower = 0;
- this.value = 0;
+ this.val = 0;
this.step_increment = 1;
- this.page_increment = 100;
- this.page_size = 100;
-
- this.adj = new Gtk.Adjustment(value, lower, upper, step_increment, page_increment, page_size);
-
+ this.page_increment = 10;
+ this.page_size = 10;
+ this.adj = new Gtk.Adjustment(val, lower, upper, step_increment, page_increment, page_size);
//spec says tabstop defaults to false.
base.TabStop = false;
-
- ConnectToChanged ();
+ ConnectToChanged();
}
//
@@ -51,111 +47,117 @@ namespace System.Windows.Forms {
//
- [MonoTODO]
public int LargeChange {
- get {
- return (int)this.adj.PageIncrement;
- }
+ get {return (int)page_increment;}
set {
+ if (value < 0){
+ String st = String.Format (
+ "'{0}' is not a valid value for LargeChange."+
+ "It should be >= 0", value
+ );
+ throw new ArgumentException (st);
+ }
page_increment = value;
- this.adj.SetBounds (lower, upper, step_increment, page_increment, page_size);
+ UpdateGtkScroll();
}
}
- [MonoTODO]
public int Maximum {
- get {
- return (int)this.adj.Upper;
- }
+ get {return (int) upper;}
set {
upper = value;
- this.adj.SetBounds (lower, upper, step_increment, page_increment, page_size);
+ if (value < lower)
+ lower = value;
+ if (value < this.Value)
+ this.Value = value;
+
+ UpdateGtkScroll();
}
}
- [MonoTODO]
public int Minimum {
- get {
- return (int)this.adj.Lower;
- }
+ get {return (int) lower;}
set {
lower = value;
- this.adj.SetBounds (lower, upper, step_increment, page_increment, page_size);
+ if (value > upper)
+ upper = value;
+ if (value > val)
+ val = value;
+ UpdateGtkScroll();
}
}
-
- [MonoTODO]
public int SmallChange {
- get {
- return (int) this.adj.StepIncrement;
- }
+ get { return (int) step_increment;}
set {
+ if (value < 0){
+ String st = String.Format (
+ "'{0}' is not a valid value for SmallChange."+
+ "It should be >= 0", value
+ );
+ throw new ArgumentException (st);
+ }
step_increment = value;
- this.adj.SetBounds (lower, upper, step_increment, page_increment, page_size);
+ UpdateGtkScroll();
}
}
- public override string Text {
- //Can't imagen what a scroll bar would do with text, so just call base.
- get {
- return base.Text;
- }
- set {
- base.Text = value;
- }
- }
-
- [MonoTODO]
public int Value {
- get {
- return (int)this.adj.Value;
- }
+ get {return (int) val; }
+
set {
- this.adj.Value = value;
+ if ((value > upper) || (value < lower)){
+ String st = String.Format (
+ "'{0}' is not a valid value for Minimum."+
+ " It should be betwen Minimum and Maximum", value);
+
+ throw new ArgumentException (st);
+ }
+ val = value;
+ UpdateGtkScroll();
}
}
//
- // --- Public Methods
- //
-
- public override string ToString()
- {
- //replace with value, if implmeted as property.
- return Value.ToString();
- }
-
- //
// --- Public Events
//
- [MonoTODO]
public event ScrollEventHandler Scroll;
-
-
public event EventHandler ValueChanged;
- internal protected void changed_cb (object o, EventArgs args)
- {
+ protected virtual void OnValueChanged (EventArgs args){
if (ValueChanged != null)
ValueChanged (this, args);
}
-
- internal protected void ConnectToChanged ()
- {
- this.adj.ValueChanged += new EventHandler (changed_cb);
+ protected virtual void OnScroll (ScrollEventArgs args){
+ if (Scroll != null)
+ Scroll (this, args);
}
-
[MonoTODO]
- protected override void OnEnabledChanged(EventArgs e)
- {
+ protected override void OnEnabledChanged(EventArgs e){
throw new NotImplementedException();
}
[MonoTODO]
- protected override void OnHandleCreated(EventArgs e)
- {
+ protected override void OnHandleCreated(EventArgs e){
throw new NotImplementedException();
+ }
+
+ // FIXME:
+
+ internal protected void changed_cb (object o, EventArgs args){
+ val = this.adj.Value;
+ OnValueChanged(args);
+ OnScroll (new ScrollEventArgs(ScrollEventType.ThumbPosition ,(int) val));
+ }
+
+ internal protected void ConnectToChanged (){
+ this.adj.ValueChanged += new EventHandler (changed_cb);
+ }
+
+ internal protected void UpdateGtkScroll(){
+ this.adj.SetBounds (lower, upper, step_increment, page_increment, page_size);
+ if ((int) val != this.adj.Value)
+ this.adj.Value = (int) val;
}
}
}
diff --git a/mcs/class/System.Windows.Forms/Gtk/ScrollableControl.cs b/mcs/class/System.Windows.Forms/Gtk/ScrollableControl.cs
index 27d23efb1e8..779d1ca2454 100644
--- a/mcs/class/System.Windows.Forms/Gtk/ScrollableControl.cs
+++ b/mcs/class/System.Windows.Forms/Gtk/ScrollableControl.cs
@@ -155,8 +155,7 @@ namespace System.Windows.Forms {
}*/
[MonoTODO]
- protected virtual void AdjustFormScrollbars (
- bool displayScrollbars) {
+ protected virtual void AdjustFormScrollbars (bool displayScrollbars) {
//FIXME:
}
@@ -344,4 +343,3 @@ namespace System.Windows.Forms {
}
}
}
-
diff --git a/mcs/class/System.Windows.Forms/Gtk/Shortcut.cs b/mcs/class/System.Windows.Forms/Gtk/Shortcut.cs
index 64cfe495ad6..d20a5081eb7 100644
--- a/mcs/class/System.Windows.Forms/Gtk/Shortcut.cs
+++ b/mcs/class/System.Windows.Forms/Gtk/Shortcut.cs
@@ -6,14 +6,14 @@
//
//
-using System;
+using System;
using Gtk;
using GtkSharp;
using Gdk;
using GLib;
namespace System.Windows.Forms{
-
+
public enum Shortcut {
Alt0 = 262192,
Alt1 = 262193,
@@ -174,128 +174,241 @@ namespace System.Windows.Forms{
[MonoTODO]
internal class ShortcutHelper {
public static void AddShortcutToWidget (Gtk.Widget widget, Gtk.AccelGroup group, Shortcut shortcut, string signal) {
+ Gtk.AccelKey ak = new Gtk.AccelKey ();
switch (shortcut) {
- case Shortcut.CtrlA : widget.AddAccelerator(signal, group, (uint)Gdk.Key.A, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.CtrlB : widget.AddAccelerator(signal, group, (uint)Gdk.Key.B, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.CtrlC : widget.AddAccelerator(signal, group, (uint)Gdk.Key.C, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.CtrlD : widget.AddAccelerator(signal, group, (uint)Gdk.Key.D, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.CtrlE : widget.AddAccelerator(signal, group, (uint)Gdk.Key.E, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.CtrlF : widget.AddAccelerator(signal, group, (uint)Gdk.Key.F, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.CtrlG : widget.AddAccelerator(signal, group, (uint)Gdk.Key.G, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.CtrlH : widget.AddAccelerator(signal, group, (uint)Gdk.Key.H, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.CtrlI : widget.AddAccelerator(signal, group, (uint)Gdk.Key.I, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.CtrlJ : widget.AddAccelerator(signal, group, (uint)Gdk.Key.J, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.CtrlK : widget.AddAccelerator(signal, group, (uint)Gdk.Key.K, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.CtrlL : widget.AddAccelerator(signal, group, (uint)Gdk.Key.L, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.CtrlM : widget.AddAccelerator(signal, group, (uint)Gdk.Key.M, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.CtrlN : widget.AddAccelerator(signal, group, (uint)Gdk.Key.N, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.CtrlO : widget.AddAccelerator(signal, group, (uint)Gdk.Key.O, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.CtrlP : widget.AddAccelerator(signal, group, (uint)Gdk.Key.P, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.CtrlQ : widget.AddAccelerator(signal, group, (uint)Gdk.Key.Q, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.CtrlR : widget.AddAccelerator(signal, group, (uint)Gdk.Key.R, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.CtrlS : widget.AddAccelerator(signal, group, (uint)Gdk.Key.S, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.CtrlT : widget.AddAccelerator(signal, group, (uint)Gdk.Key.T, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.CtrlU : widget.AddAccelerator(signal, group, (uint)Gdk.Key.U, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.CtrlV : widget.AddAccelerator(signal, group, (uint)Gdk.Key.V, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.CtrlW : widget.AddAccelerator(signal, group, (uint)Gdk.Key.W, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.CtrlX : widget.AddAccelerator(signal, group, (uint)Gdk.Key.X, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.CtrlY : widget.AddAccelerator(signal, group, (uint)Gdk.Key.Y, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.CtrlZ : widget.AddAccelerator(signal, group, (uint)Gdk.Key.Z, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.CtrlA : ak.accel_key = (uint)Gdk.Key.A;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.CtrlB : ak.accel_key = (uint)Gdk.Key.B;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.CtrlC : ak.accel_key = (uint)Gdk.Key.C;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.CtrlD : ak.accel_key = (uint)Gdk.Key.D;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.CtrlE : ak.accel_key = (uint)Gdk.Key.E;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.CtrlF : ak.accel_key = (uint)Gdk.Key.F;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.CtrlG : ak.accel_key = (uint)Gdk.Key.G;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.CtrlH : ak.accel_key = (uint)Gdk.Key.H;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.CtrlI : ak.accel_key = (uint)Gdk.Key.I;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.CtrlJ : ak.accel_key = (uint)Gdk.Key.J;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.CtrlK : ak.accel_key = (uint)Gdk.Key.K;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.CtrlL : ak.accel_key = (uint)Gdk.Key.L;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.CtrlM : ak.accel_key = (uint)Gdk.Key.M;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.CtrlN : ak.accel_key = (uint)Gdk.Key.N;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.CtrlO : ak.accel_key = (uint)Gdk.Key.O;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.CtrlP : ak.accel_key = (uint)Gdk.Key.P;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.CtrlQ : ak.accel_key = (uint)Gdk.Key.Q;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.CtrlR : ak.accel_key = (uint)Gdk.Key.R;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.CtrlS : ak.accel_key = (uint)Gdk.Key.S;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.CtrlT : ak.accel_key = (uint)Gdk.Key.T;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.CtrlU : ak.accel_key = (uint)Gdk.Key.U;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.CtrlV : ak.accel_key = (uint)Gdk.Key.V;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.CtrlW : ak.accel_key = (uint)Gdk.Key.W;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.CtrlX : ak.accel_key = (uint)Gdk.Key.X;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.CtrlY : ak.accel_key = (uint)Gdk.Key.Y;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.CtrlZ : ak.accel_key = (uint)Gdk.Key.Z;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.Ctrl0 : widget.AddAccelerator(signal, group, (uint)Gdk.Key.KP_0, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.Ctrl1 : widget.AddAccelerator(signal, group, (uint)Gdk.Key.KP_1, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.Ctrl2 : widget.AddAccelerator(signal, group, (uint)Gdk.Key.KP_2, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.Ctrl3 : widget.AddAccelerator(signal, group, (uint)Gdk.Key.KP_3, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.Ctrl4 : widget.AddAccelerator(signal, group, (uint)Gdk.Key.KP_4, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.Ctrl5 : widget.AddAccelerator(signal, group, (uint)Gdk.Key.KP_5, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.Ctrl6 : widget.AddAccelerator(signal, group, (uint)Gdk.Key.KP_6, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.Ctrl7 : widget.AddAccelerator(signal, group, (uint)Gdk.Key.KP_7, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.Ctrl8 : widget.AddAccelerator(signal, group, (uint)Gdk.Key.KP_8, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.Ctrl9 : widget.AddAccelerator(signal, group, (uint)Gdk.Key.KP_9, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.Ctrl0 : ak.accel_key = (uint)Gdk.Key.KP_0;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.Ctrl1 : ak.accel_key = (uint)Gdk.Key.KP_1;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.Ctrl2 : ak.accel_key = (uint)Gdk.Key.KP_2;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.Ctrl3 : ak.accel_key = (uint)Gdk.Key.KP_3;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.Ctrl4 : ak.accel_key = (uint)Gdk.Key.KP_4;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.Ctrl5 : ak.accel_key = (uint)Gdk.Key.KP_5;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.Ctrl6 : ak.accel_key = (uint)Gdk.Key.KP_6;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.Ctrl7 : ak.accel_key = (uint)Gdk.Key.KP_7;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.Ctrl8 : ak.accel_key = (uint)Gdk.Key.KP_8;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.Ctrl9 : ak.accel_key = (uint)Gdk.Key.KP_9;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.CtrlDel : widget.AddAccelerator(signal, group, (uint)Gdk.Key.Delete, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.CtrlIns : widget.AddAccelerator(signal, group, (uint)Gdk.Key.Insert, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.CtrlDel : ak.accel_key = (uint)Gdk.Key.Delete;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.CtrlIns : ak.accel_key = (uint)Gdk.Key.Insert;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.CtrlF1 : widget.AddAccelerator(signal, group, (uint)Gdk.Key.F1, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.CtrlF2 : widget.AddAccelerator(signal, group, (uint)Gdk.Key.F2, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.CtrlF3 : widget.AddAccelerator(signal, group, (uint)Gdk.Key.F3, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.CtrlF4 : widget.AddAccelerator(signal, group, (uint)Gdk.Key.F4, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.CtrlF5 : widget.AddAccelerator(signal, group, (uint)Gdk.Key.F5, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.CtrlF6 : widget.AddAccelerator(signal, group, (uint)Gdk.Key.F6, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.CtrlF7 : widget.AddAccelerator(signal, group, (uint)Gdk.Key.F7, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.CtrlF8 : widget.AddAccelerator(signal, group, (uint)Gdk.Key.F8, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.CtrlF9 : widget.AddAccelerator(signal, group, (uint)Gdk.Key.F9, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.CtrlF10 : widget.AddAccelerator(signal, group, (uint)Gdk.Key.F10, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.CtrlF11 : widget.AddAccelerator(signal, group, (uint)Gdk.Key.F11, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.CtrlF12 : widget.AddAccelerator(signal, group, (uint)Gdk.Key.F12, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.CtrlF1 : ak.accel_key = (uint)Gdk.Key.F1;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.CtrlF2 : ak.accel_key = (uint)Gdk.Key.F2;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.CtrlF3 : ak.accel_key = (uint)Gdk.Key.F3;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.CtrlF4 : ak.accel_key = (uint)Gdk.Key.F4;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.CtrlF5 : ak.accel_key = (uint)Gdk.Key.F5;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.CtrlF6 : ak.accel_key = (uint)Gdk.Key.F6;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.CtrlF7 : ak.accel_key = (uint)Gdk.Key.F7;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.CtrlF8 : ak.accel_key = (uint)Gdk.Key.F8;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.CtrlF9 : ak.accel_key = (uint)Gdk.Key.F9;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.CtrlF10 : ak.accel_key = (uint)Gdk.Key.F10;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.CtrlF11 : ak.accel_key = (uint)Gdk.Key.F11;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.CtrlF12 : ak.accel_key = (uint)Gdk.Key.F12;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.ShiftDel : widget.AddAccelerator(signal, group, (uint)Gdk.Key.Delete, Gdk.ModifierType.ShiftMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.ShiftIns : widget.AddAccelerator(signal, group, (uint)Gdk.Key.Insert, Gdk.ModifierType.ShiftMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.ShiftDel : ak.accel_key = (uint)Gdk.Key.Delete;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ShiftMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.ShiftIns : ak.accel_key = (uint)Gdk.Key.Insert;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ShiftMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.ShiftF1 : widget.AddAccelerator(signal, group, (uint)Gdk.Key.F1, Gdk.ModifierType.ShiftMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.ShiftF2 : widget.AddAccelerator(signal, group, (uint)Gdk.Key.F2, Gdk.ModifierType.ShiftMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.ShiftF3 : widget.AddAccelerator(signal, group, (uint)Gdk.Key.F4, Gdk.ModifierType.ShiftMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.ShiftF4 : widget.AddAccelerator(signal, group, (uint)Gdk.Key.F4, Gdk.ModifierType.ShiftMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.ShiftF5 : widget.AddAccelerator(signal, group, (uint)Gdk.Key.F5, Gdk.ModifierType.ShiftMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.ShiftF6 : widget.AddAccelerator(signal, group, (uint)Gdk.Key.F6, Gdk.ModifierType.ShiftMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.ShiftF7 : widget.AddAccelerator(signal, group, (uint)Gdk.Key.F7, Gdk.ModifierType.ShiftMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.ShiftF8 : widget.AddAccelerator(signal, group, (uint)Gdk.Key.F8, Gdk.ModifierType.ShiftMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.ShiftF9 : widget.AddAccelerator(signal, group, (uint)Gdk.Key.F9, Gdk.ModifierType.ShiftMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.ShiftF10 : widget.AddAccelerator(signal, group, (uint)Gdk.Key.F10, Gdk.ModifierType.ShiftMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.ShiftF11 : widget.AddAccelerator(signal, group, (uint)Gdk.Key.F11, Gdk.ModifierType.ShiftMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.ShiftF12 : widget.AddAccelerator(signal, group, (uint)Gdk.Key.F12, Gdk.ModifierType.ShiftMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.ShiftF1 : ak.accel_key = (uint)Gdk.Key.F1;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ShiftMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.ShiftF2 : ak.accel_key = (uint)Gdk.Key.F2;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ShiftMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.ShiftF3 : ak.accel_key = (uint)Gdk.Key.F3;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ShiftMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.ShiftF4 : ak.accel_key = (uint)Gdk.Key.F4;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ShiftMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.ShiftF5 : ak.accel_key = (uint)Gdk.Key.F5;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ShiftMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.ShiftF6 : ak.accel_key = (uint)Gdk.Key.F6;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ShiftMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.ShiftF7 : ak.accel_key = (uint)Gdk.Key.F7;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ShiftMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.ShiftF8 : ak.accel_key = (uint)Gdk.Key.F8;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ShiftMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.ShiftF9 : ak.accel_key = (uint)Gdk.Key.F9;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ShiftMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.ShiftF10 : ak.accel_key = (uint)Gdk.Key.F10;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ShiftMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.ShiftF11 : ak.accel_key = (uint)Gdk.Key.F11;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ShiftMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.ShiftF12 : ak.accel_key = (uint)Gdk.Key.F12;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ShiftMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.CtrlShift0 : widget.AddAccelerator(signal, group, (uint)Gdk.Key.KP_0, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.CtrlShift1 : widget.AddAccelerator(signal, group, (uint)Gdk.Key.KP_1, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.CtrlShift2 : widget.AddAccelerator(signal, group, (uint)Gdk.Key.KP_2, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.CtrlShift3 : widget.AddAccelerator(signal, group, (uint)Gdk.Key.KP_3, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.CtrlShift4 : widget.AddAccelerator(signal, group, (uint)Gdk.Key.KP_4, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.CtrlShift5 : widget.AddAccelerator(signal, group, (uint)Gdk.Key.KP_5, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.CtrlShift6 : widget.AddAccelerator(signal, group, (uint)Gdk.Key.KP_6, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.CtrlShift7 : widget.AddAccelerator(signal, group, (uint)Gdk.Key.KP_7, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.CtrlShift8 : widget.AddAccelerator(signal, group, (uint)Gdk.Key.KP_8, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.CtrlShift9 : widget.AddAccelerator(signal, group, (uint)Gdk.Key.KP_9, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.CtrlShift0 : ak.accel_key = (uint)Gdk.Key.KP_0;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.CtrlShift1 : ak.accel_key = (uint)Gdk.Key.KP_1;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.CtrlShift2 : ak.accel_key = (uint)Gdk.Key.KP_2;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.CtrlShift3 : ak.accel_key = (uint)Gdk.Key.KP_3;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.CtrlShift4 : ak.accel_key = (uint)Gdk.Key.KP_4;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.CtrlShift5 : ak.accel_key = (uint)Gdk.Key.KP_5;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.CtrlShift6 : ak.accel_key = (uint)Gdk.Key.KP_6;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.CtrlShift7 : ak.accel_key = (uint)Gdk.Key.KP_7;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.CtrlShift8 : ak.accel_key = (uint)Gdk.Key.KP_8;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.CtrlShift9 : ak.accel_key = (uint)Gdk.Key.KP_9;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.CtrlShiftA : widget.AddAccelerator(signal, group, (uint)Gdk.Key.N, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.CtrlShiftB : widget.AddAccelerator(signal, group, (uint)Gdk.Key.B, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.CtrlShiftC : widget.AddAccelerator(signal, group, (uint)Gdk.Key.C, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.CtrlShiftD : widget.AddAccelerator(signal, group, (uint)Gdk.Key.D, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.CtrlShiftE : widget.AddAccelerator(signal, group, (uint)Gdk.Key.E, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.CtrlShiftF : widget.AddAccelerator(signal, group, (uint)Gdk.Key.F, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.CtrlShiftG : widget.AddAccelerator(signal, group, (uint)Gdk.Key.G, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.CtrlShiftH : widget.AddAccelerator(signal, group, (uint)Gdk.Key.H, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.CtrlShiftI : widget.AddAccelerator(signal, group, (uint)Gdk.Key.I, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.CtrlShiftJ : widget.AddAccelerator(signal, group, (uint)Gdk.Key.J, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.CtrlShiftK : widget.AddAccelerator(signal, group, (uint)Gdk.Key.K, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.CtrlShiftL : widget.AddAccelerator(signal, group, (uint)Gdk.Key.L, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.CtrlShiftM : widget.AddAccelerator(signal, group, (uint)Gdk.Key.M, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.CtrlShiftN : widget.AddAccelerator(signal, group, (uint)Gdk.Key.N, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.CtrlShiftO : widget.AddAccelerator(signal, group, (uint)Gdk.Key.O, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.CtrlShiftP : widget.AddAccelerator(signal, group, (uint)Gdk.Key.P, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.CtrlShiftQ : widget.AddAccelerator(signal, group, (uint)Gdk.Key.Q, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.CtrlShiftR : widget.AddAccelerator(signal, group, (uint)Gdk.Key.R, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.CtrlShiftS : widget.AddAccelerator(signal, group, (uint)Gdk.Key.S, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.CtrlShiftT : widget.AddAccelerator(signal, group, (uint)Gdk.Key.T, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.CtrlShiftU : widget.AddAccelerator(signal, group, (uint)Gdk.Key.U, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.CtrlShiftV : widget.AddAccelerator(signal, group, (uint)Gdk.Key.V, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.CtrlShiftW : widget.AddAccelerator(signal, group, (uint)Gdk.Key.W, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.CtrlShiftX : widget.AddAccelerator(signal, group, (uint)Gdk.Key.X, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.CtrlShiftY : widget.AddAccelerator(signal, group, (uint)Gdk.Key.Y, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.CtrlShiftZ : widget.AddAccelerator(signal, group, (uint)Gdk.Key.Z, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.CtrlShiftA : ak.accel_key = (uint)Gdk.Key.A;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.CtrlShiftB : ak.accel_key = (uint)Gdk.Key.B;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.CtrlShiftC : ak.accel_key = (uint)Gdk.Key.C;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.CtrlShiftD : ak.accel_key = (uint)Gdk.Key.D;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.CtrlShiftE : ak.accel_key = (uint)Gdk.Key.E;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.CtrlShiftF : ak.accel_key = (uint)Gdk.Key.F;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.CtrlShiftG : ak.accel_key = (uint)Gdk.Key.G;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.CtrlShiftH : ak.accel_key = (uint)Gdk.Key.H;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.CtrlShiftI : ak.accel_key = (uint)Gdk.Key.I;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.CtrlShiftJ : ak.accel_key = (uint)Gdk.Key.J;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.CtrlShiftK : ak.accel_key = (uint)Gdk.Key.K;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.CtrlShiftL : ak.accel_key = (uint)Gdk.Key.L;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.CtrlShiftM : ak.accel_key = (uint)Gdk.Key.M;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.CtrlShiftN : ak.accel_key = (uint)Gdk.Key.N;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.CtrlShiftO : ak.accel_key = (uint)Gdk.Key.O;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.CtrlShiftP : ak.accel_key = (uint)Gdk.Key.P;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.CtrlShiftQ : ak.accel_key = (uint)Gdk.Key.Q;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.CtrlShiftR : ak.accel_key = (uint)Gdk.Key.R;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.CtrlShiftS : ak.accel_key = (uint)Gdk.Key.S;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.CtrlShiftT : ak.accel_key = (uint)Gdk.Key.T;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.CtrlShiftU : ak.accel_key = (uint)Gdk.Key.U;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.CtrlShiftV : ak.accel_key = (uint)Gdk.Key.V;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.CtrlShiftW : ak.accel_key = (uint)Gdk.Key.W;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.CtrlShiftX : ak.accel_key = (uint)Gdk.Key.X;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.CtrlShiftY : ak.accel_key = (uint)Gdk.Key.Y;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.CtrlShiftZ : ak.accel_key = (uint)Gdk.Key.Z;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.CtrlShiftF1 : widget.AddAccelerator(signal, group, (uint)Gdk.Key.F1, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.CtrlShiftF2 : widget.AddAccelerator(signal, group, (uint)Gdk.Key.F2, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.CtrlShiftF3 : widget.AddAccelerator(signal, group, (uint)Gdk.Key.F3, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.CtrlShiftF4 : widget.AddAccelerator(signal, group, (uint)Gdk.Key.F4, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.CtrlShiftF5 : widget.AddAccelerator(signal, group, (uint)Gdk.Key.F5, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.CtrlShiftF6 : widget.AddAccelerator(signal, group, (uint)Gdk.Key.F6, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.CtrlShiftF7 : widget.AddAccelerator(signal, group, (uint)Gdk.Key.F7, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.CtrlShiftF8 : widget.AddAccelerator(signal, group, (uint)Gdk.Key.F8, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.CtrlShiftF9 : widget.AddAccelerator(signal, group, (uint)Gdk.Key.F9, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.CtrlShiftF10 : widget.AddAccelerator(signal, group, (uint)Gdk.Key.F10, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.CtrlShiftF11 : widget.AddAccelerator(signal, group, (uint)Gdk.Key.F11, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
- case Shortcut.CtrlShiftF12 : widget.AddAccelerator(signal, group, (uint)Gdk.Key.F12, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.CtrlShiftF1 : ak.accel_key = (uint)Gdk.Key.F1;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.CtrlShiftF2 : ak.accel_key = (uint)Gdk.Key.F2;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.CtrlShiftF3 : ak.accel_key = (uint)Gdk.Key.F3;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.CtrlShiftF4 : ak.accel_key = (uint)Gdk.Key.F4;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.CtrlShiftF5 : ak.accel_key = (uint)Gdk.Key.F5;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.CtrlShiftF6 : ak.accel_key = (uint)Gdk.Key.F6;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.CtrlShiftF7 : ak.accel_key = (uint)Gdk.Key.F7;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.CtrlShiftF8 : ak.accel_key = (uint)Gdk.Key.F8;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.CtrlShiftF9 : ak.accel_key = (uint)Gdk.Key.F9;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.CtrlShiftF10 : ak.accel_key = (uint)Gdk.Key.F10;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.CtrlShiftF11 : ak.accel_key = (uint)Gdk.Key.F11;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
+ case Shortcut.CtrlShiftF12 : ak.accel_key = (uint)Gdk.Key.F12;
+ widget.AddAccelerator(signal, group, ak, Gdk.ModifierType.ShiftMask|Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); break;
// TODO:
// Del = 46,
@@ -339,5 +452,5 @@ namespace System.Windows.Forms{
// AltF12 = 262267,
}
}
- }
+ }
}
diff --git a/mcs/class/System.Windows.Forms/Gtk/StatusBar.cs b/mcs/class/System.Windows.Forms/Gtk/StatusBar.cs
index 047648cf383..37ed7b5694f 100644
--- a/mcs/class/System.Windows.Forms/Gtk/StatusBar.cs
+++ b/mcs/class/System.Windows.Forms/Gtk/StatusBar.cs
@@ -44,7 +44,7 @@ namespace System.Windows.Forms {
}
[MonoTODO]
- internal void ConnectEvents ()
+ internal override void ConnectEvents ()
{
// statusbar.TextPopped +=
// statusbar.TextPushed +=
@@ -122,7 +122,7 @@ namespace System.Windows.Forms {
//FIXME:
[MonoTODO]
- public virtual DockStyle Dock {
+ public override DockStyle Dock {
get {
return dockstyle;
}
diff --git a/mcs/class/System.Windows.Forms/Gtk/TabAlignment.cs b/mcs/class/System.Windows.Forms/Gtk/TabAlignment.cs
new file mode 100644
index 00000000000..20b7dfd068c
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/Gtk/TabAlignment.cs
@@ -0,0 +1,21 @@
+//
+// System.Windows.Forms.TabAlignment.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum TabAlignment {
+ Bottom = 1,
+ Left = 2,
+ Right = 3,
+ Top = 0
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/Gtk/TabAppearance.cs b/mcs/class/System.Windows.Forms/Gtk/TabAppearance.cs
new file mode 100644
index 00000000000..2a173cebe6a
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/Gtk/TabAppearance.cs
@@ -0,0 +1,20 @@
+//
+// System.Windows.Forms.TabAppearance.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum TabAppearance {
+ Buttons = 1,
+ FlatButtons = 2,
+ Normal =0
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/Gtk/TabControl.cs b/mcs/class/System.Windows.Forms/Gtk/TabControl.cs
new file mode 100644
index 00000000000..4be04672703
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/Gtk/TabControl.cs
@@ -0,0 +1,445 @@
+//
+// System.Windows.Forms.TabControl
+//
+// Author:
+// Alberto Fernandez (infjaf00@yahoo.es)
+//
+
+
+using System;
+using System.Drawing;
+using System.Collections;
+using System.ComponentModel;
+
+namespace System.Windows.Forms{
+
+ public class TabControl : Control {
+ [MonoTODO]
+ public TabControl(){
+ }
+
+ //InvalidEnumArgumentException
+ // Pred = top
+ [MonoTODO]
+ public TabAlignment Alignment {
+ get { throw new NotImplementedException(); }
+ set { throw new NotImplementedException(); }
+ }
+ [MonoTODO]
+ public TabAppearance Appearance {
+ get { throw new NotImplementedException(); }
+ set { throw new NotImplementedException(); }
+ }
+ [MonoTODO]
+ public override Color BackColor {
+ get { throw new NotImplementedException(); }
+ set { throw new NotImplementedException(); }
+ }
+ [MonoTODO]
+ public override Image BackgroundImage {
+ get { throw new NotImplementedException(); }
+ set { throw new NotImplementedException(); }
+ }
+ [MonoTODO]
+ protected override CreateParams CreateParams {
+ get { throw new NotImplementedException(); }
+ }
+ [MonoTODO]
+ protected override Size DefaultSize {
+ get { return new Size (200,100); }
+ }
+ [MonoTODO]
+ public override Rectangle DisplayRectangle {
+ get { throw new NotImplementedException(); }
+ }
+ [MonoTODO]
+ public TabDrawMode DrawMode {
+ get { throw new NotImplementedException(); }
+ set { throw new NotImplementedException(); }
+ }
+ [MonoTODO]
+ public override Color ForeColor {
+ get { throw new NotImplementedException(); }
+ set { throw new NotImplementedException(); }
+ }
+ [MonoTODO]
+ public bool HotTrack {
+ get { throw new NotImplementedException(); }
+ set { throw new NotImplementedException(); }
+ }
+ [MonoTODO]
+ public ImageList ImageList {
+ get { throw new NotImplementedException(); }
+ set { throw new NotImplementedException(); }
+ }
+ [MonoTODO]
+ public Size ItemSize {
+ get { throw new NotImplementedException(); }
+ set { throw new NotImplementedException(); }
+ }
+ [MonoTODO]
+ public bool Multiline {
+ get { throw new NotImplementedException(); }
+ set { throw new NotImplementedException(); }
+ }
+ [MonoTODO]
+ public Point Padding {
+ get { throw new NotImplementedException(); }
+ set { throw new NotImplementedException(); }
+ }
+ [MonoTODO]
+ public int RowCount {
+ get { throw new NotImplementedException(); }
+ }
+ [MonoTODO]
+ public int SelectedIndex {
+ get { throw new NotImplementedException(); }
+ set { throw new NotImplementedException(); }
+ }
+ [MonoTODO]
+ public TabPage SelectedTab {
+ get { throw new NotImplementedException(); }
+ set { throw new NotImplementedException(); }
+ }
+ [MonoTODO]
+ public bool ShowToolTips {
+ get { throw new NotImplementedException(); }
+ set { throw new NotImplementedException(); }
+ }
+ [MonoTODO]
+ public TabSizeMode SizeMode {
+ get { throw new NotImplementedException(); }
+ set { throw new NotImplementedException(); }
+ }
+ [MonoTODO]
+ public int TabCount {
+ get { throw new NotImplementedException(); }
+ }
+ [MonoTODO]
+ public TabControl.TabPageCollection TabPages {
+ get { throw new NotImplementedException(); }
+ }
+ [MonoTODO]
+ public override string Text {
+ get { throw new NotImplementedException(); }
+ set { throw new NotImplementedException(); }
+ }
+ [MonoTODO]
+ protected override Control.ControlCollection CreateControlsInstance(){
+ return new TabControl.ControlCollection(this);
+ }
+ [MonoTODO]
+ protected override void CreateHandle(){
+ throw new NotImplementedException();
+ }
+ [MonoTODO]
+ protected override void Dispose(bool disposing){
+ throw new NotImplementedException();
+ }
+
+ // No usar
+ public Control GetControl(int index){
+ throw new NotImplementedException();
+ }
+ protected virtual object[] GetItems(){
+ throw new NotImplementedException();
+ }
+ protected virtual object[] GetItems(Type baseType){
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ public Rectangle GetTabRect(int index){
+ throw new NotImplementedException();
+ }
+
+ // No usar
+ protected string GetToolTipText(object item){
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ protected override bool IsInputKey(Keys keyData){
+ throw new NotImplementedException();
+ }
+ [MonoTODO]
+ protected virtual void OnDrawItem(DrawItemEventArgs e){
+ throw new NotImplementedException();
+ }
+ [MonoTODO]
+ protected override void OnFontChanged(EventArgs e){
+ throw new NotImplementedException();
+ }
+ [MonoTODO]
+ protected override void OnHandleCreated(EventArgs e){
+ throw new NotImplementedException();
+ }
+ [MonoTODO]
+ protected override void OnHandleDestroyed(EventArgs e){
+ throw new NotImplementedException();
+ }
+ [MonoTODO]
+ protected override void OnKeyDown(KeyEventArgs ke){
+ throw new NotImplementedException();
+ }
+ [MonoTODO]
+ protected override void OnResize(EventArgs e){
+ throw new NotImplementedException();
+ }
+ [MonoTODO]
+ protected virtual void OnSelectedIndexChanged(EventArgs e){
+ throw new NotImplementedException();
+ }
+ [MonoTODO]
+ protected override void OnStyleChanged(EventArgs e){
+ throw new NotImplementedException();
+ }
+ [MonoTODO]
+ protected override bool ProcessKeyPreview(ref Message m){
+ throw new NotImplementedException();
+ }
+ [MonoTODO]
+ protected void RemoveAll(){
+ throw new NotImplementedException();
+ }
+
+ public override string ToString(){
+ return "System.Windows.Forms.TabContro, TabPages.Count: " +
+ this.TabPages.Count;
+ //System.Windows.Forms.TabControl, TabPages.Count: 0
+ }
+
+ // No usar
+ protected void UpdateTabSelection( bool uiselected){
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ protected override void WndProc(ref Message m){
+ throw new NotImplementedException();
+ }
+
+
+ public new event EventHandler BackColorChanged;
+ public new event EventHandler BackgroundImageChanged;
+ public event DrawItemEventHandler DrawItem;
+ public new event EventHandler ForeColorChanged;
+ public new event PaintEventHandler Paint;
+ public event EventHandler SelectedIndexChanged;
+ public new event EventHandler TextChanged;
+
+
+ public new class ControlCollection : Control.ControlCollection {
+
+ public ControlCollection ( TabControl owner ): base( owner ){ }
+
+ public override void Add( Control c ) {
+ //if ( !( c is TabPage ) ) {
+ // throw new ArgumentException();
+ //}
+ //base.Add(c);
+ //if ( owner.IsHandleCreated )
+ // ((TabControl) owner).addPage ( c, Count - 1);
+ }
+
+ public override void Clear () {
+ //base.Clear ( );
+ //if ( owner.IsHandleCreated )
+ // ((TabControl) owner).removeAllTabs ( );
+ }
+
+ public override void Remove ( Control value ) {
+ //int index = IndexOf ( value );
+ //base.Remove ( value );
+ //if ( index != -1 && owner.IsHandleCreated )
+ // ((TabControl) owner).removeTab ( value, index );
+ }
+ }
+
+
+ public class TabPageCollection : IList, ICollection, IEnumerable {
+ TabControl owner;
+ Control.ControlCollection collection;
+
+ public TabPageCollection( TabControl owner ) {
+ this.owner = owner;
+ collection = owner.Controls;
+ }
+
+ public int Count {
+ get { return collection.Count; }
+ }
+
+ public bool IsReadOnly {
+ get { return collection.IsReadOnly; }
+ }
+
+ [MonoTODO]
+ public virtual TabPage this[int index] {
+ get { return collection[ index ] as TabPage; }
+ set {
+ //( (IList)collection )[ index ] = value;
+ //owner.update ( );
+ }
+ }
+
+ public void Add(TabPage value) {
+ collection.Add ( value );
+ }
+
+ public void AddRange( TabPage[] pages ) {
+ collection.AddRange ( pages );
+ }
+
+ public virtual void Clear() {
+ collection.Clear ( );
+ }
+
+ public bool Contains( TabPage page ) {
+ return collection.Contains ( page );
+ }
+
+ public IEnumerator GetEnumerator() {
+ return collection.GetEnumerator ( );
+ }
+
+ public int IndexOf( TabPage page ) {
+ return collection.IndexOf ( page );
+ }
+
+ public void Remove( TabPage value ) {
+ collection.Remove ( value );
+ }
+
+ public void RemoveAt(int index) {
+ collection.RemoveAt ( index );
+ }
+
+ /// <summary>
+ /// IList Interface implmentation.
+ /// </summary>
+ bool IList.IsReadOnly{
+ get{ return this.IsReadOnly; }
+ }
+
+ bool IList.IsFixedSize{
+ get{ return (( IList )collection).IsFixedSize; }
+ }
+
+ object IList.this[int index]{
+ get{ return collection [ index ]; }
+ set{
+ //if ( ! (value is TabPage) )
+ // throw new ArgumentException ( );
+ //this[ index ] = (TabPage) value;
+ //owner.update ( );
+ }
+ }
+
+ void IList.Clear(){
+ this.Clear ( );
+ }
+
+ [MonoTODO]
+ int IList.Add( object value ) {
+ TabPage page = value as TabPage;
+ if ( page == null )
+ throw new ArgumentException ( );
+ this.Add ( page );
+ return this.IndexOf ( page );
+ }
+
+ [MonoTODO]
+ bool IList.Contains( object value ){
+ return this.Contains ( value as TabPage );
+ }
+
+ [MonoTODO]
+ int IList.IndexOf( object value ){
+ return this.IndexOf ( value as TabPage );
+ }
+
+ [MonoTODO]
+ void IList.Insert(int index, object value){
+ //if ( ! (value is TabPage) )
+ // throw new ArgumentException ( );
+
+ //(( IList )collection).Insert ( index, value );
+ //owner.update ( );
+ }
+
+ void IList.Remove( object value ){
+ this.Remove ( value as TabPage );
+ }
+
+ void IList.RemoveAt( int index){
+ this.RemoveAt ( index );
+ }
+ // End of IList interface
+
+ /// <summary>
+ /// ICollection Interface implmentation.
+ /// </summary>
+ int ICollection.Count{
+ get{ return this.Count; }
+ }
+
+ bool ICollection.IsSynchronized{
+ get{ return ( (ICollection) collection).IsSynchronized; }
+ }
+
+ object ICollection.SyncRoot{
+ get{ return ( (ICollection) collection).SyncRoot; }
+ }
+
+ void ICollection.CopyTo(Array array, int index){
+ ( (ICollection) collection ).CopyTo ( array, index );
+ }
+ // End Of ICollection
+ }
+
+ /*
+ [MonoTODO]
+ public class TabControl.ControlCollection : Control.ControlCollection {
+ public TabControl.ControlCollection(TabControl owner);
+
+ public override void Add(Control value);
+ public override void Remove(Control value);
+
+ }*/
+ /*
+ [MonoTODO]
+ public class TabControl.TabPageCollection : IList, ICollection, IEnumerable{
+
+ public TabControl.TabPageCollection(TabControl owner);
+ public virtual int Count {get;}
+ public virtual bool IsReadOnly {get;}
+ public virtual TabPage this[int index] {get; set;}
+ int ICollection.Count {get;}
+ bool ICollection.IsSynchronized {get;}
+ object ICollection.SyncRoot {get;}
+ bool IList.IsFixedSize {get;}
+ bool IList.IsReadOnly {get;}
+ object IList.this[ int index] {get; set;}
+
+ public void Add( TabPage value);
+ public void AddRange( TabPage[] pages);
+ public virtual void Clear();
+ public bool Contains( TabPage page);
+ public virtual IEnumerator GetEnumerator();
+ void ICollection.CopyTo(Array dest, int index);
+ int IList.Add( object value);
+ bool IList.Contains(object page);
+ int IList.IndexOf( object page);
+ void IList.Insert(int index, object value);
+ void IList.Remove( object value);
+ public int IndexOf( TabPage page);
+ public void Remove( TabPage value);
+ public virtual void RemoveAt(int index);
+
+
+ }*/
+
+ }
+
+}
diff --git a/mcs/class/System.Windows.Forms/Gtk/TabDrawMode.cs b/mcs/class/System.Windows.Forms/Gtk/TabDrawMode.cs
new file mode 100644
index 00000000000..7f8f11ef4c8
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/Gtk/TabDrawMode.cs
@@ -0,0 +1,17 @@
+//
+// System.Windows.Forms.TabDrawMode.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ public enum TabDrawMode {
+ Normal = 0,
+ OwnerDrawFixed =1
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/Gtk/TabPage.cs b/mcs/class/System.Windows.Forms/Gtk/TabPage.cs
new file mode 100644
index 00000000000..42624c13ab3
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/Gtk/TabPage.cs
@@ -0,0 +1,111 @@
+//
+// System.Windows.Forms.TabPage
+//
+// Author:
+// Alberto Fernandez (infjaf00@yahoo.es)
+//
+
+using System;
+using System.Drawing;
+using System.Collections;
+using System.ComponentModel;
+
+namespace System.Windows.Forms{
+
+ public class TabPage : Panel{
+ [MonoTODO]
+ public TabPage() : this (""){
+ }
+ [MonoTODO]
+ public TabPage(string text){
+ this.Text = text;
+ }
+ [MonoTODO]
+ public override AnchorStyles Anchor {
+ get { throw new NotImplementedException(); }
+ set { throw new NotImplementedException(); }
+ }
+ [MonoTODO]
+ public override DockStyle Dock {
+ get { throw new NotImplementedException(); }
+ set { throw new NotImplementedException(); }
+ }
+ [MonoTODO]
+ public new bool Enabled {
+ get { throw new NotImplementedException(); }
+ set { throw new NotImplementedException(); }
+ }
+ [MonoTODO]
+ public int ImageIndex {
+ get { throw new NotImplementedException(); }
+ set { throw new NotImplementedException(); }
+ }
+
+ //No usar
+ public new int TabIndex {
+ get { throw new NotImplementedException(); }
+ set { throw new NotImplementedException(); }
+ }
+ public new bool TabStop {
+ get { throw new NotImplementedException(); }
+ set { throw new NotImplementedException(); }
+ }
+
+ [MonoTODO]
+ public override string Text {
+ get { throw new NotImplementedException(); }
+ set { throw new NotImplementedException(); }
+ }
+ [MonoTODO]
+ public string ToolTipText {
+ get { throw new NotImplementedException(); }
+ set { throw new NotImplementedException(); }
+ }
+
+ //No usar
+ public new bool Visible {
+ get { throw new NotImplementedException(); }
+ set { throw new NotImplementedException(); }
+ }
+
+ [MonoTODO]
+ protected override ControlCollection CreateControlsInstance(){
+ return new TabPageControlCollection(this);
+ }
+ [MonoTODO]
+ public static TabPage GetTabPageOfComponent(object comp){
+ throw new NotImplementedException();
+ }
+ [MonoTODO]
+ protected override void SetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified){
+ throw new NotImplementedException();
+ }
+ public override string ToString(){
+ return "TabPage: {" + Text + "}";
+ }
+
+ public new event EventHandler DockChanged;
+ public new event EventHandler EnabledChanged;
+ public new event EventHandler TabIndexChanged;
+ public new event EventHandler TabStopChanged;
+ public new event EventHandler VisibleChanged;
+
+ public class TabPageControlCollection : ControlCollection {
+ public TabPageControlCollection ( Control owner ): base( owner ){ }
+
+ public override void Add( Control c ) {
+ if ( c is TabPage ) {
+ throw new ArgumentException();
+ }
+ base.Add(c);
+ }
+ }
+
+
+ /*[MonoTODO]
+ public class TabPage.TabPageControlCollection : Control.ControlCollection{
+ public TabPage.TabPageControlCollection( TabPage owner);
+ public override void Add(Control value);
+ }*/
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/Gtk/TabSizeMode.cs b/mcs/class/System.Windows.Forms/Gtk/TabSizeMode.cs
new file mode 100644
index 00000000000..b8bd053207a
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/Gtk/TabSizeMode.cs
@@ -0,0 +1,20 @@
+//
+// System.Windows.Forms.TabSizeMode.cs
+//
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Windows.Forms {
+
+ /// <summary>
+ /// </summary>
+ public enum TabSizeMode {
+ FillToRight = 1,
+ Fixed = 2,
+ Normal = 0
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/Gtk/TextBoxBase.cs b/mcs/class/System.Windows.Forms/Gtk/TextBoxBase.cs
index a7e7fe2b73b..a841f3bd603 100644
--- a/mcs/class/System.Windows.Forms/Gtk/TextBoxBase.cs
+++ b/mcs/class/System.Windows.Forms/Gtk/TextBoxBase.cs
@@ -285,8 +285,8 @@ namespace System.Windows.Forms {
public void Select(int start, int length)
{
Gtk.TextIter iter_start, iter_end;
- TextBuffer.GetIterAtOffset (out iter_start, start);
- TextBuffer.GetIterAtOffset (out iter_end, length);
+ iter_start = TextBuffer.GetIterAtOffset (start);
+ iter_end = TextBuffer.GetIterAtOffset (length);
TextBuffer.MoveMark(TextBuffer.InsertMark , iter_end);
TextBuffer.MoveMark (TextBuffer.SelectionBound, iter_start);
diff --git a/mcs/class/System.Windows.Forms/Gtk/Timer.cs b/mcs/class/System.Windows.Forms/Gtk/Timer.cs
index 5e330869ac2..30fe9a2809d 100644
--- a/mcs/class/System.Windows.Forms/Gtk/Timer.cs
+++ b/mcs/class/System.Windows.Forms/Gtk/Timer.cs
@@ -57,11 +57,9 @@ namespace System.Windows.Forms{
public event EventHandler Tick;
- protected virtual void OnTick(EventArgs e)
- {
+ protected virtual void OnTick(EventArgs e){
if ( Tick != null )
Tick ( this, e );
- //Application.DoEvents();
}
protected override void Dispose( bool disposing ) {
Enabled = false;
diff --git a/mcs/class/System.Windows.Forms/Gtk/VScrollBar.cs b/mcs/class/System.Windows.Forms/Gtk/VScrollBar.cs
index 9fbf3245ee4..bbf50c3bdff 100644
--- a/mcs/class/System.Windows.Forms/Gtk/VScrollBar.cs
+++ b/mcs/class/System.Windows.Forms/Gtk/VScrollBar.cs
@@ -6,10 +6,12 @@
// (C) 2002 Ximian, Inc. http://www.ximian.com
//
+using System.Drawing;
+
namespace System.Windows.Forms {
public class VScrollBar : ScrollBar {
- private Gtk.VScrollbar bar;
+
private RightToLeft rightToLeft;
// --- Properties ---
@@ -27,14 +29,24 @@ namespace System.Windows.Forms {
}
internal override Gtk.Widget CreateWidget () {
- return bar;
+ return new Gtk.VScrollbar ( adj );
}
// --- Constructor ---
- public VScrollBar() : base ()
- {
- this.bar = new Gtk.VScrollbar ( adj );
+ public VScrollBar() : base (){
rightToLeft = RightToLeft.Inherit;
}
+ protected override Size DefaultSize{
+ get{ return new System.Drawing.Size (17,80); }
+ }
+ public override string ToString(){
+ String ret = String.Format (
+ "System.Windows.Forms.VScrollBar, " +
+ "Minimum: {0}, Maximum: {1}, Value: {2}",
+ this.Minimum,
+ this.Maximum,
+ this.Value);
+ return ret;
+ }
}
}
diff --git a/mcs/class/System.Windows.Forms/SWFTest/.cvsignore b/mcs/class/System.Windows.Forms/SWFTest/.cvsignore
new file mode 100644
index 00000000000..2e47af6b72e
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/SWFTest/.cvsignore
@@ -0,0 +1,5 @@
+SWFTest.pdb
+list
+.makefrag
+.response
+library-deps.stamp
diff --git a/mcs/class/System.Windows.Forms/System.Resources/ResXResourceReader.cs b/mcs/class/System.Windows.Forms/System.Resources/ResXResourceReader.cs
index 0b4518cea3a..b1a18329fed 100644
--- a/mcs/class/System.Windows.Forms/System.Resources/ResXResourceReader.cs
+++ b/mcs/class/System.Windows.Forms/System.Resources/ResXResourceReader.cs
@@ -91,6 +91,11 @@ namespace System.Resources
string v = reader.Value;
return v;
}
+ else if (reader.NodeType == XmlNodeType.EndElement && reader.Value == string.Empty)
+ {
+ string v = reader.Value;
+ return v;
+ }
}
return null;
}
diff --git a/mcs/class/System.XML/ChangeLog b/mcs/class/System.XML/ChangeLog
index 58383c3cbcd..894f25647d4 100644
--- a/mcs/class/System.XML/ChangeLog
+++ b/mcs/class/System.XML/ChangeLog
@@ -1,3 +1,15 @@
+2004-01-14 Atsushi Enomoto <atsushi@ximian.com>
+
+ * System.Xml.dll.sources : added SchemaDataValueType.cs
+
+2004-01-07 Nick Drochak <ndrochak@ieee.org>
+
+ * Makefile: Don't hide behind the /nowarns. Fix them.
+
+2004-01-06 Atsushi Enomoto <atsushi@ximian.com>
+
+ * Makefile : use /noconfig like System.dll (to erase make test warning)
+
2003-12-18 Lluis Sanchez Gual <lluis@ximian.com>
* System.Xml_test.dll.sources : Added test files
diff --git a/mcs/class/System.XML/Makefile b/mcs/class/System.XML/Makefile
index 79745b1104e..2ca8ea7879d 100644
--- a/mcs/class/System.XML/Makefile
+++ b/mcs/class/System.XML/Makefile
@@ -4,7 +4,13 @@ include ../../build/rules.make
LIBRARY = System.Xml.dll
-LIB_MCS_FLAGS = /unsafe /r:$(corlib) /r:System.dll /nowarn:649 /nowarn:169
+ifeq ($(PROFILE),atomic)
+SCARY_LIB=
+else
+SCARY_LIB=/lib:$(prefix)/lib /noconfig
+endif
+
+LIB_MCS_FLAGS = $(SCARY_LIB) /unsafe /r:$(corlib) /r:System.dll
TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
EXTRA_DISTFILES = \
diff --git a/mcs/class/System.XML/Mono.Xml.Schema/ChangeLog b/mcs/class/System.XML/Mono.Xml.Schema/ChangeLog
index a427226eef7..ab8099a6701 100644
--- a/mcs/class/System.XML/Mono.Xml.Schema/ChangeLog
+++ b/mcs/class/System.XML/Mono.Xml.Schema/ChangeLog
@@ -1,3 +1,76 @@
+2004-01-26 Atsushi Enomoto <atsushi@ximian.com>
+
+ * XsdParticleValidationState.cs :
+ - Now it uses ContentTypeParticle as inputs, so no GroupRef
+ should occur anymore.
+ - xs:any should use ResolvedProcessContents. It fixes some errors.
+ * XsdValidatingReader.cs :
+ - Attribute wildcard validation should use ResolvedProcessContents.
+ - Use newly added XmlResolver field to resolve external schemas
+ specified by xsi:schemaLocation attributes.
+ - Added warning handler and raise warning events when instance-
+ specified schemas could not be resolved.
+ - xs:anyType should not be treated as a primitive datatype at
+ xsi:type resolution.
+ - Schema type was incorrectly remained when the element is laxly
+ validated.
+
+2004-01-21 Atsushi Enomoto <atsushi@ximian.com>
+
+ * XsdKeyTable.cs : Matching evaluation is incorrect when path is more
+ than depth 2.
+ * XsdValidatingReader.cs : Should clear LocalTypeDefinition when no
+ xsi:type was specified.
+ Moved character validation inside AssessEndElementSchemaValidity().
+
+2004-01-20 Atsushi Enomoto <atsushi@ximian.com>
+
+ * XsdParticleValidationState.cs : Use ValidatedMaxOccurs instead of
+ MaxOccurs. (in the meantime)
+ * XsdValidatingReader.cs : "fixed" should not be treated as default.
+ * XsdWildcard.cs : several Wildcard Subset constraint related fixes.
+
+2004-01-15 Atsushi Enomoto <atsushi@ximian.com>
+
+ * XsdValidatingReader.cs : Now use ValidatableParticle instead of
+ ContentTypeParticle. Use BaseXmlSchemaType.
+
+2004-01-14 Atsushi Enomoto <atsushi@ximian.com>
+
+ * XsdIdentityState.cs :
+ Now takes xsi:nil value into consideration for comparison.
+ nsname:* was not handled correctly.
+ Reject complexType as key value type (it is dynamic instance error).
+ * XsdKeyTable.cs : remoed unused code.
+ * XsdValidatingReader.cs :
+ ID comparison was not done.
+ {final} value of attribute definition was not used for default value.
+ Get xsi:nil value from non-default value.
+
+2004-01-13 Atsushi Enomoto <atsushi@ximian.com>
+
+ * XsdValidatingReader.cs :
+ Dependent change with XmlSchemaElement internal property.
+
+2004-01-13 Atsushi Enomoto <atsushi@ximian.com>
+
+ * XsdValidatingReader.cs : Throw exception only in case of errors.
+
+2004-01-08 Lluis Sanchez Gual <lluis@ximian.com>
+
+ * XsdValidatingReader.cs: In MoveToAttribute(name), if "name" is a default
+ attribute, search for the attribute ignoring the namespace. This matches
+ MS.NET behavior (and fixes bug #52557).
+
+2004-01-08 Atsushi Enomoto <atsushi@ximian.com>
+
+ * XsdValidatingReader.cs : Fixed in reflection to
+ XmlSchemaObjectTableGetEnumerator.Value change.
+
+2004-01-08 Nick Drochak <ndrochak@ieee.org>
+
+ * XsdParticleValidationState.cs: Remove unreachable code.
+
2003-12-18 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
* XsdValidatingReader.cs : When source Reader has schema context, it
diff --git a/mcs/class/System.XML/Mono.Xml.Schema/XsdIdentityState.cs b/mcs/class/System.XML/Mono.Xml.Schema/XsdIdentityState.cs
index d32f575fb98..fc53918735a 100644
--- a/mcs/class/System.XML/Mono.Xml.Schema/XsdIdentityState.cs
+++ b/mcs/class/System.XML/Mono.Xml.Schema/XsdIdentityState.cs
@@ -40,6 +40,7 @@ namespace Mono.Xml.Schema
public XsdAnySimpleType FieldType;
public object Identity;
+ public bool IsXsiNil;
public int FieldFoundDepth;
public XsdIdentityPath FieldFoundPath;
@@ -48,12 +49,14 @@ namespace Mono.Xml.Schema
public bool Consumed;
// Return false if there is already the same key.
- public bool SetIdentityField (object identity, XsdAnySimpleType type, XsdValidatingReader reader)
+ public bool SetIdentityField (object identity, bool isXsiNil, XsdAnySimpleType type, XsdValidatingReader reader)
{
IXmlLineInfo li = reader as IXmlLineInfo;
FieldFoundDepth = reader.Depth;
Identity = identity;
+ IsXsiNil = isXsiNil;
+ FieldFound |= isXsiNil;
FieldType = type;
Consuming = false;
Consumed = true;
@@ -119,7 +122,8 @@ namespace Mono.Xml.Schema
XmlQualifiedName qname = (XmlQualifiedName) qnameStack [entry.StartDepth + iter + 1];
if (step.NsName != null && qname.Namespace == step.NsName)
continue;
- if (step.Name == qname.Name && step.Namespace == qname.Namespace)
+ if ((step.Name == "*" || step.Name == qname.Name) &&
+ step.Namespace == qname.Namespace)
continue;
else
break;
@@ -172,7 +176,7 @@ namespace Mono.Xml.Schema
object identity = reader.ReadTypedValue ();
if (identity == null)
identity = reader.Value;
- if (!this.SetIdentityField (identity, dt as XsdAnySimpleType, reader))
+ if (!this.SetIdentityField (identity, reader.Depth - 1 == reader.XsiNilDepth , dt as XsdAnySimpleType, reader))
throw new XmlSchemaException ("Two or more identical field was found.",
reader, reader.BaseURI, entry.KeySequence.SourceSchemaIdentity, null);
// HACK: This is not logical. Attributes never be cosuming,
@@ -337,6 +341,8 @@ namespace Mono.Xml.Schema
for (int i = 0; i < KeyFields.Count; i++) {
XsdKeyEntryField f = this.KeyFields [i];
XsdKeyEntryField of = other.KeyFields [i];
+ if (f.IsXsiNil && !of.IsXsiNil || !f.IsXsiNil && of.IsXsiNil)
+ return false;
if (!XmlSchemaUtil.IsSchemaDatatypeEquals (
of.FieldType, of.Identity, f.FieldType, f.Identity))
return false; // does not match
@@ -362,17 +368,26 @@ namespace Mono.Xml.Schema
keyField.Consuming = false;
}
if (!keyField.Consumed) {
- keyField.FieldFound = true;
- keyField.FieldFoundPath = path;
- keyField.FieldFoundDepth = reader.Depth;
- keyField.Consuming = true;
- IXmlLineInfo li = reader as IXmlLineInfo;
- if (li != null && li.HasLineInfo ()) {
- keyField.FieldHasLineInfo = true;
- keyField.FieldLineNumber = li.LineNumber;
- keyField.FieldLinePosition = li.LinePosition;
- }
- reader.CurrentKeyFieldConsumers.Add (keyField);
+ if (reader.XsiNilDepth == reader.Depth && !keyField.SetIdentityField (Guid.Empty, true, XsdAnySimpleType.Instance, reader))
+ throw new XmlSchemaException ("Two or more identical field was found.", reader, reader.BaseURI, KeySequence.SourceSchemaIdentity, null);
+ else {
+ XmlSchemaComplexType ct = reader.SchemaType as XmlSchemaComplexType;
+ if (ct != null &&
+ (ct.ContentType == XmlSchemaContentType.Empty || ct.ContentType == XmlSchemaContentType.ElementOnly) &&
+ reader.SchemaType != XmlSchemaComplexType.AnyType)
+ throw new XmlSchemaException ("Specified schema type is complex type, which is not allowed for identity constraints.", reader, reader.BaseURI, KeySequence.SourceSchemaIdentity, null);
+ keyField.FieldFound = true;
+ keyField.FieldFoundPath = path;
+ keyField.FieldFoundDepth = reader.Depth;
+ keyField.Consuming = true;
+ IXmlLineInfo li = reader as IXmlLineInfo;
+ if (li != null && li.HasLineInfo ()) {
+ keyField.FieldHasLineInfo = true;
+ keyField.FieldLineNumber = li.LineNumber;
+ keyField.FieldLinePosition = li.LinePosition;
+ }
+ reader.CurrentKeyFieldConsumers.Add (keyField);
+ }
}
}
}
diff --git a/mcs/class/System.XML/Mono.Xml.Schema/XsdKeyTable.cs b/mcs/class/System.XML/Mono.Xml.Schema/XsdKeyTable.cs
index 35d66a671ed..2fe7452ee35 100644
--- a/mcs/class/System.XML/Mono.Xml.Schema/XsdKeyTable.cs
+++ b/mcs/class/System.XML/Mono.Xml.Schema/XsdKeyTable.cs
@@ -17,13 +17,6 @@ namespace Mono.Xml.Schema
// Created per constraining element.
public class XsdKeyTable
{
- /*
- private ArrayList entries = new ArrayList ();
- private ArrayList finishedEntries = new ArrayList ();
- private XsdKeyEntry [] cachedEntries;
- private XsdKeyEntry [] cachedFinishedEntries;
- */
-
private XsdIdentitySelector selector;
private XmlSchemaIdentityConstraint source;
private XmlQualifiedName qname;
@@ -40,24 +33,6 @@ namespace Mono.Xml.Schema
Reset (source, reader);
}
- /*
- public XsdKeyEntry [] Entries {
- get {
- if (cachedEntries == null)
- cachedEntries = entries.ToArray (typeof (XsdKeyEntry)) as XsdKeyEntry [];
- return cachedEntries;
- }
- }
-
- public XsdKeyEntry [] FinishedEntries {
- get {
- if (cachedFinishedEntries == null)
- cachedFinishedEntries = finishedEntries.ToArray (typeof (XsdKeyEntry)) as XsdKeyEntry [];
- return cachedFinishedEntries;
- }
- }
- */
-
public XmlQualifiedName QualifiedName {
get { return qname; }
}
@@ -112,8 +87,8 @@ namespace Mono.Xml.Schema
iter--;
XsdIdentityStep step;
- for (int x = 0; x <= iter; x++, iter--) {
- step = path.OrderedSteps [iter - x];
+ for (int x = 0; 0 <= iter; x++, iter--) {
+ step = path.OrderedSteps [iter];
if (step.IsAnyName)
continue;
XmlQualifiedName qname = (XmlQualifiedName) qnameStack [qnameStack.Count - x - 1];
diff --git a/mcs/class/System.XML/Mono.Xml.Schema/XsdParticleValidationState.cs b/mcs/class/System.XML/Mono.Xml.Schema/XsdParticleValidationState.cs
index 934905bfda2..94ab3ea2df3 100644
--- a/mcs/class/System.XML/Mono.Xml.Schema/XsdParticleValidationState.cs
+++ b/mcs/class/System.XML/Mono.Xml.Schema/XsdParticleValidationState.cs
@@ -67,8 +67,6 @@ namespace Mono.Xml.Schema
switch (typeName) {
case "XmlSchemaElement":
return AddElement ((XmlSchemaElement) xsobj);
- case "XmlSchemaGroupRef":
- return AddGroup ((XmlSchemaGroupRef) xsobj);
case "XmlSchemaSequence":
return AddSequence ((XmlSchemaSequence) xsobj);
case "XmlSchemaChoice":
@@ -77,11 +75,11 @@ namespace Mono.Xml.Schema
return AddAll ((XmlSchemaAll) xsobj);
case "XmlSchemaAny":
return AddAny ((XmlSchemaAny) xsobj);
- case "EmptyParticle": // Microsoft.NET
- case "XmlSchemaParticleEmpty": // Mono
+ case "EmptyParticle":
return AddEmpty ();
default:
- throw new InvalidOperationException (); // Should not occur.
+ // GroupRef should not appear
+ throw new InvalidOperationException ("Should not occur.");
}
}
@@ -96,42 +94,30 @@ namespace Mono.Xml.Schema
private XsdElementValidationState AddElement (XmlSchemaElement element)
{
XsdElementValidationState got = new XsdElementValidationState (element, this);
-// table [element] = got;
- return got;
- }
-
- private XsdGroupValidationState AddGroup (XmlSchemaGroupRef groupRef)
- {
- XsdGroupValidationState got = new XsdGroupValidationState (groupRef, this);
-// table [groupRef] = got;
return got;
}
private XsdSequenceValidationState AddSequence (XmlSchemaSequence sequence)
{
XsdSequenceValidationState got = new XsdSequenceValidationState (sequence, this);
-// table [sequence] = got;
return got;
}
private XsdChoiceValidationState AddChoice (XmlSchemaChoice choice)
{
XsdChoiceValidationState got = new XsdChoiceValidationState (choice, this);
-// table [choice] = got;
return got;
}
private XsdAllValidationState AddAll (XmlSchemaAll all)
{
XsdAllValidationState got = new XsdAllValidationState (all, this);
-// table [all] = got;
return got;
}
private XsdAnyValidationState AddAny (XmlSchemaAny any)
{
XsdAnyValidationState got = new XsdAnyValidationState (any, this);
-// table [any] = got;
return got;
}
@@ -167,10 +153,10 @@ namespace Mono.Xml.Schema
this.manager = manager;
}
- // Normally checks MaxOccurs boundary
+ // Normally checks Max Occurs boundary
public abstract XsdValidationState EvaluateStartElement (string localName, string ns);
- // Normally checks MinOccurs boundary
+ // Normally checks Min Occurs boundary
public abstract bool EvaluateEndElement ();
internal abstract bool EvaluateIsEmptiable ();
@@ -256,46 +242,6 @@ namespace Mono.Xml.Schema
}
}
- public class XsdGroupValidationState : XsdValidationState
- {
- public XsdGroupValidationState (XmlSchemaGroupRef groupRef, XsdValidationStateManager manager)
- : base (manager)
- {
- this.groupRef = groupRef;
- }
-
- XmlSchemaGroupRef groupRef;
-
- // Methods
-
- public override XsdValidationState EvaluateStartElement (string name, string ns)
- {
- XsdValidationState xa = Manager.Create (groupRef.Particle);
- XsdValidationState result = xa.EvaluateStartElement (name, ns);
- if (result == XsdValidationState.Invalid)
- return result;
-
- OccuredInternal++;
- if (OccuredInternal > groupRef.MaxOccurs)
- return XsdValidationState.Invalid;
- return Manager.MakeSequence (result, this);
- }
-
- public override bool EvaluateEndElement ()
- {
- if (groupRef.ValidatedMinOccurs > Occured + 1)
- return false;
- else if (groupRef.ValidatedMinOccurs <= Occured)
- return true;
- return Manager.Create (groupRef.Particle).EvaluateIsEmptiable ();
- }
-
- internal override bool EvaluateIsEmptiable ()
- {
- return (groupRef.ValidatedMinOccurs <= Occured);
- }
- }
-
public class XsdSequenceValidationState : XsdValidationState
{
XmlSchemaSequence seq;
@@ -380,7 +326,6 @@ namespace Mono.Xml.Schema
xa = null;
}
}
- return XsdValidationState.Invalid;
}
public override bool EvaluateEndElement ()
@@ -559,7 +504,7 @@ namespace Mono.Xml.Schema
if (all.CompiledItems.Count == consumed.Count)
return true;
foreach (XmlSchemaElement el in all.CompiledItems)
- if (el.MinOccurs > 0 && !consumed.Contains (el))
+ if (el.ValidatedMinOccurs > 0 && !consumed.Contains (el))
return false;
return true;
}
@@ -569,7 +514,7 @@ namespace Mono.Xml.Schema
if (all.Emptiable || all.ValidatedMinOccurs == 0)
return true;
foreach (XmlSchemaElement el in all.CompiledItems)
- if (el.MinOccurs > 0 && !consumed.Contains (el))
+ if (el.ValidatedMinOccurs > 0 && !consumed.Contains (el))
return false;
return true;
}
@@ -592,7 +537,7 @@ namespace Mono.Xml.Schema
return XsdValidationState.Invalid;
OccuredInternal++;
- Manager.SetProcessContents (any.ProcessContents);
+ Manager.SetProcessContents (any.ResolvedProcessContents);
if (Occured > any.ValidatedMaxOccurs)
return XsdValidationState.Invalid;
else if (Occured == any.ValidatedMaxOccurs)
diff --git a/mcs/class/System.XML/Mono.Xml.Schema/XsdValidatingReader.cs b/mcs/class/System.XML/Mono.Xml.Schema/XsdValidatingReader.cs
index db283f84a8f..e0227bc3733 100644
--- a/mcs/class/System.XML/Mono.Xml.Schema/XsdValidatingReader.cs
+++ b/mcs/class/System.XML/Mono.Xml.Schema/XsdValidatingReader.cs
@@ -27,6 +27,7 @@ namespace Mono.Xml.Schema
XmlReader reader;
XmlValidatingReader xvReader;
+ XmlResolver resolver;
IHasXmlSchemaInfo sourceReaderSchemaInfo;
IXmlLineInfo readerLineInfo;
bool laxElementValidation = true;
@@ -34,7 +35,7 @@ namespace Mono.Xml.Schema
XmlSchemaCollection schemas = new XmlSchemaCollection ();
bool namespaces = true;
- ArrayList idList = new ArrayList ();
+ Hashtable idList = new Hashtable ();
ArrayList missingIDReferences = new ArrayList ();
string thisElementId;
@@ -98,6 +99,10 @@ namespace Mono.Xml.Schema
// Public Non-overrides
+ public int XsiNilDepth {
+ get { return xsiNilDepth; }
+ }
+
public bool Namespaces {
get { return namespaces; }
set { namespaces = value; }
@@ -107,6 +112,13 @@ namespace Mono.Xml.Schema
get { return reader; }
}
+ // This is required to resolve xsi:schemaLocation
+ public XmlResolver XmlResolver {
+ set {
+ resolver = value;
+ }
+ }
+
// This should be changed before the first Read() call.
public XmlSchemaCollection Schemas {
get { return schemas; }
@@ -126,7 +138,6 @@ namespace Mono.Xml.Schema
else
return SourceReaderSchemaType;
case XmlNodeType.Attribute:
- // TODO: Default attribute support
XmlSchemaComplexType ct = context.ActualType as XmlSchemaComplexType;
if (ct != null) {
XmlSchemaAttribute attdef = ct.AttributeUses [CurrentQName] as XmlSchemaAttribute;
@@ -193,6 +204,46 @@ namespace Mono.Xml.Schema
return null;
}
+ /*
+ public ValueType ReadTypedValueType ()
+ {
+ XmlSchemaDatatype dt = SchemaType as XmlSchemaDatatype;
+ XmlSchemaSimpleType st = SchemaType as XmlSchemaSimpleType;
+ if (st != null)
+ dt = st.Datatype;
+ if (dt == null)
+ return null;
+
+ switch (NodeType) {
+ case XmlNodeType.Element:
+ if (IsEmptyElement)
+ return null;
+
+ storedCharacters.Length = 0;
+ bool loop = true;
+ do {
+ Read ();
+ switch (NodeType) {
+ case XmlNodeType.SignificantWhitespace:
+ case XmlNodeType.Text:
+ case XmlNodeType.CDATA:
+ storedCharacters.Append (Value);
+ break;
+ case XmlNodeType.Comment:
+ break;
+ default:
+ loop = false;
+ break;
+ }
+ } while (loop && !EOF);
+ return dt.ParseValueType (storedCharacters.ToString (), NameTable, ParserContext.NamespaceManager);
+ case XmlNodeType.Attribute:
+ return dt.ParseValueType (Value, NameTable, ParserContext.NamespaceManager);
+ }
+ return null;
+ }
+ */
+
public ValidationEventHandler ValidationEventHandler;
// Public Overrided Properties
@@ -361,7 +412,10 @@ namespace Mono.Xml.Schema
get {
if (currentDefaultAttribute < 0)
return reader.Value;
- return defaultAttributes [currentDefaultAttribute].ValidatedDefaultValue;
+ string value = defaultAttributes [currentDefaultAttribute].ValidatedDefaultValue;
+ if (value == null)
+ value = defaultAttributes [currentDefaultAttribute].ValidatedFixedValue;
+ return value;
}
}
@@ -375,7 +429,10 @@ namespace Mono.Xml.Schema
int idx = this.FindDefaultAttribute ("lang", XmlNamespaceManager.XmlnsXml);
if (idx < 0)
return null;
- return defaultAttributes [idx].ValidatedDefaultValue;
+ xmlLang = defaultAttributes [idx].ValidatedDefaultValue;
+ if (xmlLang == null)
+ xmlLang = defaultAttributes [idx].ValidatedFixedValue;
+ return xmlLang;
}
}
@@ -387,7 +444,10 @@ namespace Mono.Xml.Schema
int idx = this.FindDefaultAttribute ("space", XmlNamespaceManager.XmlnsXml);
if (idx < 0)
return XmlSpace.None;
- return (XmlSpace) Enum.Parse (typeof (XmlSpace), defaultAttributes [idx].ValidatedDefaultValue, false);
+ string spaceSpec = defaultAttributes [idx].ValidatedDefaultValue;
+ if (spaceSpec == null)
+ spaceSpec = defaultAttributes [idx].ValidatedFixedValue;
+ return (XmlSpace) Enum.Parse (typeof (XmlSpace), spaceSpec, false);
}
}
@@ -410,27 +470,37 @@ namespace Mono.Xml.Schema
private void HandleError (string error, Exception innerException)
{
+ HandleError (error, innerException, false);
+ }
+
+ private void HandleError (string error, Exception innerException, bool isWarning)
+ {
if (reportNoValidationError) // extra quick check
return;
XmlSchemaException schemaException = new XmlSchemaException (error,
this, this.BaseURI, null, innerException);
- HandleError (schemaException);
+ HandleError (schemaException, isWarning);
}
private void HandleError (XmlSchemaException schemaException)
{
+ HandleError (schemaException, false);
+ }
+
+ private void HandleError (XmlSchemaException schemaException, bool isWarning)
+ {
if (reportNoValidationError)
return;
ValidationEventArgs e = new ValidationEventArgs (schemaException,
- schemaException.Message, XmlSeverityType.Error);
+ schemaException.Message, isWarning ? XmlSeverityType.Warning : XmlSeverityType.Error);
if (this.ValidationEventHandler != null)
this.ValidationEventHandler (this, e);
else if (xvReader != null)
xvReader.OnValidationEvent (this, e);
- else
+ else if (e.Severity == XmlSeverityType.Error)
#if NON_MONO_ENV
this.xvReader.OnValidationEvent (this, e);
#else
@@ -504,15 +574,16 @@ namespace Mono.Xml.Schema
if (storedCharacters.Length == 0) {
// 3.3.4 Element Locally Valid (Element) 5.1.2
// TODO: check entire DefaultValid (3.3.6)
- if (context.Element != null && context.Element.ValidatedDefaultValue != null)
- value = context.Element.ValidatedDefaultValue;
+ if (context.Element != null) {
+ if (context.Element.ValidatedDefaultValue != null)
+ value = context.Element.ValidatedDefaultValue;
+ }
}
XmlSchemaDatatype dt = context.ActualType as XmlSchemaDatatype;
XmlSchemaSimpleType st = context.ActualType as XmlSchemaSimpleType;
if (dt == null) {
if (st != null) {
-// if (st.Variety == XmlSchemaDerivationMethod.Restriction)
dt = st.Datatype;
} else {
XmlSchemaComplexType ct = context.ActualType as XmlSchemaComplexType;
@@ -539,7 +610,7 @@ namespace Mono.Xml.Schema
XsdKeyEntryField field = this.currentKeyFieldConsumers [0] as XsdKeyEntryField;
if (field.Identity != null)
HandleError ("Two or more identical field was found. Former value is '" + field.Identity + "' .");
- object identity = null;
+ object identity = null; // This means empty value
if (dt != null) {
try {
identity = dt.ParseValue (value, NameTable, ParserContext.NamespaceManager);
@@ -549,8 +620,8 @@ namespace Mono.Xml.Schema
}
if (identity == null)
identity = value;
-
- if (!field.SetIdentityField (identity, dt as XsdAnySimpleType, this))
+
+ if (!field.SetIdentityField (identity, reader.Depth == xsiNilDepth, dt as XsdAnySimpleType, this))
HandleError ("Two or more identical key value was found: '" + value + "' .");
this.currentKeyFieldConsumers.RemoveAt (0);
}
@@ -631,7 +702,7 @@ namespace Mono.Xml.Schema
* be restriction?
* */
// mmm, will check later.
- XmlSchemaSimpleType baseType = str.ActualBaseSchemaType as XmlSchemaSimpleType;
+ XmlSchemaSimpleType baseType = st.BaseXmlSchemaType as XmlSchemaSimpleType;
if (baseType != null) {
AssessStringValid(baseType, dt, normalized);
}
@@ -657,12 +728,10 @@ namespace Mono.Xml.Schema
{
object xsiType = null;
XmlQualifiedName typeQName = QualifyName (name);
- if (typeQName.Namespace == XmlSchema.Namespace) {
- if (typeQName.Name == "anyType")
- xsiType = XmlSchemaComplexType.AnyType;
- else
- xsiType = XmlSchemaDatatype.FromName (typeQName);
- }
+ if (typeQName == XmlSchemaComplexType.AnyTypeName)
+ xsiType = XmlSchemaComplexType.AnyType;
+ else if (XmlSchemaUtil.IsBuiltInDatatypeName (typeQName))
+ xsiType = XmlSchemaDatatype.FromName (typeQName);
else
xsiType = FindType (typeQName);
return xsiType;
@@ -727,11 +796,12 @@ namespace Mono.Xml.Schema
}
// If validation state exists, then first assess particle validity.
+ context.SchemaType = null;
if (context.ParticleState != null) {
ValidateStartElementParticle ();
}
- string xsiNilValue = GetAttribute ("nil", XmlSchema.InstanceNamespace);
+ string xsiNilValue = reader.GetAttribute ("nil", XmlSchema.InstanceNamespace);
if (xsiNilValue != null)
xsiNilValue = xsiNilValue.Trim (XmlChar.WhitespaceChars);
bool isXsiNil = xsiNilValue == "true";
@@ -774,6 +844,8 @@ namespace Mono.Xml.Schema
}
}
}
+ else
+ context.LocalTypeDefinition = null;
// Create Validation Root, if not exist.
// [Schema Validity Assessment (Element) 1.1]
@@ -810,7 +882,7 @@ namespace Mono.Xml.Schema
// Finally, create child particle state.
XmlSchemaComplexType xsComplexType = SchemaType as XmlSchemaComplexType;
if (xsComplexType != null)
- childParticleState = stateManager.Create (xsComplexType.ContentTypeParticle);
+ childParticleState = stateManager.Create (xsComplexType.ValidatableParticle);
else if (stateManager.ProcessContents == XmlSchemaContentProcessing.Lax)
childParticleState = stateManager.Create (XmlSchemaAny.AnyTypeContent);
else
@@ -829,10 +901,10 @@ namespace Mono.Xml.Schema
if (element == null)
HandleError ("Element declaration is required for " + qname);
// 2.
- if (element.actualIsAbstract)
+ if (element.ActualIsAbstract)
HandleError ("Abstract element declaration was specified for " + qname);
// 3.1.
- if (!element.actualIsNillable && xsiNilValue != null)
+ if (!element.ActualIsNillable && xsiNilValue != null)
HandleError ("This element declaration is not nillable: " + qname);
// 3.2.
// Note that 3.2.1 xsi:nil constraints are to be validated in
@@ -848,6 +920,8 @@ namespace Mono.Xml.Schema
context.LocalTypeDefinition = GetLocalTypeDefinition (xsiType);
AssessLocalTypeDerivationOK (context.LocalTypeDefinition, element.ElementType, element.BlockResolved);
}
+ else
+ context.LocalTypeDefinition = null;
// 5 Not all things cannot be assessed here.
// It is common to 5.1 and 5.2
@@ -937,13 +1011,16 @@ namespace Mono.Xml.Schema
// Collect default attributes.
// 4.
// FIXME: FixedValue check maybe extraneous.
- foreach (XmlSchemaAttribute attr in cType.AttributeUses) {
+ foreach (DictionaryEntry entry in cType.AttributeUses) {
+ XmlSchemaAttribute attr = (XmlSchemaAttribute) entry.Value;
if (reader [attr.QualifiedName.Name, attr.QualifiedName.Namespace] == null) {
if (attr.ValidatedUse == XmlSchemaUse.Required &&
attr.ValidatedFixedValue == null)
HandleError ("Required attribute " + attr.QualifiedName + " was not found.");
else if (attr.ValidatedDefaultValue != null)
defaultAttributesCache.Add (attr);
+ else if (attr.ValidatedFixedValue != null)
+ defaultAttributesCache.Add (attr);
}
}
defaultAttributes = (XmlSchemaAttribute [])
@@ -982,14 +1059,16 @@ namespace Mono.Xml.Schema
if (!AttributeWildcardItemValid (cType.AttributeWildcard, qname))
return null;
- if (cType.AttributeWildcard.ProcessContents == XmlSchemaContentProcessing.Skip)
+ if (cType.AttributeWildcard.ResolvedProcessContents == XmlSchemaContentProcessing.Skip)
return cType.AttributeWildcard;
foreach (XmlSchema schema in schemas) {
- foreach (XmlSchemaAttribute attr in schema.Attributes)
+ foreach (DictionaryEntry entry in schema.Attributes) {
+ XmlSchemaAttribute attr = (XmlSchemaAttribute) entry.Value;
if (attr.QualifiedName == qname)
return attr;
+ }
}
- if (cType.AttributeWildcard.ProcessContents == XmlSchemaContentProcessing.Lax)
+ if (cType.AttributeWildcard.ResolvedProcessContents == XmlSchemaContentProcessing.Lax)
return cType.AttributeWildcard;
else
return null;
@@ -1017,7 +1096,7 @@ namespace Mono.Xml.Schema
string normalized = dt.Normalize (reader.Value);
object parsedValue = null;
try {
- dt.ParseValue (normalized, reader.NameTable, this.ParserContext.NamespaceManager);
+ parsedValue = dt.ParseValue (normalized, reader.NameTable, this.ParserContext.NamespaceManager);
} catch (Exception ex) { // FIXME: (wishlist) It is bad manner ;-(
HandleError ("Attribute value is invalid against its data type " + dt.TokenizedType, ex);
}
@@ -1053,7 +1132,10 @@ namespace Mono.Xml.Schema
if (thisElementId != null)
HandleError ("ID type attribute was already assigned in the containing element.");
thisElementId = normalized;
- idList.Add (normalized);
+ if (idList.Contains (normalized))
+ HandleError ("Duplicate ID value was found.");
+ else
+ idList.Add (normalized, normalized);
break;
case XmlTokenizedType.IDREF:
if (missingIDReferences.Contains (normalized))
@@ -1087,7 +1169,10 @@ namespace Mono.Xml.Schema
childParticleState = context.ParticleState;
ValidateEndElementParticle (); // validate against childrens' state.
- context.Load (reader.Depth);
+ if (shouldValidateCharacters) {
+ ValidateEndCharacters ();
+ shouldValidateCharacters = false;
+ }
// 3.3.4 Assess ElementLocallyValidElement 5: value constraints.
// 3.3.4 Assess ElementLocallyValidType 3.1.3. = StringValid(3.14.4)
@@ -1125,7 +1210,6 @@ namespace Mono.Xml.Schema
for (int i = 0; i < keyTables.Count; i++) {
XsdKeyTable keyseq = this.keyTables [i] as XsdKeyTable;
if (keyseq.StartDepth == reader.Depth) {
-//Console.WriteLine ("Finishing table.");
keyTables.RemoveAt (i);
i--;
}
@@ -1299,10 +1383,12 @@ namespace Mono.Xml.Schema
private string GetDefaultAttribute (string localName, string ns)
{
int idx = this.FindDefaultAttribute (localName, ns);
- if (idx >= 0)
- return defaultAttributes [idx].ValidatedDefaultValue;
- else
+ if (idx < 0)
return null;
+ string value = defaultAttributes [idx].ValidatedDefaultValue;
+ if (value == null)
+ value = defaultAttributes [idx].ValidatedFixedValue;
+ return value;
}
private int FindDefaultAttribute (string localName, string ns)
@@ -1310,7 +1396,7 @@ namespace Mono.Xml.Schema
for (int i = 0; i < this.defaultAttributes.Length; i++) {
XmlSchemaAttribute attr = defaultAttributes [i];
if (attr.QualifiedName.Name == localName &&
- attr.QualifiedName.Namespace == ns)
+ (ns == null || attr.QualifiedName.Namespace == ns))
return i;
}
return -1;
@@ -1366,8 +1452,7 @@ namespace Mono.Xml.Schema
return true;
}
- XmlQualifiedName qname = SplitQName (name);
- return MoveToDefaultAttribute (qname.Name, qname.Namespace);
+ return MoveToDefaultAttribute (name, null);
}
public override bool MoveToAttribute (string localName, string ns)
@@ -1476,11 +1561,13 @@ namespace Mono.Xml.Schema
if (tmp.Length % 2 != 0)
HandleError ("Invalid schemaLocation attribute format.");
for (int i = 0; i < tmp.Length; i += 2) {
+ Uri absUri = null;
try {
- Uri absUri = new Uri ((this.BaseURI != "" ? new Uri (BaseURI) : null), tmp [i + 1]);
+ absUri = new Uri ((this.BaseURI != "" ? new Uri (BaseURI) : null), tmp [i + 1]);
XmlTextReader xtr = new XmlTextReader (absUri.ToString ());
schema = XmlSchema.Read (xtr, null);
} catch (Exception) { // FIXME: (wishlist) It is bad manner ;-(
+ HandleError ("Could not resolve schema location URI: " + absUri, null, true);
continue;
}
if (schema.TargetNamespace == null)
@@ -1491,7 +1578,7 @@ namespace Mono.Xml.Schema
}
if (schema != null) {
try {
- schemas.Add (schema);
+ schemas.Add (schema, resolver);
} catch (XmlSchemaException ex) {
HandleError (ex);
}
@@ -1499,17 +1586,20 @@ namespace Mono.Xml.Schema
schema = null;
string noNsSchemaLocation = reader.GetAttribute ("noNamespaceSchemaLocation", XmlSchema.InstanceNamespace);
if (noNsSchemaLocation != null) {
+ Uri absUri = null;
try {
- Uri absUri = new Uri ((this.BaseURI != "" ? new Uri (BaseURI) : null), noNsSchemaLocation);
+ absUri = new Uri ((this.BaseURI != "" ? new Uri (BaseURI) : null), noNsSchemaLocation);
XmlTextReader xtr = new XmlTextReader (absUri.ToString ());
schema = XmlSchema.Read (xtr, null);
} catch (Exception) { // FIXME: (wishlist) It is bad manner ;-(
+ HandleError ("Could not resolve schema location URI: " + absUri, null, true);
}
if (schema != null && schema.TargetNamespace != null)
HandleError ("Specified schema has different target namespace.");
}
if (schema != null) {
try {
+ schema.Compile (ValidationEventHandler, resolver);
schemas.Add (schema);
} catch (XmlSchemaException ex) {
HandleError (ex);
@@ -1550,7 +1640,6 @@ namespace Mono.Xml.Schema
if (schemas.Count == 0)
break;
-// context.Load (reader.Depth);
if (skipValidationDepth < 0 || reader.Depth <= skipValidationDepth) {
if (shouldValidateCharacters) {
ValidateEndCharacters ();
@@ -1571,14 +1660,10 @@ namespace Mono.Xml.Schema
if (reader.Depth == skipValidationDepth) {
skipValidationDepth = -1;
context.Clear ();
- } else {
-// context.Load (reader.Depth);
- if (shouldValidateCharacters) {
- ValidateEndCharacters ();
- shouldValidateCharacters = false;
- }
- AssessEndElementSchemaValidity ();
}
+ else
+ AssessEndElementSchemaValidity ();
+
storedCharacters.Length = 0;
childParticleState = null;
popContext = true;
diff --git a/mcs/class/System.XML/Mono.Xml.Schema/XsdWildcard.cs b/mcs/class/System.XML/Mono.Xml.Schema/XsdWildcard.cs
index aa084e18757..79de0b5b36a 100644
--- a/mcs/class/System.XML/Mono.Xml.Schema/XsdWildcard.cs
+++ b/mcs/class/System.XML/Mono.Xml.Schema/XsdWildcard.cs
@@ -173,45 +173,71 @@ namespace Mono.Xml.Schema
internal void ValidateWildcardSubset (XsdWildcard other,
ValidationEventHandler h, XmlSchema schema)
{
+ ValidateWildcardSubset (other, h, schema, true);
+ }
+
+ internal bool ValidateWildcardSubset (XsdWildcard other,
+ ValidationEventHandler h, XmlSchema schema, bool raiseError)
+ {
// 1.
if (other.HasValueAny)
- return;
+ return true;
+ // 2.
if (HasValueOther && other.HasValueOther) {
- // 2.1 and 2.2
- if (TargetNamespace == other.TargetNamespace ||
- other.TargetNamespace == null || other.TargetNamespace == "")
- return;
+ // 2.1 and 2.2
+ if (TargetNamespace == other.TargetNamespace ||
+ other.TargetNamespace == null || other.TargetNamespace == "")
+ return true;
+ }
+ // 3.1. (not)
+ if (this.HasValueAny) {
+ if (raiseError)
+ xsobj.error (h, "Invalid wildcard subset was found.");
+ return false;
}
- // 3.1.
- if (this.HasValueAny)
- xsobj.error (h, "Invalid wildcard subset was found.");
// 3.2
if (other.HasValueOther) {
// 3.2.2
- if (other.TargetNamespace == null || other.TargetNamespace == String.Empty)
- return;
- else {
- foreach (string ns in ResolvedNamespaces)
+ if ( (this.HasValueTargetNamespace && other.TargetNamespace == this.TargetNamespace) ||
+ (this.HasValueLocal && (other.TargetNamespace == null || other.TargetNamespace.Length == 0)) ) {
+ if (raiseError)
+ xsobj.error (h, "Invalid wildcard subset was found.");
+ return false;
+ } else {
+ foreach (string ns in ResolvedNamespaces) {
if (ns == other.TargetNamespace) {
- xsobj.error (h, "Invalid wildcard subset was found.");
- return;
+ if (raiseError)
+ xsobj.error (h, "Invalid wildcard subset was found.");
+ return false;
}
+ }
}
} else {
// 3.2.1
- if (!other.HasValueLocal && HasValueLocal) {
- xsobj.error (h, "Invalid wildcard subset was found.");
- return;
- } else if (ResolvedNamespaces.Count == 0) {
- return;
+ if ((this.HasValueLocal && !other.HasValueLocal) ||
+ this.HasValueTargetNamespace && !other.HasValueTargetNamespace) {
+ if (raiseError)
+ xsobj.error (h, "Invalid wildcard subset was found.");
+ return false;
+ } else if (this.HasValueOther) {
+// if (
+// (other.HasValueLocal && !(this.TargetNamespace == null || this.TargetNamespace.Length == 0)) ||
+// other.ResolvedNamespaces.Count > 1 ||
+// other.ResolvedNamespaces.Count == 1 && other.ResolvedNamespaces [0] != other.TargetNamespace) {
+ if (raiseError)
+ xsobj.error (h, "Invalid wildcard subset was found.");
+ return false;
+// }
} else {
foreach (string ns in ResolvedNamespaces)
if (!other.ResolvedNamespaces.Contains (ns)) {
- xsobj.error (h, "Invalid wildcard subset was found.");
- return;
+ if (raiseError)
+ xsobj.error (h, "Invalid wildcard subset was found.");
+ return false;
}
}
}
+ return true;
}
}
}
diff --git a/mcs/class/System.XML/Mono.Xml.XPath/ChangeLog b/mcs/class/System.XML/Mono.Xml.XPath/ChangeLog
index b17fd4d09af..56504699f70 100644
--- a/mcs/class/System.XML/Mono.Xml.XPath/ChangeLog
+++ b/mcs/class/System.XML/Mono.Xml.XPath/ChangeLog
@@ -1,3 +1,18 @@
+2004-01-27 Atsushi Enomoto <atsushi@ximian.com>
+
+ * DTMXPathDocumentBuilder.cs : Namespace nodes are incorrectly created.
+ This fix should make XPathDocument compatible with XmlDocument.
+
+2004-01-26 Atsushi Enomoto <atsushi@ximian.com>
+
+ * DTMXPathDocument.cs : CreateNavigator() should return the first root
+ as a clone.
+ * DTMXPathNavigator.cs : ComparePosition() incorrectly compared
+ attributes and namespaces orders. Implemented IsSamePosition() more
+ efficient. MoveToFirstNamespace() should return false when the
+ current node is either attribute or namespace. Fixed IsDescendant()
+ which looks resulted in incorrect behavior.
+
2003-12-18 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
* DTMXPathDocumentBuilder.cs : Removed supportsID argument and always
diff --git a/mcs/class/System.XML/Mono.Xml.XPath/DTMXPathDocument.cs b/mcs/class/System.XML/Mono.Xml.XPath/DTMXPathDocument.cs
index 182d1a29525..5849b430624 100644
--- a/mcs/class/System.XML/Mono.Xml.XPath/DTMXPathDocument.cs
+++ b/mcs/class/System.XML/Mono.Xml.XPath/DTMXPathDocument.cs
@@ -45,9 +45,8 @@ namespace Mono.Xml.XPath
attributes,
namespaces,
idTable);
- return root;
- } else
- return root.Clone ();
+ }
+ return root.Clone ();
}
#endregion
diff --git a/mcs/class/System.XML/Mono.Xml.XPath/DTMXPathDocumentBuilder.cs b/mcs/class/System.XML/Mono.Xml.XPath/DTMXPathDocumentBuilder.cs
index 8e021d948b8..5989f2c1658 100644
--- a/mcs/class/System.XML/Mono.Xml.XPath/DTMXPathDocumentBuilder.cs
+++ b/mcs/class/System.XML/Mono.Xml.XPath/DTMXPathDocumentBuilder.cs
@@ -83,6 +83,7 @@ namespace Mono.Xml.XPath
int prevSibling;
int position;
+ int lastNsInScope;
bool skipRead = false;
public DTMXPathDocument CreateDocument ()
@@ -116,6 +117,7 @@ namespace Mono.Xml.XPath
AddNode (0, 0, 0, 0, -1, 0, XPathNodeType.Root, xmlReader.BaseURI, false, "", "", "", "", "", 1, 0, 0);
this.nodeIndex = 1;
+ this.lastNsInScope = 1;
this.requireFirstChildFill = true;
while (!xmlReader.EOF)
@@ -232,6 +234,9 @@ namespace Mono.Xml.XPath
int firstAttributeIndex = 0;
int lastNsIndexInCurrent = 0;
+ while (namespaces [lastNsInScope].DeclaredElement == previousSibling) {
+ lastNsInScope = namespaces [lastNsInScope].NextNamespace;
+ }
// process namespaces and attributes.
if (xmlReader.MoveToFirstAttribute ()) {
@@ -247,8 +252,6 @@ namespace Mono.Xml.XPath
"" : xmlReader.LocalName,
xmlReader.Value);
namespaces [nsIndex].NextNamespace = nextTmp;
-// if (lastNsIndexInCurrent == 0)
-// nodes [nodeIndex].FirstNamespace = nsIndex;
lastNsIndexInCurrent = nsIndex;
} else {
// add attribute node.
@@ -284,6 +287,9 @@ namespace Mono.Xml.XPath
xmlReader.MoveToElement ();
}
+ if (lastNsIndexInCurrent > 0)
+ lastNsInScope = nsIndex;
+
AddNode (parent,
firstAttributeIndex,
attributeIndex,
@@ -298,7 +304,7 @@ namespace Mono.Xml.XPath
xmlReader.Prefix,
"", // Element has no internal value.
xmlReader.XmlLang,
- nsIndex,
+ lastNsInScope,
lineInfo != null ? lineInfo.LineNumber : 0,
lineInfo != null ? lineInfo.LinePosition : 0);
if (!xmlReader.IsEmptyElement)
@@ -332,13 +338,11 @@ namespace Mono.Xml.XPath
public void AddNode (int parent, int firstAttribute, int attributeEnd, int previousSibling, int depth, int position, XPathNodeType nodeType, string baseUri, bool isEmptyElement, string localName, string ns, string prefix, string value, string xmlLang, int namespaceNode, int lineNumber, int linePosition)
{
if (nodes.Length < nodeIndex + 1) {
-// if (nodes.Length >= nodeCapacity) {
- nodeCapacity *= 2;
- SetNodeArrayLength (nodeCapacity);
-// }
+ nodeCapacity *= 2;
+ SetNodeArrayLength (nodeCapacity);
}
- DTMXPathLinkedNode curNode = nodes [nodeIndex];// = new DTMXPathLinkedNode ();
+ DTMXPathLinkedNode curNode = nodes [nodeIndex];
nodes [nodeIndex].FirstChild = 0; // dummy
nodes [nodeIndex].Parent = parent;
nodes [nodeIndex].FirstAttribute = firstAttribute;
@@ -363,13 +367,11 @@ namespace Mono.Xml.XPath
public void AddAttribute (int ownerElement, string localName, string ns, string prefix, string value, object schemaType, int lineNumber, int linePosition)
{
if (attributes.Length < attributeIndex + 1) {
-// if (attributes.Length >= attributeCapacity) {
- attributeCapacity *= 2;
- SetAttributeArrayLength (attributeCapacity);
-// }
+ attributeCapacity *= 2;
+ SetAttributeArrayLength (attributeCapacity);
}
- DTMXPathAttributeNode attr = attributes [attributeIndex];// = new DTMXPathAttributeNode ();
+ DTMXPathAttributeNode attr = attributes [attributeIndex];
attributes [attributeIndex].OwnerElement = ownerElement;
attributes [attributeIndex].LocalName = localName;
attributes [attributeIndex].NamespaceURI = ns;
@@ -384,13 +386,11 @@ namespace Mono.Xml.XPath
public void AddNsNode (int declaredElement, string name, string ns)
{
if (namespaces.Length < nsIndex + 1) {
-// if (namespaces.Length >= nsCapacity) {
- nsCapacity *= 2;
- SetNsArrayLength (nsCapacity);
-// }
+ nsCapacity *= 2;
+ SetNsArrayLength (nsCapacity);
}
- DTMXPathNamespaceNode nsNode = namespaces [nsIndex];// = new DTMXPathNamespaceNode ();
+ DTMXPathNamespaceNode nsNode = namespaces [nsIndex];
namespaces [nsIndex].DeclaredElement = declaredElement;
namespaces [nsIndex].Name = name;
namespaces [nsIndex].Namespace = ns;
diff --git a/mcs/class/System.XML/Mono.Xml.XPath/DTMXPathNavigator.cs b/mcs/class/System.XML/Mono.Xml.XPath/DTMXPathNavigator.cs
index ecf531cf446..72eda096591 100644
--- a/mcs/class/System.XML/Mono.Xml.XPath/DTMXPathNavigator.cs
+++ b/mcs/class/System.XML/Mono.Xml.XPath/DTMXPathNavigator.cs
@@ -243,22 +243,31 @@ namespace Mono.Xml.XPath
if (another == null || another.document != this.document)
return XmlNodeOrder.Unknown;
- int result = this.currentNode.CompareTo (another.currentNode);
- if (result != 0)
- return result > 0 ? XmlNodeOrder.After : XmlNodeOrder.Before;
+ if (currentNode > another.currentNode)
+ return XmlNodeOrder.After;
+ else if (currentNode < another.currentNode)
+ return XmlNodeOrder.Before;
// another may attr or ns,
// and this may be also attr or ns.
if (another.currentIsAttr) {
if (this.currentIsAttr) {
- int resultAttr = this.currentAttr.CompareTo (another.currentAttr);
- return result == 0 ? XmlNodeOrder.Same : result > 0 ? XmlNodeOrder.After : XmlNodeOrder.Before;
+ if (currentAttr > another.currentAttr)
+ return XmlNodeOrder.After;
+ else if (currentAttr < another.currentAttr)
+ return XmlNodeOrder.Before;
+ else
+ return XmlNodeOrder.Same;
} else
return XmlNodeOrder.Before;
} else if (!another.currentIsNode) {
if (!this.currentIsNode) {
- int resultNs = this.currentNs.CompareTo (another.currentNs);
- return result == 0 ? XmlNodeOrder.Same : result > 0 ? XmlNodeOrder.After : XmlNodeOrder.Before;
+ if (currentNs > another.currentNs)
+ return XmlNodeOrder.After;
+ else if (currentNs < another.currentNs)
+ return XmlNodeOrder.Before;
+ else
+ return XmlNodeOrder.Same;
} else
return XmlNodeOrder.Before;
} else
@@ -310,18 +319,31 @@ namespace Mono.Xml.XPath
if (another == null || another.document != this.document)
return false;
- if (ComparePosition (another) != XmlNodeOrder.After)
- return false;
-
- int end = nodes [currentNode].NextSibling;
- if (end == 0)
- end = nodes.Length;
- return another.currentNode < end;
+ // Maybe we can improve here more efficiently by
+ // comparing node indices.
+ if (another.currentNode == currentNode)
+ return !another.currentIsNode;
+ int tmp = nodes [another.currentNode].Parent;
+ while (tmp != 0) {
+ if (tmp == currentNode)
+ return true;
+ tmp = nodes [tmp].Parent;
+ }
+ return false;
}
public override bool IsSamePosition (XPathNavigator other)
{
- return ComparePosition (other) == XmlNodeOrder.Same;
+ DTMXPathNavigator another = other as DTMXPathNavigator;
+
+ if (another == null || another.document != this.document)
+ return false;
+
+ return this.currentNode == another.currentNode &&
+ this.currentAttr == another.currentAttr &&
+ this.currentIsAttr == another.currentIsAttr &&
+ this.currentIsNode == another.currentIsNode &&
+ this.currentNs == another.currentNs;
}
public override bool MoveTo (XPathNavigator other)
@@ -424,6 +446,8 @@ namespace Mono.Xml.XPath
public override bool MoveToFirstNamespace (
XPathNamespaceScope namespaceScope)
{
+ if (!currentIsNode)
+ return false;
int cur = nodes [currentNode].FirstNamespace;
return moveToSpecifiedNamespace (cur, namespaceScope);
}
@@ -442,24 +466,6 @@ namespace Mono.Xml.XPath
return false;
}
- /*
- // This is extension for XPath 2.0
- public virtual bool MoveToKeyRef (string key, string value)
- {
- Hashtable idTable = keyRefTable [key] as Hashtable;
- if (idTable == null)
- return false;
- if (!idTable.ContainsKey (key))
- return false;
-
- int target = (int) idTable [key];
- currentNode = target;
- currentIsNode = true;
- currentIsAttr = false;
- return true;
- }
- */
-
private void moveToNamespace (int nsNode)
{
currentIsNode = currentIsAttr = false;
@@ -530,8 +536,6 @@ namespace Mono.Xml.XPath
return false;
currentNode = parent;
- currentIsNode = true;
- currentIsAttr = false;
return true;
}
diff --git a/mcs/class/System.XML/Mono.Xml.Xsl.Operations/ChangeLog b/mcs/class/System.XML/Mono.Xml.Xsl.Operations/ChangeLog
index d03444b07d5..d4eab3bbc59 100644
--- a/mcs/class/System.XML/Mono.Xml.Xsl.Operations/ChangeLog
+++ b/mcs/class/System.XML/Mono.Xml.Xsl.Operations/ChangeLog
@@ -1,3 +1,19 @@
+2004-01-27 Atsushi Enomoto <atsushi@ximian.com>
+
+ * XslIf.cs : When content is empty, skip content evaluation.
+
+2004-01-14 Atsushi Enomoto <atsushi@ximian.com>
+
+ * XslVariable.cs : Use new GenericOutputter.ctor() to indicate it is
+ created for variable. (It is required not to output "PI for xmldecl"
+ incorrectly.)
+ * XslNumber.cs : trivial code refactoring.
+ * XslCopy.cs : comment out WriteLine().
+
+2004-01-08 Nick Drochak <ndrochak@ieee.org>
+
+ * XslAttribute.cs: Removed unused variable
+
2003-12-20 Atsushi Enomoto <atsushi@ximian.com>
* XslLiteralElement.cs : considering xsl:imports, we have to evaluate
diff --git a/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslAttribute.cs b/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslAttribute.cs
index 4b00cd09039..73fa2188860 100644
--- a/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslAttribute.cs
+++ b/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslAttribute.cs
@@ -82,7 +82,7 @@ namespace Mono.Xml.Xsl.Operations {
public override void Evaluate (XslTransformProcessor p)
{
- string nm, nmsp, localName, prefix;
+ string nm, nmsp, prefix;
nm = calcName != null ? calcName : name.Evaluate (p);
nmsp = calcNs != null ? calcNs : ns != null ? ns.Evaluate (p) : String.Empty;
diff --git a/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslCopy.cs b/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslCopy.cs
index 40d3d2d7ebc..0cd30cd16f1 100644
--- a/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslCopy.cs
+++ b/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslCopy.cs
@@ -104,7 +104,7 @@ namespace Mono.Xml.Xsl.Operations {
break;
default:
- Console.WriteLine ("unhandled node type {0}", p.CurrentNode.NodeType);
+// Console.WriteLine ("unhandled node type {0}", p.CurrentNode.NodeType);
break;
}
}
diff --git a/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslIf.cs b/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslIf.cs
index d6b14f610c7..0e300b2abae 100644
--- a/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslIf.cs
+++ b/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslIf.cs
@@ -36,7 +36,8 @@ namespace Mono.Xml.Xsl.Operations {
public bool EvaluateIfTrue (XslTransformProcessor p)
{
if (p.EvaluateBoolean (test)) {
- children.Evaluate (p);
+ if (children != null)
+ children.Evaluate (p);
return true;
}
return false;
diff --git a/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslNumber.cs b/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslNumber.cs
index 8e1f9de5718..65b9fdd903a 100644
--- a/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslNumber.cs
+++ b/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslNumber.cs
@@ -82,14 +82,14 @@ namespace Mono.Xml.Xsl.Operations {
XslNumberFormatter GetNumberFormatter (XslTransformProcessor p)
{
- string format = "1";
+ string formatStr = "1";
string lang = null;
string letterValue = null;
char groupingSeparatorChar = '\0';
int groupingSize = 0;
if (this.format != null)
- format = this.format.Evaluate (p);
+ formatStr = this.format.Evaluate (p);
if (this.lang != null)
lang = this.lang.Evaluate (p);
@@ -103,7 +103,7 @@ namespace Mono.Xml.Xsl.Operations {
if (this.groupingSize != null)
groupingSize = int.Parse (this.groupingSize.Evaluate (p));
- return new XslNumberFormatter (format, lang, letterValue, groupingSeparatorChar, groupingSize);
+ return new XslNumberFormatter (formatStr, lang, letterValue, groupingSeparatorChar, groupingSize);
}
string GetFormat (XslTransformProcessor p)
@@ -456,7 +456,6 @@ namespace Mono.Xml.Xsl.Operations {
string number = num.ToString ("N", nfi);
int len = decimalSectionLength;
if (len > 1) {
- // It is hack, but in most case it will work.
if (numberBuilder == null)
numberBuilder = new StringBuilder ();
for (int i = len; i > number.Length; i--)
diff --git a/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslVariable.cs b/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslVariable.cs
index b374df2e3d8..c052d400b44 100644
--- a/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslVariable.cs
+++ b/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslVariable.cs
@@ -51,7 +51,7 @@ namespace Mono.Xml.Xsl.Operations {
return p.Evaluate (select);
} else if (content != null) {
XmlNodeWriter w = new XmlNodeWriter (false);
- Outputter outputter = new GenericOutputter(w, p.Outputs);
+ Outputter outputter = new GenericOutputter(w, p.Outputs, null, true);
p.PushOutput (outputter);
content.Evaluate (p);
p.PopOutput ();
diff --git a/mcs/class/System.XML/Mono.Xml.Xsl/ChangeLog b/mcs/class/System.XML/Mono.Xml.Xsl/ChangeLog
index 05d10753ba9..33387e66fa5 100644
--- a/mcs/class/System.XML/Mono.Xml.Xsl/ChangeLog
+++ b/mcs/class/System.XML/Mono.Xml.Xsl/ChangeLog
@@ -1,3 +1,33 @@
+2004-01-16 Atsushi Enomoto <atsushi@ximian.com>
+
+ * XslOutput.cs : Reverted. default encoding should be utf-8.
+
+2004-01-14 Jackson Harper <jackson@ximian.com>
+
+ * GenericOutputter.cs: Add constructors that do not take an
+ encoding to fix build.
+
+2004-01-14 Atsushi Enomoto <atsushi@ximian.com>
+
+ * XmlWriterEmitter.cs : It now uses WriteProcessingInstruction() to
+ write XML declaration. It means that output supports non document
+ entity. This fixes bug #52729.
+ * Emitter.cs, TextEmitter.cs, HtmlEmitter.cs, XmlWriterEmitter.cs :
+ modified WriteStartDocument() signature to receive Encoding.
+ * GenericOutputter.cs :
+ - Added .ctor() which receives Encoding. (It is used for TextWriter
+ output to get actual encoding.)
+ - Added .ctor() to take an boolean argument which indicates it is
+ variable content or not. (When variable, it does not call
+ WriteStartDocument().)
+ * XslKey.cs,
+ XsltCompiledContext.cs : comment out WriteLine().
+ * XslOutput.cs : set default encoding utf-16.
+
+2004-01-08 Nick Drochak <ndrochak@ieee.org>
+
+ * XsltCompiledContext.cs: Remove unused variable and unreachable code.
+
2003-12-26 Atsushi Enomoto <atsushi@ximian.com>
* XslDecimalFormat.cs : implemented format-number() other than number
diff --git a/mcs/class/System.XML/Mono.Xml.Xsl/Emitter.cs b/mcs/class/System.XML/Mono.Xml.Xsl/Emitter.cs
index 4c410214dc0..3b6bf6da750 100644
--- a/mcs/class/System.XML/Mono.Xml.Xsl/Emitter.cs
+++ b/mcs/class/System.XML/Mono.Xml.Xsl/Emitter.cs
@@ -3,11 +3,13 @@
//
// Authors:
// Oleg Tkachenko (oleg@tkachenko.com)
-//
+// Atsushi Enomoto (atsushi@ximian.com)
// (C) 2003 Oleg Tkachenko
+// (C) 2004 Novell inc.
//
using System;
+using System.Text;
namespace Mono.Xml.Xsl {
/// <summary>
@@ -17,7 +19,7 @@ namespace Mono.Xml.Xsl {
/// implementations may be supported either.
/// </summary>
public abstract class Emitter {
- public abstract void WriteStartDocument (StandaloneType standalone);
+ public abstract void WriteStartDocument (Encoding encoding, StandaloneType standalone);
public abstract void WriteEndDocument ();
public abstract void WriteDocType (string type, string publicId, string systemId);
public abstract void WriteStartElement (string prefix, string localName, string nsURI);
diff --git a/mcs/class/System.XML/Mono.Xml.Xsl/GenericOutputter.cs b/mcs/class/System.XML/Mono.Xml.Xsl/GenericOutputter.cs
index c932216471f..ecbc03392df 100644
--- a/mcs/class/System.XML/Mono.Xml.Xsl/GenericOutputter.cs
+++ b/mcs/class/System.XML/Mono.Xml.Xsl/GenericOutputter.cs
@@ -46,12 +46,16 @@ namespace Mono.Xml.Xsl
private Hashtable _currentNamespaceDecls;
//Name table
private NameTable _nt;
+ // Specified encoding (for TextWriter output)
+ Encoding _encoding;
//Determines whether xsl:copy can output attribute-sets or not.
- bool canProcessAttributes;
- bool insideCData;
+ bool _canProcessAttributes;
+ bool _insideCData;
+ bool _isVariable;
- private GenericOutputter (Hashtable outputs)
+ private GenericOutputter (Hashtable outputs, Encoding encoding)
{
+ _encoding = encoding;
_outputs = outputs;
_currentOutput = (XslOutput)outputs [String.Empty];
_state = WriteState.Start;
@@ -62,19 +66,36 @@ namespace Mono.Xml.Xsl
_currentNamespaceDecls = new Hashtable ();
}
- public GenericOutputter (XmlWriter writer, Hashtable outputs)
- : this (outputs)
+ public GenericOutputter (XmlWriter writer, Hashtable outputs, Encoding encoding)
+ : this (writer, outputs, encoding, false)
+ {
+ }
+
+ internal GenericOutputter (XmlWriter writer, Hashtable outputs, Encoding encoding, bool isVariable)
+ : this (outputs, encoding)
{
_emitter = new XmlWriterEmitter (writer);
_state = writer.WriteState;
+ _isVariable = isVariable;
}
- public GenericOutputter (TextWriter writer, Hashtable outputs)
- : this (outputs)
+ public GenericOutputter (TextWriter writer, Hashtable outputs, Encoding encoding)
+ : this (outputs, encoding)
{
this.pendingTextWriter = writer;
}
+
+ internal GenericOutputter (TextWriter writer, Hashtable outputs)
+ : this (writer, outputs, null)
+ {
+ }
+
+ internal GenericOutputter (XmlWriter writer, Hashtable outputs)
+ : this (writer, outputs, null)
+ {
+ }
+
private Emitter Emitter {
get {
if (_emitter == null)
@@ -143,15 +164,18 @@ namespace Mono.Xml.Xsl
//Attributes flushed, state is Content now
_state = WriteState.Content;
}
- canProcessAttributes = false;
+ _canProcessAttributes = false;
}
#region Outputter's methods implementation
public override void WriteStartDocument ()
- {
+ {
+ if (_isVariable)
+ return;
+
if (!_currentOutput.OmitXmlDeclaration)
- Emitter.WriteStartDocument (_currentOutput.Standalone);
+ Emitter.WriteStartDocument (_encoding != null ? _encoding : _currentOutput.Encoding, _currentOutput.Standalone);
_state = WriteState.Prolog;
}
@@ -186,7 +210,7 @@ namespace Mono.Xml.Xsl
Emitter.WriteStartElement (prefix, localName, nsURI);
_state = WriteState.Element;
pendingAttributesPos = 0;
- canProcessAttributes = true;
+ _canProcessAttributes = true;
}
public override void WriteEndElement ()
@@ -282,7 +306,7 @@ namespace Mono.Xml.Xsl
public override void WriteString (string text)
{
CheckState ();
- if (insideCData)
+ if (_insideCData)
Emitter.WriteCDataSection (text);
else
Emitter.WriteString (text);
@@ -315,14 +339,14 @@ namespace Mono.Xml.Xsl
}
public override bool CanProcessAttributes {
- get { return canProcessAttributes; }
+ get { return _canProcessAttributes; }
}
public override WriteState WriteState { get { return _state; } }
public override bool InsideCDataSection {
- get { return insideCData; }
- set { insideCData = value; }
+ get { return _insideCData; }
+ set { _insideCData = value; }
}
#endregion
}
diff --git a/mcs/class/System.XML/Mono.Xml.Xsl/HtmlEmitter.cs b/mcs/class/System.XML/Mono.Xml.Xsl/HtmlEmitter.cs
index 272c3698778..7c9ffa8723d 100644
--- a/mcs/class/System.XML/Mono.Xml.Xsl/HtmlEmitter.cs
+++ b/mcs/class/System.XML/Mono.Xml.Xsl/HtmlEmitter.cs
@@ -19,7 +19,8 @@ using System.Xml;
namespace Mono.Xml.Xsl
{
- public class HtmlEmitter : Emitter {
+ public class HtmlEmitter : Emitter
+ {
TextWriter writer;
Stack elementNameStack;
bool openElement;
@@ -37,8 +38,9 @@ namespace Mono.Xml.Xsl
outputEncoding = writer.Encoding == null ? output.Encoding : writer.Encoding;
}
- public override void WriteStartDocument (StandaloneType standalone)
+ public override void WriteStartDocument (Encoding encoding, StandaloneType standalone)
{
+ // do nothing
}
public override void WriteEndDocument ()
diff --git a/mcs/class/System.XML/Mono.Xml.Xsl/TextEmitter.cs b/mcs/class/System.XML/Mono.Xml.Xsl/TextEmitter.cs
index 2240199b7f5..b0d469c2ad8 100644
--- a/mcs/class/System.XML/Mono.Xml.Xsl/TextEmitter.cs
+++ b/mcs/class/System.XML/Mono.Xml.Xsl/TextEmitter.cs
@@ -3,18 +3,23 @@
//
// Authors:
// Oleg Tkachenko (oleg@tkachenko.com)
+// Atsushi Enomoto (atsushi@ximian.com)
//
// (C) 2003 Oleg Tkachenko
+// (C) 2004 Atsushi Enomoto
//
using System;
using System.IO;
+using System.Text;
-namespace Mono.Xml.Xsl {
+namespace Mono.Xml.Xsl
+{
/// <summary>
/// Emitetr, which emits result tree according to "text" output method.
/// </summary>
- public class TextEmitter : Emitter {
+ public class TextEmitter : Emitter
+ {
TextWriter writer;
public TextEmitter (TextWriter writer) {
@@ -23,7 +28,7 @@ namespace Mono.Xml.Xsl {
#region # Emitter's methods implementaion
- public override void WriteStartDocument (StandaloneType standalone) {
+ public override void WriteStartDocument (Encoding encoding, StandaloneType standalone) {
//Do nothing
}
diff --git a/mcs/class/System.XML/Mono.Xml.Xsl/XmlWriterEmitter.cs b/mcs/class/System.XML/Mono.Xml.Xsl/XmlWriterEmitter.cs
index 39d1c7c29d4..348b42d9d47 100644
--- a/mcs/class/System.XML/Mono.Xml.Xsl/XmlWriterEmitter.cs
+++ b/mcs/class/System.XML/Mono.Xml.Xsl/XmlWriterEmitter.cs
@@ -3,18 +3,23 @@
//
// Authors:
// Oleg Tkachenko (oleg@tkachenko.com)
+// Atsushi Enomoto (atsushi@ximian.com)
//
// (C) 2003 Oleg Tkachenko
+// (C) 2004 Atsushi Enomoto
//
using System;
+using System.Text;
using System.Xml;
-namespace Mono.Xml.Xsl {
+namespace Mono.Xml.Xsl
+{
/// <summary>
/// Emitter, which emits result tree to a XmlWriter.
/// </summary>
- public class XmlWriterEmitter : Emitter {
+ public class XmlWriterEmitter : Emitter
+ {
XmlWriter writer;
public XmlWriterEmitter (XmlWriter writer) {
@@ -23,17 +28,39 @@ namespace Mono.Xml.Xsl {
#region # Emitter's methods implementaion
- public override void WriteStartDocument (StandaloneType standalone)
+ public override void WriteStartDocument (Encoding encoding, StandaloneType standalone)
{
+#if docent
if (standalone == StandaloneType.NONE)
writer.WriteStartDocument ();
else
writer.WriteStartDocument (standalone == StandaloneType.YES);
+#else
+ string standaloneStr = "";
+ switch (standalone) {
+ case StandaloneType.YES:
+ standaloneStr = " standalone=\"yes\"";
+ break;
+ case StandaloneType.NO:
+ standaloneStr = " standalone=\"no\"";
+ break;
+ }
+
+ if (encoding == null)
+ writer.WriteProcessingInstruction ("xml", "version=\"1.0\"" + standaloneStr);
+ else
+ writer.WriteProcessingInstruction ("xml",
+ "version=\"1.0\" encoding=\""
+ + encoding.WebName + "\""
+ + standaloneStr);
+#endif
}
public override void WriteEndDocument ()
{
+#if docent
writer.WriteEndDocument ();
+#endif
}
public override void WriteDocType (string type, string publicId, string systemId)
diff --git a/mcs/class/System.XML/Mono.Xml.Xsl/XslKey.cs b/mcs/class/System.XML/Mono.Xml.Xsl/XslKey.cs
index 1c5d4a26ca6..7b1f25fb452 100644
--- a/mcs/class/System.XML/Mono.Xml.Xsl/XslKey.cs
+++ b/mcs/class/System.XML/Mono.Xml.Xsl/XslKey.cs
@@ -48,7 +48,7 @@ namespace Mono.Xml.Xsl {
UsePattern.SetContext (nsmgr);
if (!nav.Matches (MatchPattern))
return false;
- Debug.WriteLine ("? " + nav.Name);
+// Debug.WriteLine ("? " + nav.Name);
switch (UsePattern.ReturnType)
{
case XPathResultType.NodeSet:
diff --git a/mcs/class/System.XML/Mono.Xml.Xsl/XsltCompiledContext.cs b/mcs/class/System.XML/Mono.Xml.Xsl/XsltCompiledContext.cs
index 7100c87a391..9d8fa7560aa 100644
--- a/mcs/class/System.XML/Mono.Xml.Xsl/XsltCompiledContext.cs
+++ b/mcs/class/System.XML/Mono.Xml.Xsl/XsltCompiledContext.cs
@@ -47,8 +47,6 @@ namespace Mono.Xml.Xsl {
internal override IXsltContextFunction ResolveFunction (XmlQualifiedName name, XPathResultType [] argTypes)
{
- IXsltContextFunction func = null;
-
string ns = name.Namespace;
if (ns == null) return null;
@@ -342,7 +340,6 @@ namespace Mono.Xml.Xsl.Functions {
} catch (Exception ex) {
throw new XsltException ("Custom function reported an error.", ex);
// Debug.WriteLine ("****** INCORRECT RESOLUTION **********");
- return "";
}
}
}
@@ -400,8 +397,8 @@ namespace Mono.Xml.Xsl.Functions {
Uri Resolve (string thisUri, string baseUri, XslTransformProcessor p)
{
- Debug.WriteLine ("THIS: " + thisUri);
- Debug.WriteLine ("BASE: " + baseUri);
+// Debug.WriteLine ("THIS: " + thisUri);
+// Debug.WriteLine ("BASE: " + baseUri);
XmlResolver r = p.Resolver;
Uri uriBase = null;
diff --git a/mcs/class/System.XML/System.Xml.Schema/BUGS-MS.txt b/mcs/class/System.XML/System.Xml.Schema/BUGS-MS.txt
index c3feae7557f..577378d730f 100755
--- a/mcs/class/System.XML/System.Xml.Schema/BUGS-MS.txt
+++ b/mcs/class/System.XML/System.Xml.Schema/BUGS-MS.txt
@@ -87,7 +87,7 @@ BUGS in MS Implementation of XmlSchema:
</xsd:choice>
</xsd:complexType>
- Related msxsdtest is mgH014.xsd.
+ Related msxsdtest is groupG001.xsd and mgH014.xsd.
009. derived list incorrectly allowed
@@ -126,3 +126,25 @@ BUGS in MS Implementation of XmlSchema:
(union as well.)
Related msxsdtest is stF034.xsd and stF036.xsd.
+
+012. derived types cannot duplicate fixed facet
+
+ If you have a facet like <xsd:minLength value="5" fixed="true" />, you should
+ be able to have <xsd:minLength value="5" /> in restrictions of it, as long as
+ the values are the same. MS says:
+ "Base type has {fixed} equal to true."
+
+ XML-Schema part2 Datatype, 4.3.2.1:
+ "If {fixed} is true, then types for which the current type is the {base
+ type definition} cannot specify a value for minLength other than
+ {value}."
+
+ Which implies that you can specify a value for minLength that is the same as
+ {value}.
+
+013. Some facets are incorrectly allowed for list simple type.
+
+ As to structures spec 3.14.6 Derivation Valid (Simple) 2.2, only length,
+ minLength, maxLength, pattern and enumeration are allowed. However, MS
+ implementation allows whitespace (and possibly and so on).
+
diff --git a/mcs/class/System.XML/System.Xml.Schema/BuiltInDatatype.cs b/mcs/class/System.XML/System.Xml.Schema/BuiltInDatatype.cs
index 85c62a02fd7..b9f1f98100e 100644
--- a/mcs/class/System.XML/System.Xml.Schema/BuiltInDatatype.cs
+++ b/mcs/class/System.XML/System.Xml.Schema/BuiltInDatatype.cs
@@ -12,6 +12,7 @@ using System.Text;
using System.Xml;
using System.Xml.Schema;
using System.Globalization;
+using System.Security.Cryptography;
namespace Mono.Xml.Schema
{
@@ -29,6 +30,14 @@ namespace Mono.Xml.Schema
Total
}
+ public enum XsdOrdering
+ {
+ LessThan = -1,
+ Equal = 0,
+ GreaterThan = 1,
+ Indeterminate = 2
+ }
+
public class XsdAnySimpleType : XmlSchemaDatatype
{
static XsdAnySimpleType instance;
@@ -76,69 +85,65 @@ namespace Mono.Xml.Schema
return Normalize (s);
}
+ internal override ValueType ParseValueType (string s,
+ XmlNameTable nameTable, XmlNamespaceManager nsmgr)
+ {
+ return new StringValueType (Normalize (s));
+ }
+
internal string [] ParseListValue (string s, XmlNameTable nameTable)
{
return this.Normalize (s, XsdWhitespaceFacet.Collapse).Split (whitespaceArray);
}
- internal virtual bool AllowsFacet(XmlSchemaFacet xsf)
- {
+
+
// Can you even use XsdAnySimpleType in a schema?
// -> Yes. See E1-22 of http://www.w3.org/2001/05/xmlschema-errata#Errata1 (somewhat paranoid ;-)
- return true;
+
+ internal bool AllowsFacet(XmlSchemaFacet xsf) {
+ return (AllowedFacets & xsf.ThisFacet)!=0;
}
- /* Matches facets allowed on boolean type
- */
- protected static bool BooleanAllowsFacet(XmlSchemaFacet xsf)
- {
- if (xsf is XmlSchemaPatternFacet ||
- xsf is XmlSchemaWhiteSpaceFacet ) {
- return true;
+ internal virtual XsdOrdering Compare(object x, object y) {
+ return XsdOrdering.Indeterminate;
}
- return false;
+
+ internal virtual int Length(string s) {
+ return s.Length;
}
- /* Matches facets allowed on decimal type.
- */
-
- protected static bool DecimalAllowsFacet(XmlSchemaFacet xsf)
- {
- if (xsf is XmlSchemaPatternFacet ||
- xsf is XmlSchemaEnumerationFacet ||
- xsf is XmlSchemaWhiteSpaceFacet ||
- xsf is XmlSchemaMaxInclusiveFacet ||
- xsf is XmlSchemaMaxExclusiveFacet ||
- xsf is XmlSchemaMinInclusiveFacet ||
- xsf is XmlSchemaMinExclusiveFacet ||
- xsf is XmlSchemaFractionDigitsFacet ||
- xsf is XmlSchemaTotalDigitsFacet) {
- return true;
- }
- return false;
+
+ // anySimpleType allows any facet
+ internal virtual XmlSchemaFacet.Facet AllowedFacets {
+ get { return XmlSchemaFacet.AllFacets ;}
}
+ /* Matches facets allowed on boolean type
+ */
+ internal const XmlSchemaFacet.Facet booleanAllowedFacets =
+ XmlSchemaFacet.Facet.pattern | XmlSchemaFacet.Facet.whiteSpace;
+
+ /* Matches facets allowed on decimal type.
+ */
+ internal const XmlSchemaFacet.Facet decimalAllowedFacets =
+ XmlSchemaFacet.Facet.pattern | XmlSchemaFacet.Facet.enumeration |
+ XmlSchemaFacet.Facet.whiteSpace | XmlSchemaFacet.Facet.maxInclusive |
+ XmlSchemaFacet.Facet.minInclusive | XmlSchemaFacet.Facet.maxExclusive |
+ XmlSchemaFacet.Facet.minExclusive | XmlSchemaFacet.Facet.fractionDigits |
+ XmlSchemaFacet.Facet.totalDigits ;
/* Matches facets allowed on float, double, duration, dateTime, time, date,
* gYearMonth, gYear, gMonthDay, gMonth, and gDay types
*/
- protected static bool DurationAllowsFacet(XmlSchemaFacet xsf)
- {
- if (xsf is XmlSchemaPatternFacet ||
- xsf is XmlSchemaEnumerationFacet ||
- xsf is XmlSchemaWhiteSpaceFacet ||
- xsf is XmlSchemaMaxInclusiveFacet ||
- xsf is XmlSchemaMaxExclusiveFacet ||
- xsf is XmlSchemaMinInclusiveFacet ||
- xsf is XmlSchemaMinExclusiveFacet ) {
- return true;
- }
- return false;
- }
-
+ internal const XmlSchemaFacet.Facet durationAllowedFacets =
+ XmlSchemaFacet.Facet.pattern | XmlSchemaFacet.Facet.enumeration |
+ XmlSchemaFacet.Facet.whiteSpace | XmlSchemaFacet.Facet.maxInclusive |
+ XmlSchemaFacet.Facet.minInclusive | XmlSchemaFacet.Facet.maxExclusive |
+ XmlSchemaFacet.Facet.minExclusive ;
/* Matches facet allowed on string, hexBinary, base64Binary,
* anyURI, QName and NOTATION types
@@ -146,18 +151,10 @@ namespace Mono.Xml.Schema
* Also used on list types
*/
- protected static bool StringAllowsFacet(XmlSchemaFacet xsf)
- {
- if (xsf is XmlSchemaLengthFacet ||
- xsf is XmlSchemaMinLengthFacet ||
- xsf is XmlSchemaMaxLengthFacet ||
- xsf is XmlSchemaPatternFacet ||
- xsf is XmlSchemaEnumerationFacet ||
- xsf is XmlSchemaWhiteSpaceFacet) {
- return true;
- }
- return false;
- }
+ internal const XmlSchemaFacet.Facet stringAllowedFacets =
+ XmlSchemaFacet.Facet.length | XmlSchemaFacet.Facet.minLength |
+ XmlSchemaFacet.Facet.maxLength | XmlSchemaFacet.Facet.pattern |
+ XmlSchemaFacet.Facet.enumeration | XmlSchemaFacet.Facet.whiteSpace;
}
// xs:string
@@ -167,6 +164,10 @@ namespace Mono.Xml.Schema
{
}
+ internal override XmlSchemaFacet.Facet AllowedFacets {
+ get { return stringAllowedFacets; }
+ }
+
public override XmlTokenizedType TokenizedType {
get { return XmlTokenizedType.CDATA; }
}
@@ -189,22 +190,6 @@ namespace Mono.Xml.Schema
get { return XsdOrderedFacet.False; }
}
- /* Freeze their use now.
- // Constraining Facets
- public bool HasLengthFacet;
- public bool HasMaxLengthFacet;
- public bool HasMinLengthFacet;
- public int Length;
- public int MaxLength;
- public int MinLength;
- public string Pattern;
- public ICollection Enumeration;
- */
- internal override bool AllowsFacet(XmlSchemaFacet xsf)
- {
- return StringAllowsFacet(xsf);
- }
-
}
// xs:normalizedString
@@ -287,6 +272,10 @@ namespace Mono.Xml.Schema
return s;
}
+ internal override ValueType ParseValueType (string s, XmlNameTable nameTable, XmlNamespaceManager nsmgr)
+ {
+ return new StringValueType (ParseValue (s, nameTable, nsmgr) as string);
+ }
}
// xs:NMTOKENS
@@ -308,6 +297,11 @@ namespace Mono.Xml.Schema
{
return ParseListValue (value, nt);
}
+
+ internal override ValueType ParseValueType (string s, XmlNameTable nameTable, XmlNamespaceManager nsmgr)
+ {
+ return new StringArrayValueType (ParseListValue (s, nameTable));
+ }
}
// xs:Name
@@ -332,6 +326,11 @@ namespace Mono.Xml.Schema
throw new ArgumentException ("'" + s + "' is an invalid name.");
return s;
}
+
+ internal override ValueType ParseValueType (string s, XmlNameTable nameTable, XmlNamespaceManager nsmgr)
+ {
+ return new StringValueType (ParseValue (s, nameTable, nsmgr) as string);
+ }
}
// xs:NCName
@@ -357,6 +356,10 @@ namespace Mono.Xml.Schema
return s;
}
+ internal override ValueType ParseValueType (string s, XmlNameTable nameTable, XmlNamespaceManager nsmgr)
+ {
+ return new StringValueType (ParseValue (s, nameTable, nsmgr) as string);
+ }
}
// xs:ID
@@ -414,13 +417,17 @@ namespace Mono.Xml.Schema
{
return ParseListValue (value, nt);
}
+
+ internal override ValueType ParseValueType (string s, XmlNameTable nameTable, XmlNamespaceManager nsmgr)
+ {
+ return new StringArrayValueType (ParseListValue (s, nameTable));
+ }
}
// xs:ENTITY
public class XsdEntity : XsdName
{
internal XsdEntity ()
-
{
}
@@ -455,6 +462,11 @@ namespace Mono.Xml.Schema
{
return ParseListValue (value, nt);
}
+
+ internal override ValueType ParseValueType (string s, XmlNameTable nameTable, XmlNamespaceManager nsmgr)
+ {
+ return new StringArrayValueType (ParseListValue (s, nameTable));
+ }
}
// xs:NOTATION
@@ -464,6 +476,10 @@ namespace Mono.Xml.Schema
{
}
+ internal override XmlSchemaFacet.Facet AllowedFacets {
+ get { return stringAllowedFacets; }
+ }
+
public override XmlTokenizedType TokenizedType {
get { return XmlTokenizedType.NOTATION; }
}
@@ -492,23 +508,6 @@ namespace Mono.Xml.Schema
get { return XsdOrderedFacet.False; }
}
- // Constraining Facets
- public bool HasLengthFacet;
- public bool HasMaxLengthFacet;
- public bool HasMinLengthFacet;
- public int Length;
- public int MaxLength;
- public int MinLength;
- public string Pattern;
- public ICollection Enumeration;
-
-
- internal override bool AllowsFacet(XmlSchemaFacet xsf)
- {
- return StringAllowsFacet(xsf);
- }
-
-
}
// xs:decimal
@@ -519,6 +518,10 @@ namespace Mono.Xml.Schema
this.WhitespaceValue = XsdWhitespaceFacet.Collapse;
}
+ internal override XmlSchemaFacet.Facet AllowedFacets {
+ get { return decimalAllowedFacets; }
+ }
+
public override XmlTokenizedType TokenizedType {
get { return XmlTokenizedType.None; }
}
@@ -530,9 +533,30 @@ namespace Mono.Xml.Schema
public override object ParseValue (string s,
XmlNameTable nameTable, XmlNamespaceManager nsmgr)
{
- return XmlConvert.ToDecimal (this.Normalize (s));
+ return ParseValueType (s, nameTable, nsmgr);
}
+ internal override ValueType ParseValueType (string s, XmlNameTable nameTable, XmlNamespaceManager nsmgr)
+ {
+ return XmlConvert.ToDecimal (this.Normalize (s));
+ }
+
+ internal override XsdOrdering Compare(object x, object y) {
+ if ((x is Decimal) && (y is Decimal)) {
+ int ret = Decimal.Compare((Decimal)x, (Decimal)y);
+ if (ret < 0) {
+ return XsdOrdering.LessThan;
+ }
+ else if (ret > 0) {
+ return XsdOrdering.GreaterThan;
+ }
+ else {
+ return XsdOrdering.Equal;
+ }
+ }
+ return XsdOrdering.Indeterminate;
+ }
+
// Fundamental Facets
public override bool Bounded {
get { return false; }
@@ -547,23 +571,6 @@ namespace Mono.Xml.Schema
get { return XsdOrderedFacet.Total; }
}
- // Constraining Facets
- public bool HasLengthFacet;
- public bool HasMaxLengthFacet;
- public bool HasMinLengthFacet;
- public int Length;
- public int MaxLength;
- public int MinLength;
- public string Pattern;
- public ICollection Enumeration;
-
-
- internal override bool AllowsFacet(XmlSchemaFacet xsf)
- {
- return DecimalAllowsFacet(xsf);
- }
-
-
}
// xs:integer
@@ -581,11 +588,19 @@ namespace Mono.Xml.Schema
public override object ParseValue (string s,
XmlNameTable nameTable, XmlNamespaceManager nsmgr)
{
+ return ParseValueType (s, nameTable, nsmgr);
+ }
+
+ internal override ValueType ParseValueType (string s, XmlNameTable nameTable, XmlNamespaceManager nsmgr)
+ {
decimal d = XmlConvert.ToDecimal (Normalize (s));
if (Decimal.Floor (d) != d)
throw new FormatException ("Integer contains point number.");
return d;
}
+
+
+
}
// xs:Long
@@ -598,8 +613,28 @@ namespace Mono.Xml.Schema
public override object ParseValue (string s,
XmlNameTable nameTable, XmlNamespaceManager nsmgr)
{
+ return ParseValueType (s, nameTable, nsmgr);
+ }
+
+ internal override ValueType ParseValueType (string s, XmlNameTable nameTable, XmlNamespaceManager nsmgr)
+ {
return XmlConvert.ToInt64 (Normalize (s));
}
+
+ internal override XsdOrdering Compare(object x, object y) {
+ if ((x is long) && (y is long)) {
+ if ((long)x==(long)y) {
+ return XsdOrdering.Equal;
+ }
+ else if ((long)x<(long)y) {
+ return XsdOrdering.LessThan;
+ }
+ else {
+ return XsdOrdering.GreaterThan;
+ }
+ }
+ return XsdOrdering.Indeterminate;
+ }
}
// xs:Int
@@ -612,8 +647,28 @@ namespace Mono.Xml.Schema
public override object ParseValue (string s,
XmlNameTable nameTable, XmlNamespaceManager nsmgr)
{
+ return ParseValueType (s, nameTable, nsmgr);
+ }
+
+ internal override ValueType ParseValueType (string s, XmlNameTable nameTable, XmlNamespaceManager nsmgr)
+ {
return XmlConvert.ToInt32 (Normalize (s));
}
+
+ internal override XsdOrdering Compare(object x, object y) {
+ if ((x is int) && (y is int)) {
+ if ((int)x==(int)y) {
+ return XsdOrdering.Equal;
+ }
+ else if ((int)x<(int)y) {
+ return XsdOrdering.LessThan;
+ }
+ else {
+ return XsdOrdering.GreaterThan;
+ }
+ }
+ return XsdOrdering.Indeterminate;
+ }
}
@@ -627,8 +682,28 @@ namespace Mono.Xml.Schema
public override object ParseValue (string s,
XmlNameTable nameTable, XmlNamespaceManager nsmgr)
{
+ return ParseValueType (s, nameTable, nsmgr);
+ }
+
+ internal override ValueType ParseValueType (string s, XmlNameTable nameTable, XmlNamespaceManager nsmgr)
+ {
return XmlConvert.ToInt16 (Normalize (s));
}
+
+ internal override XsdOrdering Compare(object x, object y) {
+ if ((x is short) && (y is short)) {
+ if ((short)x==(short)y) {
+ return XsdOrdering.Equal;
+ }
+ else if ((short)x<(short)y) {
+ return XsdOrdering.LessThan;
+ }
+ else {
+ return XsdOrdering.GreaterThan;
+ }
+ }
+ return XsdOrdering.Indeterminate;
+ }
}
// xs:Byte
@@ -641,8 +716,28 @@ namespace Mono.Xml.Schema
public override object ParseValue (string s,
XmlNameTable nameTable, XmlNamespaceManager nsmgr)
{
+ return ParseValueType (s, nameTable, nsmgr);
+ }
+
+ internal override ValueType ParseValueType (string s, XmlNameTable nameTable, XmlNamespaceManager nsmgr)
+ {
return XmlConvert.ToSByte (Normalize (s));
}
+
+ internal override XsdOrdering Compare(object x, object y) {
+ if ((x is sbyte) && (y is sbyte)) {
+ if ((sbyte)x==(sbyte)y) {
+ return XsdOrdering.Equal;
+ }
+ else if ((sbyte)x<(sbyte)y) {
+ return XsdOrdering.LessThan;
+ }
+ else {
+ return XsdOrdering.GreaterThan;
+ }
+ }
+ return XsdOrdering.Indeterminate;
+ }
}
// xs:nonNegativeInteger
@@ -657,6 +752,11 @@ namespace Mono.Xml.Schema
public override object ParseValue (string s,
XmlNameTable nameTable, XmlNamespaceManager nsmgr)
{
+ return ParseValueType (s, nameTable, nsmgr);
+ }
+
+ internal override ValueType ParseValueType (string s, XmlNameTable nameTable, XmlNamespaceManager nsmgr)
+ {
return XmlConvert.ToDecimal (Normalize (s));
}
}
@@ -672,8 +772,28 @@ namespace Mono.Xml.Schema
public override object ParseValue (string s,
XmlNameTable nameTable, XmlNamespaceManager nsmgr)
{
+ return ParseValueType (s, nameTable, nsmgr);
+ }
+
+ internal override ValueType ParseValueType (string s, XmlNameTable nameTable, XmlNamespaceManager nsmgr)
+ {
return XmlConvert.ToUInt64 (Normalize (s));
}
+
+ internal override XsdOrdering Compare(object x, object y) {
+ if ((x is ulong) && (y is ulong)) {
+ if ((ulong)x==(ulong)y) {
+ return XsdOrdering.Equal;
+ }
+ else if ((ulong)x<(ulong)y) {
+ return XsdOrdering.LessThan;
+ }
+ else {
+ return XsdOrdering.GreaterThan;
+ }
+ }
+ return XsdOrdering.Indeterminate;
+ }
}
// xs:unsignedInt
@@ -687,8 +807,28 @@ namespace Mono.Xml.Schema
public override object ParseValue (string s,
XmlNameTable nameTable, XmlNamespaceManager nsmgr)
{
+ return ParseValueType (s, nameTable, nsmgr);
+ }
+
+ internal override ValueType ParseValueType (string s, XmlNameTable nameTable, XmlNamespaceManager nsmgr)
+ {
return XmlConvert.ToUInt32 (Normalize (s));
}
+
+ internal override XsdOrdering Compare(object x, object y) {
+ if ((x is uint) && (y is uint)) {
+ if ((uint)x==(uint)y) {
+ return XsdOrdering.Equal;
+ }
+ else if ((uint)x<(uint)y) {
+ return XsdOrdering.LessThan;
+ }
+ else {
+ return XsdOrdering.GreaterThan;
+ }
+ }
+ return XsdOrdering.Indeterminate;
+ }
}
@@ -703,8 +843,28 @@ namespace Mono.Xml.Schema
public override object ParseValue (string s,
XmlNameTable nameTable, XmlNamespaceManager nsmgr)
{
+ return ParseValueType (s, nameTable, nsmgr);
+ }
+
+ internal override ValueType ParseValueType (string s, XmlNameTable nameTable, XmlNamespaceManager nsmgr)
+ {
return XmlConvert.ToUInt16 (Normalize (s));
}
+
+ internal override XsdOrdering Compare(object x, object y) {
+ if ((x is ushort) && (y is ushort)) {
+ if ((ushort)x==(ushort)y) {
+ return XsdOrdering.Equal;
+ }
+ else if ((ushort)x<(ushort)y) {
+ return XsdOrdering.LessThan;
+ }
+ else {
+ return XsdOrdering.GreaterThan;
+ }
+ }
+ return XsdOrdering.Indeterminate;
+ }
}
// xs:unsignedByte
@@ -718,8 +878,28 @@ namespace Mono.Xml.Schema
public override object ParseValue (string s,
XmlNameTable nameTable, XmlNamespaceManager nsmgr)
{
+ return ParseValueType (s, nameTable, nsmgr);
+ }
+
+ internal override ValueType ParseValueType (string s, XmlNameTable nameTable, XmlNamespaceManager nsmgr)
+ {
return XmlConvert.ToByte(Normalize (s));
}
+
+ internal override XsdOrdering Compare(object x, object y) {
+ if ((x is byte) && (y is byte)) {
+ if ((byte)x==(byte)y) {
+ return XsdOrdering.Equal;
+ }
+ else if ((byte)x<(byte)y) {
+ return XsdOrdering.LessThan;
+ }
+ else {
+ return XsdOrdering.GreaterThan;
+ }
+ }
+ return XsdOrdering.Indeterminate;
+ }
}
@@ -736,6 +916,11 @@ namespace Mono.Xml.Schema
public override object ParseValue (string s,
XmlNameTable nameTable, XmlNamespaceManager nsmgr)
{
+ return ParseValueType (s, nameTable, nsmgr);
+ }
+
+ internal override ValueType ParseValueType (string s, XmlNameTable nameTable, XmlNamespaceManager nsmgr)
+ {
return XmlConvert.ToDecimal (Normalize (s));
}
}
@@ -750,6 +935,11 @@ namespace Mono.Xml.Schema
public override object ParseValue (string s,
XmlNameTable nameTable, XmlNamespaceManager nsmgr)
{
+ return ParseValueType (s, nameTable, nsmgr);
+ }
+
+ internal override ValueType ParseValueType (string s, XmlNameTable nameTable, XmlNamespaceManager nsmgr)
+ {
return XmlConvert.ToDecimal (Normalize (s));
}
}
@@ -765,6 +955,11 @@ namespace Mono.Xml.Schema
public override object ParseValue (string s,
XmlNameTable nameTable, XmlNamespaceManager nsmgr)
{
+ return ParseValueType (s, nameTable, nsmgr);
+ }
+
+ internal override ValueType ParseValueType (string s, XmlNameTable nameTable, XmlNamespaceManager nsmgr)
+ {
return XmlConvert.ToDecimal (Normalize (s));
}
}
@@ -777,6 +972,10 @@ namespace Mono.Xml.Schema
this.WhitespaceValue = XsdWhitespaceFacet.Collapse;
}
+ internal override XmlSchemaFacet.Facet AllowedFacets {
+ get { return durationAllowedFacets; }
+ }
+
// Fundamental Facets
public override bool Bounded {
get { return true; }
@@ -798,13 +997,29 @@ namespace Mono.Xml.Schema
public override object ParseValue (string s,
XmlNameTable nameTable, XmlNamespaceManager nsmgr)
{
- return XmlConvert.ToSingle (Normalize (s));
+ return ParseValueType (s, nameTable, nsmgr);
}
-
- internal override bool AllowsFacet(XmlSchemaFacet xsf)
+
+ internal override ValueType ParseValueType (string s, XmlNameTable nameTable, XmlNamespaceManager nsmgr)
{
- return DurationAllowsFacet(xsf);
+ return XmlConvert.ToSingle (Normalize (s));
+ }
+
+ internal override XsdOrdering Compare(object x, object y) {
+ if ((x is float) && (y is float)) {
+ if ((float)x==(float)y) {
+ return XsdOrdering.Equal;
+ }
+ else if ((float)x<(float)y) {
+ return XsdOrdering.LessThan;
+ }
+ else {
+ return XsdOrdering.GreaterThan;
+ }
}
+ return XsdOrdering.Indeterminate;
+ }
+
}
// xs:double
@@ -815,6 +1030,10 @@ namespace Mono.Xml.Schema
this.WhitespaceValue = XsdWhitespaceFacet.Collapse;
}
+ internal override XmlSchemaFacet.Facet AllowedFacets {
+ get { return durationAllowedFacets; }
+ }
+
// Fundamental Facets
public override bool Bounded {
get { return true; }
@@ -836,13 +1055,29 @@ namespace Mono.Xml.Schema
public override object ParseValue (string s,
XmlNameTable nameTable, XmlNamespaceManager nsmgr)
{
- return XmlConvert.ToDouble (Normalize (s));
+ return ParseValueType (s, nameTable, nsmgr);
}
-
- internal override bool AllowsFacet(XmlSchemaFacet xsf)
+
+ internal override ValueType ParseValueType (string s, XmlNameTable nameTable, XmlNamespaceManager nsmgr)
{
- return DurationAllowsFacet(xsf);
+ return XmlConvert.ToDouble (Normalize (s));
}
+
+ internal override XsdOrdering Compare(object x, object y) {
+ if ((x is double) && (y is double)) {
+ if ((double)x==(double)y) {
+ return XsdOrdering.Equal;
+ }
+ else if ((double)x<(double)y) {
+ return XsdOrdering.LessThan;
+ }
+ else {
+ return XsdOrdering.GreaterThan;
+ }
+ }
+ return XsdOrdering.Indeterminate;
+ }
+
}
// xs:base64Binary
@@ -859,16 +1094,87 @@ namespace Mono.Xml.Schema
public override object ParseValue (string s,
XmlNameTable nameTable, XmlNamespaceManager nsmgr)
{
- return Convert.FromBase64String (Normalize (s));
+ // If it isnt ASCII it isnt valid base64 data
+ byte[] inArr = new System.Text.ASCIIEncoding().GetBytes(s);
+ FromBase64Transform t = new FromBase64Transform();
+ return t.TransformFinalBlock(inArr, 0, inArr.Length);
+ }
+
+
+ internal override int Length(string s) {
+ int length = 0;
+ int pad = 0;
+ int end = s.Length;
+ for (int i = 0; i < end; i++) {
+ char c = s[i];
+ if (!Char.IsWhiteSpace(c)) {
+ if (isData(c))
+ length ++;
+ else if (isPad(c))
+ pad++;
+ else
+ return -1; // Invalid characters
+ }
+ }
+ if (pad > 2)
+ return -1; // Max 2 padding at the end.
+ if (pad > 0)
+ pad = 3-pad;
+
+ return ((length/4)*3)+pad;
+ }
+
+/* TODO: Use the Base64Table and similar code when it makes it
+ * out of System.Security.Cryptography (currently internal so I
+ * don't think we can use it).
+ *
+ */
+ private static string ALPHABET =
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+
+ private static byte[] decodeTable;
+ static XsdBase64Binary ()
+ {
+ int len = ALPHABET.Length;
+
+ decodeTable = new byte [1 + (int)'z'];
+
+ for (int i=0; i < decodeTable.Length; i++) {
+ decodeTable [i] = Byte.MaxValue;
+ }
+
+ for (int i=0; i < len; i++) {
+ char ch = ALPHABET [i];
+ decodeTable [(int)ch] = (byte) i;
+ }
+ }
+
+ protected static bool isPad(char octect) {
+ return (octect == '=');
+ }
+
+ protected static bool isData(char octect) {
+ return ((octect <= 'z') && (decodeTable[octect] != Byte.MaxValue));
+ }
+
+
+ internal override ValueType ParseValueType (string s, XmlNameTable nameTable, XmlNamespaceManager nsmgr)
+ {
+ return new StringValueType (ParseValue (s, nameTable, nsmgr) as string);
}
}
+
// xs:hexBinary
public class XsdHexBinary : XsdAnySimpleType
{
internal XsdHexBinary ()
{
- this.WhitespaceValue = XsdWhitespaceFacet.Collapse;
+ this.WhitespaceValue = XsdWhitespaceFacet.Collapse;
+ }
+
+ internal override XmlSchemaFacet.Facet AllowedFacets {
+ get { return stringAllowedFacets; }
}
public override XmlTokenizedType TokenizedType {
@@ -885,9 +1191,13 @@ namespace Mono.Xml.Schema
return XmlConvert.FromBinHexString (Normalize (s));
}
- internal override bool AllowsFacet(XmlSchemaFacet xsf)
+ internal override int Length(string s) {
+ return s.Length / 2 + s.Length % 2 ; // Not sure if odd lengths are even allowed
+ }
+
+ internal override ValueType ParseValueType (string s, XmlNameTable nameTable, XmlNamespaceManager nsmgr)
{
- return StringAllowsFacet(xsf);
+ return new StringValueType (ParseValue (s, nameTable, nsmgr) as string);
}
// Fundamental Facets ... no need to override
@@ -919,12 +1229,16 @@ namespace Mono.Xml.Schema
if (nsmgr == null)
throw new ArgumentNullException ("namespace manager");
int colonAt = s.IndexOf (':');
- string localName =
- nameTable.Add (colonAt < 0 ? s : s.Substring (colonAt + 1));
+ string localName = colonAt < 0 ? s : s.Substring (colonAt + 1);
+// string localName = nameTable.Add (colonAt < 0 ? s : s.Substring (colonAt + 1));
return new XmlQualifiedName (localName, nsmgr.LookupNamespace (
colonAt < 0 ? "" : s.Substring (0, colonAt - 1)));
}
-
+
+ internal override ValueType ParseValueType (string s, XmlNameTable nameTable, XmlNamespaceManager nsmgr)
+ {
+ return new QNameValueType (ParseValue (s, nameTable, nsmgr) as XmlQualifiedName);
+ }
}
// xs:boolean
@@ -935,6 +1249,10 @@ namespace Mono.Xml.Schema
this.WhitespaceValue = XsdWhitespaceFacet.Collapse;
}
+ internal override XmlSchemaFacet.Facet AllowedFacets {
+ get { return booleanAllowedFacets; }
+ }
+
public override XmlTokenizedType TokenizedType {
get { return XmlTokenizedType.CDATA; }
}
@@ -946,6 +1264,11 @@ namespace Mono.Xml.Schema
public override object ParseValue (string s,
XmlNameTable nameTable, XmlNamespaceManager nsmgr)
{
+ return ParseValueType (s, nameTable, nsmgr);
+ }
+
+ internal override ValueType ParseValueType (string s, XmlNameTable nameTable, XmlNamespaceManager nsmgr)
+ {
return XmlConvert.ToBoolean (this.Normalize (s));
}
@@ -964,10 +1287,6 @@ namespace Mono.Xml.Schema
}
- internal override bool AllowsFacet(XmlSchemaFacet xsf)
- {
- return BooleanAllowsFacet(xsf);
- }
}
// xs:anyURI
@@ -985,7 +1304,12 @@ namespace Mono.Xml.Schema
public override object ParseValue (string s,
XmlNameTable nameTable, XmlNamespaceManager nsmgr)
{
- return new Uri (Normalize (s));
+ return ParseValueType (s, nameTable, nsmgr);
+ }
+
+ internal override ValueType ParseValueType (string s, XmlNameTable nameTable, XmlNamespaceManager nsmgr)
+ {
+ return new UriValueType (Normalize (s));
}
}
@@ -997,6 +1321,10 @@ namespace Mono.Xml.Schema
this.WhitespaceValue = XsdWhitespaceFacet.Collapse;
}
+ internal override XmlSchemaFacet.Facet AllowedFacets {
+ get { return durationAllowedFacets; }
+ }
+
public override XmlTokenizedType TokenizedType {
get { return XmlTokenizedType.CDATA; }
}
@@ -1008,9 +1336,37 @@ namespace Mono.Xml.Schema
public override object ParseValue (string s,
XmlNameTable nameTable, XmlNamespaceManager nsmgr)
{
+ return ParseValueType (s, nameTable, nsmgr);
+ }
+
+ internal override ValueType ParseValueType (string s, XmlNameTable nameTable, XmlNamespaceManager nsmgr)
+ {
return XmlConvert.ToTimeSpan (Normalize (s));
}
+ internal override XsdOrdering Compare(object x, object y) {
+ /* FIXME: This is really simple so far
+ *
+ * In fact in order to do this correctly in XmlSchema, we cannot use TimeSpan as the base type
+ * Though it turns out that MS .NET is a little broken in this regard too. Not doing comparisons
+ * correctly.
+ */
+ if ((x is TimeSpan) && (y is TimeSpan)) {
+ int ret = TimeSpan.Compare((TimeSpan)x, (TimeSpan)y);
+ if (ret < 0) {
+ return XsdOrdering.LessThan;
+ }
+ else if (ret > 0) {
+ return XsdOrdering.GreaterThan;
+ }
+ else {
+ return XsdOrdering.Equal;
+ }
+ }
+ return XsdOrdering.Indeterminate;
+ }
+
+
// Fundamental Facets
public override bool Bounded {
get { return false; }
@@ -1023,14 +1379,8 @@ namespace Mono.Xml.Schema
}
public override XsdOrderedFacet Ordered {
get { return XsdOrderedFacet.Partial; }
- }
- internal override bool AllowsFacet(XmlSchemaFacet xsf)
- {
- return DurationAllowsFacet(xsf);
}
-
-
}
// xs:dateTime
@@ -1041,6 +1391,10 @@ namespace Mono.Xml.Schema
this.WhitespaceValue = XsdWhitespaceFacet.Collapse;
}
+ internal override XmlSchemaFacet.Facet AllowedFacets {
+ get { return durationAllowedFacets; }
+ }
+
public override XmlTokenizedType TokenizedType {
get { return XmlTokenizedType.CDATA; }
}
@@ -1052,9 +1406,31 @@ namespace Mono.Xml.Schema
public override object ParseValue (string s,
XmlNameTable nameTable, XmlNamespaceManager nsmgr)
{
+ return ParseValueType (s, nameTable, nsmgr);
+ }
+
+ internal override ValueType ParseValueType (string s, XmlNameTable nameTable, XmlNamespaceManager nsmgr)
+ {
return XmlConvert.ToDateTime (Normalize (s));
}
+ internal override XsdOrdering Compare(object x, object y) {
+ /* Really simple so far */
+ if ((x is DateTime) && (y is DateTime)) {
+ int ret = DateTime.Compare((DateTime)x, (DateTime)y);
+ if (ret < 0) {
+ return XsdOrdering.LessThan;
+ }
+ else if (ret > 0) {
+ return XsdOrdering.GreaterThan;
+ }
+ else {
+ return XsdOrdering.Equal;
+ }
+ }
+ return XsdOrdering.Indeterminate;
+ }
+
// Fundamental Facets
public override bool Bounded {
get { return false; }
@@ -1069,10 +1445,6 @@ namespace Mono.Xml.Schema
get { return XsdOrderedFacet.Partial; }
}
- internal override bool AllowsFacet(XmlSchemaFacet xsf)
- {
- return DurationAllowsFacet(xsf);
- }
}
// xs:date
@@ -1083,6 +1455,10 @@ namespace Mono.Xml.Schema
this.WhitespaceValue = XsdWhitespaceFacet.Collapse;
}
+ internal override XmlSchemaFacet.Facet AllowedFacets {
+ get { return durationAllowedFacets; }
+ }
+
public override XmlTokenizedType TokenizedType {
get { return XmlTokenizedType.CDATA; }
}
@@ -1094,18 +1470,35 @@ namespace Mono.Xml.Schema
public override object ParseValue (string s,
XmlNameTable nameTable, XmlNamespaceManager nsmgr)
{
+ return ParseValueType (s, nameTable, nsmgr);
+ }
+
+ internal override ValueType ParseValueType (string s, XmlNameTable nameTable, XmlNamespaceManager nsmgr)
+ {
return DateTime.ParseExact (Normalize (s), "yyyy-MM-dd", null);
}
+ internal override XsdOrdering Compare(object x, object y) {
+ /* Really simple so far */
+ if ((x is DateTime) && (y is DateTime)) {
+ int ret = DateTime.Compare((DateTime)x, (DateTime)y);
+ if (ret < 0) {
+ return XsdOrdering.LessThan;
+ }
+ else if (ret > 0) {
+ return XsdOrdering.GreaterThan;
+ }
+ else {
+ return XsdOrdering.Equal;
+ }
+ }
+ return XsdOrdering.Indeterminate;
+ }
// Fundamental Facets ... no need to override except for Ordered.
public override XsdOrderedFacet Ordered {
get { return XsdOrderedFacet.Partial; }
}
- internal override bool AllowsFacet(XmlSchemaFacet xsf)
- {
- return DurationAllowsFacet(xsf);
- }
}
// xs:time
@@ -1143,6 +1536,10 @@ namespace Mono.Xml.Schema
this.WhitespaceValue = XsdWhitespaceFacet.Collapse;
}
+ internal override XmlSchemaFacet.Facet AllowedFacets {
+ get { return durationAllowedFacets; }
+ }
+
public override XmlTokenizedType TokenizedType {
get { return XmlTokenizedType.CDATA; }
}
@@ -1154,18 +1551,35 @@ namespace Mono.Xml.Schema
public override object ParseValue (string s,
XmlNameTable nameTable, XmlNamespaceManager nsmgr)
{
+ return ParseValueType (s, nameTable, nsmgr);
+ }
+
+ internal override ValueType ParseValueType (string s, XmlNameTable nameTable, XmlNamespaceManager nsmgr)
+ {
return DateTime.ParseExact (Normalize (s), timeFormats, null, DateTimeStyles.None);
}
+ internal override XsdOrdering Compare(object x, object y) {
+ /* Really simple so far */
+ if ((x is DateTime) && (y is DateTime)) {
+ int ret = DateTime.Compare((DateTime)x, (DateTime)y);
+ if (ret < 0) {
+ return XsdOrdering.LessThan;
+ }
+ else if (ret > 0) {
+ return XsdOrdering.GreaterThan;
+ }
+ else {
+ return XsdOrdering.Equal;
+ }
+ }
+ return XsdOrdering.Indeterminate;
+ }
// Fundamental Facets ... no need to override except for Ordered.
public override XsdOrderedFacet Ordered {
get { return XsdOrderedFacet.Partial; }
}
- internal override bool AllowsFacet(XmlSchemaFacet xsf)
- {
- return DurationAllowsFacet(xsf);
- }
}
// xs:gYearMonth
@@ -1176,6 +1590,10 @@ namespace Mono.Xml.Schema
this.WhitespaceValue = XsdWhitespaceFacet.Collapse;
}
+ internal override XmlSchemaFacet.Facet AllowedFacets {
+ get { return durationAllowedFacets; }
+ }
+
public override Type ValueType {
get { return typeof (DateTime); }
}
@@ -1183,12 +1601,29 @@ namespace Mono.Xml.Schema
public override object ParseValue (string s,
XmlNameTable nameTable, XmlNamespaceManager nsmgr)
{
+ return ParseValueType (s, nameTable, nsmgr);
+ }
+
+ internal override ValueType ParseValueType (string s, XmlNameTable nameTable, XmlNamespaceManager nsmgr)
+ {
return DateTime.ParseExact (Normalize (s), "yyyy-MM", null);
}
- internal override bool AllowsFacet(XmlSchemaFacet xsf)
- {
- return DurationAllowsFacet(xsf);
+ internal override XsdOrdering Compare(object x, object y) {
+ /* Really simple so far */
+ if ((x is DateTime) && (y is DateTime)) {
+ int ret = DateTime.Compare((DateTime)x, (DateTime)y);
+ if (ret < 0) {
+ return XsdOrdering.LessThan;
+ }
+ else if (ret > 0) {
+ return XsdOrdering.GreaterThan;
+ }
+ else {
+ return XsdOrdering.Equal;
+ }
+ }
+ return XsdOrdering.Indeterminate;
}
}
@@ -1200,6 +1635,10 @@ namespace Mono.Xml.Schema
this.WhitespaceValue = XsdWhitespaceFacet.Collapse;
}
+ internal override XmlSchemaFacet.Facet AllowedFacets {
+ get { return durationAllowedFacets; }
+ }
+
public override Type ValueType {
get { return typeof (DateTime); }
}
@@ -1207,12 +1646,29 @@ namespace Mono.Xml.Schema
public override object ParseValue (string s,
XmlNameTable nameTable, XmlNamespaceManager nsmgr)
{
+ return ParseValueType (s, nameTable, nsmgr);
+ }
+
+ internal override ValueType ParseValueType (string s, XmlNameTable nameTable, XmlNamespaceManager nsmgr)
+ {
return DateTime.ParseExact (Normalize (s), "--MM-dd", null);
}
- internal override bool AllowsFacet(XmlSchemaFacet xsf)
- {
- return DurationAllowsFacet(xsf);
+ internal override XsdOrdering Compare(object x, object y) {
+ /* Really simple so far */
+ if ((x is DateTime) && (y is DateTime)) {
+ int ret = DateTime.Compare((DateTime)x, (DateTime)y);
+ if (ret < 0) {
+ return XsdOrdering.LessThan;
+ }
+ else if (ret > 0) {
+ return XsdOrdering.GreaterThan;
+ }
+ else {
+ return XsdOrdering.Equal;
+ }
+ }
+ return XsdOrdering.Indeterminate;
}
}
@@ -1224,6 +1680,10 @@ namespace Mono.Xml.Schema
this.WhitespaceValue = XsdWhitespaceFacet.Collapse;
}
+ internal override XmlSchemaFacet.Facet AllowedFacets {
+ get { return durationAllowedFacets; }
+ }
+
public override Type ValueType {
get { return typeof (DateTime); }
}
@@ -1233,12 +1693,29 @@ namespace Mono.Xml.Schema
public override object ParseValue (string s,
XmlNameTable nameTable, XmlNamespaceManager nsmgr)
{
+ return ParseValueType (s, nameTable, nsmgr);
+ }
+
+ internal override ValueType ParseValueType (string s, XmlNameTable nameTable, XmlNamespaceManager nsmgr)
+ {
return DateTime.ParseExact (Normalize(s), "yyyy", null);
}
- internal override bool AllowsFacet(XmlSchemaFacet xsf)
- {
- return DurationAllowsFacet(xsf);
+ internal override XsdOrdering Compare(object x, object y) {
+ /* Really simple so far */
+ if ((x is DateTime) && (y is DateTime)) {
+ int ret = DateTime.Compare((DateTime)x, (DateTime)y);
+ if (ret < 0) {
+ return XsdOrdering.LessThan;
+ }
+ else if (ret > 0) {
+ return XsdOrdering.GreaterThan;
+ }
+ else {
+ return XsdOrdering.Equal;
+ }
+ }
+ return XsdOrdering.Indeterminate;
}
}
@@ -1250,6 +1727,10 @@ namespace Mono.Xml.Schema
this.WhitespaceValue = XsdWhitespaceFacet.Collapse;
}
+ internal override XmlSchemaFacet.Facet AllowedFacets {
+ get { return durationAllowedFacets; }
+ }
+
public override Type ValueType {
get { return typeof (DateTime); }
}
@@ -1257,12 +1738,29 @@ namespace Mono.Xml.Schema
public override object ParseValue (string s,
XmlNameTable nameTable, XmlNamespaceManager nsmgr)
{
+ return ParseValueType (s, nameTable, nsmgr);
+ }
+
+ internal override ValueType ParseValueType (string s, XmlNameTable nameTable, XmlNamespaceManager nsmgr)
+ {
return DateTime.ParseExact (Normalize(s), "--MM--", null);
}
- internal override bool AllowsFacet(XmlSchemaFacet xsf)
- {
- return DurationAllowsFacet(xsf);
+ internal override XsdOrdering Compare(object x, object y) {
+ /* Really simple so far */
+ if ((x is DateTime) && (y is DateTime)) {
+ int ret = DateTime.Compare((DateTime)x, (DateTime)y);
+ if (ret < 0) {
+ return XsdOrdering.LessThan;
+ }
+ else if (ret > 0) {
+ return XsdOrdering.GreaterThan;
+ }
+ else {
+ return XsdOrdering.Equal;
+ }
+ }
+ return XsdOrdering.Indeterminate;
}
}
@@ -1274,6 +1772,10 @@ namespace Mono.Xml.Schema
this.WhitespaceValue = XsdWhitespaceFacet.Collapse;
}
+ internal override XmlSchemaFacet.Facet AllowedFacets {
+ get { return durationAllowedFacets; }
+ }
+
public override Type ValueType {
get { return typeof (DateTime); }
}
@@ -1281,12 +1783,29 @@ namespace Mono.Xml.Schema
public override object ParseValue (string s,
XmlNameTable nameTable, XmlNamespaceManager nsmgr)
{
+ return ParseValueType (s, nameTable, nsmgr);
+ }
+
+ internal override ValueType ParseValueType (string s, XmlNameTable nameTable, XmlNamespaceManager nsmgr)
+ {
return DateTime.ParseExact (Normalize(s), "---dd", null);
}
- internal override bool AllowsFacet(XmlSchemaFacet xsf)
- {
- return DurationAllowsFacet(xsf);
+ internal override XsdOrdering Compare(object x, object y) {
+ /* Really simple so far */
+ if ((x is DateTime) && (y is DateTime)) {
+ int ret = DateTime.Compare((DateTime)x, (DateTime)y);
+ if (ret < 0) {
+ return XsdOrdering.LessThan;
+ }
+ else if (ret > 0) {
+ return XsdOrdering.GreaterThan;
+ }
+ else {
+ return XsdOrdering.Equal;
+ }
+ }
+ return XsdOrdering.Indeterminate;
}
}
diff --git a/mcs/class/System.XML/System.Xml.Schema/ChangeLog b/mcs/class/System.XML/System.Xml.Schema/ChangeLog
index 9b006f6c999..bf7b1876933 100755
--- a/mcs/class/System.XML/System.Xml.Schema/ChangeLog
+++ b/mcs/class/System.XML/System.Xml.Schema/ChangeLog
@@ -1,3 +1,305 @@
+2004-01-26 Atsushi Enomoto <atsushi@ximian.com>
+
+ * XmlSchema.cs : Raise warning event when external schema could not
+ be resolved.
+ * XmlSchemaAll.cs : Fixed incorrect IsEmptiable computation.
+ * XmlSchemaAny.cs : Fixed incorrect occurence computation.
+ * XmlSchemaChoice.cs : compiledItems were incorrectly appended.
+ * XmlSchemaComplexType.cs : Now validatableParticle became extraneous.
+ * XmlSchemaGroupBase.cs : Here we should not get optimized particle
+ because it might cause infinite loop.
+ * XmlSchemaGroupRef.cs : Fixed Validate() to avoid null reference
+ exception (only occur with ValidationEventHandler). Fixed Occurence
+ embedding logic that was useless because of particle optimization.
+
+2004-01-22 Atsushi Enomoto <atsushi@ximian.com>
+
+ * BuiltInDatatype.cs : On parsing QName, we don't have to spend costs
+ on Add()ing parsed name to name table.
+ * XmlSchemaUtil.cs : Added IsBuiltInDatatypeName().
+ * XmlSchemaAttribute.cs, XmlSchemaComplexType.cs,
+ XmlSchemaElement.cs, XmlSchemaSimpleContentExtension.cs,
+ XmlSchemaSimpleContentRestriction.cs, XmlSchemaSimpleTypeList.cs :
+ Use the method above instead of Namespace string comparison.
+ (it will be required to validate schema for schemas.)
+ * XmlSchemaComplexType.cs : Type Derivation OK (3.4.6) should also
+ treat null base type as anyType. Derivation Valid Restriction
+ (3.4.6) should allow base type wildcard absense in case of anyType.
+
+2004-01-22 Atsushi Enomoto <atsushi@ximian.com>
+
+ * XmlSchema.cs : When we have schema A which includes schema B which
+ includes schema C (i.e. A->B->C), C components should be compiled.
+ Here, same URL inclusions are ignored.
+ * XmlSchemaElement.cs : Hack for missing substitution-group fix.
+ * XmlSchemaSimpleTypeContent.cs : make actualBaseSchemaType private
+ and initialize. This fixes bug #53178.
+ * XmlSchemaSimpleTypeUnion.cs : Forgot to commit ;)
+
+2004-01-22 Atsushi Enomoto <atsushi@ximian.com>
+
+ * XmlSchemaSimpleTypeRestriction.cs : regexp improvements. Modify
+ pattern string as "^str$" and convert WXS specific char classes into
+ .NET regexp patterns.
+
+2004-01-21 Atsushi Enomoto <atsushi@ximian.com>
+
+ * XmlSchema.cs :
+ - Removed extra property Language. Fill substitution-group info
+ before ContentTypeParticle is computed.
+ * XmlSchemaComplexType.cs : ContentType and ContentTypeParticle are
+ now computer before Validate() (to exclude 3.4.2 from 3.4.6
+ component constraint check).
+ * XmlSchemaObject.cs, XmlSchemaParticle.cs :
+ Added CopyInfo() for cloning objects.
+ * XmlSchemaObjectTable.cs :
+ Add() doesn't have to reject same named items.
+ * XmlSchemaParticle.cs :
+ - Renamed internal class XmlSchemaParticleEmpty to EmptyParticle
+ (for ease of post compilation infoset comparison).
+ - GetMinEffectiveTotalRange() should return max occurs for element and
+ any.
+ * XmlSchemaParticle.cs,
+ XmlSchemaAll.cs,
+ XmlSchemaAny.cs,
+ XmlSchemaChoice.cs,
+ XmlSchemaElement.cs,
+ XmlSchemaGroupBase.cs,
+ XmlSchemaGroupRef.cs,
+ XmlSchemaSequence.cs :
+ - Removed ActualParticle property.
+ - Added GetOptimizedParticle() to get ContentTypeParticle.
+ - ContentTypeParticle is now created as different object from
+ user-specified "Particle" property.
+ - Return Empty particle when model groups contains no Items.
+ - When Items contains exactly 1 item, return the item (unless it is
+ top level choice model group - it causes DBR problem).
+ - ValidateDerivationValidRestriction() and related WXS 3.9.6 DBR
+ check methods such as ValidateNSRecurseCheckCardinality() now
+ returns a bool value and avoids exceptions on each failure time.
+ - ValidateRecurse() now doesn't progress base particle incorrectly.
+ (it caused incorrect order-preserving-mapping error.)
+ - 3.9.6 Recurse, RecurseLax, MapAndSum are now treated as different.
+ * XmlSchemaAll.cs : occurence validation shoud be done against values
+ after computation (ValidatedMaxOccurs).
+ * XmlSchemaChoice.cs : When Items is empty, then invoke warning event.
+ * XmlSchemaElement.cs :
+ - Consider referencedElement also for SubstitutionGroupElement.
+ - Removed SubstitutingChoice which is not in use.
+ - when it was targeted as substitution group by other elements, its
+ ContentTypeParticle should be substitution choice (see 3.9.6
+ Particle Valid (Restriction) term 2.1).
+ - Added FillsubstitutionElementInfo() (see XmlSchema.cs above).
+ * XmlSchemaGroup.cs : Removed extra check on model group (because it
+ is impossible to specify non-model-group particle).
+ * XmlSchemaIdentityConstraint.cs,
+ XmlSchemaKey.cs,
+ XmlSchemaKeyRef.cs,
+ XmlSchemaUnique.cs : Removed extraneous MonoTODO.
+ * XmlSchemaSimpleContent.cs : Made actualSchemaType as internal.
+ * XmlSchemaSimpleType.cs : Removed extraneous new Datatype property.
+ * XmlSchemaSimpleTypeRestriction.cs : Renamed actualBaseSchemaType to
+ ActualBaseSchemaType.
+ * XmlSchemaSimpleTypeList.cs, XmlSchemaSimpleTypeUnion.cs :
+ Removed unused actualBaseSchemaType code.
+ * XmlSchemaType.cs : use recently introduced BaseXmlSchemaType.
+ * XmlSchemaUtil.cs : Removed unused CheckLanguage().
+
+2004-01-21 Atsushi Enomoto <atsushi@ximian.com>
+
+ * XmlSchemaXPath.cs : wildcard with prefix (e.g. @foo:*) was
+ incorrectly treated.
+
+2004-01-20 Atsushi Enomoto <atsushi@ximian.com>
+
+ * SchemaDataValueType.cs : UriValueType.ToString() should return
+ actual URI string (as MS's XmlSchemaUri class does).
+ * XmlSchemaReader.cs : Make it internal.
+
+2004-01-16 David Sheldon <dave-mono@earth.li>
+
+ * BuiltInDatatype.cs: added guard to stop index out of range error for
+ invalid Base64 characters.
+
+2004-01-15 Jackson Harper <jackson@ximian.com>
+
+ * XmlSchemaContent.cs: Make actualBaseSchemaType protected (fixes
+ build).
+
+2004-01-15 Atsushi Enomoto <atsushi@ximian.com>
+
+ * XmlSchemaComplexContentExtension.cs,
+ XmlSchemaSimpleContentExtension.cs,
+ XmlSchemaSimpleContentExtension.cs,
+ XmlSchemaSimpleContentRestriction.cs,
+ XmlSchemaContent.cs : Added IsExtension. GetXXX() became nonvirtual.
+ * XmlSchemaType.cs :
+ - Added NET_1_2 BaseXmlSchemaType (other members are commented out).
+ - Now BaseSchemaType redirects to new property BaseXmlSchemaType.
+ * XmlSchemaComplexType.cs :
+ - Now it fully uses BaseXmlSchemaType above.
+ - Since ValidateXXX() became too huge, I divided them into
+ CollectXXX() [spec 3.4.1] and ValidateXXX() [spec 3.4.3 / 3.4.6].
+ Schema Components are contributed before constraint check.
+ - Now ContentTypeParticle is distinguished from validating particle
+ which is newly introduced as "ValidatableParticle" (only used in
+ XsdValidatingReader).
+ * XmlSchemaSimpleType.cs : Now it uses BaseXmlSchemaType.
+ capitalized internal members a bit.
+
+2004-01-14 David Sheldon <dave-mono@earth.li>
+
+ * XmlSchemaSimpleTypeRestriction: Convert pattern facets to be ORed,
+ as per: http://www.w3.org/TR/xmlschema-2/#src-multiple-patterns
+ Fixes bug 52841
+
+2004-01-14 David Sheldon <dave-mono@earth.li>
+
+ * BuiltInDatatype.cs:
+ XsdAnySimpleType - Added Length that returns the string length.
+ XsdBase64Binary - Added Length, and used more direct, less fussy,
+ Base64 decoder.
+ XsdHexBinary - Added Length method
+
+ * XmlSchemaSimpleTypeRestriction: use DataType Length method to
+ determine length to compare against. Stop testing Lenght facets on
+ QName and Notation types (as per errata)
+
+2004-01-14 Atsushi Enomoto <atsushi@ximian.com>
+
+ * XmlSchemaComplexType.cs : forgot to commit ;)
+ * XmlSchemaUtil.cs : Fixed IsSchemaDatatypeEquals() to return false
+ for comparison between ID and IDREF.
+
+2004-01-14 Atsushi Enomoto <atsushi@ximian.com>
+
+ * Added SchemaDataValueType.cs.
+ * BuiltInDatatype.cs, XmlSchemaDatatype.cs : Adde ParseValueType() on
+ all derived datatype classes.
+ * XmlSchemaComplexType.cs : Fixed ContentType value for simple types.
+ Errata-considered simple content derivation check and simple content
+ restriction should check this too.
+
+2004-01-13 Jackson Harper <jackson@ximian.com>
+
+ * XmlSchemaComplexType.cs: Comment out line that was breaking the build.
+
+2004-01-13 Atsushi Enomoto <atsushi@ximian.com>
+
+ * XmlSchemaSimpleTypeUnion.cs : The same reason as the previous patch.
+ * XmlSchemaComplexType.cs : Now it handles ContentTypeParticle and
+ ContentType much more presise than before.
+ * XmlSchemaElement.cs :
+ Simplified property handling for reference element.
+
+2004-01-13 Atsushi Enomoto <atsushi@ximian.com>
+
+ * XmlSchema.cs, XmlSchemaComplexType.cs, XmlSchemaElement.cs :
+ Invalid attribute should raise an error, not a warning.
+
+2004-01-13 Atsushi Enomoto <atsushi@ximian.com>
+
+ * XmlSchemaObject.cs : Fixed error() not to set severity as Warning.
+ * ValidationHandler.cs,
+ XmlSchemaSet.cs,
+ XmlSchemaCollection.cs : Throw exception only in case of errors.
+ * XmlSchemaCollection.cs : Remove schema from schemaset if exist.
+ (It might not be good to use schemaset, but keep for a while)
+ * XmlSchemaContent.cs,
+ XmlSchemaComplexContentExtension.cs,
+ XmlSchemaComplexContentRestriction.cs,
+ XmlSchemaSimpleContentExtension.cs,
+ XmlSchemaSimpleContentRestriction.cs,
+ : added GetBaseTypeName() and GetParticle() (not used yet).
+
+2004-01-11 Atsushi Enomoto <atsushi@ximian.com>
+
+ * BuiltInDatatype.cs : internal type should not appear in protected
+ members' signature.
+
+2004-01-11 David Sheldon <dave-mono@earth.li>
+
+ * BuiltInDatatype.cs : Added XsdOrdering enum, and Compare methods
+ to the data-types. Changed AllowedFacets to be a bitfield.
+
+ * XmlSchemaFacet.cs : Added Facet enumeration to represent bitfield.
+
+ * XmlSchemaEnumerationFacet.cs,
+ XmlSchemaFractionDigitsFacet.cs,
+ XmlSchemaLengthFacet.cs,
+ XmlSchemaMaxExclusiveFacet.cs,
+ XmlSchemaMaxInclusiveFacet.cs,
+ XmlSchemaMaxLengthFacet.cs,
+ XmlSchemaMinExclusiveFacet.cs,
+ XmlSchemaMinInclusiveFacet.cs,
+ XmlSchemaMinLengthFacet.cs,
+ XmlSchemaNumericFacet.cs,
+ XmlSchemaPatternFacet.cs,
+ XmlSchemaTotalDigitsFacet.cs,
+ XmlSchemaWhiteSpaceFacet.cs : Added ThisFacet Property to return facet type
+
+
+ * XmlSchemaSimpleTypeRestriction.cs: Inherited facets from base types,
+ checked which which were allowed on different types. Validated fixed
+ facets, duplicated facets and derivation by restriction. Added checking
+ for min/max Inclusive/Exclusive, totalDigits and fractionDigits facets in
+ validation.
+
+2004-01-09 Atsushi Enomoto <atsushi@ximian.com>
+
+ * XmlSchemaSet.cs : implemented some members.
+ * XmlSchemaCollection.cs : modified to use internal schema set (This
+ class provides more precise schema validation feature and will be
+ commonly used for XPathNavigator2).
+ Added .NET 1.1 .ctor() which takes XmlResolver.
+ * XmlSchema.cs : fix related to above changes.
+ Use validation event handler on Read() at all required places.
+ Added .NET 1.1 .ctor() which takes XmlResolver.
+ * XmlSchemaComplexType.cs : content type comparison was incorrect.
+ Renamed confusing method.
+ * XmlSchemaElement.cs : don't use ContentTypeParticle in
+ CheckRecursion(), where that property might not be determined yet.
+ * XmlSchemaGroupBase.cs : Modified ValidateRecurse() a bit (currently
+ no effect)
+ * XmlSchemaGroupBase.cs,
+ XmlSchemaChoice.cs,
+ XmlSchemaAll.cs,
+ XmlSchemaSequence.cs : moved CheckRecursion to XmlSchemaGroupBase.
+ * XmlSchemaObjectTable.cs : Fixed missing error info.
+ * BUGS-MS.txt : Added info a bit.
+
+2004-01-08 Atsushi Enomoto <atsushi@ximian.com>
+
+ * BUGS-MS.txt : added list derivation and facet case.
+ * XmlSchemaComplexType.cs :
+ Added some description. Avoided null reference exception in
+ some places.
+ Fixed incorrect 3.4.6 Derivation Valid (Extension) 1.4.1.2.2 and
+ 3.9.6 Particle Valid (Extension) 2.
+ * XmlSchemaGroupBase.cs : Fixed ParticleEquals() which didn't work
+ properly against sequence and all.
+
+2004-01-08 Atsushi Enomoto <atsushi@ximian.com>
+
+ * XmlSchemaObjectTable.cs : Modified enumerator's Current to return
+ DictionaryEntry.
+ * XmlSchemaComplexType.cs, XmlSchemaUtil.cs :
+ In reflection to object table enumerator change.
+
+2004-01-08 Atsushi Enomoto <atsushi@ximian.com>
+
+ * XmlSchemaElement.cs : Fixed incorrect unique particle attribution
+ check on ##other and target namespace element.
+
+2004-01-08 Nick Drochak <ndrochak@ieee.org>
+
+ * XmlSchemaSimpleType.cs: Needed a 'new' on the property
+ * XmlSchemaXPath.cs: Removed unreachable code.
+
+2004-01-03 Atsushi Enomoto <atsushi@ximian.com>
+
+ * XmlSchemaDatatype.cs : trivial allocation fix.
+
2003-12-17 David Sheldon <dave-mono@earth.li>
* BuiltInDatatype.cs : Added whitespace=collapse to data types
diff --git a/mcs/class/System.XML/System.Xml.Schema/SchemaDataValueType.cs b/mcs/class/System.XML/System.Xml.Schema/SchemaDataValueType.cs
new file mode 100755
index 00000000000..4c8054ea54d
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/SchemaDataValueType.cs
@@ -0,0 +1,155 @@
+namespace System.Xml.Schema
+{
+ internal struct QNameValueType
+ {
+ XmlQualifiedName value;
+
+ public QNameValueType (XmlQualifiedName value)
+ {
+ this.value = value;
+ }
+
+ public XmlQualifiedName Value {
+ get { return value; }
+ }
+
+ public static bool operator == (QNameValueType v1, QNameValueType v2)
+ {
+ return v1.Value == v2.Value;
+ }
+
+ public static bool operator != (QNameValueType v1, QNameValueType v2)
+ {
+ return v1.Value != v2.Value;
+ }
+
+ public override bool Equals (object obj)
+ {
+ if (obj is QNameValueType)
+ return (QNameValueType) obj == this;
+ else
+ return false;
+ }
+
+ public override int GetHashCode ()
+ {
+ return value.GetHashCode ();
+ }
+ }
+
+ internal struct StringValueType
+ {
+ string value;
+
+ public StringValueType (string value)
+ {
+ this.value = value;
+ }
+
+ public string Value {
+ get { return value; }
+ }
+
+ public static bool operator == (StringValueType v1, StringValueType v2)
+ {
+ return v1.Value == v2.Value;
+ }
+
+ public static bool operator != (StringValueType v1, StringValueType v2)
+ {
+ return v1.Value != v2.Value;
+ }
+
+ public override bool Equals (object obj)
+ {
+ if (obj is StringValueType)
+ return (StringValueType) obj == this;
+ else
+ return false;
+ }
+
+ public override int GetHashCode ()
+ {
+ return value.GetHashCode ();
+ }
+ }
+
+ internal struct UriValueType
+ {
+ string value;
+
+ public UriValueType (string value)
+ {
+ this.value = value;
+ }
+
+ public string Value {
+ get { return value; }
+ }
+
+ public static bool operator == (UriValueType v1, UriValueType v2)
+ {
+ return v1.Value == v2.Value;
+ }
+
+ public static bool operator != (UriValueType v1, UriValueType v2)
+ {
+ return v1.Value != v2.Value;
+ }
+
+ public override bool Equals (object obj)
+ {
+ if (obj is UriValueType)
+ return (UriValueType) obj == this;
+ else
+ return false;
+ }
+
+ public override int GetHashCode ()
+ {
+ return value.GetHashCode ();
+ }
+
+ public override string ToString ()
+ {
+ return value;
+ }
+ }
+
+ internal struct StringArrayValueType
+ {
+ string [] value;
+
+ public StringArrayValueType (string [] value)
+ {
+ this.value = value;
+ }
+
+ public string [] Value {
+ get { return value; }
+ }
+
+ public static bool operator == (StringArrayValueType v1, StringArrayValueType v2)
+ {
+ return v1.Value == v2.Value;
+ }
+
+ public static bool operator != (StringArrayValueType v1, StringArrayValueType v2)
+ {
+ return v1.Value != v2.Value;
+ }
+
+ public override bool Equals (object obj)
+ {
+ if (obj is StringArrayValueType)
+ return (StringArrayValueType) obj == this;
+ else
+ return false;
+ }
+
+ public override int GetHashCode ()
+ {
+ return value.GetHashCode ();
+ }
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System.XML/System.Xml.Schema/ValidationHandler.cs b/mcs/class/System.XML/System.Xml.Schema/ValidationHandler.cs
index ae47fd5e662..a9663aa50aa 100755
--- a/mcs/class/System.XML/System.Xml.Schema/ValidationHandler.cs
+++ b/mcs/class/System.XML/System.Xml.Schema/ValidationHandler.cs
@@ -25,7 +25,8 @@ namespace System.Xml.Schema
ValidationEventArgs e = new ValidationEventArgs(ex,message,severity);
if(handle == null)
{
- throw e.Exception;
+ if (e.Severity == XmlSeverityType.Error)
+ throw e.Exception;
}
else
{
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchema.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchema.cs
index 03a8d365f77..5d7109794af 100755
--- a/mcs/class/System.XML/System.Xml.Schema/XmlSchema.cs
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchema.cs
@@ -49,10 +49,13 @@ namespace System.Xml.Schema
private XmlSchemaCollection schemas;
private XmlNameTable nameTable;
- private XmlResolver resolver;
internal bool missedSubComponents;
+ // Only compilation-time use
+ private XmlSchemaObjectCollection compilationItems;
+ private Hashtable handledUris;
+
// Compiler specific things
private static string xmlname = "schema";
@@ -214,14 +217,6 @@ namespace System.Xml.Schema
get{ return notations;}
}
- // New attribute defined in W3C schema element
- [System.Xml.Serialization.XmlAttribute("xml:lang")]
- public string Language
- {
- get{ return language; }
- set{ language = value; }
- }
-
internal Hashtable IDCollection
{
get { return idCollection; }
@@ -255,19 +250,27 @@ namespace System.Xml.Schema
/// 5. version should be a normalizedString
/// 6. xml:lang should be a language
/// </remarks>
- [MonoTODO]
- public void Compile(ValidationEventHandler handler)
+ public void Compile (ValidationEventHandler handler)
+ {
+ Compile (handler, new XmlUrlResolver ());
+ }
+
+#if NET_1_0
+ internal void Compile (ValidationEventHandler handler, XmlResolver resolver)
+#else
+ public void Compile (ValidationEventHandler handler, XmlResolver resolver)
+#endif
{
- Compile (handler, new Stack (), this, null);
+ Compile (handler, new Stack (), this, null, resolver);
isCompiled = true;
}
- internal void Compile (ValidationEventHandler handler, XmlSchemaCollection col)
+ internal void Compile (ValidationEventHandler handler, XmlSchemaCollection col, XmlResolver resolver)
{
- Compile (handler, new Stack (), this, col);
+ Compile (handler, new Stack (), this, col, resolver);
}
- private void Compile (ValidationEventHandler handler, Stack schemaLocationStack, XmlSchema rootSchema, XmlSchemaCollection col)
+ private void Compile (ValidationEventHandler handler, Stack schemaLocationStack, XmlSchema rootSchema, XmlSchemaCollection col, XmlResolver resolver)
{
if (rootSchema != this) {
CompilationId = rootSchema.CompilationId;
@@ -277,19 +280,19 @@ namespace System.Xml.Schema
schemas = col;
if (schemas == null) {
schemas = new XmlSchemaCollection ();
- schemas.CompilationId = Guid.NewGuid ();
+ schemas.SchemaSet.CompilationId = Guid.NewGuid ();
}
- CompilationId = schemas.CompilationId;
+ CompilationId = schemas.SchemaSet.CompilationId;
this.idCollection.Clear ();
}
schemas.Add (this);
- attributeGroups = new XmlSchemaObjectTable ();
- attributes = new XmlSchemaObjectTable ();
- elements = new XmlSchemaObjectTable ();
- groups = new XmlSchemaObjectTable ();
- notations = new XmlSchemaObjectTable ();
- schemaTypes = new XmlSchemaObjectTable ();
+ attributeGroups.Clear ();
+ attributes.Clear ();
+ elements.Clear ();
+ groups.Clear ();
+ notations.Clear ();
+ schemaTypes.Clear ();
//1. Union and List are not allowed in block default
if(BlockDefault != XmlSchemaDerivationMethod.All)
@@ -322,14 +325,16 @@ namespace System.Xml.Schema
error(handler, Version + "is not a valid value for version attribute of schema");
//6. xml:lang must be a language
- if(!XmlSchemaUtil.CheckLanguage(Language))
- error(handler, Language + " is not a valid language");
+// if(!XmlSchemaUtil.CheckLanguage(Language))
+// error(handler, Language + " is not a valid language");
// Compile the content of this schema
- XmlSchemaObjectCollection compilationItems = new XmlSchemaObjectCollection ();
+ compilationItems = new XmlSchemaObjectCollection ();
foreach (XmlSchemaObject obj in Items)
compilationItems.Add (obj);
+ if (this == rootSchema)
+ handledUris = new Hashtable ();
// First, we run into inclusion schemas to collect
// compilation target items into compiledItems.
@@ -340,20 +345,26 @@ namespace System.Xml.Schema
{
if (ext.SchemaLocation == null)
continue;
- string url = GetResolvedUri (ext.SchemaLocation);
Stream stream = null;
- if (schemaLocationStack.Contains (url)) {
- error(handler, "Nested inclusion was found: " + url);
- // must skip this inclusion
- continue;
- }
- try {
- if (resolver == null)
- resolver = new XmlUrlResolver ();
- stream = resolver.GetEntity (new Uri (url), null, typeof (Stream)) as Stream;
- } catch (Exception) {
- // FIXME: This is not good way to handle errors.
- stream = null;
+ string url = null;
+ if (resolver != null) {
+ url = GetResolvedUri (resolver, ext.SchemaLocation);
+ if (schemaLocationStack.Contains (url)) {
+ error(handler, "Nested inclusion was found: " + url);
+ // must skip this inclusion
+ continue;
+ }
+ if (rootSchema.handledUris.Contains (url))
+ // This schema is already handled, so simply skip (otherwise, duplicate definition errrors occur.
+ continue;
+ rootSchema.handledUris.Add (url, url);
+ try {
+ stream = resolver.GetEntity (new Uri (url), null, typeof (Stream)) as Stream;
+ } catch (Exception) {
+ // LAMESPEC: This is not good way to handle errors, but since we cannot know what kind of XmlResolver will come, so there are no mean to avoid this ugly catch.
+ warn (handler, "Could not resolve schema location URI: " + url);
+ stream = null;
+ }
}
// Process redefinition children in advance.
@@ -405,16 +416,28 @@ namespace System.Xml.Schema
// Compile included schema.
includedSchema.idCollection = this.IDCollection;
- includedSchema.Compile (handler, schemaLocationStack, rootSchema, col);
+ includedSchema.Compile (handler, schemaLocationStack, rootSchema, col, resolver);
schemaLocationStack.Pop ();
if (import != null)
rootSchema.schemas.Add (includedSchema);
- // Add compiled items.
- foreach (XmlSchemaObject includedObj in includedSchema.Items)
- compilationItems.Add (includedObj);
- }
+ // Note that we use compiled items. Items
+ // may not exist in Items, since included
+ // schema also includes another schemas.
+ foreach (DictionaryEntry entry in includedSchema.Attributes)
+ compilationItems.Add ((XmlSchemaObject) entry.Value);
+ foreach (DictionaryEntry entry in includedSchema.Elements)
+ compilationItems.Add ((XmlSchemaObject) entry.Value);
+ foreach (DictionaryEntry entry in includedSchema.SchemaTypes)
+ compilationItems.Add ((XmlSchemaObject) entry.Value);
+ foreach (DictionaryEntry entry in includedSchema.AttributeGroups)
+ compilationItems.Add ((XmlSchemaObject) entry.Value);
+ foreach (DictionaryEntry entry in includedSchema.Groups)
+ compilationItems.Add ((XmlSchemaObject) entry.Value);
+ foreach (DictionaryEntry entry in includedSchema.Notations)
+ compilationItems.Add ((XmlSchemaObject) entry.Value);
+ }
else
{
error(handler,"Object of Type "+obj.GetType().Name+" is not valid in Includes Property of XmlSchema");
@@ -445,6 +468,8 @@ namespace System.Xml.Schema
errorCount += numerr;
if(numerr == 0)
{
+ if (!attr.IsComplied (this.CompilationId))
+ schemas.SchemaSet.GlobalAttributes.Add (attr.QualifiedName, attr);
XmlSchemaUtil.AddToTable (Attributes, attr, attr.QualifiedName, handler);
}
}
@@ -466,6 +491,8 @@ namespace System.Xml.Schema
errorCount += numerr;
if(numerr == 0)
{
+ if (!ctype.IsComplied (this.CompilationId))
+ schemas.SchemaSet.GlobalTypes.Add (ctype.QualifiedName, ctype);
XmlSchemaUtil.AddToTable (schemaTypes, ctype, ctype.QualifiedName, handler);
}
}
@@ -477,6 +504,8 @@ namespace System.Xml.Schema
errorCount += numerr;
if(numerr == 0)
{
+ if (!stype.IsComplied (this.CompilationId))
+ schemas.SchemaSet.GlobalTypes.Add (stype.QualifiedName, stype);
XmlSchemaUtil.AddToTable (SchemaTypes, stype, stype.QualifiedName, handler);
}
}
@@ -488,6 +517,8 @@ namespace System.Xml.Schema
errorCount += numerr;
if(numerr == 0)
{
+ if (!elem.IsComplied (this.CompilationId))
+ schemas.SchemaSet.GlobalElements.Add (elem.QualifiedName, elem);
XmlSchemaUtil.AddToTable (Elements, elem, elem.QualifiedName, handler);
}
}
@@ -524,12 +555,12 @@ namespace System.Xml.Schema
Validate(handler);
}
- private string GetResolvedUri (string relativeUri)
+ private string GetResolvedUri (XmlResolver resolver, string relativeUri)
{
Uri baseUri = null;
if (this.SourceUri != null && this.SourceUri != String.Empty)
baseUri = new Uri (this.SourceUri);
- return new XmlUrlResolver ().ResolveUri (baseUri, relativeUri).ToString ();
+ return resolver.ResolveUri (baseUri, relativeUri).ToString ();
}
internal bool IsNamespaceAbsent (string ns)
@@ -539,11 +570,15 @@ namespace System.Xml.Schema
#endregion
- [MonoTODO]
private void Validate(ValidationEventHandler handler)
{
ValidationId = CompilationId;
+ // Firstly Element needs to be filled their substitution group info
+ foreach(XmlSchemaElement elem in Elements.Values)
+ elem.FillSubstitutionElementInfo ();
+
+ // Validate
foreach(XmlSchemaAttribute attr in Attributes.Values)
{
errorCount += attr.Validate(handler, this);
@@ -572,28 +607,19 @@ namespace System.Xml.Schema
#region Read
- public static XmlSchema Read(TextReader reader, ValidationEventHandler validationEventHandler)
+ // We cannot use xml deserialization, since it does not provide line info, qname context, and so on.
+ public static XmlSchema Read (TextReader reader, ValidationEventHandler validationEventHandler)
{
- return Read(new XmlTextReader(reader),validationEventHandler);
+ return Read (new XmlTextReader (reader),validationEventHandler);
}
- public static XmlSchema Read(Stream stream, ValidationEventHandler validationEventHandler)
+ public static XmlSchema Read (Stream stream, ValidationEventHandler validationEventHandler)
{
- return Read(new XmlTextReader(stream),validationEventHandler);
+ return Read (new XmlTextReader (stream),validationEventHandler);
}
- [MonoTODO ("Use ValidationEventHandler")]
- public static XmlSchema Read(XmlReader rdr, ValidationEventHandler validationEventHandler)
+ public static XmlSchema Read (XmlReader rdr, ValidationEventHandler validationEventHandler)
{
-/*
- string baseURI = rdr.BaseURI;
- XmlSerializer xser = new XmlSerializer (typeof (XmlSchema));
- XmlSchema schema = (XmlSchema) xser.Deserialize (rdr);
- schema.SourceUri = baseURI;
- schema.Compile (validationEventHandler);
- schema.nameTable = rdr.NameTable;
- return schema;
-*/
- XmlSchemaReader reader = new XmlSchemaReader(rdr, validationEventHandler);
+ XmlSchemaReader reader = new XmlSchemaReader (rdr, validationEventHandler);
if (reader.ReadState == ReadState.Initial)
reader.ReadNextElement ();
@@ -604,42 +630,43 @@ namespace System.Xml.Schema
{
switch(reader.NodeType)
{
- case XmlNodeType.Element:
- if(reader.LocalName == "schema")
- {
- XmlSchema schema = new XmlSchema();
- schema.nameTable = rdr.NameTable;
-
- schema.LineNumber = reader.LineNumber;
- schema.LinePosition = reader.LinePosition;
- schema.SourceUri = reader.BaseURI;
-
- ReadAttributes(schema, reader, validationEventHandler);
- //IsEmptyElement does not behave properly if reader is
- //positioned at an attribute.
- reader.MoveToElement();
- if(!reader.IsEmptyElement)
- {
- ReadContent(schema, reader, validationEventHandler);
- }
- else
- rdr.Skip ();
-
- if (rdr.NodeType == XmlNodeType.EndElement)
- rdr.Read ();
- return schema;
- }
- else
- {
- //Schema can't be generated. Throw an exception
- throw new XmlSchemaException("The root element must be schema", null);
- }
- default:
- error(validationEventHandler, "This should never happen. XmlSchema.Read 1 ",null);
- break;
+ case XmlNodeType.Element:
+ if(reader.LocalName == "schema")
+ {
+ XmlSchema schema = new XmlSchema ();
+ schema.nameTable = rdr.NameTable;
+
+ schema.LineNumber = reader.LineNumber;
+ schema.LinePosition = reader.LinePosition;
+ schema.SourceUri = reader.BaseURI;
+
+ ReadAttributes(schema, reader, validationEventHandler);
+ //IsEmptyElement does not behave properly if reader is
+ //positioned at an attribute.
+ reader.MoveToElement();
+ if(!reader.IsEmptyElement)
+ {
+ ReadContent(schema, reader, validationEventHandler);
+ }
+ else
+ rdr.Skip ();
+
+ if (rdr.NodeType == XmlNodeType.EndElement)
+ rdr.Read ();
+ return schema;
+ }
+ else
+ //Schema can't be generated. Throw an exception
+ error (validationEventHandler, "The root element must be schema", null);
+ break;
+ default:
+ error(validationEventHandler, "This should never happen. XmlSchema.Read 1 ",null);
+ break;
}
} while(reader.Depth > startDepth && reader.ReadNextElement());
- throw new XmlSchemaException("The top level schema must have namespace "+XmlSchema.Namespace, null);
+
+ // This is thrown regardless of ValidationEventHandler existence.
+ throw new XmlSchemaException ("The top level schema must have namespace " + XmlSchema.Namespace, null);
}
private static void ReadAttributes(XmlSchema schema, XmlSchemaReader reader, ValidationEventHandler h)
@@ -660,7 +687,7 @@ namespace System.Xml.Schema
schema.blockDefault = XmlSchemaUtil.ReadDerivationAttribute(reader,out ex, "blockDefault",
XmlSchemaUtil.ElementBlockAllowed);
if(ex != null)
- warn(h, ex.Message, ex);
+ error (h, ex.Message, ex);
break;
case "elementFormDefault":
schema.elementFormDefault = XmlSchemaUtil.ReadFormAttribute(reader, out ex);
@@ -671,7 +698,7 @@ namespace System.Xml.Schema
schema.finalDefault = XmlSchemaUtil.ReadDerivationAttribute(reader, out ex, "finalDefault",
XmlSchemaUtil.FinalAllowed);
if(ex != null)
- warn(h, ex.Message , ex);
+ error (h, ex.Message , ex);
break;
case "id":
schema.id = reader.Value;
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAll.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAll.cs
index 62b2925a68e..4fdbca0734a 100755
--- a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAll.cs
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAll.cs
@@ -17,6 +17,7 @@ namespace System.Xml.Schema
/// </summary>
public class XmlSchemaAll : XmlSchemaGroupBase
{
+ private XmlSchema schema;
private XmlSchemaObjectCollection items;
private static string xmlname = "all";
private bool emptiable;
@@ -37,29 +38,19 @@ namespace System.Xml.Schema
get { return emptiable; }
}
- internal override XmlSchemaParticle ActualParticle {
- get {
- if (CompiledItems.Count == 0)
- return XmlSchemaParticle.Empty;
- else if (CompiledItems.Count == 1)
- return ((XmlSchemaParticle) CompiledItems [0]).ActualParticle;
- else
- return this;
- }
- }
-
/// <remarks>
/// 1. MaxOccurs must be one. (default is also one)
/// 2. MinOccurs must be zero or one.
/// </remarks>
- [MonoTODO]
internal override int Compile(ValidationEventHandler h, XmlSchema schema)
{
// If this is already compiled this time, simply skip.
if (this.IsComplied (schema.CompilationId))
return 0;
+ this.schema = schema;
+
//FIXME: Should we reset the values on error??
if(MaxOccurs != Decimal.One)
error(h,"maxOccurs must be 1");
@@ -74,9 +65,9 @@ namespace System.Xml.Schema
XmlSchemaElement elem = obj as XmlSchemaElement;
if(elem != null)
{
- if(elem.MaxOccurs != Decimal.One && elem.MaxOccurs != Decimal.Zero)
+ if(elem.ValidatedMaxOccurs != Decimal.One && elem.ValidatedMaxOccurs != Decimal.Zero)
{
- elem.error(h,"The {max occurs} of all the elements of 'all' must be 0 or 1. ");
+ elem.error (h,"The {max occurs} of all the elements of 'all' must be 0 or 1. ");
}
errorCount += elem.Compile(h, schema);
}
@@ -90,50 +81,95 @@ namespace System.Xml.Schema
return errorCount;
}
- [MonoTODO]
+ internal override XmlSchemaParticle GetOptimizedParticle (bool isTop)
+ {
+ if (OptimizedParticle != null)
+ return OptimizedParticle;
+ if (Items.Count == 0 || ValidatedMaxOccurs == 0) {
+ OptimizedParticle = XmlSchemaParticle.Empty;
+ return OptimizedParticle;
+ }
+ else if (Items.Count == 1) {
+ if (ValidatedMinOccurs == 1 && ValidatedMaxOccurs == 1) {
+ XmlSchemaSequence seq = new XmlSchemaSequence ();
+ this.CopyInfo (seq);
+ XmlSchemaParticle p = (XmlSchemaParticle) Items [0];
+ p = p.GetOptimizedParticle (false);
+ if (p == XmlSchemaParticle.Empty)
+ OptimizedParticle = p;
+ else {
+ seq.Items.Add (p);
+ seq.CompiledItems.Add (p);
+ seq.Compile (null, schema);
+ OptimizedParticle = seq;
+ }
+ return OptimizedParticle;
+ }
+ }
+
+ XmlSchemaAll all = new XmlSchemaAll ();
+ CopyInfo (all);
+ CopyOptimizedItems (all);
+ OptimizedParticle = all;
+ all.ComputeEmptiable ();
+
+ return OptimizedParticle;
+ }
+
internal override int Validate(ValidationEventHandler h, XmlSchema schema)
{
if (IsValidated (schema.CompilationId))
return errorCount;
- this.CompileOccurence (h, schema);
+
// 3.8.6 All Group Limited :: 1.
// Beware that this section was corrected: E1-26 of http://www.w3.org/2001/05/xmlschema-errata#Errata1
if (!this.parentIsGroupDefinition && ValidatedMaxOccurs != 1)
error (h, "-all- group is limited to be content of a model group, or that of a complex type with maxOccurs to be 1.");
- emptiable = true;
CompiledItems.Clear ();
- foreach (XmlSchemaElement obj in Items) {
+ foreach (XmlSchemaParticle obj in Items) {
errorCount += obj.Validate (h, schema);
if (obj.ValidatedMaxOccurs != 0 &&
obj.ValidatedMaxOccurs != 1)
error (h, "MaxOccurs of a particle inside -all- compositor must be either 0 or 1.");
CompiledItems.Add (obj);
- if (obj.MinOccurs > 0)
- emptiable = false;
}
+ ComputeEmptiable ();
ValidationId = schema.ValidationId;
return errorCount;
}
- internal override void ValidateDerivationByRestriction (XmlSchemaParticle baseParticle,
- ValidationEventHandler h, XmlSchema schema)
+ private void ComputeEmptiable ()
+ {
+ emptiable = true;
+ for (int i = 0; i < Items.Count; i++) {
+ if (((XmlSchemaParticle) Items [i]).ValidatedMinOccurs > 0) {
+ emptiable = false;
+ break;
+ }
+ }
+ }
+
+ internal override bool ValidateDerivationByRestriction (XmlSchemaParticle baseParticle,
+ ValidationEventHandler h, XmlSchema schema, bool raiseError)
{
XmlSchemaAny any = baseParticle as XmlSchemaAny;
XmlSchemaAll derivedAll = baseParticle as XmlSchemaAll;
if (any != null) {
// NSRecurseCheckCardinality
- this.ValidateNSRecurseCheckCardinality (any, h, schema);
- return;
+ return ValidateNSRecurseCheckCardinality (any, h, schema, raiseError);
} else if (derivedAll != null) {
// Recurse
- ValidateOccurenceRangeOK (derivedAll, h, schema);
- this.ValidateRecurse (derivedAll, h, schema);
- return;
+ if (!ValidateOccurenceRangeOK (derivedAll, h, schema, raiseError))
+ return false;
+ return ValidateRecurse (derivedAll, h, schema, raiseError);
+ }
+ else {
+ if (raiseError)
+ error (h, "Invalid -all- particle derivation was found.");
+ return false;
}
- else
- error (h, "Invalid -all- particle derivation was found.");
}
internal override decimal GetMinEffectiveTotalRange ()
@@ -141,12 +177,6 @@ namespace System.Xml.Schema
return GetMinEffectiveTotalRangeAllAndSequence ();
}
- internal override void CheckRecursion (int depth, ValidationEventHandler h, XmlSchema schema)
- {
- foreach (XmlSchemaElement el in this.Items)
- el.CheckRecursion (depth, h, schema);
- }
-
internal override void ValidateUniqueParticleAttribution (XmlSchemaObjectTable qnames, ArrayList nsNames,
ValidationEventHandler h, XmlSchema schema)
{
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAny.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAny.cs
index 627dcd16905..abadeddd561 100755
--- a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAny.cs
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAny.cs
@@ -42,6 +42,7 @@ namespace System.Xml.Schema
private string nameSpace;
private XmlSchemaContentProcessing processing;
private static string xmlname = "any";
+
private XsdWildcard wildcard;
public XmlSchemaAny()
@@ -64,7 +65,7 @@ namespace System.Xml.Schema
set{ processing = value; }
}
- // Internal
+ // Post Compilation Schema Infoset
internal bool HasValueAny {
get { return wildcard.HasValueAny; }
}
@@ -125,6 +126,26 @@ namespace System.Xml.Schema
this.CompilationId = schema.CompilationId;
return errorCount;
}
+
+ internal override XmlSchemaParticle GetOptimizedParticle (bool isTop)
+ {
+ if (OptimizedParticle != null)
+ return OptimizedParticle;
+ // Uncommenting this causes incorrect validation.
+ // It will prevent UPA e.g. msxsdtest/Particles/particlesJf006.xsd
+// if (ValidatedMaxOccurs == 0) {
+// OptimizedParticle = XmlSchemaParticle.Empty;
+// return OptimizedParticle;
+// }
+
+ XmlSchemaAny any = new XmlSchemaAny ();
+ CopyInfo (any);
+ any.CompileOccurence (null, null);
+ any.wildcard = this.wildcard;
+ OptimizedParticle = any;
+
+ return OptimizedParticle;
+ }
internal override int Validate(ValidationEventHandler h, XmlSchema schema)
{
@@ -161,17 +182,19 @@ namespace System.Xml.Schema
return wildcard.ExamineAttributeWildcardIntersection (other, h, schema);
}
- internal override void ValidateDerivationByRestriction (XmlSchemaParticle baseParticle,
- ValidationEventHandler h, XmlSchema schema)
+ internal override bool ValidateDerivationByRestriction (XmlSchemaParticle baseParticle,
+ ValidationEventHandler h, XmlSchema schema, bool raiseError)
{
XmlSchemaAny baseAny = baseParticle as XmlSchemaAny;
if (baseAny == null) {
- error (h, "Invalid particle derivation by restriction was found.");
- return;
+ if (raiseError)
+ error (h, "Invalid particle derivation by restriction was found.");
+ return false;
}
// 3.9.6 Particle Derivation OK (Any:Any - NSSubset)
- this.ValidateOccurenceRangeOK (baseParticle, h, schema);
- wildcard.ValidateWildcardSubset (baseAny.wildcard, h, schema);
+ if (!ValidateOccurenceRangeOK (baseParticle, h, schema, raiseError))
+ return false;
+ return wildcard.ValidateWildcardSubset (baseAny.wildcard, h, schema, raiseError);
}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAttribute.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAttribute.cs
index d6f30f5f788..4307bd5d70e 100755
--- a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAttribute.cs
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAttribute.cs
@@ -334,7 +334,7 @@ namespace System.Xml.Schema
}
else if (SchemaTypeName == XmlSchemaComplexType.AnyTypeName)
attributeType = XmlSchemaComplexType.AnyType;
- else if (SchemaTypeName.Namespace == XmlSchema.Namespace) {
+ else if (XmlSchemaUtil.IsBuiltInDatatypeName (SchemaTypeName)) {
attributeType = XmlSchemaDatatype.FromName (SchemaTypeName);
if (attributeType == null)
error (h, "Invalid xml schema namespace datatype was specified.");
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaChoice.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaChoice.cs
index dc8ed48e9d7..9dd34474c61 100755
--- a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaChoice.cs
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaChoice.cs
@@ -12,16 +12,13 @@ using System.Xml;
namespace System.Xml.Schema
{
- /// <summary>
- /// Summary description for XmlSchemaAll.
- /// </summary>
public class XmlSchemaChoice : XmlSchemaGroupBase
{
private XmlSchemaObjectCollection items;
private static string xmlname = "choice";
private decimal minEffectiveTotalRange = -1;
- public XmlSchemaChoice()
+ public XmlSchemaChoice ()
{
items = new XmlSchemaObjectCollection();
}
@@ -36,18 +33,6 @@ namespace System.Xml.Schema
get{ return items; }
}
- internal override XmlSchemaParticle ActualParticle {
- get {
- if (this.ValidatedMinOccurs == 1 &&
- this.ValidatedMaxOccurs == 1 &&
- CompiledItems.Count == 1)
- return ((XmlSchemaParticle) CompiledItems [0]).ActualParticle;
- else
- return this;
- }
- }
-
- [MonoTODO]
internal override int Compile(ValidationEventHandler h, XmlSchema schema)
{
// If this is already compiled this time, simply skip.
@@ -57,6 +42,9 @@ namespace System.Xml.Schema
XmlSchemaUtil.CompileID(Id, this, schema.IDCollection, h);
CompileOccurence (h, schema);
+ if (Items.Count == 0)
+ this.warn (h, "Empty choice is unsatisfiable if minOccurs not equals to 0");
+
foreach(XmlSchemaObject obj in Items)
{
if(obj is XmlSchemaElement ||
@@ -73,16 +61,53 @@ namespace System.Xml.Schema
this.CompilationId = schema.CompilationId;
return errorCount;
}
-
- [MonoTODO]
- internal override int Validate(ValidationEventHandler h, XmlSchema schema)
+
+ internal override XmlSchemaParticle GetOptimizedParticle (bool isTop)
+ {
+ if (OptimizedParticle != null)
+ return OptimizedParticle;
+
+ if (Items.Count == 0 || ValidatedMaxOccurs == 0)
+ OptimizedParticle = XmlSchemaParticle.Empty;
+ // FIXME: Regardless of isTop, it should remove pointless particle.
+ else if (!isTop && Items.Count == 1 && ValidatedMinOccurs == 1 && ValidatedMaxOccurs == 1)
+ OptimizedParticle = ((XmlSchemaParticle) Items [0]).GetOptimizedParticle (false);
+ else {
+ XmlSchemaChoice c = new XmlSchemaChoice ();
+ CopyInfo (c);
+ for (int i = 0; i < Items.Count; i++) {
+ XmlSchemaParticle p = Items [i] as XmlSchemaParticle;
+ p = p.GetOptimizedParticle (false);
+ if (p == XmlSchemaParticle.Empty)
+ continue;
+ else if (p is XmlSchemaChoice && p.ValidatedMinOccurs == 1 && p.ValidatedMaxOccurs == 1) {
+ XmlSchemaChoice pc = p as XmlSchemaChoice;
+ for (int ci = 0; ci < pc.Items.Count; ci++) {
+ c.Items.Add (pc.Items [ci]);
+ c.CompiledItems.Add (pc.Items [ci]);
+ }
+ }
+ else {
+ c.Items.Add (p);
+ c.CompiledItems.Add (p);
+ }
+ }
+ if (c.Items.Count == 0)
+ OptimizedParticle = XmlSchemaParticle.Empty;
+ else
+ OptimizedParticle = c;
+ }
+ return OptimizedParticle;
+ }
+
+ internal override int Validate (ValidationEventHandler h, XmlSchema schema)
{
if (IsValidated (schema.CompilationId))
return errorCount;
CompiledItems.Clear ();
foreach (XmlSchemaParticle p in Items) {
- errorCount += p.Validate (h, schema);
+ errorCount += p.Validate (h, schema); // This is basically extraneous for pointless item, but needed to check validation error.
CompiledItems.Add (p);
}
@@ -90,30 +115,91 @@ namespace System.Xml.Schema
return errorCount;
}
- internal override void ValidateDerivationByRestriction (XmlSchemaParticle baseParticle,
- ValidationEventHandler h, XmlSchema schema)
+ internal override bool ValidateDerivationByRestriction (XmlSchemaParticle baseParticle,
+ ValidationEventHandler h, XmlSchema schema, bool raiseError)
{
XmlSchemaAny any = baseParticle as XmlSchemaAny;
if (any != null) {
// NSRecurseCheckCardinality
- this.ValidateNSRecurseCheckCardinality (any, h, schema);
- return;
+ return ValidateNSRecurseCheckCardinality (any, h, schema, raiseError);
}
XmlSchemaChoice choice = baseParticle as XmlSchemaChoice;
if (choice != null) {
// RecurseLax
- this.ValidateOccurenceRangeOK (choice, h, schema);
+ if (!ValidateOccurenceRangeOK (choice, h, schema, raiseError))
+ return false;
// If it is totally optional, then ignore their contents.
if (choice.ValidatedMinOccurs == 0 && choice.ValidatedMaxOccurs == 0 &&
this.ValidatedMinOccurs == 0 && this.ValidatedMaxOccurs == 0)
- return;
- this.ValidateRecurse (choice, h, schema);
- return;
+ return true;
+// return ValidateRecurseLax (choice, h, schema, raiseError);
+ return this.ValidateSeqRecurseMapSumCommon (choice, h, schema, true, false, raiseError);
}
- error (h, "Invalid choice derivation by restriction was found.");
+ if (raiseError)
+ error (h, "Invalid choice derivation by restriction was found.");
+ return false;
+ }
+
+ private bool ValidateRecurseLax (XmlSchemaGroupBase baseGroup,
+ ValidationEventHandler h, XmlSchema schema, bool raiseError)
+ {
+ int index = 0;
+ for (int i = 0; i < baseGroup.CompiledItems.Count; i++) {
+ XmlSchemaParticle pb = (XmlSchemaParticle) baseGroup.CompiledItems [i];
+ pb = pb.GetOptimizedParticle (false);
+ if (pb == XmlSchemaParticle.Empty)
+ continue;
+ XmlSchemaParticle pd = null;
+ while (this.CompiledItems.Count > index) {
+ pd = (XmlSchemaParticle) this.CompiledItems [index];
+ pd = pd.GetOptimizedParticle (false);
+ index++;
+ if (pd != XmlSchemaParticle.Empty)
+ break;
+ }
+ if (!ValidateParticleSection (ref index, pd, pb, h, schema, raiseError))
+ continue;
+ }
+ if (this.CompiledItems.Count > 0 && index != this.CompiledItems.Count) {
+ if (raiseError)
+ error (h, "Invalid particle derivation by restriction was found. Extraneous derived particle was found.");
+ return false;
+ }
+ return true;
+ }
+
+ private bool ValidateParticleSection (ref int index, XmlSchemaParticle pd, XmlSchemaParticle pb, ValidationEventHandler h, XmlSchema schema, bool raiseError)
+ {
+ if (pd == pb) // they are same particle
+ return true;
+
+ if (pd != null) {
+ XmlSchemaElement el = pd as XmlSchemaElement;
+ XmlSchemaParticle pdx = pd;
+// if (el != null && el.SubstitutingElements.Count > 0)
+// pdx = el.SubstitutingChoice;
+
+ if (!pdx.ValidateDerivationByRestriction (pb, h, schema, false)) {
+ if (!pb.ValidateIsEmptiable ()) {
+ if (raiseError)
+ error (h, "Invalid particle derivation by restriction was found. Invalid sub-particle derivation was found.");
+ return false;
+ }
+ else {
+ index--; // try the same derived particle and next base particle.
+ return false;
+ }
+ }
+ } else if (!pb.ValidateIsEmptiable ()) {
+ if (raiseError)
+ error (h, "Invalid particle derivation by restriction was found. Base schema particle has non-emptiable sub particle that is not mapped to the derived particle.");
+ return false;
+ }
+
+ return true;
}
internal override decimal GetMinEffectiveTotalRange ()
@@ -135,12 +221,6 @@ namespace System.Xml.Schema
return product;
}
- internal override void CheckRecursion (int depth, ValidationEventHandler h, XmlSchema schema)
- {
- foreach (XmlSchemaParticle p in this.Items)
- p.CheckRecursion (depth, h, schema);
- }
-
internal override void ValidateUniqueParticleAttribution (XmlSchemaObjectTable qnames, ArrayList nsNames,
ValidationEventHandler h, XmlSchema schema)
{
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaCollection.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaCollection.cs
index e3984bb18da..38a2f7352ee 100755
--- a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaCollection.cs
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaCollection.cs
@@ -18,45 +18,39 @@ namespace System.Xml.Schema
public sealed class XmlSchemaCollection : ICollection, IEnumerable
{
//private fields
- private Hashtable htable;
- private Hashtable uriTable;
- private XmlNameTable ntable;
- internal Guid CompilationId;
+ private XmlSchemaSet schemaSet;
- public XmlSchemaCollection()
+ public XmlSchemaCollection ()
: this (new NameTable ())
{
}
- public XmlSchemaCollection(XmlNameTable nametable)
+ public XmlSchemaCollection (XmlNameTable nameTable)
+ : this (new XmlSchemaSet (nameTable))
{
- htable = new Hashtable();
- uriTable = new Hashtable ();
- ntable = nametable;
- CompilationId = Guid.NewGuid ();
+ this.schemaSet.SchemaCollection = this;
+ }
+
+ internal XmlSchemaCollection (XmlSchemaSet schemaSet)
+ {
+ this.schemaSet = schemaSet;
}
//properties
- public int Count
- {
- get
- {
- return this.htable.Count;
- }
+ internal XmlSchemaSet SchemaSet {
+ get { return schemaSet; }
}
- public XmlNameTable NameTable
- {
- get
- {
- return this.ntable;
- }
+
+ public int Count {
+ get { return schemaSet.Count; }
}
- public XmlSchema this[ string ns ]
- {
- get
- {
- return (XmlSchema) this.htable[GetSafeNs(ns)];
- }
+
+ public XmlNameTable NameTable {
+ get { return schemaSet.NameTable; }
+ }
+
+ public XmlSchema this [ string ns ] {
+ get { return schemaSet.Get (ns); }
}
// Events
@@ -65,138 +59,129 @@ namespace System.Xml.Schema
// Methods
public XmlSchema Add (string ns, XmlReader reader)
{
- if (reader == null)
- throw new ArgumentNullException ("reader");
+ return Add (ns, reader, new XmlUrlResolver ());
+ }
+#if NET_1_0
+ internal XmlSchema Add (string ns, XmlReader reader, XmlResolver resolver)
+#else
+ public XmlSchema Add (string ns, XmlReader reader, XmlResolver resolver)
+#endif
+ {
XmlSchema schema = XmlSchema.Read (reader, ValidationEventHandler);
- return Add (schema);
+ schema.Compile (ValidationEventHandler, this, resolver);
+ return schemaSet.Add (schema);
+ }
+
+ public XmlSchema Add (string ns, string uri)
+ {
+ return schemaSet.Add (ns, uri);
}
- public XmlSchema Add(string ns, string uri)
+ public XmlSchema Add (XmlSchema schema)
{
- return Add (ns, new XmlTextReader (uri));
+ return Add (schema, new XmlUrlResolver ());
}
- public XmlSchema Add(XmlSchema schema)
+ public XmlSchema Add (XmlSchema schema, XmlResolver resolver)
{
if (schema == null)
throw new ArgumentNullException ("schema");
+ // XmlSchemaCollection.Add() compiles, while XmlSchemaSet.Add() does not
if (!schema.IsCompiled)
- schema.Compile (null, this);
- /*
- // This is requried to complete maybe missing sub components.
- foreach (XmlSchema existing in htable.Values)
- if (existing.CompilationId != this.CompilationId)
- existing.Compile (null, this);
- */
+ schema.Compile (ValidationEventHandler, this, resolver);
- htable [GetSafeNs(schema.TargetNamespace)] = schema;
- return schema;
+ string ns = GetSafeNs (schema.TargetNamespace);
+ if (schemaSet.Contains (ns))
+ schemaSet.Remove (schemaSet.Get (ns));
+ return schemaSet.Add (schema);
}
- public void Add(XmlSchemaCollection schema)
+ private string GetSafeNs (string ns)
+ {
+ return ns != null ? ns : String.Empty;
+ }
+
+ public void Add (XmlSchemaCollection schema)
{
if (schema == null)
throw new ArgumentNullException ("schema");
- foreach (XmlSchema s in schema)
- Add (s);
+ foreach (XmlSchema s in schema) {
+ string ns = GetSafeNs (s.TargetNamespace);
+ if (schemaSet.Contains (ns))
+ schemaSet.Remove (schemaSet.Get (ns));
+ schemaSet.Add (s);
+ }
}
- string GetSafeNs (string ns)
+ public bool Contains (string ns)
{
- return ns == null ? "" : ns;
+ return schemaSet.Contains (ns);
}
- public bool Contains(string ns)
+ public bool Contains (XmlSchema schema)
{
- return this.htable.Contains(GetSafeNs(ns));
+ return schemaSet.Contains (schema);
}
- public bool Contains(XmlSchema schema)
- {
- return this.htable.Contains(GetSafeNs(schema.TargetNamespace));
- }
- public void CopyTo(XmlSchema[] array, int index)
+
+ public void CopyTo (XmlSchema[] array, int index)
{
- ((ICollection) this).CopyTo (array, index);
+ schemaSet.CopyTo (array, index);
}
- public XmlSchemaCollectionEnumerator GetEnumerator()
+ public XmlSchemaCollectionEnumerator GetEnumerator ()
{
- return new XmlSchemaCollectionEnumerator(this);
+ return new XmlSchemaCollectionEnumerator (this);
}
// interface Methods
- void ICollection.CopyTo(Array array, int index)
+ void ICollection.CopyTo (Array array, int index)
{
- htable.Values.CopyTo (array, index);
+ schemaSet.CopyTo (array, index);
}
+
+ [MonoTODO]
bool ICollection.IsSynchronized
{
- get { return false; }
+ get { throw new NotImplementedException (); }
}
- IEnumerator IEnumerable.GetEnumerator()
+
+ IEnumerator IEnumerable.GetEnumerator ()
{
- return this.htable.GetEnumerator();
+ return schemaSet.GetEnumerator ();
}
+
+ [MonoTODO]
Object ICollection.SyncRoot
{
- get { return this; }
+ get { throw new NotImplementedException (); }
}
// Internal Methods
internal XmlSchemaAttribute FindAttribute (XmlQualifiedName qname)
{
- XmlSchemaAttribute found = null;
- XmlSchema target = this [qname.Namespace];
- if (target != null)
- found = target.Attributes [qname] as XmlSchemaAttribute;
- if (found != null)
- return found;
- foreach (XmlSchema schema in htable.Values) {
- found = schema.Attributes [qname] as XmlSchemaAttribute;
- if (found != null)
- return found;
- }
- return null;
+ return (XmlSchemaAttribute) schemaSet.GlobalAttributes [qname];
}
internal XmlSchemaElement FindElement (XmlQualifiedName qname)
{
- XmlSchemaElement found = null;
- XmlSchema target = this [qname.Namespace];
- if (target != null)
- found = target.Elements [qname] as XmlSchemaElement;
- if (found != null)
- return found;
- foreach (XmlSchema schema in htable.Values) {
- found = schema.Elements [qname] as XmlSchemaElement;
- if (found != null)
- return found;
- }
- return null;
+ return (XmlSchemaElement) schemaSet.GlobalElements [qname];
}
internal object FindSchemaType (XmlQualifiedName qname)
{
- if (qname == XmlSchemaComplexType.AnyTypeName)
- return XmlSchemaComplexType.AnyType;
- else if (qname.Namespace == XmlSchema.Namespace)
- return XmlSchemaDatatype.FromName (qname);
-
- XmlSchemaType found = null;
- XmlSchema target = this [qname.Namespace];
- if (target != null)
- found = target.SchemaTypes [qname] as XmlSchemaType;
- if (found != null)
- return found;
- foreach (XmlSchema schema in htable.Values) {
- found = schema.SchemaTypes [qname] as XmlSchemaType;
- if (found != null)
- return found;
- }
- return null;
+ return schemaSet.GlobalTypes [qname];
}
+
+ internal void OnValidationError (object o, ValidationEventArgs e)
+ {
+ if (ValidationEventHandler != null)
+ ValidationEventHandler (o, e);
+ else if (e.Severity == XmlSeverityType.Error)
+ throw e.Exception;
+ }
+
}
}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaComplexContentExtension.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaComplexContentExtension.cs
index bcda628e9f9..039311c48a9 100755
--- a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaComplexContentExtension.cs
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaComplexContentExtension.cs
@@ -59,9 +59,13 @@ namespace System.Xml.Schema
set{ any = value;}
}
+ // internal properties
+ internal override bool IsExtension {
+ get { return true; }
+ }
+
/// <remarks>
/// </remarks>
- [MonoTODO]
internal override int Compile(ValidationEventHandler h, XmlSchema schema)
{
// If this is already compiled this time, simply skip.
@@ -135,7 +139,16 @@ namespace System.Xml.Schema
return errorCount;
}
- [MonoTODO]
+ internal override XmlQualifiedName GetBaseTypeName ()
+ {
+ return baseTypeName;
+ }
+
+ internal override XmlSchemaParticle GetParticle ()
+ {
+ return particle;
+ }
+
internal override int Validate(ValidationEventHandler h, XmlSchema schema)
{
if (IsValidated (schema.ValidationId))
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaComplexContentRestriction.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaComplexContentRestriction.cs
index 5028bd5fc8d..0e8116a9caa 100755
--- a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaComplexContentRestriction.cs
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaComplexContentRestriction.cs
@@ -59,10 +59,14 @@ namespace System.Xml.Schema
set{ any = value; }
}
+ // internal properties
+ internal override bool IsExtension {
+ get { return false; }
+ }
+
/// <remarks>
/// 1. base must be present
/// </remarks>
- [MonoTODO]
internal override int Compile(ValidationEventHandler h, XmlSchema schema)
{
// If this is already compiled this time, simply skip.
@@ -136,8 +140,17 @@ namespace System.Xml.Schema
return errorCount;
}
- [MonoTODO]
- internal override int Validate(ValidationEventHandler h, XmlSchema schema)
+ internal override XmlQualifiedName GetBaseTypeName ()
+ {
+ return baseTypeName;
+ }
+
+ internal override XmlSchemaParticle GetParticle ()
+ {
+ return particle;
+ }
+
+ internal override int Validate (ValidationEventHandler h, XmlSchema schema)
{
return errorCount;
}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaComplexType.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaComplexType.cs
index e03f3dc5764..18c07850763 100755
--- a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaComplexType.cs
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaComplexType.cs
@@ -25,6 +25,7 @@ namespace System.Xml.Schema
private XmlSchemaDerivationMethod block;
private XmlSchemaDerivationMethod blockResolved;
private XmlSchemaContentModel contentModel;
+ private XmlSchemaParticle validatableParticle;
private XmlSchemaParticle contentTypeParticle;
private bool isAbstract;
private bool isMixed;
@@ -44,9 +45,9 @@ namespace System.Xml.Schema
anyType = new XmlSchemaComplexType ();
anyType.Name = ""; // In MS.NET, it is not "anyType"
anyType.QNameInternal = XmlQualifiedName.Empty; // Not xs:anyType as well.
- anyType.contentTypeParticle = XmlSchemaAny.AnyTypeContent;
-// anyType.baseSchemaTypeInternal = anyType;
- anyType.datatypeInternal = XmlSchemaSimpleType.AnySimpleType;
+ anyType.validatableParticle = XmlSchemaAny.AnyTypeContent;
+ anyType.contentTypeParticle = anyType.validatableParticle;
+ anyType.DatatypeInternal = XmlSchemaSimpleType.AnySimpleType;
anyType.isMixed = true;
}
return anyType;
@@ -55,11 +56,13 @@ namespace System.Xml.Schema
internal static readonly XmlQualifiedName AnyTypeName = new XmlQualifiedName ("anyType", XmlSchema.Namespace);
- public XmlSchemaComplexType()
+ public XmlSchemaComplexType ()
{
attributes = new XmlSchemaObjectCollection();
block = XmlSchemaDerivationMethod.None;
attributeUses = new XmlSchemaObjectTable();
+ validatableParticle = XmlSchemaParticle.Empty;
+ contentTypeParticle = validatableParticle;
}
#region Attributes
@@ -131,7 +134,6 @@ namespace System.Xml.Schema
get{ return resolvedContentType; }
}
[XmlIgnore]
- [MonoTODO ("Derivation is not supported yet.")]
public XmlSchemaParticle ContentTypeParticle
{
get{ return contentTypeParticle; }
@@ -153,6 +155,12 @@ namespace System.Xml.Schema
}
#endregion
+ internal XmlSchemaParticle ValidatableParticle
+ {
+// get{ return validatableParticle; }
+ get{ return contentTypeParticle; }
+ }
+
/// <remarks>
/// 1. If ContentModel is present, neither particle nor Attributes nor AnyAttribute can be present.
/// 2. If particle is present,
@@ -167,8 +175,7 @@ namespace System.Xml.Schema
/// 4. block must be absent
///
/// </remarks>
- [MonoTODO]
- internal override int Compile(ValidationEventHandler h, XmlSchema schema)
+ internal override int Compile (ValidationEventHandler h, XmlSchema schema)
{
// If this is already compiled this time, simply skip.
if (this.IsComplied (schema.CompilationId))
@@ -284,24 +291,21 @@ namespace System.Xml.Schema
baseTypeName = sscr.BaseTypeName;
if (sscr.BaseType != null) {
sscr.BaseType.Compile (h, schema);
- baseSchemaTypeInternal = sscr.BaseType;
+ BaseXmlSchemaTypeInternal = sscr.BaseType;
}
}
}
- contentTypeParticle = XmlSchemaParticle.Empty;
}
else
{
XmlSchemaComplexContent cmodel = (XmlSchemaComplexContent) ContentModel;
XmlSchemaComplexContentExtension sccx = cmodel.Content as XmlSchemaComplexContentExtension;
if (sccx != null) {
- contentTypeParticle = sccx.Particle;
baseTypeName = sccx.BaseTypeName;
}
else {
XmlSchemaComplexContentRestriction sccr = (XmlSchemaComplexContentRestriction) cmodel.Content;
if (sccr != null) {
- contentTypeParticle = sccr.Particle;
baseTypeName = sccr.BaseTypeName;
}
}
@@ -329,7 +333,6 @@ namespace System.Xml.Schema
XmlSchemaSequence xss = (XmlSchemaSequence)Particle;
errorCount += xss.Compile(h,schema);
}
- this.contentTypeParticle = Particle;
if(this.anyAttribute != null)
{
@@ -357,8 +360,207 @@ namespace System.Xml.Schema
return errorCount;
}
- [MonoTODO]
- internal override int Validate(ValidationEventHandler h, XmlSchema schema)
+ Guid CollectProcessId;
+
+ private void CollectSchemaComponent (ValidationEventHandler h, XmlSchema schema)
+ {
+ if (CollectProcessId == schema.CompilationId)
+ return;
+ // Below are already contributed by Compile():
+ // {name}, {namespace} => QualifiedName, QNameInternal
+ // {abstract} => ValidatedIsAbstract
+ // {prohibited substitutions} => BlockResolved
+ // {final} => FinalResolved
+ // {annotations} => Annotation (XmlSchemaAnnotated)
+
+ // Below are different properties depending on simpleContent | complexContent.
+ // {base type definition}
+ // {derivation method}
+ // {attribute uses} => AttributeUses (later)
+ // {attribute wildcard} => AttributeWildcard (later)
+ // {content type}
+
+
+ // {base type definition} => baseSchemaTypeInternal (later)
+ if (contentModel != null) {
+ BaseSchemaTypeName = contentModel.Content != null ? contentModel.Content.GetBaseTypeName () : XmlQualifiedName.Empty;
+
+ BaseXmlSchemaTypeInternal = schema.SchemaTypes [BaseSchemaTypeName] as XmlSchemaType;
+ }
+ // Resolve redefine.
+ if (this.isRedefineChild && BaseXmlSchemaType != null && this.QualifiedName == BaseSchemaTypeName) {
+ XmlSchemaType redType = (XmlSchemaType) redefinedObject;
+ if (redType == null)
+ error (h, "Redefinition base type was not found.");
+ else
+ BaseXmlSchemaTypeInternal = redType;
+ }
+
+ // {derivation method} => resolvedDerivedBy
+ if (contentModel != null && contentModel.Content != null) {
+ resolvedDerivedBy =
+ contentModel.Content.IsExtension ?
+ XmlSchemaDerivationMethod.Extension :
+ XmlSchemaDerivationMethod.Restriction;
+ }
+ else
+ resolvedDerivedBy = XmlSchemaDerivationMethod.Empty;
+
+
+ // {content type} => ContentType and ContentTypeParticle (later)
+ if (ContentModel != null) {
+ CollectContentTypeFromContentModel (h, schema);
+ } else
+ CollectContentTypeFromImmediateContent ();
+ contentTypeParticle = validatableParticle.GetOptimizedParticle (true);
+ if (contentTypeParticle == XmlSchemaParticle.Empty && resolvedContentType == XmlSchemaContentType.ElementOnly)
+ resolvedContentType = XmlSchemaContentType.Empty;
+
+ CollectProcessId = schema.CompilationId;
+ }
+
+ #region {content type}
+ private void CollectContentTypeFromImmediateContent ()
+ {
+ // leave resolvedDerivedBy as Empty
+ if (Particle != null)
+ validatableParticle = Particle;
+ if (validatableParticle == XmlSchemaParticle.Empty) {
+ // note that this covers "Particle == null" case
+ if (this.IsMixed)
+ resolvedContentType = XmlSchemaContentType.TextOnly;
+ else
+ resolvedContentType = XmlSchemaContentType.Empty;
+ } else {
+ if (this.IsMixed)
+ resolvedContentType = XmlSchemaContentType.Mixed;
+ else
+ resolvedContentType = XmlSchemaContentType.ElementOnly;
+ }
+ }
+
+ private void CollectContentTypeFromContentModel (ValidationEventHandler h, XmlSchema schema)
+ {
+ if (ContentModel.Content == null) {
+ // basically it is error. Recover by specifying empty content.
+ validatableParticle = XmlSchemaParticle.Empty;
+ resolvedContentType = XmlSchemaContentType.Empty;
+ return;
+ }
+
+ if (ContentModel.Content is XmlSchemaComplexContentExtension)
+ CollectContentTypeFromComplexExtension (h, schema);
+ if (ContentModel.Content is XmlSchemaComplexContentRestriction)
+ CollectContentTypeFromComplexRestriction ();
+ }
+
+ private void CollectContentTypeFromComplexExtension (ValidationEventHandler h, XmlSchema schema)
+ {
+ XmlSchemaComplexContentExtension cce = (XmlSchemaComplexContentExtension) ContentModel.Content;
+ XmlSchemaComplexType baseComplexType = this.BaseXmlSchemaType as XmlSchemaComplexType;
+ if (baseComplexType != null)
+ baseComplexType.CollectSchemaComponent (h ,schema);
+
+ // It must exist, but consider validation error case.
+ if (BaseSchemaTypeName == XmlSchemaComplexType.AnyTypeName)
+ baseComplexType = XmlSchemaComplexType.AnyType;
+
+ // On error case, it simple reject any contents
+ if (baseComplexType == null) {
+ validatableParticle = XmlSchemaParticle.Empty;
+ resolvedContentType = XmlSchemaContentType.Empty;
+ return;
+ }
+
+ // 3.4.2 complex content {content type}
+ if (cce.Particle == null || cce.Particle == XmlSchemaParticle.Empty) {
+ // - 2.1
+ if (baseComplexType == null) {
+ // Basically it is an error. Considering ValidationEventHandler.
+ validatableParticle = XmlSchemaParticle.Empty;
+ resolvedContentType = XmlSchemaContentType.Empty;
+ } else {
+ validatableParticle = baseComplexType.ValidatableParticle;
+ resolvedContentType = baseComplexType.resolvedContentType;
+ }
+ } else if (baseComplexType.validatableParticle == XmlSchemaParticle.Empty
+ || baseComplexType == XmlSchemaComplexType.AnyType) {
+ // - 2.2
+ validatableParticle = cce.Particle;
+ resolvedContentType = GetComplexContentType (contentModel);
+ } else {
+ // - 2.3 : create a new sequences that merges both contents.
+ XmlSchemaSequence seq = new XmlSchemaSequence ();
+ this.CopyInfo (seq);
+ seq.Items.Add (baseComplexType.validatableParticle);
+ seq.Items.Add (cce.Particle);
+ seq.Compile (h, schema);
+ seq.Validate (h, schema);
+ validatableParticle = seq;
+ resolvedContentType = GetComplexContentType (contentModel);
+ }
+ if (validatableParticle == null)
+ validatableParticle = XmlSchemaParticle.Empty;
+ }
+
+ private void CollectContentTypeFromComplexRestriction ()
+ {
+ XmlSchemaComplexContentRestriction ccr = (XmlSchemaComplexContentRestriction) ContentModel.Content;
+ // 3.4.2 complex content schema component {content type}
+ // - 1.1.1
+ bool isEmptyParticle = false;
+ if (ccr.Particle == null)
+ isEmptyParticle = true;
+ else {
+ XmlSchemaGroupBase gb = ccr.Particle as XmlSchemaGroupBase;
+ if (gb != null) {
+ // - 1.1.2
+ if (!(gb is XmlSchemaChoice) && gb.Items.Count == 0)
+ isEmptyParticle = true;
+ // - 1.1.3
+ else if (gb is XmlSchemaChoice && gb.Items.Count == 0 && gb.ValidatedMinOccurs == 0)
+ isEmptyParticle = true;
+ }
+ }
+ if (isEmptyParticle) {
+ resolvedContentType = XmlSchemaContentType.Empty;
+ validatableParticle = XmlSchemaParticle.Empty;
+ } else {
+ // - 1.2.1
+ resolvedContentType = GetComplexContentType (contentModel);
+ // - 1.2.2
+ validatableParticle = ccr.Particle;
+ }
+ }
+
+ // 3.4.2 Complex Content Schema Component {content type} 1.2.1
+ private XmlSchemaContentType GetComplexContentType (XmlSchemaContentModel content)
+ {
+ if (this.IsMixed || ((XmlSchemaComplexContent) content).IsMixed)
+ return XmlSchemaContentType.Mixed;
+ else
+ return XmlSchemaContentType.ElementOnly;
+ }
+ #endregion
+
+ //
+ // We have to validate:
+ //
+ // - 3.4.3 Complex Type Definition Representation OK
+ // - 3.4.6 Type Definition Properties Correct
+ // - 3.4.6 Derivation Valid (Extension)
+ // - 3.4.6 Derivation Valid (Restriction, Complex)
+ //
+ // There are many schema errata:
+ // http://www.w3.org/2001/05/xmlschema-errata#Errata1
+ //
+ // E1-43 Derivation Valid (Restriction, Complex) 5.
+ // E1-21 Derivation Valid (Restriction, Complex) 4.3.
+ // E1-17 Type Derivation OK (Complex) 2.1.
+ //
+ // And E1-38, E1-37, E1-30, E1-27
+ //
+ internal override int Validate (ValidationEventHandler h, XmlSchema schema)
{
if (IsValidated (schema.ValidationId))
return errorCount;
@@ -367,50 +569,38 @@ namespace System.Xml.Schema
// it may result in insufficient results.
ValidationId = schema.ValidationId;
- // Term. 1 of 3.4.6 = 3.4.1 : Complex Type Definitions Properties Correct
- // Term. 2 and 3 goes ValidateContentModel().
- // Term. 4 and 5 follows in this method.
- //
- // Schema component to CLR type property mapping:
- // {derivation method} => resolvedDerivedBy
- // {annotations} are as is.
- // {name}, {namespace} => QualifiedName
- // {final} and {prohibited substitutions} are Compile()d.
- // {abstract} => ValidatedIsAbstract
+ CollectSchemaComponent (h, schema);
- // Below are different properties depending on simpleContent | complexContent.
- // {base type definition} => BaseSchemaType (later)
- // {attribute uses} => AttributeUses (later)
- // {content type} => ContentType and ContentTypeParticle (later)
-
- // TODO: Beware of E1-27 of http://www.w3.org/2001/05/xmlschema-errata#Errata1
- if (contentModel != null)
+ // 3.4.6: Properties Correct
+ // Term. 1 => 3.4.1 already done by CollectSchemaComponent()
+ // except for {attribute uses} and {attribute wildcard}
+ // Term. 2, 3 and 4 goes to ValidateContentModel().
+ // Term. 5 follows in this method.
+ //
+ if (ContentModel != null)
ValidateContentModel (h, schema);
else {
- if (particle != null)
- ValidateParticle (h, schema);
- // contentModel never has them.
+ if (Particle != null)
+ ValidateImmediateParticle (h, schema);
ValidateImmediateAttributes (h, schema);
}
+
// Additional support for 3.8.6 All Group Limited
- if (contentTypeParticle != null) {
- XmlSchemaAll termAll = contentTypeParticle.ActualParticle as XmlSchemaAll;
- if (termAll != null && contentTypeParticle.ValidatedMaxOccurs != 1)
+ if (ContentTypeParticle != null) {
+ XmlSchemaAll termAll = contentTypeParticle.GetOptimizedParticle (true) as XmlSchemaAll;
+ if (termAll != null && (termAll.ValidatedMaxOccurs != 1 || contentTypeParticle.ValidatedMaxOccurs != 1)) // here contentTypeParticle is used to check occurence. FIXME: In the future contentTypeParticle will remove group references.
error (h, "Particle whose term is -all- and consists of complex type content particle must have maxOccurs = 1.");
}
- // {content type} is going to be finished.
- if (contentTypeParticle == null)
- contentTypeParticle = XmlSchemaParticle.Empty;
contentTypeParticle.ValidateUniqueParticleAttribution (new XmlSchemaObjectTable (),
new ArrayList (), h, schema);
contentTypeParticle.ValidateUniqueTypeAttribution (
new XmlSchemaObjectTable (), h, schema);
- resolvedContentType = GetContentType ();
// 3.4.6 Properties Correct :: 5 (Two distinct ID attributes)
XmlSchemaAttribute idAttr = null;
- foreach (XmlSchemaAttribute attr in attributeUses) {
+ foreach (DictionaryEntry entry in attributeUses) {
+ XmlSchemaAttribute attr = (XmlSchemaAttribute) entry.Value;
XmlSchemaDatatype dt = attr.AttributeType as XmlSchemaDatatype;
if (dt != null && dt.TokenizedType != XmlTokenizedType.ID)
continue;
@@ -428,11 +618,9 @@ namespace System.Xml.Schema
return errorCount;
}
- private void ValidateParticle (ValidationEventHandler h, XmlSchema schema)
+ private void ValidateImmediateParticle (ValidationEventHandler h, XmlSchema schema)
{
- // {content type} as a particle.
errorCount += particle.Validate (h, schema);
- contentTypeParticle = Particle;
XmlSchemaGroupRef pgrp = Particle as XmlSchemaGroupRef;
if (pgrp != null) {
if (pgrp.TargetGroup != null)
@@ -454,6 +642,8 @@ namespace System.Xml.Schema
private void ValidateContentModel (ValidationEventHandler h, XmlSchema schema)
{
+ XmlSchemaType baseType = BaseXmlSchemaTypeInternal;
+
// Here we check 3.4.6 Properties Correct :: 2. and 3.
errorCount += contentModel.Validate (h, schema);
XmlSchemaComplexContentExtension cce = contentModel.Content as XmlSchemaComplexContentExtension;
@@ -464,44 +654,21 @@ namespace System.Xml.Schema
XmlSchemaAnyAttribute localAnyAttribute = null;
XmlSchemaAnyAttribute baseAnyAttribute = null;
- XmlQualifiedName baseTypeName = null;
- if (cce != null)
- baseTypeName = cce.BaseTypeName;
- else if (ccr != null)
- baseTypeName = ccr.BaseTypeName;
- else if (sce != null)
- baseTypeName = sce.BaseTypeName;
- else
- baseTypeName = scr.BaseTypeName;
-
- XmlSchemaType baseType = schema.SchemaTypes [baseTypeName] as XmlSchemaType;
- // Resolve redefine.
- if (this.isRedefineChild && baseType != null && this.QualifiedName == baseTypeName) {
- baseType = (XmlSchemaType) redefinedObject;
- if (baseType == null)
- error (h, "Redefinition base type was not found.");
- baseType.Validate (h, schema);
- }
// 3.4.6 Properties Correct :: 3. Circular definition prohibited.
if (ValidateRecursionCheck ())
error (h, "Circular definition of schema types was found.");
if (baseType != null) {
baseType.Validate (h, schema);
// Fill "Datatype" property.
- this.datatypeInternal = baseType.Datatype;
- } else if (baseTypeName == XmlSchemaComplexType.AnyTypeName)
- datatypeInternal = XmlSchemaSimpleType.AnySimpleType;
- else if (baseTypeName.Namespace == XmlSchema.Namespace) {
- datatypeInternal = XmlSchemaDatatype.FromName (baseTypeName);
+ this.DatatypeInternal = baseType.Datatype;
+ } else if (BaseSchemaTypeName == XmlSchemaComplexType.AnyTypeName)
+ DatatypeInternal = XmlSchemaSimpleType.AnySimpleType;
+ else if (XmlSchemaUtil.IsBuiltInDatatypeName (BaseSchemaTypeName)) {
+ DatatypeInternal = XmlSchemaDatatype.FromName (BaseSchemaTypeName);
}
- // {derivation method}
XmlSchemaComplexType baseComplexType = baseType as XmlSchemaComplexType;
XmlSchemaSimpleType baseSimpleType = baseType as XmlSchemaSimpleType;
- if (cce != null || sce != null)
- resolvedDerivedBy = XmlSchemaDerivationMethod.Extension;
- else
- resolvedDerivedBy = XmlSchemaDerivationMethod.Restriction;
// 3.4.6 Derivation Valid (common to Extension and Restriction, Complex) :: 1.
if (baseType != null && (baseType.FinalResolved & resolvedDerivedBy) != 0)
@@ -516,62 +683,65 @@ namespace System.Xml.Schema
if (cce != null || ccr != null) {
// 3.4.3 Complex Type Definition Representation OK :: 1.
// base
- if (baseTypeName == XmlSchemaComplexType.AnyTypeName)
+ if (BaseSchemaTypeName == XmlSchemaComplexType.AnyTypeName)
baseComplexType = XmlSchemaComplexType.AnyType;
- else if (baseTypeName.Namespace == XmlSchema.Namespace)
+ else if (XmlSchemaUtil.IsBuiltInDatatypeName (BaseSchemaTypeName))
error (h, "Referenced base schema type is XML Schema datatype.");
- else if (baseComplexType == null && !schema.IsNamespaceAbsent (baseTypeName.Namespace))
- error (h, "Referenced base schema type " + baseTypeName + " was not complex type or not found in the corresponding schema.");
+ else if (baseComplexType == null && !schema.IsNamespaceAbsent (BaseSchemaTypeName.Namespace))
+ error (h, "Referenced base schema type " + BaseSchemaTypeName + " was not complex type or not found in the corresponding schema.");
}
// Common to simpleContent
else {
+ // ContentType of {content type}
+ resolvedContentType = XmlSchemaContentType.TextOnly;
+
// 3.4.3 Complex Type Definition Representation OK :: 1.
// base
- if (baseTypeName == XmlSchemaComplexType.AnyTypeName)
+ if (BaseSchemaTypeName == XmlSchemaComplexType.AnyTypeName)
baseComplexType = XmlSchemaComplexType.AnyType;
if (baseComplexType != null && baseComplexType.ContentType != XmlSchemaContentType.TextOnly) {
- error (h, "Base schema complex type of a simple content must be simple content type. Base type is " + baseTypeName);
- } else if (sce == null && (baseSimpleType != null && baseTypeName.Namespace != XmlSchema.Namespace)) {
- error (h, "If a simple content is not an extension, base schema type must be complex type. Base type is " + baseTypeName);
- } else if (baseTypeName.Namespace == XmlSchema.Namespace) {
- if (XmlSchemaDatatype.FromName (baseTypeName) == null)
- error (h, "Invalid schema data type was specified: " + baseTypeName);
+ error (h, "Base schema complex type of a simple content must be simple content type. Base type is " + BaseSchemaTypeName);
+ } else if (sce == null && (baseSimpleType != null && BaseSchemaTypeName.Namespace != XmlSchema.Namespace)) {
+ error (h, "If a simple content is not an extension, base schema type must be complex type. Base type is " + BaseSchemaTypeName);
+ } else if (XmlSchemaUtil.IsBuiltInDatatypeName (BaseSchemaTypeName)) {
// do nothing for particle.
}
// otherwise, it might be missing sub components.
- else if (baseType == null && !schema.IsNamespaceAbsent (baseTypeName.Namespace))// && schema.Schemas [baseTypeName.Namespace] != null)
- error (h, "Referenced base schema type " + baseTypeName + " was not found in the corresponding schema.");
+ else if (baseType == null && !schema.IsNamespaceAbsent (BaseSchemaTypeName.Namespace))// && schema.Schemas [baseTypeName.Namespace] != null)
+ error (h, "Referenced base schema type " + BaseSchemaTypeName + " was not found in the corresponding schema.");
+
+ // 3.4.3 Complex Type Definition Representation OK :: 2.
+ // Note that baseSimpleType is also allowed as to Errata E1-27 (http://www.w3.org/2001/05/xmlschema-errata)
+ if (baseComplexType != null) {
+ if (baseComplexType.ContentType == XmlSchemaContentType.TextOnly) {
+ // 2.1.1
+ // Here "baseComplexType.Particle != null" is required for error-ignorant case
+ } else if (scr != null && baseComplexType.ContentType == XmlSchemaContentType.Mixed && baseComplexType.Particle != null && baseComplexType.Particle.ValidateIsEmptiable () && scr.BaseType != null) {
+ // 2.1.2 && 2.2: OK
+ }
+ else
+ error (h, "Base complex type of a simple content restriction must be text only.");
+ } else {
+ if (sce != null && baseComplexType == null) {
+ // 2.1.3 : OK
+ }
+ else
+ error (h, "Not allowed base type of a simple content restriction.");
+ }
}
// complexType/complexContent/extension
if (cce != null) {
- // ContentTypeParticle
- if (baseComplexType == null) {
- // Basically it is an error. Considering ValidationEventHandler.
- }
- else if (baseComplexType.ContentTypeParticle == XmlSchemaParticle.Empty
- || baseComplexType == XmlSchemaComplexType.AnyType)
- contentTypeParticle = cce.Particle;
- else if (cce.Particle == null || cce.Particle == XmlSchemaParticle.Empty)
- contentTypeParticle = baseComplexType.ContentTypeParticle;
- else {
- // create a new sequences that merges both contents.
- XmlSchemaSequence seq = new XmlSchemaSequence ();
- seq.Items.Add (baseComplexType.ContentTypeParticle);
- seq.Items.Add (cce.Particle);
- seq.Compile (h, schema);
- seq.Validate (h, schema);
- contentTypeParticle = seq;
- }
-
// I don't think 3.4.6 Derivation Valid (Extension) :: 1.2
// is constraining anything here, since 3.4.2 {attribute uses}
// defines as to include base type's attribute uses.
localAnyAttribute = cce.AnyAttribute;
if (baseComplexType != null) {
- foreach (XmlSchemaAttribute attr in baseComplexType.AttributeUses)
+ foreach (DictionaryEntry entry in baseComplexType.AttributeUses) {
+ XmlSchemaAttribute attr = (XmlSchemaAttribute) entry.Value;
XmlSchemaUtil.AddToTable (attributeUses, attr, attr.QualifiedName, h);
+ }
baseAnyAttribute = baseComplexType.AttributeWildcard;
}
// attributes
@@ -590,15 +760,10 @@ namespace System.Xml.Schema
// For ValidationEventHandler.
if (baseComplexType == null)
baseComplexType = XmlSchemaComplexType.AnyType;
-
- // ContentTypeParticles (It must contain base type's particle).
- if (ccr.Particle != null) {
+ if (ccr.Particle != null)
ccr.Particle.Validate (h, schema);
- contentTypeParticle = ccr.Particle;
- }
- else
- contentTypeParticle = XmlSchemaParticle.Empty;
+ // attributes
localAnyAttribute = ccr.AnyAttribute;
this.attributeWildcard = localAnyAttribute;
if (baseComplexType != null)
@@ -612,7 +777,8 @@ namespace System.Xml.Schema
errorCount += XmlSchemaUtil.ValidateAttributesResolved (
this.attributeUses, h, schema, ccr.Attributes,
ccr.AnyAttribute, ref attributeWildcard, null);
- foreach (XmlSchemaAttribute attr in baseComplexType.AttributeUses) {
+ foreach (DictionaryEntry entry in baseComplexType.AttributeUses) {
+ XmlSchemaAttribute attr = (XmlSchemaAttribute) entry.Value;
if (attributeUses [attr.QualifiedName] == null)
XmlSchemaUtil.AddToTable (attributeUses, attr, attr.QualifiedName, h);
}
@@ -637,8 +803,10 @@ namespace System.Xml.Schema
if (baseComplexType != null) {
baseAnyAttribute = baseComplexType.AttributeWildcard;
- foreach (XmlSchemaAttribute attr in baseComplexType.AttributeUses)
+ foreach (DictionaryEntry entry in baseComplexType.AttributeUses) {
+ XmlSchemaAttribute attr = (XmlSchemaAttribute) entry.Value;
XmlSchemaUtil.AddToTable (attributeUses, attr, attr.QualifiedName, h);
+ }
}
if (baseAnyAttribute != null && localAnyAttribute != null)
// 1.3 attribute wildcard subset. (=> 3.10.6)
@@ -646,26 +814,21 @@ namespace System.Xml.Schema
}
// complexType/simpleContent/restriction
if (scr != null) {
- if (baseComplexType == null) {
- // 3.4.3 :: 2.
- error (h, "Base type of a simple content restriction must be a complex type.");
- } else {
- // Attributes
- baseAnyAttribute = baseComplexType.AttributeWildcard;
+ // Attributes
+ baseAnyAttribute = baseComplexType != null ? baseComplexType.AttributeWildcard : null;
- localAnyAttribute = scr.AnyAttribute;
- if (localAnyAttribute != null && baseAnyAttribute != null)
- // 1.3 attribute wildcard subset. (=> 3.10.6)
- localAnyAttribute.ValidateWildcardSubset (baseAnyAttribute, h, schema);
- // TODO: 3.4.6 :: 5.1. Beware that There is an errata for 5.1!!
- // http://www.w3.org/2001/05/xmlschema-errata#Errata1
-
- // FIXME: Check 3.4.2 Complex Type Definition with simple content Schema Component
- // and its {attribute uses} and {attribute wildcard}
- errorCount += XmlSchemaUtil.ValidateAttributesResolved (
- this.attributeUses, h, schema, scr.Attributes,
- scr.AnyAttribute, ref attributeWildcard, null);
- }
+ localAnyAttribute = scr.AnyAttribute;
+ if (localAnyAttribute != null && baseAnyAttribute != null)
+ // 1.3 attribute wildcard subset. (=> 3.10.6)
+ localAnyAttribute.ValidateWildcardSubset (baseAnyAttribute, h, schema);
+ // TODO: 3.4.6 :: 5.1. Beware that There is an errata for 5.1!!
+ // http://www.w3.org/2001/05/xmlschema-errata#Errata1
+
+ // FIXME: Check 3.4.2 Complex Type Definition with simple content Schema Component
+ // and its {attribute uses} and {attribute wildcard}
+ errorCount += XmlSchemaUtil.ValidateAttributesResolved (
+ this.attributeUses, h, schema, scr.Attributes,
+ scr.AnyAttribute, ref attributeWildcard, null);
}
// Common process of AttributeWildcard.
@@ -675,67 +838,41 @@ namespace System.Xml.Schema
}
else
this.attributeWildcard = baseAnyAttribute;
- this.baseSchemaTypeInternal = baseType;
- }
-
- private void AddExtensionAttributes (XmlSchemaObjectCollection attributes,
- XmlSchemaAnyAttribute anyAttribute, ValidationEventHandler h, XmlSchema schema)
- {
- }
-
- // It was formerly placed directly in ContentType property.
- // I get it out, since ContentType is _post_ compilation property value.
- private XmlSchemaContentType GetContentType ()
- {
- if (this.isMixed)
- return XmlSchemaContentType.Mixed;
- XmlSchemaComplexContent xcc =
- ContentModel as XmlSchemaComplexContent;
- if (xcc != null && xcc.IsMixed)
- return XmlSchemaContentType.Mixed;
-
- XmlSchemaSimpleContent xsc = ContentModel as XmlSchemaSimpleContent;
- if (xsc != null)
- return XmlSchemaContentType.TextOnly;
-
- return contentTypeParticle != XmlSchemaParticle.Empty ?
- XmlSchemaContentType.ElementOnly :
- XmlSchemaContentType.Empty;
}
// 3.4.6 Type Derivation OK (Complex)
internal void ValidateTypeDerivationOK (object b, ValidationEventHandler h, XmlSchema schema)
{
// AnyType derives from AnyType itself.
- if (this == XmlSchemaComplexType.AnyType && BaseSchemaType == this)
+ if (this == XmlSchemaComplexType.AnyType && BaseXmlSchemaType == this)
return;
XmlSchemaType bst = b as XmlSchemaType;
if (b == this) // 1 and 2.1
return;
- if (bst != null && (resolvedDerivedBy & bst.FinalResolved) != 0) // 1
+ if (bst != null && (resolvedDerivedBy & bst.FinalResolved) != 0) // 1.
error (h, "Derivation type " + resolvedDerivedBy + " is prohibited by the base type.");
- if (BaseSchemaType == b) // 2.2
+ if (BaseXmlSchemaType == b) // 2.2
return;
- if (BaseSchemaType == XmlSchemaComplexType.AnyType) { // 2.3.1
+ if (BaseXmlSchemaType == null || BaseXmlSchemaType == XmlSchemaComplexType.AnyType) { // 2.3.1
error (h, "Derived type's base schema type is anyType.");
return;
}
// 2.3.2.1
- XmlSchemaComplexType dbct = BaseSchemaType as XmlSchemaComplexType;
+ XmlSchemaComplexType dbct = BaseXmlSchemaType as XmlSchemaComplexType;
if (dbct != null) {
dbct.ValidateTypeDerivationOK (b, h, schema);
return;
}
// 2.3.2.2
- XmlSchemaSimpleType dbst = BaseSchemaType as XmlSchemaSimpleType;
+ XmlSchemaSimpleType dbst = BaseXmlSchemaType as XmlSchemaSimpleType;
if (dbst != null) {
dbst.ValidateTypeDerivationOK (b, h, schema, true);
return;
}
}
- // Term. 1 of 3.4.6 Derivation Valid (Extension)
+ // 3.4.6 Derivation Valid (Extension) - Term. 1 (Complex Type)
internal void ValidateComplexBaseDerivationValidExtension (XmlSchemaComplexType baseComplexType,
ValidationEventHandler h, XmlSchema schema)
{
@@ -743,7 +880,8 @@ namespace System.Xml.Schema
if ((baseComplexType.FinalResolved & XmlSchemaDerivationMethod.Extension) != 0)
error (h, "Derivation by extension is prohibited.");
// 1.2
- foreach (XmlSchemaAttribute ba in baseComplexType.AttributeUses) {
+ foreach (DictionaryEntry entry in baseComplexType.AttributeUses) {
+ XmlSchemaAttribute ba = (XmlSchemaAttribute) entry.Value;
XmlSchemaAttribute da = AttributeUses [ba.QualifiedName] as XmlSchemaAttribute;
if (da == null)
error (h, "Invalid complex type derivation by extension was found. Missing attribute was found: " + ba.QualifiedName + " .");
@@ -764,29 +902,24 @@ namespace System.Xml.Schema
// 1.4.2.2.1
if (baseComplexType.ContentType != XmlSchemaContentType.Empty) {
// 1.4.2.2.2.1
- if (this.GetContentType () == baseComplexType.ContentType) {
- // nothing to do
- }
- // 1.4.2.2.2.2
- // 3.9.6 Particle Valid (Extension)
- else if (this.contentTypeParticle != baseComplexType.ContentTypeParticle) {
+ if (this.ContentType != baseComplexType.ContentType)
+// if (this.GetContentType (false) != baseComplexType.GetContentType (false))
+ error (h, "Base complex type has different content type " + baseComplexType.ContentType + ".");
+ // 1.4.2.2.2.2 => 3.9.6 Particle Valid (Extension)
+ else if (this.contentTypeParticle == null ||
+ !this.contentTypeParticle.ParticleEquals (baseComplexType.ContentTypeParticle)) {
XmlSchemaSequence seq = contentTypeParticle as XmlSchemaSequence;
- if (contentTypeParticle.ValidatedMinOccurs != 1 ||
- contentTypeParticle.ValidatedMaxOccurs != 1 ||
- seq == null)
+ if (contentTypeParticle != XmlSchemaParticle.Empty && (seq == null || contentTypeParticle.ValidatedMinOccurs != 1 || contentTypeParticle.ValidatedMaxOccurs != 1))
error (h, "Invalid complex content extension was found.");
else {
// Identical sequence item should be checked, but
// I think it is naturally achieved as coded above.
}
-
}
- else
- error (h, "Invalid complex content extension was found. Extended complex type has different content type from base type.");
}
}
- // Term. 2 of 3.4.6 Derivation Valid (Extension)
+ // 3.4.6 Derivation Valid (Extension) - Term. 2 (Simple Type)
internal void ValidateSimpleBaseDerivationValidExtension (object baseType,
ValidationEventHandler h, XmlSchema schema)
{
@@ -799,25 +932,6 @@ namespace System.Xml.Schema
dt = st.Datatype;
if (dt != this.Datatype)
error (h, "To extend simple type, a complex type must have the same content type as the base type.");
-
- /*
- switch (resolvedContentType) {
- case XmlSchemaContentType.Mixed:
- case XmlSchemaContentType.TextOnly:
- XmlSchemaSimpleType st = baseType as XmlSchemaSimpleType;
- if ((st == null && Datatype != baseType) ||
- (st != null && st.Datatype != Datatype))
- goto case XmlSchemaContentType.ElementOnly;
- if (st != null
- && (st.FinalResolved & XmlSchemaDerivationMethod.Extension) != 0)
- error (h, "Extension is prohibited by the base type.");
- break;
- case XmlSchemaContentType.ElementOnly:
- case XmlSchemaContentType.Empty:
- error (h, "To extend simple type, a complex type must have the same content type as the base type.");
- break;
- }
- */
}
internal void ValidateDerivationValidRestriction (XmlSchemaComplexType baseType,
@@ -834,7 +948,8 @@ namespace System.Xml.Schema
}
// 2.
- foreach (XmlSchemaAttribute attr in this.AttributeUses) {
+ foreach (DictionaryEntry entry in this.AttributeUses) {
+ XmlSchemaAttribute attr = (XmlSchemaAttribute) entry.Value;
XmlSchemaAttribute baseAttr = baseType.AttributeUses [attr.QualifiedName] as XmlSchemaAttribute;
if (baseAttr != null) {
// 2.1
@@ -871,7 +986,7 @@ namespace System.Xml.Schema
}
// I think 3. is considered in 2.
// 4.
- if (this.AttributeWildcard != null) {
+ if (this.AttributeWildcard != null && baseType != XmlSchemaComplexType.AnyType) {
if (baseType.AttributeWildcard == null)
error (h, "Invalid attribute derivation by restriction because of attribute wildcard.");
else
@@ -880,19 +995,27 @@ namespace System.Xml.Schema
// 5.
if (contentTypeParticle == XmlSchemaParticle.Empty) {
- // TODO: 5.1
- // 5.2
- if (baseType.ContentTypeParticle != XmlSchemaParticle.Empty &&
- !baseType.ContentTypeParticle.ValidateIsEmptiable ())
- error (h, "Invalid content type derivation.");
+ // 5.1
+ if (ContentType != XmlSchemaContentType.Empty) {
+ // TODO: 5.1.1
+// XmlSchemaSimpleType baseST = baseType as XmlSchemaSimpleType;
+ // 5.1.2
+ if (baseType.ContentType == XmlSchemaContentType.Mixed && !baseType.ContentTypeParticle.ValidateIsEmptiable ())
+ error (h, "Invalid content type derivation.");
+
+ } else {
+ // 5.2
+ if (baseType.ContentTypeParticle != XmlSchemaParticle.Empty &&
+ !baseType.ContentTypeParticle.ValidateIsEmptiable ())
+ error (h, "Invalid content type derivation.");
+ }
} else {
// 5.3 => 3.9.6 Particle Valid (Restriction)
if (baseType.ContentTypeParticle != null) {
// 3.9.6 - 1 : same particle.
// 3.9.6 - 2 is covered by using ActualParticle.
- if (!contentTypeParticle.ActualParticle.ParticleEquals (baseType.ContentTypeParticle.ActualParticle))
- contentTypeParticle.ActualParticle.ValidateDerivationByRestriction (
- baseType.ContentTypeParticle.ActualParticle, h, schema);
+ if (!contentTypeParticle.ParticleEquals (baseType.ContentTypeParticle))
+ contentTypeParticle.ValidateDerivationByRestriction (baseType.ContentTypeParticle, h, schema, true);
}
}
}
@@ -938,14 +1061,14 @@ namespace System.Xml.Schema
ctype.block = XmlSchemaUtil.ReadDerivationAttribute(reader,out innerex, "block",
XmlSchemaUtil.ComplexTypeBlockAllowed);
if(innerex != null)
- warn(h,"some invalid values for block attribute were found",innerex);
+ error (h,"some invalid values for block attribute were found",innerex);
}
else if(reader.Name == "final")
{
ctype.Final = XmlSchemaUtil.ReadDerivationAttribute(reader,out innerex, "final",
XmlSchemaUtil.FinalAllowed);
if(innerex != null)
- warn(h,"some invalid values for final attribute were found",innerex);
+ error (h,"some invalid values for final attribute were found",innerex);
}
else if(reader.Name == "id")
{
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaContent.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaContent.cs
index 7ad48c71ca9..2b143d3cef0 100755
--- a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaContent.cs
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaContent.cs
@@ -14,14 +14,15 @@ namespace System.Xml.Schema
/// </summary>
public abstract class XmlSchemaContent : XmlSchemaAnnotated
{
- internal object actualBaseSchemaType;
+ protected object actualBaseSchemaType;
protected XmlSchemaContent()
{}
- internal object ActualBaseSchemaType
- {
- get { return actualBaseSchemaType; }
- }
+ internal abstract bool IsExtension { get; }
+
+ internal abstract XmlQualifiedName GetBaseTypeName ();
+
+ internal abstract XmlSchemaParticle GetParticle ();
}
-} \ No newline at end of file
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaDatatype.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaDatatype.cs
index 7c709201b72..e848a0c8bd4 100755
--- a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaDatatype.cs
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaDatatype.cs
@@ -34,7 +34,10 @@ namespace System.Xml.Schema
public abstract object ParseValue (string s,
XmlNameTable nameTable, XmlNamespaceManager nsmgr);
- char [] wsChars = new char [] {' ', '\t', '\n', '\r'};
+ internal abstract ValueType ParseValueType (string s,
+ XmlNameTable nameTable, XmlNamespaceManager nsmgr);
+
+ static char [] wsChars = new char [] {' ', '\t', '\n', '\r'};
StringBuilder sb = new StringBuilder ();
internal string Normalize (string s)
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaElement.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaElement.cs
index 71ff9360b58..1066ff7bad6 100755
--- a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaElement.cs
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaElement.cs
@@ -36,13 +36,13 @@ namespace System.Xml.Schema
private XmlQualifiedName schemaTypeName;
private XmlQualifiedName substitutionGroup;
internal bool parentIsSchema = false;
- private string targetNamespace;
private string validatedDefaultValue;
private string validatedFixedValue;
- internal bool actualIsAbstract;
- internal bool actualIsNillable;
+ private bool actualIsAbstract;
+ private bool actualIsNillable;
+ private XmlSchemaElement substitutionGroupElement;
private ArrayList substitutingElements = new ArrayList ();
- XmlSchemaElement referencedElement;
+ private XmlSchemaElement referencedElement;
// Post compilation items. It should be added on all schema components.
XmlSchema schema;
@@ -58,7 +58,6 @@ namespace System.Xml.Schema
refName = XmlQualifiedName.Empty;
schemaTypeName = XmlQualifiedName.Empty;
substitutionGroup = XmlQualifiedName.Empty;
- substitutionGroup = XmlQualifiedName.Empty;
}
#region Attributes
@@ -146,6 +145,9 @@ namespace System.Xml.Schema
get{ return schemaTypeName; }
set{ schemaTypeName = value; }
}
+ #endregion
+
+ #region Elements
[XmlElement("simpleType",typeof(XmlSchemaSimpleType),Namespace="http://www.w3.org/2001/XMLSchema")]
[XmlElement("complexType",typeof(XmlSchemaComplexType),Namespace="http://www.w3.org/2001/XMLSchema")]
@@ -162,7 +164,9 @@ namespace System.Xml.Schema
{
get{ return constraints; }
}
+ #endregion
+ #region Post Compilation Schema Info
[XmlIgnore]
public XmlQualifiedName QualifiedName
{
@@ -179,7 +183,7 @@ namespace System.Xml.Schema
return elementType;
}
}
-
+
[XmlIgnore]
public XmlSchemaDerivationMethod BlockResolved
{
@@ -202,9 +206,26 @@ namespace System.Xml.Schema
}
}
+ internal bool ActualIsNillable {
+ get {
+ if (referencedElement != null)
+ return referencedElement.ActualIsNillable;
+ else
+ return actualIsNillable;
+ }
+ }
+
+ internal bool ActualIsAbstract {
+ get {
+ if (referencedElement != null)
+ return referencedElement.ActualIsAbstract;
+ else
+ return actualIsAbstract;
+ }
+ }
+
// Post compilation default value (normalized)
- internal string ValidatedDefaultValue
- {
+ internal string ValidatedDefaultValue {
get{
if (referencedElement != null)
return referencedElement.ValidatedDefaultValue;
@@ -214,8 +235,7 @@ namespace System.Xml.Schema
}
// Post compilation fixed value (normalized)
- internal string ValidatedFixedValue
- {
+ internal string ValidatedFixedValue {
get{
if (referencedElement != null)
return referencedElement.ValidatedFixedValue;
@@ -224,8 +244,7 @@ namespace System.Xml.Schema
}
}
- internal ArrayList SubstitutingElements
- {
+ internal ArrayList SubstitutingElements {
get {
if (referencedElement != null)
return referencedElement.SubstitutingElements;
@@ -234,27 +253,18 @@ namespace System.Xml.Schema
}
}
- #endregion
-
- /*
- // FIXME: using this causes stack overflow...
- internal override XmlSchemaParticle ActualParticle {
+ internal XmlSchemaElement SubstitutionGroupElement {
get {
- if (this.SubstitutingElements != null && this.SubstitutingElements.Count > 0) {
- XmlSchemaChoice choice = new XmlSchemaChoice ();
- choice.Compile (null, schema); // compute Validated Min/Max Occurs.
- choice.CompiledItems.Add (this);
- for (int i = 0; i < SubstitutingElements.Count; i++) {
- XmlSchemaElement se = SubstitutingElements [i] as XmlSchemaElement;
- choice.CompiledItems.Add (se);
- }
- return choice;
- }
+ if (referencedElement != null)
+ return referencedElement.SubstitutionGroupElement;
else
- return this;
+ return substitutionGroupElement;
}
}
- */
+
+ #endregion
+
+ private XmlSchemaParticle substChoice;
/// <remarks>
/// a) If Element has parent as schema:
@@ -281,7 +291,6 @@ namespace System.Xml.Schema
/// 5. abstract is prohibited
/// 6. default and fixed must not both be present.(Actually both are absent)
/// </remarks>
- [MonoTODO]
internal override int Compile(ValidationEventHandler h, XmlSchema schema)
{
// If this is already compiled this time, simply skip.
@@ -320,7 +329,7 @@ namespace System.Xml.Schema
{
// if((final & ~allfinal) != 0)
if ((final | XmlSchemaUtil.FinalAllowed) != XmlSchemaUtil.FinalAllowed)
- warn(h,"some values for final are invalid in this context");
+ error (h,"some values for final are invalid in this context");
finalResolved = final & allfinal;
}
@@ -370,42 +379,23 @@ namespace System.Xml.Schema
error(h,"substitutionGroup must be absent");
if(final != XmlSchemaDerivationMethod.None)
error(h,"final must be absent");
- // This is not W3C REC 3.3.3 requirement
-// if(isAbstract)
-// error(h,"abstract must be absent");
CompileOccurence (h, schema);
if(refName == null || RefName.IsEmpty)
{
+ string targetNamespace = String.Empty;
+
if(form == XmlSchemaForm.Qualified || (form == XmlSchemaForm.None && schema.ElementFormDefault == XmlSchemaForm.Qualified))
- this.targetNamespace = schema.TargetNamespace;
- else
- this.targetNamespace = "";
+ targetNamespace = schema.TargetNamespace;
if(this.name == null) //b1
error(h,"Required attribute name must be present");
else if(!XmlSchemaUtil.CheckNCName(this.name)) // b1.2
error(h,"attribute name must be NCName");
else
- this.qName = new XmlQualifiedName(this.name, this.targetNamespace);
+ this.qName = new XmlQualifiedName(this.name, targetNamespace);
- /*
- XmlSchemaDerivationMethod allblock = XmlSchemaDerivationMethod.Extension |
- XmlSchemaDerivationMethod.Restriction | XmlSchemaDerivationMethod.Substitution;
-
- if(block == XmlSchemaDerivationMethod.All)
- blockResolved = allblock;
-// else if(block == XmlSchemaDerivationMethod.None)
-// blockResolved = allblock;
- else
- {
- if((block & ~allblock) != 0)
- warn(h,"Some of the values for block are invalid in this context");
- blockResolved = block & allblock;
- }
- */
-
if(schemaType != null && schemaTypeName != null && !schemaTypeName.IsEmpty)
{
error(h,"both schemaType and content can't be present");
@@ -483,7 +473,7 @@ namespace System.Xml.Schema
break;
default:
if ((block | XmlSchemaUtil.ElementBlockAllowed) != XmlSchemaUtil.ElementBlockAllowed)
- warn(h,"Some of the values for block are invalid in this context");
+ error (h,"Some of the values for block are invalid in this context");
blockResolved = block;
break;
}
@@ -501,7 +491,72 @@ namespace System.Xml.Schema
return errorCount;
}
- [MonoTODO]
+ [MonoTODO ("Return clone in case when it returns itself")]
+ internal override XmlSchemaParticle GetOptimizedParticle (bool isTop)
+ {
+ if (OptimizedParticle != null)
+ return OptimizedParticle;
+ if (RefName != null && RefName != XmlQualifiedName.Empty) {
+ referencedElement = schema.Elements [RefName] as XmlSchemaElement;
+ }
+
+// if (this.referencedElement != null)
+// OptimizedParticle = referencedElement.GetOptimizedParticle (isTop);
+// else
+ if (ValidatedMaxOccurs == 0)
+ OptimizedParticle = XmlSchemaParticle.Empty;
+ // Substitution Group
+ else if (SubstitutingElements != null && SubstitutingElements.Count > 0) {
+ XmlSchemaChoice choice = new XmlSchemaChoice ();
+ choice.MinOccurs = MinOccurs;
+ choice.MaxOccurs = MaxOccurs;
+ substChoice = choice;
+ choice.Compile (null, schema); // compute Validated Min/Max Occurs.
+ XmlSchemaElement item = this.MemberwiseClone () as XmlSchemaElement;
+ item.MinOccurs = 1;
+ item.MaxOccurs = 1;
+ item.substitutionGroupElement = null;
+ item.substitutingElements = null;
+ for (int i = 0; i < SubstitutingElements.Count; i++) {
+ XmlSchemaElement se = SubstitutingElements [i] as XmlSchemaElement;
+// choice.Items.Add (se);
+// choice.CompiledItems.Add (se);
+ this.AddSubstElementRecursively (choice.Items, se);
+ this.AddSubstElementRecursively (choice.CompiledItems, se);
+ }
+ if (!choice.Items.Contains (item)) {
+ choice.Items.Add (item);
+ choice.CompiledItems.Add (item);
+ }
+ OptimizedParticle = choice;
+ }
+ else
+ OptimizedParticle = this;//.MemberwiseClone () as XmlSchemaElement;
+ return OptimizedParticle;
+ }
+
+ private void AddSubstElementRecursively (XmlSchemaObjectCollection col, XmlSchemaElement el)
+ {
+ if (el.SubstitutingElements != null)
+ for (int i = 0; i < el.SubstitutingElements.Count; i++)
+ this.AddSubstElementRecursively (col, el.SubstitutingElements [i] as XmlSchemaElement);
+ if (!col.Contains (el))
+ col.Add (el);
+ }
+
+ internal void FillSubstitutionElementInfo ()
+ {
+ if (this.substitutionGroupElement != null)
+ return;
+
+ if (this.SubstitutionGroup != XmlQualifiedName.Empty) {
+ XmlSchemaElement substElem = schema.Elements [SubstitutionGroup] as XmlSchemaElement;
+ this.substitutionGroupElement = substElem;
+ if (substElem != null)
+ substElem.substitutingElements.Add (this);
+ }
+ }
+
internal override int Validate(ValidationEventHandler h, XmlSchema schema)
{
if (IsValidated (schema.CompilationId))
@@ -523,6 +578,13 @@ namespace System.Xml.Schema
this.actualIsNillable = IsNillable;
this.actualIsAbstract = IsAbstract;
+ // Before determining element type, we need to validate substituting element
+ if (this.SubstitutionGroup != XmlQualifiedName.Empty) {
+ XmlSchemaElement substElem = substitutionGroupElement;
+ if (substElem != null)
+ substElem.Validate (h, schema);
+ }
+
// {type} from here
XmlSchemaDatatype datatype = null;
if (schemaType != null)
@@ -536,7 +598,7 @@ namespace System.Xml.Schema
}
else if (SchemaTypeName == XmlSchemaComplexType.AnyTypeName)
elementType = XmlSchemaComplexType.AnyType;
- else if (SchemaTypeName.Namespace == XmlSchema.Namespace) {
+ else if (XmlSchemaUtil.IsBuiltInDatatypeName (SchemaTypeName)) {
datatype = XmlSchemaDatatype.FromName (SchemaTypeName);
if (datatype == null)
error (h, "Invalid schema datatype was specified.");
@@ -554,20 +616,20 @@ namespace System.Xml.Schema
if (refElem != null) {
this.referencedElement = refElem;
errorCount += refElem.Validate (h, schema);
- elementType = refElem.ElementType;
- this.validatedDefaultValue = refElem.validatedDefaultValue;
- this.validatedFixedValue = refElem.validatedFixedValue;
- this.actualIsAbstract = refElem.IsAbstract;
- this.actualIsNillable = refElem.IsNillable;
}
// otherwise, it might be missing sub components.
else if (!schema.IsNamespaceAbsent (RefName.Namespace))
error (h, "Referenced element " + RefName + " was not found in the corresponding schema.");
}
- // Otherwise the -ur type- definition.
- if (elementType == null)
- elementType = XmlSchemaComplexType.AnyType;
+ // Otherwise if there are substitution group, then the type of the substitution group element.
+ if (referencedElement == null) {
+ if (elementType == null && this.substitutionGroupElement != null)
+ elementType = substitutionGroupElement.ElementType;
+ // Otherwise, the -ur type- definition.
+ if (elementType == null)
+ elementType = XmlSchemaComplexType.AnyType;
+ }
XmlSchemaType xsType = elementType as XmlSchemaType;
if (xsType != null) {
@@ -582,7 +644,6 @@ namespace System.Xml.Schema
XmlSchemaElement substElem = schema.Elements [SubstitutionGroup] as XmlSchemaElement;
// If el is null, then it is missing sub components .
if (substElem != null) {
- substElem.Validate (h, schema);
XmlSchemaType substSchemaType = substElem.ElementType as XmlSchemaType;
if (substSchemaType != null) {
// 3.3.6 Properties Correct 3.
@@ -599,7 +660,7 @@ namespace System.Xml.Schema
if (xsSimpleType != null)
xsSimpleType.ValidateTypeDerivationOK (substElem.ElementType, h, schema, true);
}
- substElem.substitutingElements.Add (this);
+
}
// otherwise, it might be missing sub components.
else if (!schema.IsNamespaceAbsent (SubstitutionGroup.Namespace))
@@ -657,23 +718,22 @@ namespace System.Xml.Schema
return true;
}
- internal override void ValidateDerivationByRestriction (XmlSchemaParticle baseParticle,
- ValidationEventHandler h, XmlSchema schema)
+ internal override bool ValidateDerivationByRestriction (XmlSchemaParticle baseParticle,
+ ValidationEventHandler h, XmlSchema schema, bool raiseError)
{
// element - NameAndTypeOK
XmlSchemaElement baseElement = baseParticle as XmlSchemaElement;
if (baseElement != null) {
- ValidateDerivationByRestrictionNameAndTypeOK (baseElement, h, schema);
- return;
+ return ValidateDerivationByRestrictionNameAndTypeOK (baseElement, h, schema, raiseError);
}
// any - NSCompat
XmlSchemaAny baseAny = baseParticle as XmlSchemaAny;
if (baseAny != null) {
// NSCompat
- baseAny.ValidateWildcardAllowsNamespaceName (this.QualifiedName.Namespace, h, schema, true);
- ValidateOccurenceRangeOK (baseAny, h, schema);
- return;
+ if (!baseAny.ValidateWildcardAllowsNamespaceName (this.QualifiedName.Namespace, h, schema, raiseError))
+ return false;
+ return ValidateOccurenceRangeOK (baseAny, h, schema, raiseError);
}
//*
@@ -692,63 +752,80 @@ namespace System.Xml.Schema
gb.Validate (h, schema);
// It looks weird, but here we never think about
// _pointlessness_ of this groupbase particle.
- gb.ValidateDerivationByRestriction (baseParticle, h, schema);
- return;
+ return gb.ValidateDerivationByRestriction (baseParticle, h, schema, raiseError);
}
//*/
+ return true;
}
- private void ValidateDerivationByRestrictionNameAndTypeOK (XmlSchemaElement baseElement,
- ValidationEventHandler h, XmlSchema schema)
+ private bool ValidateDerivationByRestrictionNameAndTypeOK (XmlSchemaElement baseElement,
+ ValidationEventHandler h, XmlSchema schema, bool raiseError)
{
// 1.
- if (this.QualifiedName != baseElement.QualifiedName)
- error (h, "Invalid derivation by restriction of particle was found. Both elements must have the same name.");
+ if (this.QualifiedName != baseElement.QualifiedName) {
+ if (raiseError)
+ error (h, "Invalid derivation by restriction of particle was found. Both elements must have the same name.");
+ return false;
+ }
// 2.
- if (this.isNillable && !baseElement.isNillable)
- error (h, "Invalid element derivation by restriction of particle was found. Base element is not nillable and derived type is nillable.");
+ if (this.isNillable && !baseElement.isNillable) {
+ if (raiseError)
+ error (h, "Invalid element derivation by restriction of particle was found. Base element is not nillable and derived type is nillable.");
+ return false;
+ }
// 3.
- ValidateOccurenceRangeOK (baseElement, h, schema);
+ if (!ValidateOccurenceRangeOK (baseElement, h, schema, raiseError))
+ return false;
// 4.
if (baseElement.ValidatedFixedValue != null &&
- baseElement.ValidatedFixedValue != this.ValidatedFixedValue)
- error (h, "Invalid element derivation by restriction of particle was found. Both fixed value must be the same.");
+ baseElement.ValidatedFixedValue != this.ValidatedFixedValue) {
+ if (raiseError)
+ error (h, "Invalid element derivation by restriction of particle was found. Both fixed value must be the same.");
+ return false;
+ }
// 5. TODO: What is "identity constraints subset" ???
// 6.
- if ((baseElement.BlockResolved | this.BlockResolved) != this.BlockResolved)
- error (h, "Invalid derivation by restriction of particle was found. Derived element must contain all of the base element's block value.");
+ if ((baseElement.BlockResolved | this.BlockResolved) != this.BlockResolved) {
+ if (raiseError)
+ error (h, "Invalid derivation by restriction of particle was found. Derived element must contain all of the base element's block value.");
+ return false;
+ }
// 7.
if (baseElement.ElementType != null) {
XmlSchemaComplexType derivedCType = this.ElementType as XmlSchemaComplexType;
- if (derivedCType != null)
- // W3C REC says that it is Type Derivation OK to be check, but
+ if (derivedCType != null) {
+ // FIXME: W3C REC says that it is Type Derivation OK to be check, but
// in fact it should be DerivationValid (Restriction, Complex).
derivedCType.ValidateDerivationValidRestriction (
baseElement.ElementType as XmlSchemaComplexType, h, schema);
- // derivedCType.ValidateTypeDerivationOK (baseElement.ElementType, h, schema);
- else {
+ derivedCType.ValidateTypeDerivationOK (baseElement.ElementType, h, schema);
+ } else {
XmlSchemaSimpleType derivedSType = this.ElementType as XmlSchemaSimpleType;
if (derivedSType != null)
derivedSType.ValidateTypeDerivationOK (baseElement.ElementType, h, schema, true);
- else if (baseElement.ElementType != XmlSchemaComplexType.AnyType && baseElement.ElementType != this.ElementType)
- error (h, "Invalid element derivation by restriction of particle was found. Both primitive types differ.");
+ else if (baseElement.ElementType != XmlSchemaComplexType.AnyType && baseElement.ElementType != this.ElementType) {
+ if (raiseError)
+ error (h, "Invalid element derivation by restriction of particle was found. Both primitive types differ.");
+ return false;
+ }
}
}
+ return true;
}
internal override void CheckRecursion (int depth, ValidationEventHandler h, XmlSchema schema)
{
XmlSchemaComplexType ct = this.ElementType as XmlSchemaComplexType;
- if (ct == null || ct.ContentTypeParticle == null)
+ if (ct == null || ct.Particle == null)
return;
- ct.ContentTypeParticle.CheckRecursion (depth + 1, h, schema);
+ ct.Particle.CheckRecursion (depth + 1, h, schema);
}
internal override void ValidateUniqueParticleAttribution (XmlSchemaObjectTable qnames, ArrayList nsNames,
ValidationEventHandler h, XmlSchema schema)
{
- if (qnames.Contains (this.QualifiedName))
+ if (qnames.Contains (this.QualifiedName))// && !this.ParticleEquals ((XmlSchemaParticle) qnames [this.QualifiedName]))
error (h, "Ambiguous element label was detected: " + this.QualifiedName);
else {
foreach (XmlSchemaAny any in nsNames) {
@@ -756,11 +833,11 @@ namespace System.Xml.Schema
continue;
if (any.HasValueAny ||
any.HasValueLocal && this.QualifiedName.Namespace == "" ||
- any.HasValueOther && this.QualifiedName.Namespace != this.targetNamespace ||
- any.HasValueTargetNamespace && this.QualifiedName.Namespace == this.targetNamespace) {
+ any.HasValueOther && this.QualifiedName.Namespace != this.QualifiedName.Namespace ||
+ any.HasValueTargetNamespace && this.QualifiedName.Namespace == this.QualifiedName.Namespace) {
error (h, "Ambiguous element label which is contained by -any- particle was detected: " + this.QualifiedName);
break;
- } else {
+ } else if (!any.HasValueOther) {
bool bad = false;
foreach (string ns in any.ResolvedNamespaces) {
if (ns == this.QualifiedName.Namespace) {
@@ -772,6 +849,10 @@ namespace System.Xml.Schema
error (h, "Ambiguous element label which is contained by -any- particle was detected: " + this.QualifiedName);
break;
}
+ } else {
+ if (any.TargetNamespace.Length == 0 ||
+ any.TargetNamespace != this.QualifiedName.Namespace)
+ error (h, "Ambiguous element label which is contained by -any- particle with ##other value was detected: " + this.QualifiedName);
}
}
qnames.Add (this.QualifiedName, this);
@@ -887,7 +968,7 @@ namespace System.Xml.Schema
element.block = XmlSchemaUtil.ReadDerivationAttribute(reader,out innerex, "block",
XmlSchemaUtil.ElementBlockAllowed);
if(innerex != null)
- warn(h,"some invalid values for block attribute were found",innerex);
+ error (h,"some invalid values for block attribute were found",innerex);
}
else if(reader.Name == "default")
{
@@ -898,7 +979,7 @@ namespace System.Xml.Schema
element.Final = XmlSchemaUtil.ReadDerivationAttribute(reader,out innerex, "final",
XmlSchemaUtil.FinalAllowed);
if(innerex != null)
- warn(h,"some invalid values for final attribute were found",innerex);
+ error (h,"some invalid values for final attribute were found",innerex);
}
else if(reader.Name == "fixed")
{
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaEnumerationFacet.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaEnumerationFacet.cs
index 512b3c7d70a..c6b6f25f4ec 100755
--- a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaEnumerationFacet.cs
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaEnumerationFacet.cs
@@ -15,6 +15,11 @@ namespace System.Xml.Schema
{
}
+ internal override Facet ThisFacet {
+ get { return Facet.enumeration;}
+ }
+
+
//<enumeration
// id = ID
// value = anySimpleType
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaFacet.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaFacet.cs
index 076bc74486d..e0c80ccc40f 100755
--- a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaFacet.cs
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaFacet.cs
@@ -7,11 +7,38 @@ using System.ComponentModel;
namespace System.Xml.Schema
{
+
/// <summary>
/// Summary description for XmlSchemaFacet.
/// </summary>
public abstract class XmlSchemaFacet : XmlSchemaAnnotated
{
+ [Flags]
+ internal protected enum Facet {
+ None = 0,
+ length = 1 ,
+ minLength = 2,
+ maxLength = 4,
+ pattern = 8,
+ enumeration = 16,
+ whiteSpace = 32,
+ maxInclusive = 64,
+ maxExclusive = 128,
+ minExclusive = 256,
+ minInclusive = 512,
+ totalDigits = 1024,
+ fractionDigits = 2048
+ };
+
+ internal protected const Facet AllFacets =
+ Facet.length | Facet.minLength | Facet.maxLength |
+ Facet.minExclusive | Facet.maxExclusive |
+ Facet.minInclusive | Facet.maxInclusive |
+ Facet.pattern | Facet.enumeration | Facet.whiteSpace |
+ Facet.totalDigits | Facet.fractionDigits;
+
+ internal abstract Facet ThisFacet { get ; }
+
private bool isFixed;
private string val;
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaFractionDigitsFacet.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaFractionDigitsFacet.cs
index 319d19fd8e3..478439cd619 100755
--- a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaFractionDigitsFacet.cs
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaFractionDigitsFacet.cs
@@ -16,6 +16,10 @@ namespace System.Xml.Schema
{
}
+ internal override Facet ThisFacet {
+ get { return Facet.fractionDigits;}
+ }
+
//<fractionDigits
// fixed = boolean : false
// id = ID
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaGroup.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaGroup.cs
index 617a3fa3be6..72af32057f9 100755
--- a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaGroup.cs
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaGroup.cs
@@ -57,7 +57,6 @@ namespace System.Xml.Schema
// 1. name must be present
// 2. MinOccurs & MaxOccurs of the Particle must be absent
- [MonoTODO]
internal override int Compile(ValidationEventHandler h, XmlSchema schema)
{
// If this is already compiled this time, simply skip.
@@ -82,22 +81,7 @@ namespace System.Xml.Schema
if(Particle.MinOccursString != null)
Particle.error(h,"MinOccurs must not be present when the Particle is a child of Group");
- if(Particle is XmlSchemaChoice)
- {
- errorCount += ((XmlSchemaChoice)Particle).Compile(h,schema);
- }
- else if(Particle is XmlSchemaSequence)
- {
- errorCount += ((XmlSchemaSequence)Particle).Compile(h,schema);
- }
- else if(Particle is XmlSchemaAll)
- {
- errorCount += ((XmlSchemaAll)Particle).Compile(h,schema);
- }
- else
- {
- error(h,"only all,choice or sequence are allowed");
- }
+ Particle.Compile (h, schema);
}
XmlSchemaUtil.CompileID(Id,this,schema.IDCollection,h);
@@ -106,7 +90,6 @@ namespace System.Xml.Schema
return errorCount;
}
- [MonoTODO]
internal override int Validate(ValidationEventHandler h, XmlSchema schema)
{
if (this.IsValidated (schema.ValidationId))
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaGroupBase.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaGroupBase.cs
index b522f116942..3cb2d3ad0b1 100755
--- a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaGroupBase.cs
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaGroupBase.cs
@@ -1,18 +1,20 @@
-// Author: Dwivedi, Ajay kumar
-// Adwiv@Yahoo.com
+//
+// XmlSchemaGroupBase.cs
+//
+// Authors:
+// Dwivedi, Ajay kumar Adwiv@Yahoo.com
+// Atsushi Enomoto atsushi@ximian.com
+//
using System;
using System.Xml.Serialization;
namespace System.Xml.Schema
{
- /// <summary>
- /// Summary description for XmlSchemaGroupBase.
- /// </summary>
public abstract class XmlSchemaGroupBase : XmlSchemaParticle
{
private XmlSchemaObjectCollection compiledItems;
- protected XmlSchemaGroupBase()
+ protected XmlSchemaGroupBase ()
{
compiledItems = new XmlSchemaObjectCollection ();
}
@@ -25,64 +27,134 @@ namespace System.Xml.Schema
get{ return compiledItems; }
}
+ internal void CopyOptimizedItems (XmlSchemaGroupBase gb)
+ {
+ for (int i = 0; i < Items.Count; i++) {
+ XmlSchemaParticle p = Items [i] as XmlSchemaParticle;
+ p = p.GetOptimizedParticle (false);
+ if (p == XmlSchemaParticle.Empty)
+ continue;
+ gb.Items.Add (p);
+ gb.CompiledItems.Add (p);
+ }
+ }
+
internal override bool ParticleEquals (XmlSchemaParticle other)
{
- XmlSchemaChoice choice = other as XmlSchemaChoice;
- if (choice == null)
+ XmlSchemaGroupBase gb = other as XmlSchemaGroupBase;
+ if (gb == null)
+ return false;
+ if (this.GetType () != gb.GetType ())
return false;
- if (this.ValidatedMaxOccurs != choice.ValidatedMaxOccurs ||
- this.ValidatedMinOccurs != choice.ValidatedMinOccurs)
+
+ if (this.ValidatedMaxOccurs != gb.ValidatedMaxOccurs ||
+ this.ValidatedMinOccurs != gb.ValidatedMinOccurs)
return false;
- if (this.CompiledItems.Count != choice.CompiledItems.Count)
+ if (this.CompiledItems.Count != gb.CompiledItems.Count)
return false;
for (int i = 0; i < CompiledItems.Count; i++) {
XmlSchemaParticle p1 = this.CompiledItems [i] as XmlSchemaParticle;
- XmlSchemaParticle p2 = choice.CompiledItems [i] as XmlSchemaParticle;
+ XmlSchemaParticle p2 = gb.CompiledItems [i] as XmlSchemaParticle;
if (!p1.ParticleEquals (p2))
return false;
}
return true;
}
- internal void ValidateNSRecurseCheckCardinality (XmlSchemaAny any,
- ValidationEventHandler h, XmlSchema schema)
+ internal override void CheckRecursion (int depth, ValidationEventHandler h, XmlSchema schema)
+ {
+ foreach (XmlSchemaParticle p in this.Items)
+ p.CheckRecursion (depth, h, schema);
+ }
+
+ internal bool ValidateNSRecurseCheckCardinality (XmlSchemaAny any,
+ ValidationEventHandler h, XmlSchema schema, bool raiseError)
{
foreach (XmlSchemaParticle p in Items)
- p.ValidateDerivationByRestriction (any, h, schema);
- ValidateOccurenceRangeOK (any, h, schema);
+ if (!p.ValidateDerivationByRestriction (any, h, schema, raiseError))
+ return false;
+ return ValidateOccurenceRangeOK (any, h, schema, raiseError);
}
- internal void ValidateRecurse (XmlSchemaGroupBase baseGroup,
- ValidationEventHandler h, XmlSchema schema)
+ internal bool ValidateRecurse (XmlSchemaGroupBase baseGroup,
+ ValidationEventHandler h, XmlSchema schema, bool raiseError)
+ {
+ return ValidateSeqRecurseMapSumCommon (baseGroup, h, schema, false, false, raiseError);
+ }
+
+ internal bool ValidateSeqRecurseMapSumCommon (XmlSchemaGroupBase baseGroup,
+ ValidationEventHandler h, XmlSchema schema, bool isLax, bool isMapAndSum, bool raiseError)
{
int index = 0;
- for (int i = 0; i < baseGroup.CompiledItems.Count; i++) {
- XmlSchemaParticle pb = baseGroup.CompiledItems [i] as XmlSchemaParticle;
- if (pb.ActualParticle == XmlSchemaParticle.Empty)
- continue;
+ int baseIndex = 0;
+ decimal baseOccured = 0;
+ if (baseGroup.CompiledItems.Count == 0 && this.CompiledItems.Count > 0) {
+ if (raiseError)
+ error (h, "Invalid particle derivation by restriction was found. base particle does not contain particles.");
+ return false;
+ }
+
+ for (int i = 0; i < CompiledItems.Count; i++) {
+ // get non-empty derived particle
XmlSchemaParticle pd = null;
while (this.CompiledItems.Count > index) {
- pd = this.CompiledItems [index] as XmlSchemaParticle;
- index++;
- if (pd.ActualParticle != XmlSchemaParticle.Empty)
+ pd = ((XmlSchemaParticle) this.CompiledItems [index]);//.GetOptimizedParticle (false);
+ if (pd != XmlSchemaParticle.Empty)// && pd.ValidatedMaxOccurs > 0)
+ break;
+ else
+ index++;
+ }
+ if (index >= CompiledItems.Count) {
+ if (raiseError)
+ error (h, "Invalid particle derivation by restriction was found. Cannot be mapped to base particle.");
+ return false;
+ }
+
+ // get non-empty base particle
+ XmlSchemaParticle pb = null;
+ while (baseGroup.CompiledItems.Count > baseIndex) {
+ pb = ((XmlSchemaParticle) baseGroup.CompiledItems [baseIndex]);//.GetOptimizedParticle (false);
+ if (pb == XmlSchemaParticle.Empty && pb.ValidatedMaxOccurs > 0)
+ continue;
+ if (!pd.ValidateDerivationByRestriction (pb, h, schema, false)) {
+ if (!isLax && !isMapAndSum && pb.MinOccurs > baseOccured && !pb.ValidateIsEmptiable ()) {
+ if (raiseError)
+ error (h, "Invalid particle derivation by restriction was found. Invalid sub-particle derivation was found.");
+ return false;
+ }
+ else {
+ baseOccured = 0;
+ baseIndex++;
+ }
+ } else {
+ baseOccured += pb.ValidatedMinOccurs;
+ if (baseOccured >= baseGroup.ValidatedMaxOccurs) {
+ baseOccured = 0;
+ baseIndex++;
+ }
+ index++;
break;
+ }
}
- if (pd != null) {
- try {
- pd.ActualParticle.ValidateDerivationByRestriction (pb.ActualParticle, h, schema);
- } catch (XmlSchemaException ex) {
- if (!pb.ValidateIsEmptiable ())
- error (h, "Invalid particle derivation by restriction was found. Invalid sub-particle derivation was found.", ex);
- else
- index--; // try the same derived particle and next base particle.
+ }
+ if (this.CompiledItems.Count > 0 && index != this.CompiledItems.Count) {
+ if (raiseError)
+ error (h, "Invalid particle derivation by restriction was found. Extraneous derived particle was found.");
+ return false;
+ }
+ if (!isLax && !isMapAndSum) {
+ if (baseOccured > 0)
+ baseIndex++;
+ for (int i = baseIndex; i < baseGroup.CompiledItems.Count; i++) {
+ XmlSchemaParticle p = baseGroup.CompiledItems [i] as XmlSchemaParticle;
+ if (!p.ValidateIsEmptiable ()) {
+ if (raiseError)
+ error (h, "Invalid particle derivation by restriction was found. There is a base particle which does not have mapped derived particle and is not emptiable.");
+ return false;
}
- } else if (!pb.ValidateIsEmptiable ()) {
- error (h, "Invalid particle derivation by restriction was found. Base schema particle has non-emptiable sub particle that is not mapped to the derived particle.");
- return;
}
}
- if (index != this.CompiledItems.Count)
- error (h, "Invalid particle derivation by restriction was found. Extraneous derived particle was found.");
+ return true;
}
}
}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaGroupRef.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaGroupRef.cs
index 3f9edc860a6..a70288d32bf 100755
--- a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaGroupRef.cs
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaGroupRef.cs
@@ -17,9 +17,8 @@ namespace System.Xml.Schema
/// </summary>
public class XmlSchemaGroupRef : XmlSchemaParticle
{
- private XmlSchemaGroupBase particle;
+ private XmlSchema schema;
private XmlQualifiedName refName;
- private XmlQualifiedName resolvedRefName;
private static string xmlname = "group";
private XmlSchemaGroup referencedGroup;
@@ -27,12 +26,16 @@ namespace System.Xml.Schema
{
refName = XmlQualifiedName.Empty;
}
+
+ // Attribute
[System.Xml.Serialization.XmlAttribute("ref")]
public XmlQualifiedName RefName
{
get{ return refName; }
set{ refName = value; }
}
+
+ // Post Compilation Schema Information
[XmlIgnore]
public XmlSchemaGroupBase Particle
{
@@ -43,6 +46,7 @@ namespace System.Xml.Schema
return null;
}
}
+
internal XmlSchemaGroup TargetGroup
{
get {
@@ -52,26 +56,16 @@ namespace System.Xml.Schema
return referencedGroup;
}
}
- internal override XmlSchemaParticle ActualParticle
- {
- get {
- if (TargetGroup != null)
- return TargetGroup.Particle.ActualParticle;
- else
- // For ValidationEventHandler and missing sub components.
- return XmlSchemaParticle.Empty;
- }
- }
/// <remarks>
/// 1. RefName must be present
/// </remarks>
- [MonoTODO]
internal override int Compile(ValidationEventHandler h, XmlSchema schema)
{
// If this is already compiled this time, simply skip.
if (this.IsComplied (schema.CompilationId))
return 0;
+ this.schema = schema;
XmlSchemaUtil.CompileID(Id,this,schema.IDCollection,h);
CompileOccurence (h, schema);
@@ -87,7 +81,6 @@ namespace System.Xml.Schema
return errorCount;
}
- [MonoTODO]
internal override int Validate(ValidationEventHandler h, XmlSchema schema)
{
if (IsValidated (schema.ValidationId))
@@ -95,25 +88,58 @@ namespace System.Xml.Schema
referencedGroup = schema.Groups [RefName] as XmlSchemaGroup;
// it might be missing sub components.
- if (referencedGroup == null && !schema.IsNamespaceAbsent (RefName.Namespace))
- error (h, "Referenced group " + RefName + " was not found in the corresponding schema.");
- else if (TargetGroup != null)
+ if (referencedGroup == null) {
+ if (!schema.IsNamespaceAbsent (RefName.Namespace))
+ error (h, "Referenced group " + RefName + " was not found in the corresponding schema.");
+ }
+ // See Errata E1-26: minOccurs=0 is now allowed.
+ else if (referencedGroup.Particle is XmlSchemaAll && ValidatedMaxOccurs != 1)
+ error (h, "Group reference to -all- particle must have schema component {maxOccurs}=1.");
+ if (TargetGroup != null)
TargetGroup.Validate (h, schema);
ValidationId = schema.ValidationId;
return errorCount;
}
+ bool busy; // only for avoiding infinite loop on illegal recursion cases.
+ internal override XmlSchemaParticle GetOptimizedParticle (bool isTop)
+ {
+ if (busy)
+ return XmlSchemaParticle.Empty;
+ if (OptimizedParticle != null)
+ return OptimizedParticle;
+ busy = true;
+ XmlSchemaGroup g = referencedGroup != null ? referencedGroup : schema.Groups [RefName] as XmlSchemaGroup;
+ if (g != null && g.Particle != null) {
+ OptimizedParticle = g.Particle;
+ OptimizedParticle = OptimizedParticle.GetOptimizedParticle (isTop);
+ if (OptimizedParticle != XmlSchemaParticle.Empty && (ValidatedMinOccurs != 1 || ValidatedMaxOccurs != 1)) {
+ OptimizedParticle = OptimizedParticle.GetShallowClone ();
+ OptimizedParticle.MinOccurs = this.MinOccurs;
+ OptimizedParticle.MaxOccurs = this.MaxOccurs;
+ OptimizedParticle.CompileOccurence (null, null);
+ }
+ }
+ else
+ OptimizedParticle = XmlSchemaParticle.Empty;
+ busy = false;
+ return OptimizedParticle;
+ }
+
+
internal override bool ParticleEquals (XmlSchemaParticle other)
{
- return ActualParticle.ParticleEquals (other.ActualParticle);
+ return this.GetOptimizedParticle (true).ParticleEquals (other);
}
- internal override void ValidateDerivationByRestriction (XmlSchemaParticle baseParticle,
- ValidationEventHandler h, XmlSchema schema)
+ internal override bool ValidateDerivationByRestriction (XmlSchemaParticle baseParticle,
+ ValidationEventHandler h, XmlSchema schema, bool raiseError)
{
if (TargetGroup != null)
- TargetGroup.Particle.ValidateDerivationByRestriction (baseParticle, h, schema);
+ return TargetGroup.Particle.ValidateDerivationByRestriction (baseParticle, h, schema, raiseError);
+ else
+ return false; // should not occur
}
@@ -145,6 +171,7 @@ namespace System.Xml.Schema
}
+ #region Read
// <group
// id = ID
// ref = QName
@@ -239,5 +266,6 @@ namespace System.Xml.Schema
}
return groupref;
}
+ #endregion
}
}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaIdentityConstraint.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaIdentityConstraint.cs
index d44fc456ac8..236d585e980 100755
--- a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaIdentityConstraint.cs
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaIdentityConstraint.cs
@@ -61,7 +61,6 @@ namespace System.Xml.Schema
/// 1. name must be present
/// 2. selector and field must be present
/// </remarks>
- [MonoTODO]
internal override int Compile(ValidationEventHandler h, XmlSchema schema)
{
// If this is already compiled this time, simply skip.
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaKey.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaKey.cs
index ad84540137c..2df74fb4cda 100755
--- a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaKey.cs
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaKey.cs
@@ -19,7 +19,6 @@ namespace System.Xml.Schema
/// 1. name must be present
/// 2. selector and field must be present
/// </remarks>
- [MonoTODO]
internal override int Compile(ValidationEventHandler h, XmlSchema schema)
{
return base.Compile(h, schema);
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaKeyref.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaKeyref.cs
index cda2fe1df60..b66a99b585e 100755
--- a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaKeyref.cs
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaKeyref.cs
@@ -37,7 +37,6 @@ namespace System.Xml.Schema
/// 2. selector and field must be present
/// 3. refer must be present
/// </remarks>
- [MonoTODO]
internal override int Compile(ValidationEventHandler h, XmlSchema schema)
{
base.Compile(h, schema);
@@ -50,7 +49,6 @@ namespace System.Xml.Schema
return errorCount;
}
- [MonoTODO]
internal override int Validate (ValidationEventHandler h, XmlSchema schema)
{
// Find target key
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaLengthFacet.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaLengthFacet.cs
index 263d3c1c58e..8549c7747cc 100755
--- a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaLengthFacet.cs
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaLengthFacet.cs
@@ -16,6 +16,10 @@ namespace System.Xml.Schema
{
}
+ internal override Facet ThisFacet {
+ get { return Facet.length ; }
+ }
+
//<length
// fixed = boolean : false
// id = ID
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaMaxExclusiveFacet.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaMaxExclusiveFacet.cs
index 258c5bf9ccc..a5709046b20 100755
--- a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaMaxExclusiveFacet.cs
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaMaxExclusiveFacet.cs
@@ -16,6 +16,10 @@ namespace System.Xml.Schema
{
}
+ internal override Facet ThisFacet {
+ get { return Facet.maxExclusive;}
+ }
+
//<maxExclusive
// fixed = boolean : false
// id = ID
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaMaxInclusiveFacet.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaMaxInclusiveFacet.cs
index c080abad8d9..33d4410eda7 100755
--- a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaMaxInclusiveFacet.cs
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaMaxInclusiveFacet.cs
@@ -16,6 +16,10 @@ namespace System.Xml.Schema
{
}
+ internal override Facet ThisFacet {
+ get { return Facet.maxInclusive;}
+ }
+
//<maxInclusive
// fixed = boolean : false
// id = ID
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaMaxLengthFacet.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaMaxLengthFacet.cs
index a7bbb98b145..af96e227ac8 100755
--- a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaMaxLengthFacet.cs
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaMaxLengthFacet.cs
@@ -16,6 +16,11 @@ namespace System.Xml.Schema
{
}
+ internal override Facet ThisFacet {
+ get { return Facet.maxLength;}
+ }
+
+
//<maxLength
// fixed = boolean : false
// id = ID
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaMinExclusiveFacet.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaMinExclusiveFacet.cs
index ea0cda2c7fa..06b1b1d3c22 100755
--- a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaMinExclusiveFacet.cs
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaMinExclusiveFacet.cs
@@ -16,6 +16,10 @@ namespace System.Xml.Schema
{
}
+ internal override Facet ThisFacet {
+ get { return Facet.minExclusive; }
+ }
+
//<minExclusive
// fixed = boolean : false
// id = ID
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaMinInclusiveFacet.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaMinInclusiveFacet.cs
index 8459cd3ebe5..fcd89e8260b 100755
--- a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaMinInclusiveFacet.cs
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaMinInclusiveFacet.cs
@@ -15,6 +15,11 @@ namespace System.Xml.Schema
public XmlSchemaMinInclusiveFacet()
{
}
+
+ internal override Facet ThisFacet {
+ get { return Facet.minInclusive ;}
+ }
+
//<minInclusive
// fixed = boolean : false
// id = ID
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaMinLengthFacet.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaMinLengthFacet.cs
index 51763977a4a..28ff3286eb9 100755
--- a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaMinLengthFacet.cs
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaMinLengthFacet.cs
@@ -16,6 +16,11 @@ namespace System.Xml.Schema
{
}
+ internal override Facet ThisFacet {
+ get { return Facet.minLength;}
+ }
+
+
//<minLength
// fixed = boolean : false
// id = ID
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaObject.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaObject.cs
index 997203cad44..e5246401f55 100755
--- a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaObject.cs
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaObject.cs
@@ -95,7 +95,7 @@ namespace System.Xml.Schema
xsobj,
sender,
null,
- XmlSeverityType.Warning);
+ XmlSeverityType.Error);
}
internal static void warn(ValidationEventHandler handle,
string message,
@@ -131,5 +131,15 @@ namespace System.Xml.Schema
{
return this.ValidationId == validationId;
}
+
+ // This method is used only by particles
+ internal virtual void CopyInfo (XmlSchemaParticle obj)
+ {
+ obj.LineNumber = LineNumber;
+ obj.LinePosition = LinePosition;
+ obj.SourceUri = SourceUri;
+ obj.errorCount = errorCount;
+ // Other fields and properties may be useless for Particle.
+ }
}
} \ No newline at end of file
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaObjectTable.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaObjectTable.cs
index 2ad79838315..cfefd85de05 100755
--- a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaObjectTable.cs
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaObjectTable.cs
@@ -13,7 +13,7 @@ namespace System.Xml.Schema
{
private Hashtable table;
- internal XmlSchemaObjectTable()
+ internal XmlSchemaObjectTable ()
{
table = new Hashtable();
}
@@ -34,21 +34,17 @@ namespace System.Xml.Schema
get{ return table.Values; }
}
- public bool Contains(XmlQualifiedName name)
+ public bool Contains (XmlQualifiedName name)
{
- return table.Contains(name);
+ return table.Contains (name);
}
- public IDictionaryEnumerator GetEnumerator()
+ public IDictionaryEnumerator GetEnumerator ()
{
return new XmlSchemaObjectTableEnumerator (this);
}
- internal void Add(XmlQualifiedName name, XmlSchemaObject value)
+ internal void Add (XmlQualifiedName name, XmlSchemaObject value)
{
- if (table.ContainsKey (name))
- throw new XmlSchemaException (
- "Schema object for the name " + name + " already exists in this table.",
- 0, 0, value, null, null);
table [name] = value;
}
@@ -57,7 +53,7 @@ namespace System.Xml.Schema
table.Clear ();
}
- internal void Set(XmlQualifiedName name, XmlSchemaObject value)
+ internal void Set (XmlQualifiedName name, XmlSchemaObject value)
{
table [name] = value;
}
@@ -105,7 +101,7 @@ namespace System.Xml.Schema
}
object IEnumerator.Current
{
- get { return xenum.Value; }
+ get { return xenum.Entry; }
}
DictionaryEntry IDictionaryEnumerator.Entry {
get { return xenum.Entry; }
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaParticle.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaParticle.cs
index ce2b9a44719..56f591ea283 100755
--- a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaParticle.cs
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaParticle.cs
@@ -11,23 +11,23 @@ namespace System.Xml.Schema
/// </summary>
public abstract class XmlSchemaParticle : XmlSchemaAnnotated
{
- decimal minOccurs, maxOccurs;
- string minstr, maxstr;
- static XmlSchemaParticle empty;
- decimal validatedMinOccurs, validatedMaxOccurs;
- internal int recursionDepth = -1;
- private decimal minEffectiveTotalRange = -1;
- internal bool parentIsGroupDefinition;
-
internal static XmlSchemaParticle Empty {
get {
if (empty == null) {
- empty = new XmlSchemaParticleEmpty ();
+ empty = new EmptyParticle ();
}
return empty;
}
}
+ decimal minOccurs, maxOccurs;
+ string minstr, maxstr;
+ static XmlSchemaParticle empty;
+ decimal validatedMinOccurs = 1, validatedMaxOccurs = 1;
+ internal int recursionDepth = -1;
+ private decimal minEffectiveTotalRange = -1;
+ internal bool parentIsGroupDefinition;
+
protected XmlSchemaParticle()
{
minOccurs = decimal.One;
@@ -125,12 +125,16 @@ namespace System.Xml.Schema
{
get { return validatedMaxOccurs; }
}
+ #endregion
- internal virtual XmlSchemaParticle ActualParticle
+ internal XmlSchemaParticle OptimizedParticle;
+
+ internal abstract XmlSchemaParticle GetOptimizedParticle (bool isTop);
+
+ internal XmlSchemaParticle GetShallowClone ()
{
- get { return this; }
+ return (XmlSchemaParticle) MemberwiseClone ();
}
- #endregion
internal void CompileOccurence (ValidationEventHandler h, XmlSchema schema)
{
@@ -148,18 +152,35 @@ namespace System.Xml.Schema
}
}
- internal virtual void ValidateOccurenceRangeOK (XmlSchemaParticle other,
- ValidationEventHandler h, XmlSchema schema)
+ internal override void CopyInfo (XmlSchemaParticle obj)
+ {
+ base.CopyInfo (obj);
+ if (MaxOccursString == "unbounded")
+ obj.MaxOccurs = obj.validatedMaxOccurs = decimal.MaxValue;
+ else
+ obj.MaxOccurs = obj.validatedMaxOccurs = this.ValidatedMaxOccurs;
+ if (MaxOccurs == 0)
+ obj.MinOccurs = obj.validatedMinOccurs = 0;
+ else
+ obj.MinOccurs = obj.validatedMinOccurs = this.ValidatedMinOccurs;
+ }
+
+ internal virtual bool ValidateOccurenceRangeOK (XmlSchemaParticle other,
+ ValidationEventHandler h, XmlSchema schema, bool raiseError)
{
if ((this.ValidatedMinOccurs < other.ValidatedMinOccurs) ||
(other.ValidatedMaxOccurs != decimal.MaxValue &&
- this.ValidatedMaxOccurs > other.ValidatedMaxOccurs))
- error (h, "Invalid derivation occurence range was found.");
+ this.ValidatedMaxOccurs > other.ValidatedMaxOccurs)) {
+ if (raiseError)
+ error (h, "Invalid derivation occurence range was found.");
+ return false;
+ }
+ return true;
}
internal virtual decimal GetMinEffectiveTotalRange ()
{
- return 0;
+ return ValidatedMinOccurs;
}
internal decimal GetMinEffectiveTotalRangeAllAndSequence ()
@@ -180,13 +201,14 @@ namespace System.Xml.Schema
return product;
}
+ // 3.9.6 Particle Emptiable
internal virtual bool ValidateIsEmptiable ()
{
return this.validatedMinOccurs == 0 || this.GetMinEffectiveTotalRange () == 0;
}
- internal abstract void ValidateDerivationByRestriction (XmlSchemaParticle baseParticle,
- ValidationEventHandler h, XmlSchema schema);
+ internal abstract bool ValidateDerivationByRestriction (XmlSchemaParticle baseParticle,
+ ValidationEventHandler h, XmlSchema schema, bool raiseError);
internal abstract void ValidateUniqueParticleAttribution (
XmlSchemaObjectTable qnames, ArrayList nsNames,
@@ -201,22 +223,26 @@ namespace System.Xml.Schema
internal abstract bool ParticleEquals (XmlSchemaParticle other);
#region Internal Class
- public class XmlSchemaParticleEmpty : XmlSchemaParticle
+ public class EmptyParticle : XmlSchemaParticle
{
- internal XmlSchemaParticleEmpty ()
+ internal EmptyParticle ()
{
}
- internal override bool ParticleEquals (XmlSchemaParticle other)
+ internal override XmlSchemaParticle GetOptimizedParticle (bool isTop)
{
- return other == this || other is XmlSchemaParticleEmpty;
+ return this;
}
+ internal override bool ParticleEquals (XmlSchemaParticle other)
+ {
+ return other == this || other == XmlSchemaParticle.Empty;
+ }
- internal override void ValidateDerivationByRestriction (XmlSchemaParticle baseParticle,
- ValidationEventHandler h, XmlSchema schema)
+ internal override bool ValidateDerivationByRestriction (XmlSchemaParticle baseParticle,
+ ValidationEventHandler h, XmlSchema schema, bool raiseError)
{
- // TODO
+ return true;
}
internal override void CheckRecursion (int depth,
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaPatternFacet.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaPatternFacet.cs
index da2effbb380..74275505748 100755
--- a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaPatternFacet.cs
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaPatternFacet.cs
@@ -15,6 +15,11 @@ namespace System.Xml.Schema
public XmlSchemaPatternFacet()
{
}
+
+ internal override Facet ThisFacet {
+ get { return Facet.pattern;}
+ }
+
//<pattern
// id = ID
// value = anySimpleType
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaReader.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaReader.cs
index 49e993c08ed..69f7d2047e3 100755
--- a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaReader.cs
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaReader.cs
@@ -6,7 +6,7 @@ namespace System.Xml.Schema
/// <summary>
/// A wrapper around XmlReader
/// </summary>
- public class XmlSchemaReader : XmlReader, IXmlLineInfo
+ internal class XmlSchemaReader : XmlReader, IXmlLineInfo
{
XmlReader reader;
ValidationEventHandler handler;
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSequence.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSequence.cs
index 4cf704ef175..1da701c8911 100755
--- a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSequence.cs
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSequence.cs
@@ -35,21 +35,6 @@ namespace System.Xml.Schema
get{ return items; }
}
- internal override XmlSchemaParticle ActualParticle {
- get {
- if (CompiledItems.Count == 0)
- return XmlSchemaParticle.Empty;
- if (ValidatedMaxOccurs == 1 &&
- ValidatedMinOccurs == 1 &&
- CompiledItems.Count == 1)
- return ((XmlSchemaParticle) CompiledItems [0]).ActualParticle;
- else
- return this;
- }
- }
-
-
- [MonoTODO]
internal override int Compile(ValidationEventHandler h, XmlSchema schema)
{
// If this is already compiled this time, simply skip.
@@ -75,82 +60,139 @@ namespace System.Xml.Schema
this.CompilationId = schema.CompilationId;
return errorCount;
}
-
- [MonoTODO]
- internal override int Validate(ValidationEventHandler h, XmlSchema schema)
+
+
+ internal override XmlSchemaParticle GetOptimizedParticle (bool isTop)
+ {
+ if (OptimizedParticle != null)
+ return OptimizedParticle;
+ if (Items.Count == 0 || ValidatedMaxOccurs == 0) {
+ OptimizedParticle = XmlSchemaParticle.Empty;
+ return OptimizedParticle;
+ }
+ if (!isTop && ValidatedMinOccurs == 1 && ValidatedMaxOccurs == 1) {
+ if (Items.Count == 1)
+ return ((XmlSchemaParticle) Items [0]).GetOptimizedParticle (false);
+ }
+
+ XmlSchemaSequence seq = new XmlSchemaSequence ();
+ CopyInfo (seq);
+ for (int i = 0; i < Items.Count; i++) {
+ XmlSchemaParticle p = Items [i] as XmlSchemaParticle;
+ p = p.GetOptimizedParticle (false);
+ if (p == XmlSchemaParticle.Empty)
+ continue;
+
+ else if (p is XmlSchemaSequence && p.ValidatedMinOccurs == 1 && p.ValidatedMaxOccurs == 1) {
+ XmlSchemaSequence ps = p as XmlSchemaSequence;
+ for (int pi = 0; pi < ps.Items.Count; pi++) {
+ seq.Items.Add (ps.Items [pi]);
+ seq.CompiledItems.Add (ps.Items [pi]);
+ }
+ }
+ else {
+ seq.Items.Add (p);
+ seq.CompiledItems.Add (p);
+ }
+ }
+ if (seq.Items.Count == 0)
+ OptimizedParticle = XmlSchemaParticle.Empty;
+ else
+ OptimizedParticle = seq;
+ return OptimizedParticle;
+ }
+
+ internal override int Validate (ValidationEventHandler h, XmlSchema schema)
{
if (IsValidated (schema.CompilationId))
return errorCount;
CompiledItems.Clear ();
- foreach (XmlSchemaObject obj in Items) {
- errorCount += obj.Validate (h, schema);
- CompiledItems.Add (obj);
+ foreach (XmlSchemaParticle p in Items) {
+ errorCount += p.Validate (h, schema); // This is basically extraneous for pointless item, but needed to check validation error.
+// XmlSchemaParticle particleInPoint = p.GetParticleWithoutPointless ();
+// if (particleInPoint != XmlSchemaParticle.Empty)
+// CompiledItems.Add (particleInPoint);
+ CompiledItems.Add (p);
}
ValidationId = schema.ValidationId;
return errorCount;
}
- internal override void ValidateDerivationByRestriction (XmlSchemaParticle baseParticle,
- ValidationEventHandler h, XmlSchema schema)
+ internal override bool ValidateDerivationByRestriction (XmlSchemaParticle baseParticle,
+ ValidationEventHandler h, XmlSchema schema, bool raiseError)
{
+ if (this == baseParticle) // quick check
+ return true;
+
XmlSchemaElement el = baseParticle as XmlSchemaElement;
if (el != null) {
// Forbidden
- error (h, "Invalid sequence paricle derivation.");
- return;
+ if (raiseError)
+ error (h, "Invalid sequence paricle derivation.");
+ return false;
}
XmlSchemaSequence seq = baseParticle as XmlSchemaSequence;
if (seq != null) {
// Recurse
- ValidateOccurenceRangeOK (seq, h, schema);
+ if (!ValidateOccurenceRangeOK (seq, h, schema, raiseError))
+ return false;
// If it is totally optional, then ignore their contents.
if (seq.ValidatedMinOccurs == 0 && seq.ValidatedMaxOccurs == 0 &&
this.ValidatedMinOccurs == 0 && this.ValidatedMaxOccurs == 0)
- return;
- this.ValidateRecurse (seq, h, schema);
- return;
+ return true;
+ return ValidateRecurse (seq, h, schema, raiseError);
}
XmlSchemaAll all = baseParticle as XmlSchemaAll;
- XmlSchemaAny any = baseParticle as XmlSchemaAny;
- XmlSchemaChoice choice = baseParticle as XmlSchemaChoice;
if (all != null) {
// RecurseUnordered
XmlSchemaObjectCollection already = new XmlSchemaObjectCollection ();
for (int i = 0; i < this.Items.Count; i++) {
XmlSchemaElement de = this.Items [i] as XmlSchemaElement;
if (de == null) {
- error (h, "Invalid sequence particle derivation by restriction from all.");
- continue;
+ if (raiseError)
+ error (h, "Invalid sequence particle derivation by restriction from all.");
+ return false;
}
foreach (XmlSchemaElement e in all.Items) {
if (e.QualifiedName == de.QualifiedName) {
- if (already.Contains (e))
- error (h, "Base element particle is mapped to the derived element particle in a sequence two or more times.");
- else {
+ if (already.Contains (e)) {
+ if (raiseError)
+ error (h, "Base element particle is mapped to the derived element particle in a sequence two or more times.");
+ return false;
+ } else {
already.Add (e);
- de.ValidateDerivationByRestriction (e, h, schema);
+ if (!de.ValidateDerivationByRestriction (e, h, schema, raiseError))
+ return false;
}
}
}
}
foreach (XmlSchemaElement e in all.Items)
if (!already.Contains (e))
- if (!e.ValidateIsEmptiable ())
- error (h, "In base -all- particle, mapping-skipped base element which is not emptiable was found.");
- } else if (any != null) {
+ if (!e.ValidateIsEmptiable ()) {
+ if (raiseError)
+ error (h, "In base -all- particle, mapping-skipped base element which is not emptiable was found.");
+ return false;
+ }
+ return true;
+ }
+ XmlSchemaAny any = baseParticle as XmlSchemaAny;
+ if (any != null) {
// NSRecurseCheckCardinality
- ValidateNSRecurseCheckCardinality (any, h, schema);
- return;
- } else if (choice != null) {
+ return ValidateNSRecurseCheckCardinality (any, h, schema, raiseError);
+ }
+ XmlSchemaChoice choice = baseParticle as XmlSchemaChoice;
+ if (choice != null) {
// MapAndSum
- // In fact it is not Recurse, but it looks common.
- ValidateRecurse (choice, h, schema);
+ // In fact it is not Recurse, but it looks almost common.
+ return ValidateSeqRecurseMapSumCommon (choice, h, schema, false, true, raiseError);
}
+ return true;
}
internal override decimal GetMinEffectiveTotalRange ()
@@ -158,12 +200,6 @@ namespace System.Xml.Schema
return GetMinEffectiveTotalRangeAllAndSequence ();
}
- internal override void CheckRecursion (int depth, ValidationEventHandler h, XmlSchema schema)
- {
- foreach (XmlSchemaParticle p in this.Items)
- p.CheckRecursion (depth, h, schema);
- }
-
internal override void ValidateUniqueParticleAttribution (XmlSchemaObjectTable qnames, ArrayList nsNames,
ValidationEventHandler h, XmlSchema schema)
{
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSet.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSet.cs
index 352149082cb..71dc252c1b1 100644
--- a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSet.cs
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSet.cs
@@ -5,9 +5,8 @@
// Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
//
// (C)2003 Atsushi Enomoto
+// (C)2004 Novell Inc.
//
-#if NET_1_2
-
using System;
using System.Collections;
using System.Collections.Specialized;
@@ -19,55 +18,108 @@ using System.Xml.XPath;
namespace System.Xml.Schema
{
+#if NET_1_2
public class XmlSchemaSet
+#else
+ internal class XmlSchemaSet
+#endif
{
+ XmlNameTable nameTable;
+ XmlResolver xmlResolver;
+
+ Hashtable schemas;
+ XmlSchemaObjectTable attributes;
+ XmlSchemaObjectTable elements;
+ XmlSchemaObjectTable types;
+ XmlSchemaCollection col;
+
+ bool isCompiled;
+
+ internal Guid CompilationId;
+
+ public XmlSchemaSet () : this (new NameTable ())
+ {
+ }
+
+ public XmlSchemaSet (XmlNameTable nameTable)
+ {
+ this.nameTable = nameTable;
+ schemas = new Hashtable ();
+ attributes = new XmlSchemaObjectTable ();
+ elements = new XmlSchemaObjectTable ();
+ types = new XmlSchemaObjectTable ();
+ CompilationId = Guid.NewGuid ();
+ }
+
+ public event ValidationEventHandler ValidationEventHandler;
+
public int Count {
- get { throw new NotImplementedException (); }
+ get { return schemas.Count; }
}
public XmlSchemaObjectTable GlobalAttributes {
- get { throw new NotImplementedException (); }
+ get { return attributes; }
}
public XmlSchemaObjectTable GlobalElements {
- get { throw new NotImplementedException (); }
+ get { return elements; }
}
public XmlSchemaObjectTable GlobalTypes {
- get { throw new NotImplementedException (); }
+ get { return types; }
}
public bool IsCompiled {
- get { throw new NotImplementedException (); }
+ get { return isCompiled; }
}
public XmlNameTable NameTable {
- get { throw new NotImplementedException (); }
+ get { return nameTable; }
}
- public XmlResolver XmlResolver {
- set { throw new NotImplementedException (); }
+ // This is mainly used for event delegating
+ internal XmlSchemaCollection SchemaCollection {
+ get { return col; }
+ set { col = value; }
}
+ public XmlResolver XmlResolver {
+ set { xmlResolver = value; }
+ }
public XmlSchema Add (string targetNamespace, string url)
{
- throw new NotImplementedException ();
+ XmlTextReader r = null;
+ try {
+ r = new XmlTextReader (url);
+ return Add (targetNamespace, r);
+ } finally {
+ if (r != null)
+ r.Close ();
+ }
}
+ [MonoTODO ("Check how targetNamespace is used")]
public XmlSchema Add (string targetNamespace, XmlReader reader)
{
- throw new NotImplementedException ();
+ return Add (XmlSchema.Read (reader, null));
}
+ [MonoTODO ("Check the exact behavior when namespaces are in conflict")]
public void Add (XmlSchemaSet schemaSet)
{
- throw new NotImplementedException ();
+ foreach (XmlSchema schema in schemaSet.schemas)
+ schemas.Add (schema.TargetNamespace, schema);
}
+ [MonoTODO ("Check the exact behavior when namespaces are in conflict")]
public XmlSchema Add (XmlSchema schema)
{
- throw new NotImplementedException ();
+ XmlSchema existing = schemas [GetSafeNs (schema.TargetNamespace)] as XmlSchema;
+ if (existing != null)
+ return existing;
+ schemas.Add (GetSafeNs (schema.TargetNamespace), schema);
+ return schema;
}
public void Compile ()
@@ -77,44 +129,65 @@ namespace System.Xml.Schema
public bool Contains (string targetNamespace)
{
- throw new NotImplementedException ();
+ return schemas.ContainsKey (targetNamespace);
}
public bool Contains (XmlSchema targetNamespace)
{
- throw new NotImplementedException ();
+ return schemas.Contains (targetNamespace);
}
public void CopyTo (XmlSchema[] array, int index)
{
- throw new NotImplementedException ();
+ schemas.CopyTo (array, index);
}
- public XmlSchema Remove (XmlSchema schema)
+ internal void CopyTo (Array array, int index)
{
- throw new NotImplementedException ();
+ schemas.CopyTo (array, index);
}
- public ArrayList Schemas ()
+ internal XmlSchema Get (string ns)
{
- throw new NotImplementedException ();
+ return (XmlSchema) schemas [GetSafeNs (ns)];
+ }
+
+ internal IEnumerator GetEnumerator()
+ {
+ return schemas.GetEnumerator();
+ }
+
+ string GetSafeNs (string ns)
+ {
+ return ns == null ? "" : ns;
+ }
+
+ internal void OnValidationError (object o, ValidationEventArgs e)
+ {
+ if (col != null)
+ col.OnValidationError (o, e);
+ if (ValidationEventHandler != null)
+ ValidationEventHandler (o, e);
+ else if (e.Severity == XmlSeverityType.Error)
+ throw e.Exception;
}
- public ArrayList Schemas (string targetNamespace)
+ [MonoTODO ("Check exact behavior")]
+ public XmlSchema Remove (XmlSchema schema)
{
- throw new NotImplementedException ();
+ schemas.Remove (schema);
+ return schema;
}
- public XmlSchemaSet ()
+ public ArrayList Schemas ()
{
- throw new NotImplementedException ();
+ return new ArrayList (schemas);
}
- public XmlSchemaSet (XmlNameTable nameTable)
+ [MonoTODO]
+ public ArrayList Schemas (string targetNamespace)
{
throw new NotImplementedException ();
}
}
}
-
-#endif
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleContent.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleContent.cs
index 044c6f3e4d9..92b8283272f 100755
--- a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleContent.cs
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleContent.cs
@@ -18,7 +18,6 @@ namespace System.Xml.Schema
{
private XmlSchemaContent content;
private static string xmlname = "simpleContent";
- internal object actualBaseSchemaType;
public XmlSchemaSimpleContent()
{
}
@@ -34,7 +33,6 @@ namespace System.Xml.Schema
///<remarks>
/// 1. Content must be present and one of restriction or extention
///</remarks>
- [MonoTODO]
internal override int Compile(ValidationEventHandler h, XmlSchema schema)
{
// If this is already compiled this time, simply skip.
@@ -66,7 +64,6 @@ namespace System.Xml.Schema
return errorCount;
}
- [MonoTODO]
internal override int Validate(ValidationEventHandler h, XmlSchema schema)
{
if (IsValidated (schema.ValidationId))
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleContentExtension.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleContentExtension.cs
index 149afea9db6..89f935189ac 100755
--- a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleContentExtension.cs
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleContentExtension.cs
@@ -49,10 +49,14 @@ namespace System.Xml.Schema
set{ any = value; }
}
+ // internal properties
+ internal override bool IsExtension {
+ get { return true; }
+ }
+
///<remarks>
/// 1. Base must be present and a QName
///</remarks>
- [MonoTODO]
internal override int Compile(ValidationEventHandler h, XmlSchema schema)
{
// If this is already compiled this time, simply skip.
@@ -102,7 +106,16 @@ namespace System.Xml.Schema
return errorCount;
}
- [MonoTODO]
+ internal override XmlQualifiedName GetBaseTypeName ()
+ {
+ return baseTypeName;
+ }
+
+ internal override XmlSchemaParticle GetParticle ()
+ {
+ return null;
+ }
+
internal override int Validate(ValidationEventHandler h, XmlSchema schema)
{
if (IsValidated (schema.ValidationId))
@@ -117,7 +130,7 @@ namespace System.Xml.Schema
actualBaseSchemaType = st;
} else if (baseTypeName == XmlSchemaComplexType.AnyTypeName) {
actualBaseSchemaType = XmlSchemaComplexType.AnyType;
- } else if (baseTypeName.Namespace == XmlSchema.Namespace) {
+ } else if (XmlSchemaUtil.IsBuiltInDatatypeName (baseTypeName)) {
actualBaseSchemaType = XmlSchemaDatatype.FromName (baseTypeName);
if (actualBaseSchemaType == null)
error (h, "Invalid schema datatype name is specified.");
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleContentRestriction.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleContentRestriction.cs
index 181638116e1..eda9827908c 100755
--- a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleContentRestriction.cs
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleContentRestriction.cs
@@ -71,10 +71,14 @@ namespace System.Xml.Schema
set{ any = value; }
}
+ // internal properties
+ internal override bool IsExtension {
+ get { return false; }
+ }
+
///<remarks>
/// 1. Base must be present and a QName
///</remarks>
- [MonoTODO]
internal override int Compile(ValidationEventHandler h, XmlSchema schema)
{
// If this is already compiled this time, simply skip.
@@ -131,7 +135,16 @@ namespace System.Xml.Schema
return errorCount;
}
- [MonoTODO]
+ internal override XmlQualifiedName GetBaseTypeName ()
+ {
+ return baseTypeName;
+ }
+
+ internal override XmlSchemaParticle GetParticle ()
+ {
+ return null;
+ }
+
internal override int Validate(ValidationEventHandler h, XmlSchema schema)
{
if (IsValidated (schema.ValidationId))
@@ -148,7 +161,7 @@ namespace System.Xml.Schema
actualBaseSchemaType = st;
} else if (baseTypeName == XmlSchemaComplexType.AnyTypeName) {
actualBaseSchemaType = XmlSchemaComplexType.AnyType;
- } else if (baseTypeName.Namespace == XmlSchema.Namespace) {
+ } else if (XmlSchemaUtil.IsBuiltInDatatypeName (baseTypeName)) {
actualBaseSchemaType = XmlSchemaDatatype.FromName (baseTypeName);
if (actualBaseSchemaType == null)
error (h, "Invalid schema datatype name is specified.");
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleType.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleType.cs
index 5625800b51c..fe6a273819f 100755
--- a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleType.cs
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleType.cs
@@ -46,19 +46,6 @@ namespace System.Xml.Schema
get{ return variety; }
}
- internal XmlSchemaDatatype Datatype
- {
- get {
- XmlSchemaDatatype dt = BaseSchemaType as XmlSchemaDatatype;
- if (dt == null) {
- XmlSchemaSimpleType baseSimple = BaseSchemaType as XmlSchemaSimpleType;
- if (baseSimple != null)
- dt = baseSimple.Datatype;
- }
- return dt;
- }
- }
-
/// <remarks>
/// For a simple Type:
/// 1. Content must be present
@@ -78,7 +65,6 @@ namespace System.Xml.Schema
/// 4.1 If restriction is chosen,the base type of restriction or elements
/// 4.2 otherwise simple ur-type
/// </remarks>
- [MonoTODO]
internal override int Compile(ValidationEventHandler h, XmlSchema schema)
{
// If this is already compiled this time, simply skip.
@@ -165,7 +151,6 @@ namespace System.Xml.Schema
return errorCount;
}
- [MonoTODO]
internal override int Validate(ValidationEventHandler h, XmlSchema schema)
{
// 3.14.6 Properties Correct.
@@ -187,19 +172,23 @@ namespace System.Xml.Schema
}
recursed = true;
- errorCount += content.Validate (h, schema);
+ if (content != null)
+ errorCount += content.Validate (h, schema);
+
// BaseSchemaType property
- this.baseSchemaTypeInternal = content.ActualBaseSchemaType;
+ BaseXmlSchemaTypeInternal = content.ActualBaseSchemaType as XmlSchemaType;
+ if (this.BaseXmlSchemaTypeInternal == null)
+ this.DatatypeInternal = content.ActualBaseSchemaType as XmlSchemaDatatype;
// Datatype property
- XmlSchemaSimpleType simple = BaseSchemaType as XmlSchemaSimpleType;
+ XmlSchemaSimpleType simple = BaseXmlSchemaType as XmlSchemaSimpleType;
if (simple != null)
- this.datatypeInternal = simple.Datatype;
- else
- this.datatypeInternal = BaseSchemaType as XmlSchemaDatatype;
+ this.DatatypeInternal = simple.Datatype;
+// else
+// DatatypeInternal = BaseSchemaType as XmlSchemaDatatype;
// 3.
- XmlSchemaSimpleType baseSType = baseSchemaTypeInternal as XmlSchemaSimpleType;
+ XmlSchemaSimpleType baseSType = BaseXmlSchemaType as XmlSchemaSimpleType;
if (baseSType != null) {
if ((baseSType.FinalResolved & this.resolvedDerivedBy) != 0)
error (h, "Specified derivation is prohibited by the base simple type.");
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleTypeContent.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleTypeContent.cs
index 3afcbe4fe90..3da5c11b8c1 100755
--- a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleTypeContent.cs
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleTypeContent.cs
@@ -13,7 +13,9 @@ namespace System.Xml.Schema
{
}
- internal object actualBaseSchemaType;
+ internal XmlSchemaType OwnerType;
+
+ private object actualBaseSchemaType = XmlSchemaSimpleType.AnySimpleType;
internal object ActualBaseSchemaType {
get { return actualBaseSchemaType; }
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleTypeList.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleTypeList.cs
index 3cea6d563de..8c0c9d0bcf4 100755
--- a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleTypeList.cs
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleTypeList.cs
@@ -50,7 +50,6 @@ namespace System.Xml.Schema
/// 1. One of itemType or a <simpleType> must be present, but not both.
/// 2. id must be of type ID
/// </remarks>
- [MonoTODO]
internal override int Compile(ValidationEventHandler h, XmlSchema schema)
{
// If this is already compiled this time, simply skip.
@@ -76,14 +75,13 @@ namespace System.Xml.Schema
return errorCount;
}
- [MonoTODO]
internal override int Validate(ValidationEventHandler h, XmlSchema schema)
{
if (IsValidated (schema.ValidationId))
return errorCount;
// As far as I saw, MS.NET handles simpleType.BaseSchemaType as anySimpleType.
- this.actualBaseSchemaType = XmlSchemaSimpleType.AnySimpleType;
+// this.actualBaseSchemaType = XmlSchemaSimpleType.AnySimpleType;
// ListItemType
XmlSchemaSimpleType type = itemType;
@@ -94,7 +92,7 @@ namespace System.Xml.Schema
validatedListItemType = type;
} else if (itemTypeName == XmlSchemaComplexType.AnyTypeName) {
validatedListItemType = XmlSchemaSimpleType.AnySimpleType;
- } else if (itemTypeName.Namespace == XmlSchema.Namespace) {
+ } else if (XmlSchemaUtil.IsBuiltInDatatypeName (itemTypeName)) {
validatedListItemType = XmlSchemaDatatype.FromName (itemTypeName);
if (validatedListItemType == null)
error (h, "Invalid schema type name was specified: " + itemTypeName);
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleTypeRestriction.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleTypeRestriction.cs
index dcd32bf29f0..9a6c38300db 100755
--- a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleTypeRestriction.cs
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleTypeRestriction.cs
@@ -2,6 +2,7 @@
// Adwiv@Yahoo.com
using System;
using System.Collections;
+using System.Text;
using System.Text.RegularExpressions;
using System.Xml;
using System.Xml.Serialization;
@@ -27,6 +28,13 @@ namespace System.Xml.Schema
private decimal minLengthFacet;
private decimal fractionDigitsFacet;
private decimal totalDigitsFacet;
+ private object maxInclusiveFacet ;
+ private object maxExclusiveFacet ;
+ private object minInclusiveFacet ;
+ private object minExclusiveFacet ;
+ private XmlSchemaFacet.Facet fixedFacets = XmlSchemaFacet.Facet.None;
+ private static NumberStyles lengthStyle = NumberStyles.Integer;
+
public XmlSchemaSimpleTypeRestriction()
{
@@ -99,29 +107,31 @@ namespace System.Xml.Schema
/** Checks if this facet is valid on this restriction. Does not check that it has
* not been fixed in the baseType. That is done elsewhere.
*/
+
+ private const XmlSchemaFacet.Facet listFacets =
+ XmlSchemaFacet.Facet.length | XmlSchemaFacet.Facet.minLength |
+ XmlSchemaFacet.Facet.maxLength | XmlSchemaFacet.Facet.pattern |
+ XmlSchemaFacet.Facet.enumeration | XmlSchemaFacet.Facet.whiteSpace;
+
+
private bool IsAllowedFacet(XmlSchemaFacet xsf) {
/* Must be called after this.ValidateActualType, as it uses actualBaseSchemaType */
- XsdAnySimpleType ast = actualBaseSchemaType as XsdAnySimpleType;
+ XsdAnySimpleType ast = ActualBaseSchemaType as XsdAnySimpleType;
if (ast != null) {
// Based directly on an xsd type
return ast.AllowsFacet(xsf);
}
else {
- XmlSchemaSimpleTypeContent st = ((XmlSchemaSimpleType)actualBaseSchemaType).Content as XmlSchemaSimpleTypeContent;
+ XmlSchemaSimpleTypeContent st = ((XmlSchemaSimpleType)ActualBaseSchemaType).Content as XmlSchemaSimpleTypeContent;
if (st != null) {
XmlSchemaSimpleTypeRestriction str = st as XmlSchemaSimpleTypeRestriction;
- if (str != null) {
+ if (str != null && str != this) {
return str.IsAllowedFacet(xsf);
}
XmlSchemaSimpleTypeList stl = st as XmlSchemaSimpleTypeList;
if (stl != null) {
- return (xsf is XmlSchemaLengthFacet ||
- xsf is XmlSchemaMaxLengthFacet ||
- xsf is XmlSchemaMinLengthFacet ||
- xsf is XmlSchemaPatternFacet ||
- xsf is XmlSchemaEnumerationFacet ||
- xsf is XmlSchemaWhiteSpaceFacet);
+ return ((xsf.ThisFacet & listFacets) != 0);
}
XmlSchemaSimpleTypeUnion stu = st as XmlSchemaSimpleTypeUnion;
@@ -140,19 +150,45 @@ namespace System.Xml.Schema
return false;
}
+
+
[MonoTODO]
internal override int Validate(ValidationEventHandler h, XmlSchema schema)
{
- NumberStyles lengthStyle = NumberStyles.Integer;
if (IsValidated (schema.ValidationId))
return errorCount;
this.ValidateActualType (baseType, baseTypeName, h, schema);
+
+ lengthFacet = maxLengthFacet = minLengthFacet = fractionDigitsFacet = totalDigitsFacet = -1;
+
+ XmlSchemaSimpleTypeRestriction baseSTR = null;
+
+ if (ActualBaseSchemaType is XmlSchemaSimpleType) {
+ XmlSchemaSimpleTypeContent st = ((XmlSchemaSimpleType)ActualBaseSchemaType).Content as XmlSchemaSimpleTypeContent;
+ baseSTR = st as XmlSchemaSimpleTypeRestriction;
+ }
+
+
+ if (baseSTR != null) {
+ fixedFacets = baseSTR.fixedFacets;
+ lengthFacet = baseSTR.lengthFacet;
+ maxLengthFacet = baseSTR.maxLengthFacet;
+ minLengthFacet = baseSTR.minLengthFacet;
+ fractionDigitsFacet = baseSTR.fractionDigitsFacet;
+ totalDigitsFacet = baseSTR.totalDigitsFacet;
+ maxInclusiveFacet = baseSTR.maxInclusiveFacet;
+ maxExclusiveFacet = baseSTR.maxExclusiveFacet;
+ minInclusiveFacet = baseSTR.minInclusiveFacet;
+ minExclusiveFacet = baseSTR.minExclusiveFacet;
+ }
+
enumarationFacetValues = patternFacetValues = null;
rexPatterns = null;
- lengthFacet = maxLengthFacet = minLengthFacet = fractionDigitsFacet = totalDigitsFacet = -1;
+
+ XmlSchemaFacet.Facet facetsDefined = XmlSchemaFacet.Facet.None;
ArrayList enums = null;
ArrayList patterns = null;
@@ -161,10 +197,17 @@ namespace System.Xml.Schema
XmlSchemaFacet facet = facets[i] as XmlSchemaFacet;
if (facet != null) {
if (!IsAllowedFacet(facet)) {
- facet.error(h, facet +" is not a valid facet for this type");
+ facet.error(h, facet.ThisFacet +" is not a valid facet for this type");
continue;
}
}
+ else {
+ // FIXME: Not an XmlSchemaFacet, should we complain here?
+ // Definately not worth seeing what sort of facet it is, as
+ // it isn't any of them.
+ continue;
+ }
+
XmlSchemaEnumerationFacet ef = facets [i] as XmlSchemaEnumerationFacet;
if (ef != null) {
@@ -180,85 +223,329 @@ namespace System.Xml.Schema
patterns.Add (pf.Value);
continue;
}
- XmlSchemaLengthFacet lf = facets [i] as XmlSchemaLengthFacet;
+
+ // Put this test here, as pattern and enumeration
+ // can occur multiple times.
+ if ( (facetsDefined & facet.ThisFacet) !=0) {
+ facet.error (h, "This is a duplicate '" + facet.ThisFacet + "' facet.");
+ continue;
+ }
+ else {
+ facetsDefined |= facet.ThisFacet;
+ }
+
+
+
+
+
+ if (facet is XmlSchemaLengthFacet) {
+ checkLengthFacet((XmlSchemaLengthFacet)facet, facetsDefined, h);
+ }
+ else if (facet is XmlSchemaMaxLengthFacet) {
+ checkMaxLengthFacet((XmlSchemaMaxLengthFacet)facet, facetsDefined, h);
+ }
+ else if (facet is XmlSchemaMinLengthFacet) {
+ checkMinLengthFacet((XmlSchemaMinLengthFacet)facet, facetsDefined, h);
+ }
+
+ else if (facet is XmlSchemaMinInclusiveFacet) {
+ checkMinMaxFacet((XmlSchemaMinInclusiveFacet)facet, ref minInclusiveFacet, h);
+ }
+ else if (facet is XmlSchemaMaxInclusiveFacet) {
+ checkMinMaxFacet((XmlSchemaMaxInclusiveFacet)facet, ref maxInclusiveFacet, h);
+ }
+ else if (facet is XmlSchemaMinExclusiveFacet) {
+ checkMinMaxFacet((XmlSchemaMinExclusiveFacet)facet, ref minExclusiveFacet, h);
+ }
+ else if (facet is XmlSchemaMaxExclusiveFacet) {
+ checkMinMaxFacet((XmlSchemaMaxExclusiveFacet)facet, ref maxExclusiveFacet, h);
+ }
+ else if (facet is XmlSchemaFractionDigitsFacet) {
+ checkFractionDigitsFacet((XmlSchemaFractionDigitsFacet)facet, h);
+ }
+ else if (facet is XmlSchemaTotalDigitsFacet) {
+ checkTotalDigitsFacet((XmlSchemaTotalDigitsFacet)facet, h);
+ }
+
+ if (facet.IsFixed) {
+ fixedFacets |= facet.ThisFacet;
+ }
+
+
+ }
+ if (enums != null)
+ this.enumarationFacetValues = enums.ToArray (typeof (string)) as string [];
+ if (patterns != null) {
+ this.patternFacetValues = patterns.ToArray (typeof (string)) as string [];
+ this.rexPatterns = new Regex [patterns.Count];
+ for (int i = 0; i < patternFacetValues.Length; i++) {
+ try {
+ string src = patternFacetValues [i];
+ StringBuilder sb = null;
+ int start = 0;
+ for (int c = 0; c < src.Length; c++) {
+ if (src [c] == '\\' && src.Length > i + 1) {
+ string subst = null;
+ switch (src [c + 1]) {
+ case 'i':
+ subst = "[\\p{L}_]";
+ break;
+ case 'I':
+ subst = "[^\\p{L}_]";
+ break;
+ case 'c':
+ subst = "[\\p{L}\\p{N}_\\.\\-:]";
+ break;
+ case 'C':
+ subst = "[^\\p{L}\\p{N}_\\.\\-:]";
+ break;
+ }
+ if (subst != null) {
+ if (sb == null)
+ sb = new StringBuilder ();
+ sb.Append (src, start, c - start);
+ sb.Append (subst);
+ start = c + 2;
+ }
+ }
+ }
+ if (sb != null) {
+ sb.Append (src, start, src.Length - start);
+ src = sb.ToString ();
+ }
+// src = src.Replace ("\\i", "[\\p{L}_]").Replace ("\\I", "[^\\p{L}_]").Replace ("\\c", "[\\p{L}\\p{N}_\\.\\-:]").Replace ("\\C", "[^\\p{L}\\p{N}_\\.\\-:]");
+ Regex rex = new Regex ("^" + src + "$");
+ rexPatterns [i] = rex;
+ } catch (Exception ex) {
+ error (h, "Invalid regular expression pattern was specified.", ex);
+ }
+ }
+
+
+
+ }
+
+ ValidationId = schema.ValidationId;
+ /*
+ Console.WriteLine("Facets:\n defined\t{10}\n fixed\t{0}\n length\t{1}\n maxLen\t{2}\n minLen\t{3}\n " +
+ "frac\t{4}\n tot\t{5}\n maxI\t{6}\n maxE\t{7}\n minI\t{8}\n minE\t{9}\n",
+ fixedFacets ,
+ lengthFacet,
+ maxLengthFacet ,
+ minLengthFacet ,
+ fractionDigitsFacet ,
+ totalDigitsFacet ,
+ maxInclusiveFacet ,
+ maxExclusiveFacet ,
+ minInclusiveFacet ,
+ minExclusiveFacet ,
+ facetsDefined);
+*/
+ return errorCount;
+ }
+
+
+ private void checkTotalDigitsFacet (XmlSchemaTotalDigitsFacet totf,
+ ValidationEventHandler h) {
+ if (totf != null) {
+ /* totalDigits is the maximum number of digits in values of datatypes
+ * ·derived· from decimal. The value of totalDigits ·must· be a
+ * positiveInteger. */
+ try {
+ decimal newTotalDigits = decimal.Parse (totf.Value.Trim (), lengthStyle);
+ if (newTotalDigits <= 0)
+ totf.error(h, String.Format("The value '{0}' is an invalid totalDigits value", newTotalDigits));
+ // Valid restriction
+ if ((totalDigitsFacet > 0) && (newTotalDigits > totalDigitsFacet)) {
+ totf.error(h, String.Format("The value '{0}' is not a valid restriction of the base totalDigits facet '{1}'", newTotalDigits, totalDigitsFacet));
+ }
+ totalDigitsFacet = newTotalDigits;
+ }
+ catch (FormatException ) {
+ totf.error(h, String.Format("The value '{0}' is an invalid totalDigits facet specification", totf.Value.Trim () ));
+ }
+ }
+ }
+
+
+ private void checkFractionDigitsFacet (XmlSchemaFractionDigitsFacet fracf,
+ ValidationEventHandler h) {
+
+ if (fracf != null) {
+ try {
+ decimal newFractionDigits = decimal.Parse (fracf.Value.Trim (), lengthStyle);
+ if (newFractionDigits< 0)
+ fracf.error(h, String.Format("The value '{0}' is an invalid fractionDigits value", newFractionDigits));
+
+ if ((fractionDigitsFacet >= 0) && (newFractionDigits > fractionDigitsFacet)) {
+ fracf.error(h, String.Format("The value '{0}' is not a valid restriction of the base fractionDigits facet '{1}'", newFractionDigits, fractionDigitsFacet));
+ }
+ fractionDigitsFacet = newFractionDigits;
+ }
+ catch (FormatException ) {
+ fracf.error(h, String.Format("The value '{0}' is an invalid fractionDigits facet specification", fracf.Value.Trim () ));
+ }
+ }
+
+ }
+
+
+ private void checkMinMaxFacet(XmlSchemaFacet facet,
+ ref object baseFacet,
+ ValidationEventHandler h) {
+// Is it a valid instance of the base type.
+ object newValue = ValidateValueWithDatatype(facet.Value);
+ if (newValue != null) {
+// Is the base fixed - if so is it the same
+ if (((fixedFacets & facet.ThisFacet) != 0) && (baseFacet != null)){
+ XsdAnySimpleType dt = getDatatype();
+ if (dt.Compare (newValue, baseFacet) != XsdOrdering.Equal) {
+ facet.error (h,
+ String.Format("{0} is not the same as fixed parent {1} facet.",
+ facet.Value, facet.ThisFacet));
+ }
+ }
+ baseFacet = newValue;
+ }
+ else {
+ facet.error(h,
+ String.Format("The value '{0}' is not valid against the base type.", facet.Value));
+ }
+ }
+
+
+
+ private void checkLengthFacet(XmlSchemaLengthFacet lf,
+ XmlSchemaFacet.Facet facetsDefined,
+ ValidationEventHandler h) {
if (lf != null) {
try {
- if (minLengthFacet >=0 || maxLengthFacet>=0)
+ if ((facetsDefined & (XmlSchemaFacet.Facet.minLength | XmlSchemaFacet.Facet.maxLength)) != 0)
lf.error(h, "It is an error for both length and minLength or maxLength to be present.");
- if (lengthFacet >= 0)
- lf.error (h, "There already length facet exists.");
else {
lengthFacet = decimal.Parse (lf.Value.Trim (), lengthStyle);
+ /* TODO: Check that it is between inherited max/min lengths */
if (lengthFacet < 0)
lf.error(h, "The value '" + lengthFacet + "' is an invalid length");
}
- } catch (Exception) { // FIXME: better catch ;-(
+ } catch (FormatException) { // FIXME: better catch ;-(
lf.error (h, "The value '" + lf.Value + "' is an invalid length facet specification");
}
- continue;
}
- XmlSchemaMaxLengthFacet maxlf = facets [i] as XmlSchemaMaxLengthFacet;
+ }
+
+ private void checkMaxLengthFacet(XmlSchemaMaxLengthFacet maxlf,
+ XmlSchemaFacet.Facet facetsDefined,
+ ValidationEventHandler h) {
if (maxlf != null) {
try {
- if (lengthFacet >=0)
+ if ((facetsDefined & XmlSchemaFacet.Facet.length) != 0)
maxlf.error(h, "It is an error for both length and minLength or maxLength to be present.");
- if (maxLengthFacet >= 0)
- maxlf.error (h, "There already maxLength facet exists.");
else {
- maxLengthFacet = decimal.Parse (maxlf.Value.Trim (), lengthStyle);
+ decimal newMaxLengthFacet = decimal.Parse (maxlf.Value.Trim (), lengthStyle);
+
+ if (((fixedFacets & XmlSchemaFacet.Facet.maxLength)!=0) && (newMaxLengthFacet != maxLengthFacet))
+ maxlf.error(h, String.Format("The value '{0}' is not the same as the fixed value '{1}' on the base type", maxlf.Value.Trim (), maxLengthFacet));
+ if ((maxLengthFacet >0) && (newMaxLengthFacet > maxLengthFacet))
+ maxlf.error(h, String.Format("The value '{0}' is not a valid restriction of the value '{1}' on the base maxLength facet", maxlf.Value.Trim (), maxLengthFacet));
+ else
+ maxLengthFacet = newMaxLengthFacet;
if (maxLengthFacet < 0)
maxlf.error(h, "The value '" + maxLengthFacet + "' is an invalid maxLength");
if (minLengthFacet >=0 && minLengthFacet > maxLengthFacet)
maxlf.error(h, "minLength is greater than maxLength.");
}
-
- } catch (Exception) { // FIXME: better catch ;-(
+ } catch (FormatException) {
maxlf.error (h, "The value '" + maxlf.Value+ "' is an invalid maxLength facet specification");
}
- continue;
}
- XmlSchemaMinLengthFacet minlf = facets [i] as XmlSchemaMinLengthFacet;
+ }
+
+ private void checkMinLengthFacet(XmlSchemaMinLengthFacet minlf,
+ XmlSchemaFacet.Facet facetsDefined,
+ ValidationEventHandler h) {
if (minlf != null) {
try {
if (lengthFacet >=0)
minlf.error(h, "It is an error for both length and minLength or maxLength to be present.");
- if (minLengthFacet >= 0)
- minlf.error (h, "There already minLength facet exists.");
else {
- minLengthFacet = decimal.Parse (minlf.Value.Trim (), lengthStyle);
+ decimal newMinLengthFacet = decimal.Parse (minlf.Value.Trim (), lengthStyle);
+
+ if (((fixedFacets & XmlSchemaFacet.Facet.minLength)!=0) && (newMinLengthFacet != minLengthFacet))
+ minlf.error(h, String.Format("The value '{0}' is not the same as the fixed value '{1}' on the base type", minlf.Value.Trim (), minLengthFacet));
+ if (newMinLengthFacet < minLengthFacet)
+ minlf.error(h, String.Format("The value '{0}' is not a valid restriction of the value '{1}' on the base minLength facet", minlf.Value.Trim (), minLengthFacet));
+ else
+ minLengthFacet = newMinLengthFacet;
if (minLengthFacet < 0)
minlf.error(h, "The value '" + minLengthFacet + "' is an invalid minLength");
if (maxLengthFacet >=0 && minLengthFacet > maxLengthFacet)
minlf.error(h, "minLength is greater than maxLength.");
}
- } catch (Exception) { // FIXME: better catch ;-(
+ } catch (FormatException) {
minlf.error (h, "The value '" + minlf.Value + "' is an invalid minLength facet specification");
}
- continue;
}
}
- if (enums != null)
- this.enumarationFacetValues = enums.ToArray (typeof (string)) as string [];
- if (patterns != null) {
- this.patternFacetValues = patterns.ToArray (typeof (string)) as string [];
- this.rexPatterns = new Regex [patterns.Count];
- for (int i = 0; i < patternFacetValues.Length; i++) {
+
+
+ private XsdAnySimpleType getDatatype() {
+ XsdAnySimpleType ast = ActualBaseSchemaType as XsdAnySimpleType;
+ if (ast != null) {
+ // Based directly on an xsd type
+ return ast;
+ }
+ XmlSchemaSimpleTypeContent st = ((XmlSchemaSimpleType)ActualBaseSchemaType).Content as XmlSchemaSimpleTypeContent;
+
+ if (st is XmlSchemaSimpleTypeRestriction) {
+ return ((XmlSchemaSimpleTypeRestriction)st).getDatatype();
+ }
+ else if ((st is XmlSchemaSimpleTypeList) ||
+ (st is XmlSchemaSimpleTypeUnion)) {
+ return null;
+ }
+ return null;
+ }
+
+
+ private object ValidateValueWithDatatype(string value) {
+ XsdAnySimpleType dt = getDatatype();
+ object ret = null;
+ // Console.WriteLine("DT: " + dt);
+ if (dt != null) {
try {
- Regex rex = new Regex (patternFacetValues [i]);
- rexPatterns [i] = rex;
- } catch (Exception ex) {
- error (h, "Invalid regular expression pattern was specified.", ex);
+ /* I think we can parse null here, as the types
+ * that use the nametable and nsmgr are ones that
+ * we don't need to parse here.
+ */
+ ret = dt.ParseValue (value, null, null);
+ // Console.WriteLine("Ret: " + ret);
+ // If we are based on something with facets, check that we are valid
+ if (ActualBaseSchemaType is XmlSchemaSimpleType) {
+ XmlSchemaSimpleTypeContent st = ((XmlSchemaSimpleType) ActualBaseSchemaType).Content as XmlSchemaSimpleTypeContent;
+ if (st is XmlSchemaSimpleTypeRestriction) {
+ if (((XmlSchemaSimpleTypeRestriction)st).ValidateValueWithFacets(value, null)) {
+ return ret;
+ } else {
+ return null;
}
}
}
- ValidationId = schema.ValidationId;
- return errorCount;
+ }catch (Exception e) {
+ return null;
+ }
+ }
+ return ret;
}
internal bool ValidateValueWithFacets (string value, XmlNameTable nt)
{
+ /*
+ * FIXME: Shouldn't this be recursing more? What if this is a
+ * restriction of a restriction of a list type?
+ */
XmlSchemaSimpleType baseST = this.ActualBaseSchemaType as XmlSchemaSimpleType;
XmlSchemaSimpleTypeList listType = baseST != null ? baseST.Content as XmlSchemaSimpleTypeList : null;
@@ -306,16 +593,25 @@ namespace System.Xml.Schema
// : minLength
if (minLengthFacet >= 0 && list.Length < minLengthFacet)
return false;
+
return true;
}
private bool ValidateNonListValueWithFacets (string value, XmlNameTable nt)
{
// pattern
+ // Patterns are the only facets that need to be checked on this
+ // type and its base types. We should probably separate them, then
+ // do base-type pattern validation.
if (this.patternFacetValues != null) {
+ bool matched = false;
for (int i = 0; i < this.patternFacetValues.Length; i++)
- if (rexPatterns [i] != null && !rexPatterns [i].IsMatch (value))
- return false;
+ if (rexPatterns [i] != null && rexPatterns [i].IsMatch (value)) {
+ matched = true;
+ break;
+ }
+ if (!matched)
+ return false;
}
// enumeration
if (this.enumarationFacetValues != null) {
@@ -329,18 +625,90 @@ namespace System.Xml.Schema
if (!matched)
return false;
}
- // numeric
- // : length
- if (lengthFacet >= 0 && value.Length != lengthFacet)
- return false;
- // : maxLength
- if (maxLengthFacet >= 0 && value.Length > maxLengthFacet)
+ XsdAnySimpleType dt = getDatatype ();
+
+ // Need to skip length tests for
+ // types derived from QName or NOTATION
+ // see errata: E2-36 Clarification
+
+ if (! ( (dt is XsdQName) || (dt is XsdNotation))) {
+ // Length potentially slower now, so only calculate if needed
+ if (! (lengthFacet == -1) && (maxLengthFacet == -1) && (minLengthFacet == -1)) {
+
+ // numeric
+ // : length
+
+ int length = dt.Length(value);
+
+ if (lengthFacet >= 0 && length != lengthFacet)
+ return false;
+ // : maxLength
+ if (maxLengthFacet >= 0 && length > maxLengthFacet)
+ return false;
+ // : minLength
+ if (minLengthFacet >= 0 && length < minLengthFacet)
+ return false;
+
+ }
+ }
+
+ if ((totalDigitsFacet >=0) || (fractionDigitsFacet >=0)) {
+ String newValue = value.Trim(new Char [] { '+', '-', '0', '.' });
+ int fractionDigits = 0;
+ int totalDigits = newValue.Length;
+ int point = newValue.IndexOf(".");
+ if (point != -1) {
+ totalDigits -= 1;
+ fractionDigits = newValue.Length - point -1;
+ }
+ if ((totalDigitsFacet >=0) && (totalDigits > totalDigitsFacet))
return false;
- // : minLength
- if (minLengthFacet >= 0 && value.Length < minLengthFacet)
+ if ((fractionDigitsFacet >=0) && (fractionDigits > fractionDigitsFacet))
return false;
+ }
+
+ if ((maxInclusiveFacet != null) ||
+ (maxExclusiveFacet != null) ||
+ (minInclusiveFacet != null) ||
+ (minExclusiveFacet != null)) {
+ if (dt != null) {
+ object parsed;
+ try {
+ parsed = dt.ParseValue (value, nt, null);
+ } catch (OverflowException ) {
+ /* This appears to be what .NET does */
+ return false ;
+ } catch (FormatException ) {
+ /* This appears to be what .NET does */
+ return false ;
+ }
+
+ if (maxInclusiveFacet != null) {
+ XsdOrdering result = dt.Compare (parsed, maxInclusiveFacet);
+ if ((result != XsdOrdering.LessThan) &&
+ (result != XsdOrdering.Equal))
+ return false;
+ }
+ if (maxExclusiveFacet != null) {
+
+ XsdOrdering result = dt.Compare (parsed, maxExclusiveFacet);
+ if (result != XsdOrdering.LessThan)
+ return false;
+ }
+ if (minInclusiveFacet != null) {
+ XsdOrdering result = dt.Compare (parsed, minInclusiveFacet);
+ if ((result != XsdOrdering.GreaterThan) &&
+ (result != XsdOrdering.Equal))
+ return false;
+ }
+ if (minExclusiveFacet != null) {
+ XsdOrdering result = dt.Compare (parsed, minExclusiveFacet);
+ if (result != XsdOrdering.GreaterThan)
+ return false;
+ }
- // TODO: fractionDigits and totalDigits
+ }
+ }
// all passed
return true;
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleTypeUnion.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleTypeUnion.cs
index cf76ee93952..11b0bca4e48 100755
--- a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleTypeUnion.cs
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleTypeUnion.cs
@@ -44,7 +44,6 @@ namespace System.Xml.Schema
/// 1. Circular union type definition is disallowed. (WTH is this?)
/// 2. id must be a valid ID
/// </remarks>
- [MonoTODO]
internal override int Compile(ValidationEventHandler h, XmlSchema schema)
{
// If this is already compiled this time, simply skip.
@@ -74,7 +73,7 @@ namespace System.Xml.Schema
{
if(memberTypes[i] == null || !XmlSchemaUtil.CheckQName(MemberTypes[i]))
{
- warn(h,"Invalid membertype");
+ error (h,"Invalid membertype");
memberTypes[i] = XmlQualifiedName.Empty;
}
else
@@ -93,14 +92,13 @@ namespace System.Xml.Schema
return errorCount;
}
- [MonoTODO]
internal override int Validate(ValidationEventHandler h, XmlSchema schema)
{
if (IsValidated (schema.ValidationId))
return errorCount;
// As far as I saw, MS.NET handles simpleType.BaseSchemaType as anySimpleType.
- this.actualBaseSchemaType = XmlSchemaSimpleType.AnySimpleType;
+// this.actualBaseSchemaType = XmlSchemaSimpleType.AnySimpleType;
ArrayList al = new ArrayList ();
// Validate MemberTypes
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaTotalDigitsFacet.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaTotalDigitsFacet.cs
index d7ef688b549..5d1caaf0a65 100755
--- a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaTotalDigitsFacet.cs
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaTotalDigitsFacet.cs
@@ -15,6 +15,11 @@ namespace System.Xml.Schema
public XmlSchemaTotalDigitsFacet()
{
}
+
+ internal override Facet ThisFacet {
+ get { return Facet.totalDigits;}
+ }
+
//<totalDigits
// fixed = boolean : false
// id = ID
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaType.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaType.cs
index fb3bcca4abf..cf428ed5602 100755
--- a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaType.cs
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaType.cs
@@ -1,9 +1,17 @@
-// Author: Dwivedi, Ajay kumar
-// Adwiv@Yahoo.com
+//
+// XmlSchemaType.cs
+//
+// Authors:
+// Dwivedi, Ajay kumar Adwiv@Yahoo.com
+// Atsushi Enomoto atsushi@ximian.com
+//
using System;
using System.Xml;
using System.ComponentModel;
using System.Xml.Serialization;
+#if NET_1_2_in_the_future
+using MS.Internal.Xml;
+#endif
namespace System.Xml.Schema
{
@@ -12,17 +20,19 @@ namespace System.Xml.Schema
/// </summary>
public class XmlSchemaType : XmlSchemaAnnotated
{
- internal object baseSchemaTypeInternal;
- internal XmlSchemaDatatype datatypeInternal;
- internal XmlSchemaDerivationMethod resolvedDerivedBy;
private XmlSchemaDerivationMethod final;
- internal XmlSchemaDerivationMethod finalResolved;
private bool isMixed;
private string name;
- internal XmlQualifiedName QNameInternal;
bool recursed;
- public XmlSchemaType()
+ internal XmlQualifiedName BaseSchemaTypeName;
+ internal XmlSchemaType BaseXmlSchemaTypeInternal;
+ internal XmlSchemaDatatype DatatypeInternal;
+ internal XmlSchemaDerivationMethod resolvedDerivedBy;
+ internal XmlSchemaDerivationMethod finalResolved;
+ internal XmlQualifiedName QNameInternal;
+
+ public XmlSchemaType ()
{
final = XmlSchemaDerivationMethod.None;
QNameInternal = XmlQualifiedName.Empty;
@@ -30,60 +40,109 @@ namespace System.Xml.Schema
#region Attributes
[System.Xml.Serialization.XmlAttribute("name")]
- public string Name
- {
+ public string Name {
get{ return name; }
set{ name = value; }
}
+
[DefaultValue(XmlSchemaDerivationMethod.None)]
[System.Xml.Serialization.XmlAttribute("final")]
- public XmlSchemaDerivationMethod Final
- {
+ public XmlSchemaDerivationMethod Final {
get{ return final; }
set{ final = value; }
}
#endregion
- #region XmlIgnore
+ #region Post Compilation Schema Information
[XmlIgnore]
- public XmlQualifiedName QualifiedName
- {
+ public XmlQualifiedName QualifiedName {
get{ return QNameInternal; }
}
+
[XmlIgnore]
- public XmlSchemaDerivationMethod FinalResolved
- {
+ public XmlSchemaDerivationMethod FinalResolved {
get{ return finalResolved; }
}
+
[XmlIgnore]
- public object BaseSchemaType
- {
- get{ return baseSchemaTypeInternal; }
+#if NET_1_2
+ [Obsolete ("This property is going away. Use BaseXmlSchemaType instead")]
+#endif
+ public object BaseSchemaType {
+ get{
+ if (BaseXmlSchemaType != null)
+ return BaseXmlSchemaType;
+ else if (this == XmlSchemaComplexType.AnyType)
+ return null; // This property is designed so.
+ else
+ return Datatype;
+ }
}
+
[XmlIgnore]
- public XmlSchemaDerivationMethod DerivedBy
- {
+#if NET_1_2
+ public XmlSchemaType BaseXmlSchemaType {
+#else
+ internal XmlSchemaType BaseXmlSchemaType {
+#endif
+ get { return BaseXmlSchemaTypeInternal; }
+ }
+
+ [XmlIgnore]
+ public XmlSchemaDerivationMethod DerivedBy {
get{ return resolvedDerivedBy; }
}
+
[XmlIgnore]
- public XmlSchemaDatatype Datatype
- {
- get{ return datatypeInternal; }
+ public XmlSchemaDatatype Datatype {
+ get{ return DatatypeInternal; }
}
+
[XmlIgnore]
- public virtual bool IsMixed
- {
+ public virtual bool IsMixed {
get{ return isMixed; }
set{ isMixed = value; }
}
#endregion
+#if NET_1_2
+ public static XmlSchemaComplexType GetBuiltInComplexType (XmlQualifiedName qualifiedName)
+#else
+ internal static XmlSchemaComplexType GetBuiltInComplexType (XmlQualifiedName qualifiedName)
+#endif
+ {
+ if (qualifiedName == XmlSchemaComplexType.AnyType.QualifiedName)
+ return XmlSchemaComplexType.AnyType;
+
+ return null;
+ }
+
+#if NET_1_2_in_the_future
+ public static XmlSchemaSimpleType GetBuiltInSimpleType (XmlQualifiedName qualifiedName)
+ {
+ if (qualifiedName.Name == "anySimpleType" && qualifiedName.Namespace == XmlSchema.Namespace)
+ return XmlSchemaSimpleType.AnySimpleType;
+
+ return null;
+ }
+
+ public virtual IXmlInfosetReader Validate (IXmlInfosetReader reader, object schemas)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public virtual IXmlInfosetWriter Validate (IXmlInfosetWriter reader, object schemas)
+ {
+ throw new NotImplementedException ();
+ }
+#endif
+
internal bool ValidateRecursionCheck ()
{
if (recursed)
return (this != XmlSchemaComplexType.AnyType);
recursed = true;
- XmlSchemaType baseType = this.BaseSchemaType as XmlSchemaType;
+ XmlSchemaType baseType = this.BaseXmlSchemaType as XmlSchemaType;
bool result = false;
if (baseType != null)
result = baseType.ValidateRecursionCheck ();
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaUnique.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaUnique.cs
index 70770883d1e..40d3bdb224a 100755
--- a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaUnique.cs
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaUnique.cs
@@ -19,13 +19,11 @@ namespace System.Xml.Schema
/// 1. name must be present
/// 2. selector and field must be present
/// </remarks>
- [MonoTODO]
internal override int Compile(ValidationEventHandler h, XmlSchema schema)
{
return base.Compile(h,schema);
}
- [MonoTODO]
internal override int Validate(ValidationEventHandler h, XmlSchema schema)
{
return errorCount;
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaUtil.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaUtil.cs
index 72b7a097592..b667450529c 100755
--- a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaUtil.cs
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaUtil.cs
@@ -13,7 +13,7 @@ namespace System.Xml.Schema
/// </summary>
internal class XmlSchemaUtil
{
- static XmlSchemaUtil()
+ static XmlSchemaUtil ()
{
FinalAllowed = XmlSchemaDerivationMethod.Restriction |
XmlSchemaDerivationMethod.Extension;
@@ -82,23 +82,10 @@ namespace System.Xml.Schema
return true;
}
- public static bool CheckLanguage(string lang)
- {
- //check if the string conforms to http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/datatypes.html#language
- return true;
- }
public static bool CheckNCName(string name)
{
//check if the string conforms to http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/datatypes.html#NCName
- try
- {
- XmlConvert.VerifyNCName(name);
- return true;
- }
- catch(Exception)
- {
- return false;
- }
+ return XmlChar.IsNCName (name);
}
public static bool CheckQName(XmlQualifiedName qname)
@@ -125,6 +112,38 @@ namespace System.Xml.Schema
throw new NotSupportedException ("XmlParserContext cannot be acquired from this XmlReader.");
}
+ public static bool IsBuiltInDatatypeName (XmlQualifiedName qname)
+ {
+ if (qname.Namespace != XmlSchema.Namespace)
+ return false;
+ switch (qname.Name) {
+ case "anySimpleType":
+ case "duration": case "dateTime": case "time":
+ case "date": case "gYearMonth": case "gYear":
+ case "gMonthDay": case "gDay": case "gMonth":
+ case "boolean":
+ case "base64Binary": case "hexBinary":
+ case "float": case "double":
+ case "anyURI":
+ case "QName":
+ case "NOTATION":
+ case "string": case "normalizedString": case "token":
+ case "language": case "Name": case "NCName":
+ case "ID": case "IDREF": case "IDREFS":
+ case "ENTITY": case "ENTITIES":
+ case "NMTOKEN": case "NMTOKENS":
+ case "decimal": case "integer":
+ case "nonPositiveInteger": case "negativeInteger":
+ case "nonNegativeInteger":
+ case "unsignedLong": case "unsignedInt":
+ case "unsignedShort": case "unsignedByte":
+ case "positiveInteger":
+ case "long": case "int": case "short": case "byte":
+ return true;
+ }
+ return false;
+ }
+
public static bool IsSchemaDatatypeEquals (XsdAnySimpleType st1, object v1,
XsdAnySimpleType st2, object v2)
{
@@ -171,6 +190,10 @@ namespace System.Xml.Schema
return false;
if (st2 is XsdName && (st1 is XsdLanguage || st1 is XsdNMToken))
return false;
+ if (st1 is XsdID && st2 is XsdIDRef)
+ return false;
+ if (st1 is XsdIDRef && st2 is XsdID)
+ return false;
}
else if (st1 != st2)
return false;
@@ -470,7 +493,8 @@ namespace System.Xml.Schema
if (anyAttribute == null)
anyAttributeUse = grp.AnyAttributeUse;
}
- foreach (XmlSchemaAttribute attr in grp.AttributeUses) {
+ foreach (DictionaryEntry entry in grp.AttributeUses) {
+ XmlSchemaAttribute attr = (XmlSchemaAttribute) entry.Value;
if (attr.RefName != null && attr.RefName != XmlQualifiedName.Empty)
AddToTable (attributesResolved, attr, attr.RefName, h);
else
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaWhiteSpaceFacet.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaWhiteSpaceFacet.cs
index df39caba223..7a0e2324cac 100755
--- a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaWhiteSpaceFacet.cs
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaWhiteSpaceFacet.cs
@@ -15,6 +15,11 @@ namespace System.Xml.Schema
public XmlSchemaWhiteSpaceFacet()
{
}
+
+ internal override Facet ThisFacet {
+ get { return Facet.whiteSpace;}
+ }
+
// <whiteSpace
// fixed = boolean : false
// id = ID
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaXPath.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaXPath.cs
index 8122e1a8ff4..8950454b6f2 100755
--- a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaXPath.cs
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaXPath.cs
@@ -173,10 +173,9 @@ namespace System.Xml.Schema
this.currentPath = null;
return;
}
- if (xpath.Length == pos || xpath [pos] != ':') {
+ if (xpath.Length == pos || xpath [pos] != ':')
step.Name = xpath.Substring (nameStart, pos - nameStart);
- break;
- } else {
+ else {
string prefix = xpath.Substring (nameStart, pos - nameStart);
pos++;
if (xpath.Length > pos && xpath [pos] == '*') {
@@ -186,8 +185,7 @@ namespace System.Xml.Schema
this.currentPath = null;
return;
}
- step.Namespace = ns;
- step.Name = "*";
+ step.NsName = ns;
pos++;
} else {
int localNameStart = pos;
@@ -206,7 +204,6 @@ namespace System.Xml.Schema
}
step.Namespace = ns;
}
- break;
}
break;
}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/ChangeLog b/mcs/class/System.XML/System.Xml.Serialization/ChangeLog
index 5e7fd3e29b6..86abd67b49f 100755
--- a/mcs/class/System.XML/System.Xml.Serialization/ChangeLog
+++ b/mcs/class/System.XML/System.Xml.Serialization/ChangeLog
@@ -1,3 +1,108 @@
+2004-01-27 Lluis Sanchez Gual <lluis@ximian.com>
+
+ * XmlSchemaImporter.cs: Redefinition of types are not supported. Added a
+ check.
+
+2004-01-27 Lluis Sanchez Gual <lluis@ximian.com>
+
+ * MapCodeGenerator.cs: Added helper method for generating an attribute
+ parameter of type enum.
+ * XmlAttributeAttribute.cs: little fix.
+ * XmlCodeExporter.cs: Support XmlAnyAttribute when generating attributes
+ for method parameters.
+ * XmlMemberMapping.cs: Improved support for members of type "any".
+ * XmlReflectionImporter.cs: Improved assignment of the attribute form.
+ If the namespace is explicitly specified, then the form should be
+ qualified. Also fixed issues with the namespace assigned to attributes.
+ This should fix bug #53384.
+ * XmlSchemaExporter.cs: ExportMembersMapping(): improved support for
+ methods that return values of type "any". Changed the methods
+ AddSchemaArrayElement and AddSchemaElement, so instead of adding the
+ element, return it, and the caller must add it to the collection.
+ Other fixes in attribute generation.
+ * XmlSchemaImporter.cs: ImportAnyType(): if a type name is provided,
+ generate the AnyType mapping from the type described in the schema.
+ Small fixes regarding IsMixed property of complex types (it means that
+ the type can contain text, so the XmlTextAttribute must be generated).
+ * XmlSerializationReaderInterpreter.cs: Reading of members by-order must
+ be only used in the bare+encoded format.
+
+2004-01-24 Lluis Sanchez Gual <lluis@ximian.com>
+
+ * SoapReflectionImporter.cs: Types included with SoapInclude don't need
+ to be derived types of the one that has the attribute.
+ * XmlReflectionImporter.cs: Recursively register the derived maps of a given
+ map to the parent map. This fixes #53246.
+ * XmlSerializationWriter.cs: Some fixes regarding empty namespaces.
+
+2004-01-22 Lluis Sanchez Gual <lluis@ximian.com>
+
+ * XmlSerializationReaderInterpreter.cs: When deserializing an XmlElement,
+ do not check the root element name, since it can be any name. This fixes
+ bug #53201.
+
+2004-01-20 Lluis Sanchez Gual <lluis@ximian.com>
+
+ * XmlReflectionImporter.cs: Throw exception if a value type member has the
+ IsNullable=true flag. This fixes bug #52906.
+
+2004-01-20 Lluis Sanchez Gual <lluis@ximian.com>
+
+ * MapCodeGenerator.cs, XmlSchemaImporter.cs: Attributes are allways optional,
+ so a 'specified' member has always to be generated.
+ * TypeData.cs: Fixed check for value type.
+
+2004-01-20 Lluis Sanchez Gual <lluis@ximian.com>
+
+ * XmlSerializationReaderInterpreter.cs, XmlSerializationWriterInterpreter.cs,
+ XmlTypeMapMember.cs, MapCodeGenerator.cs, SoapCodeExporter.cs, TypeData.cs,
+ XmlCodeExporter.cs, XmlReflectionImporter.cs, XmlSchemaExporter.cs,
+ XmlSchemaImporter.cs, XmlSerializationReaderInterpreter.cs,
+ XmlSerializationWriterInterpreter.cs, XmlTypeMapMember.cs:
+ Added support for value specifiers members. This fixes bug #53024.
+
+2004-01-20 Lluis Sanchez Gual <lluis@ximian.com>
+
+ * XmlSchemaExporter.cs: Don't create referenced element if it has already
+ been created (two types could be referencing the same schema element).
+
+2004-01-19 Lluis Sanchez Gual <lluis@ximian.com>
+
+ * XmlReflectionImporter.cs: Read IsNullable flag from XmlArrayAttribute.
+ * XmlSerializationWriterInterpreter.cs: Interpret IsNullable flag for
+ arrays. This fixes bug #53018.
+
+2004-01-14 Lluis Sanchez Gual <lluis@ximian.com>
+
+ * MapCodeGenerator.cs: Use type namespace instead of root namespace as
+ default namespace for members.
+ * XmlCodeExporter.cs: Fixed generation of XmlRootAttribute.
+ * XmlReflectionImporter.cs: Fixed the assignment of root and type
+ namespaces.
+ * XmlSchemaExporter.cs: Use type namespace instead of root namespace as
+ default namespace for members. In AddSchemaElement, if the element is
+ a root element never use a "ref" attribute.
+ * XmlSchemaImporter.cs: Fixed issue when importing root elements.
+
+2004-01-13 Lluis Sanchez Gual <lluis@ximian.com>
+
+ * XmlReflectionImporter.cs, XmlSerializationWriterInterpreter.cs
+ XmlTypeMapping.cs: more namespace fixes.
+
+2004-01-13 Lluis Sanchez Gual <lluis@ximian.com>
+
+ * XmlReflectionImporter.cs: type namespace must never be used as root
+ namespace. This fixes bug #52772.
+
+2004-01-08 Nick Drochak <ndrochak@ieee.org>
+
+ * XmlSchemaImporter.cs: Removed unused variable.
+
+2004-01-07 Lluis Sanchez Gual <lluis@ximian.com>
+
+ * XmlReflectionImporter.cs: Ignore Namespace property when applying
+ the [XmlType] attribute to an enum. This fixes bug #52607.
+
2003-12-19 Lluis Sanchez Gual <lluis@ximian.com>
* SerializationCodeGenerator.cs, XmlReflectionImporter.cs: Added internal
diff --git a/mcs/class/System.XML/System.Xml.Serialization/MapCodeGenerator.cs b/mcs/class/System.XML/System.Xml.Serialization/MapCodeGenerator.cs
index 80c974608a9..c439b31550e 100644
--- a/mcs/class/System.XML/System.Xml.Serialization/MapCodeGenerator.cs
+++ b/mcs/class/System.XML/System.Xml.Serialization/MapCodeGenerator.cs
@@ -75,7 +75,7 @@ namespace System.Xml.Serialization {
GenerateClass (map, codeClass);
- ExportMembersMapCode (codeClass, (ClassMap)map.ObjectMap, map.Namespace, map.BaseMap);
+ ExportMembersMapCode (codeClass, (ClassMap)map.ObjectMap, map.XmlTypeNamespace, map.BaseMap);
if (map.BaseMap != null)
{
@@ -174,6 +174,14 @@ namespace System.Xml.Serialization {
if (attinfo.MappedType != null)
ExportMapCode (attinfo.MappedType);
+
+ if (attinfo.TypeData.IsValueType && attinfo.IsOptionalValueType)
+ {
+ codeField = new CodeMemberField (typeof(bool), attinfo.Name + "Specified");
+ codeField.Attributes = MemberAttributes.Public;
+ codeClass.Members.Add (codeField);
+ GenerateSpecifierMember (codeField);
+ }
}
void AddElementFieldMember (CodeTypeDeclaration codeClass, XmlTypeMapMemberElement member, string defaultNamespace)
@@ -199,6 +207,14 @@ namespace System.Xml.Serialization {
}
GenerateElementMember (codeField, member);
+
+ if (member.TypeData.IsValueType && member.IsOptionalValueType)
+ {
+ codeField = new CodeMemberField (typeof(bool), member.Name + "Specified");
+ codeField.Attributes = MemberAttributes.Public;
+ codeClass.Members.Add (codeField);
+ GenerateSpecifierMember (codeField);
+ }
}
void AddAnyElementFieldMember (CodeTypeDeclaration codeClass, XmlTypeMapMemberElement member, string defaultNamespace)
@@ -355,6 +371,11 @@ namespace System.Xml.Serialization {
return new CodeAttributeArgument (name, new CodeTypeOfExpression(typeName));
}
+ public CodeAttributeArgument GetEnumArg (string name, string enumType, string enumValue)
+ {
+ return new CodeAttributeArgument (name, new CodeFieldReferenceExpression (new CodeTypeReferenceExpression(enumType), enumValue));
+ }
+
public static void AddComments (CodeTypeMember member, string comments)
{
if (comments == null || comments == "") member.Comments.Add (new CodeCommentStatement ("<remarks/>", true));
@@ -421,7 +442,11 @@ namespace System.Xml.Serialization {
protected virtual void GenerateEnumItem (CodeMemberField codeField, EnumMap.EnumMapMember emem)
{
- }
+ }
+
+ protected virtual void GenerateSpecifierMember (CodeMemberField codeField)
+ {
+ }
#endregion
}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/SoapCodeExporter.cs b/mcs/class/System.XML/System.Xml.Serialization/SoapCodeExporter.cs
index b32356e4dbc..de2f47b50f6 100644
--- a/mcs/class/System.XML/System.Xml.Serialization/SoapCodeExporter.cs
+++ b/mcs/class/System.XML/System.Xml.Serialization/SoapCodeExporter.cs
@@ -145,5 +145,10 @@ namespace System.Xml.Serialization {
AddCustomAttribute (codeField, xatt, true);
}
}
+
+ protected override void GenerateSpecifierMember (CodeMemberField codeField)
+ {
+ AddCustomAttribute (codeField, "System.Xml.Serialization.SoapIgnore");
+ }
}
}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/SoapReflectionImporter.cs b/mcs/class/System.XML/System.Xml.Serialization/SoapReflectionImporter.cs
index f7d9861dba7..e4d2d4ce6a5 100644
--- a/mcs/class/System.XML/System.Xml.Serialization/SoapReflectionImporter.cs
+++ b/mcs/class/System.XML/System.Xml.Serialization/SoapReflectionImporter.cs
@@ -177,17 +177,13 @@ namespace System.Xml.Serialization {
throw helper.CreateError (map, ex.Message);
}
- // Import derived classes
+ // Import included classes
SoapIncludeAttribute[] includes = (SoapIncludeAttribute[])type.GetCustomAttributes (typeof (SoapIncludeAttribute), false);
for (int n=0; n<includes.Length; n++)
{
Type includedType = includes[n].Type;
- if (!includedType.IsSubclassOf(type)) throw helper.CreateError (map, "Type '" + includedType.FullName + "' is not a subclass of '" + type.FullName + "'");
-
- XmlTypeMapping derived = ImportTypeMapping (includedType, defaultNamespace);
- map.DerivedTypes.Add (derived);
- map.DerivedTypes.AddRange (derived.DerivedTypes);
+ ImportTypeMapping (includedType, defaultNamespace);
}
if (type == typeof (object) && includedTypes != null)
@@ -196,17 +192,32 @@ namespace System.Xml.Serialization {
map.DerivedTypes.Add (ImportTypeMapping (intype, defaultNamespace));
}
- // Register this map as a derived class of object
+ // Register inheritance relations
- if (typeData.Type != typeof(object))
- ImportTypeMapping (typeof(object), defaultNamespace).DerivedTypes.Add (map);
+ if (type.BaseType != null)
+ {
+ XmlTypeMapping bmap = ImportClassMapping (type.BaseType, defaultNamespace);
+
+ if (type.BaseType != typeof (object))
+ map.BaseMap = bmap;
+
+ // At this point, derived classes of this map must be already registered
+
+ RegisterDerivedMap (bmap, map);
+ }
- if (type.BaseType != null && type.BaseType != typeof(object))
- map.BaseMap = ImportClassMapping (type.BaseType, defaultNamespace);
-
return map;
}
+ void RegisterDerivedMap (XmlTypeMapping map, XmlTypeMapping derivedMap)
+ {
+ map.DerivedTypes.Add (derivedMap);
+ map.DerivedTypes.AddRange (derivedMap.DerivedTypes);
+
+ if (map.BaseMap != null)
+ RegisterDerivedMap (map.BaseMap, derivedMap);
+ }
+
string GetTypeNamespace (TypeData typeData, string defaultNamespace)
{
string membersNamespace = defaultNamespace;
diff --git a/mcs/class/System.XML/System.Xml.Serialization/TypeData.cs b/mcs/class/System.XML/System.Xml.Serialization/TypeData.cs
index 1329d69296f..3f4db003316 100644
--- a/mcs/class/System.XML/System.Xml.Serialization/TypeData.cs
+++ b/mcs/class/System.XML/System.Xml.Serialization/TypeData.cs
@@ -111,6 +111,14 @@ namespace System.Xml.Serialization
}
}
+ public bool IsValueType
+ {
+ get
+ {
+ if (type != null) return type.IsValueType;
+ else return (sType == SchemaTypes.Primitive || sType == SchemaTypes.Enum);
+ }
+ }
public TypeData ListItemTypeData
{
diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlAttributeAttribute.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlAttributeAttribute.cs
index e23ff75890c..858297687bf 100644
--- a/mcs/class/System.XML/System.Xml.Serialization/XmlAttributeAttribute.cs
+++ b/mcs/class/System.XML/System.Xml.Serialization/XmlAttributeAttribute.cs
@@ -66,7 +66,6 @@ namespace System.Xml.Serialization
return form;
}
set {
- if(Namespace != null)
form = value;
}
}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlCodeExporter.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlCodeExporter.cs
index 9a4e7f5ea3b..b5bdcaa5803 100644
--- a/mcs/class/System.XML/System.Xml.Serialization/XmlCodeExporter.cs
+++ b/mcs/class/System.XML/System.Xml.Serialization/XmlCodeExporter.cs
@@ -70,7 +70,24 @@ namespace System.Xml.Serialization {
CodeAttributeDeclaration att;
TypeData memType = member.TypeMapMember.TypeData;
- if (memType.SchemaType == SchemaTypes.Array)
+ if (member.Any)
+ {
+ XmlTypeMapElementInfoList list = (XmlTypeMapElementInfoList)((XmlTypeMapMemberElement)member.TypeMapMember).ElementInfo;
+ foreach (XmlTypeMapElementInfo info in list)
+ {
+ if (info.IsTextElement)
+ metadata.Add (new CodeAttributeDeclaration ("System.Xml.Serialization.XmlText"));
+ else {
+ att = new CodeAttributeDeclaration ("System.Xml.Serialization.XmlAnyElement");
+ if (!info.IsUnnamedAnyElement) {
+ att.Arguments.Add (MapCodeGenerator.GetArg ("Name", info.ElementName));
+ if (info.Namespace != ns) att.Arguments.Add (MapCodeGenerator.GetArg ("Namespace", member.Namespace));
+ }
+ metadata.Add (att);
+ }
+ }
+ }
+ else if (memType.SchemaType == SchemaTypes.Array)
{
// Array parameter
att = new CodeAttributeDeclaration ("System.Xml.Serialization.XmlArray");
@@ -115,12 +132,10 @@ namespace System.Xml.Serialization {
if (map.XmlTypeNamespace != "") att.Arguments.Add (GetArg ("Namespace", map.XmlTypeNamespace));
AddCustomAttribute (codeClass, att, false);
- if (map.ElementName != map.XmlType || map.Namespace != map.XmlTypeNamespace) {
- CodeAttributeDeclaration ratt = new CodeAttributeDeclaration ("System.Xml.Serialization.XmlRoot");
- ratt.Arguments.Add (GetArg (map.ElementName));
- ratt.Arguments.Add (GetArg ("Namespace", map.Namespace));
- AddCustomAttribute (codeClass, ratt, false);
- }
+ CodeAttributeDeclaration ratt = new CodeAttributeDeclaration ("System.Xml.Serialization.XmlRoot");
+ if (map.ElementName != map.XmlType) ratt.Arguments.Add (GetArg (map.ElementName));
+ if (map.Namespace != "") ratt.Arguments.Add (GetArg ("Namespace", map.Namespace));
+ AddCustomAttribute (codeClass, ratt, false);
}
protected override void GenerateClassInclude (CodeTypeDeclaration codeClass, XmlTypeMapping map)
@@ -146,7 +161,7 @@ namespace System.Xml.Serialization {
CodeAttributeDeclaration att = new CodeAttributeDeclaration ("System.Xml.Serialization.XmlAttribute");
if (attinfo.Name != attinfo.AttributeName) att.Arguments.Add (GetArg (attinfo.AttributeName));
if (attinfo.Namespace != defaultNamespace) att.Arguments.Add (GetArg ("Namespace", attinfo.Namespace));
- if (attinfo.Form != XmlSchemaForm.None) att.Arguments.Add (GetArg ("Form",attinfo.Form));
+ if (attinfo.Form != XmlSchemaForm.None) att.Arguments.Add (GetEnumArg ("Form","System.Xml.Schema.XmlSchemaForm",attinfo.Form.ToString()));
if (!TypeTranslator.IsDefaultPrimitiveTpeData(attinfo.TypeData)) att.Arguments.Add (GetArg ("DataType",attinfo.TypeData.XmlType));
AddCustomAttribute (codeField, att, true);
}
@@ -224,6 +239,12 @@ namespace System.Xml.Serialization {
AddCustomAttribute (codeField, xatt, true);
}
- }
+ }
+
+ protected override void GenerateSpecifierMember (CodeMemberField codeField)
+ {
+ AddCustomAttribute (codeField, "System.Xml.Serialization.XmlIgnore");
+ }
+
}
}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlMemberMapping.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlMemberMapping.cs
index b928412f1e7..3658091f44c 100644
--- a/mcs/class/System.XML/System.Xml.Serialization/XmlMemberMapping.cs
+++ b/mcs/class/System.XML/System.Xml.Serialization/XmlMemberMapping.cs
@@ -23,7 +23,16 @@ namespace System.Xml.Serialization
_mapMember = mapMem;
_memberName = memberName;
- if (mapMem is XmlTypeMapMemberElement)
+ if (mapMem is XmlTypeMapMemberAnyElement)
+ {
+ XmlTypeMapMemberAnyElement anyelem = (XmlTypeMapMemberAnyElement) mapMem;
+ XmlTypeMapElementInfo info = (XmlTypeMapElementInfo) anyelem.ElementInfo[anyelem.ElementInfo.Count-1];
+ _elementName = info.ElementName;
+ _namespace = info.Namespace;
+ if (info.MappedType != null) _typeNamespace = info.MappedType.Namespace;
+ else _typeNamespace = "";
+ }
+ else if (mapMem is XmlTypeMapMemberElement)
{
XmlTypeMapElementInfo info = (XmlTypeMapElementInfo) ((XmlTypeMapMemberElement)mapMem).ElementInfo[0];
_elementName = info.ElementName;
diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlReflectionImporter.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlReflectionImporter.cs
index c181212a4ee..ada432ac611 100644
--- a/mcs/class/System.XML/System.Xml.Serialization/XmlReflectionImporter.cs
+++ b/mcs/class/System.XML/System.Xml.Serialization/XmlReflectionImporter.cs
@@ -12,6 +12,7 @@
using System.Reflection;
using System.Collections;
+using System.Xml.Schema;
namespace System.Xml.Serialization {
public class XmlReflectionImporter {
@@ -138,7 +139,9 @@ namespace System.Xml.Serialization {
XmlTypeMapping CreateTypeMapping (TypeData typeData, XmlRootAttribute root, string defaultXmlType, string defaultNamespace)
{
- string membersNamespace;
+ string rootNamespace = defaultNamespace;
+ string typeNamespace = null;
+
string elementName;
bool includeInSchema = true;
XmlAttributes atts = null;
@@ -161,8 +164,8 @@ namespace System.Xml.Serialization {
if (atts.XmlType != null)
{
- if (atts.XmlType.Namespace != null && atts.XmlType.Namespace != string.Empty)
- defaultNamespace = atts.XmlType.Namespace;
+ if (atts.XmlType.Namespace != null && atts.XmlType.Namespace != string.Empty && typeData.SchemaType != SchemaTypes.Enum)
+ typeNamespace = atts.XmlType.Namespace;
if (atts.XmlType.TypeName != null && atts.XmlType.TypeName != string.Empty)
defaultXmlType = atts.XmlType.TypeName;
@@ -170,7 +173,6 @@ namespace System.Xml.Serialization {
includeInSchema = atts.XmlType.IncludeInSchema;
}
- membersNamespace = defaultNamespace;
elementName = defaultXmlType;
if (root != null)
@@ -178,11 +180,13 @@ namespace System.Xml.Serialization {
if (root.ElementName != null && root.ElementName != String.Empty)
elementName = root.ElementName;
if (root.Namespace != null && root.Namespace != String.Empty)
- membersNamespace = root.Namespace;
+ rootNamespace = root.Namespace;
}
- if (membersNamespace == null) membersNamespace = "";
- XmlTypeMapping map = new XmlTypeMapping (elementName, membersNamespace, typeData, defaultXmlType, defaultNamespace);
+ if (rootNamespace == null) rootNamespace = "";
+ if (typeNamespace == null || typeNamespace.Length == 0) typeNamespace = rootNamespace;
+
+ XmlTypeMapping map = new XmlTypeMapping (elementName, rootNamespace, typeData, defaultXmlType, typeNamespace);
map.IncludeInSchema = includeInSchema;
relatedMaps.Add (map);
@@ -199,8 +203,8 @@ namespace System.Xml.Serialization {
ReflectionHelper.CheckSerializableType (type);
map = CreateTypeMapping (typeData, root, null, defaultNamespace);
- helper.RegisterClrType (map, type, map.Namespace);
- helper.RegisterSchemaType (map, map.XmlType, map.Namespace);
+ helper.RegisterClrType (map, type, map.XmlTypeNamespace);
+ helper.RegisterSchemaType (map, map.XmlType, map.XmlTypeNamespace);
// Import members
@@ -213,7 +217,9 @@ namespace System.Xml.Serialization {
foreach (XmlReflectionMember rmember in members)
{
if (rmember.XmlAttributes.XmlIgnore) continue;
- classMap.AddMember (CreateMapMember (rmember, map.Namespace));
+ XmlTypeMapMember mem = CreateMapMember (rmember, map.XmlTypeNamespace);
+ mem.CheckOptionalValueType (type);
+ classMap.AddMember (mem);
}
// }
// catch (Exception ex) {
@@ -241,8 +247,7 @@ namespace System.Xml.Serialization {
// At this point, derived classes of this map must be already registered
- bmap.DerivedTypes.Add (map);
- bmap.DerivedTypes.AddRange (map.DerivedTypes);
+ RegisterDerivedMap (bmap, map);
if (((ClassMap)bmap.ObjectMap).HasSimpleContent && classMap.ElementMembers != null && classMap.ElementMembers.Count != 1)
throw new InvalidOperationException (String.Format (errSimple, map.TypeData.TypeName, map.BaseMap.TypeData.TypeName));
@@ -250,11 +255,20 @@ namespace System.Xml.Serialization {
return map;
}
+
+ void RegisterDerivedMap (XmlTypeMapping map, XmlTypeMapping derivedMap)
+ {
+ map.DerivedTypes.Add (derivedMap);
+ map.DerivedTypes.AddRange (derivedMap.DerivedTypes);
+
+ if (map.BaseMap != null)
+ RegisterDerivedMap (map.BaseMap, derivedMap);
+ }
string GetTypeNamespace (TypeData typeData, XmlRootAttribute root, string defaultNamespace)
{
- string mapNamespace = defaultNamespace;
-
+ string typeNamespace = null;
+
XmlAttributes atts = null;
if (!typeData.IsListType)
{
@@ -265,23 +279,25 @@ namespace System.Xml.Serialization {
if (atts == null)
atts = new XmlAttributes (typeData.Type);
- if (atts.XmlRoot != null && root == null)
- root = atts.XmlRoot;
-
if (atts.XmlType != null)
{
- if (atts.XmlType.Namespace != null && atts.XmlType.Namespace != string.Empty)
- mapNamespace = atts.XmlType.Namespace;
+ if (atts.XmlType.Namespace != null && atts.XmlType.Namespace.Length != 0 && typeData.SchemaType != SchemaTypes.Enum)
+ typeNamespace = atts.XmlType.Namespace;
}
+
+ if (typeNamespace != null && typeNamespace.Length != 0) return typeNamespace;
+ if (atts.XmlRoot != null && root == null)
+ root = atts.XmlRoot;
+
if (root != null)
{
- if (root.Namespace != null && root.Namespace != String.Empty)
- mapNamespace = root.Namespace;
+ if (root.Namespace != null && root.Namespace.Length != 0)
+ return root.Namespace;
}
- if (mapNamespace == null) return "";
- else return mapNamespace;
+ if (defaultNamespace == null) return "";
+ else return defaultNamespace;
}
XmlTypeMapping ImportListMapping (Type type, XmlRootAttribute root, string defaultNamespace, XmlAttributes atts, int nestingLevel)
@@ -331,7 +347,7 @@ namespace System.Xml.Serialization {
else if (elem.TypeData.IsComplexType)
elem.MappedType = ImportTypeMapping (itemType, null, defaultNamespace);
- if (elem.MappedType != null) elem.ElementName = elem.MappedType.ElementName;
+ if (elem.MappedType != null) elem.ElementName = elem.MappedType.XmlType;
else elem.ElementName = TypeTranslator.GetTypeData(itemType).XmlType ;
elem.Namespace = (defaultNamespace != null) ? defaultNamespace : "";
@@ -350,7 +366,7 @@ namespace System.Xml.Serialization {
else
{
XmlTypeMapElementInfo elem = ((XmlTypeMapElementInfo)list[0]);
- if (elem.MappedType != null) baseName = TypeTranslator.GetArrayName (elem.MappedType.ElementName);
+ if (elem.MappedType != null) baseName = TypeTranslator.GetArrayName (elem.MappedType.XmlType);
else baseName = TypeTranslator.GetArrayName (elem.ElementName);
}
@@ -396,13 +412,13 @@ namespace System.Xml.Serialization {
// Registers the maps for XmlNode and XmlElement
XmlTypeMapping nodeMap = CreateTypeMapping (TypeTranslator.GetTypeData (typeof(XmlNode)), root, null, defaultNamespace);
- helper.RegisterClrType (nodeMap, typeof(XmlNode), nodeMap.Namespace);
+ helper.RegisterClrType (nodeMap, typeof(XmlNode), nodeMap.XmlTypeNamespace);
XmlTypeMapping elemMap = CreateTypeMapping (TypeTranslator.GetTypeData (typeof(XmlElement)), root, null, defaultNamespace);
- helper.RegisterClrType (elemMap, typeof(XmlElement), elemMap.Namespace);
+ helper.RegisterClrType (elemMap, typeof(XmlElement), elemMap.XmlTypeNamespace);
XmlTypeMapping textMap = CreateTypeMapping (TypeTranslator.GetTypeData (typeof(XmlText)), root, null, defaultNamespace);
- helper.RegisterClrType (elemMap, typeof(XmlText), textMap.Namespace);
+ helper.RegisterClrType (elemMap, typeof(XmlText), textMap.XmlTypeNamespace);
XmlTypeMapping obmap = ImportTypeMapping (typeof(object));
obmap.DerivedTypes.Add (nodeMap);
@@ -420,7 +436,7 @@ namespace System.Xml.Serialization {
XmlTypeMapping map = helper.GetRegisteredClrType (type, GetTypeNamespace (typeData, root, defaultNamespace));
if (map != null) return map;
map = CreateTypeMapping (typeData, root, null, defaultNamespace);
- helper.RegisterClrType (map, type, map.Namespace);
+ helper.RegisterClrType (map, type, map.XmlTypeNamespace);
return map;
}
@@ -430,7 +446,7 @@ namespace System.Xml.Serialization {
XmlTypeMapping map = helper.GetRegisteredClrType (type, GetTypeNamespace (typeData, root, defaultNamespace));
if (map != null) return map;
map = CreateTypeMapping (typeData, root, null, defaultNamespace);
- helper.RegisterClrType (map, type, map.Namespace);
+ helper.RegisterClrType (map, type, map.XmlTypeNamespace);
string [] names = Enum.GetNames (type);
ArrayList members = new ArrayList();
@@ -458,7 +474,7 @@ namespace System.Xml.Serialization {
XmlTypeMapping map = helper.GetRegisteredClrType (type, GetTypeNamespace (typeData, root, defaultNamespace));
if (map != null) return map;
map = CreateTypeMapping (typeData, root, null, defaultNamespace);
- helper.RegisterClrType (map, type, map.Namespace);
+ helper.RegisterClrType (map, type, map.XmlTypeNamespace);
return map;
}
@@ -525,7 +541,7 @@ namespace System.Xml.Serialization {
(rmember.MemberType.FullName == "System.Xml.XmlElement"))
{
XmlTypeMapMemberAnyElement member = new XmlTypeMapMemberAnyElement();
- member.ElementInfo = ImportAnyElementInfo (defaultNamespace, rmember.MemberType, member, atts);
+ member.ElementInfo = ImportAnyElementInfo (defaultNamespace, rmember, member, atts);
mapMember = member;
}
else
@@ -549,11 +565,25 @@ namespace System.Xml.Serialization {
else
mapAttribute.AttributeName = atts.XmlAttribute.AttributeName;
- mapAttribute.Form = atts.XmlAttribute.Form;
- mapAttribute.Namespace = (atts.XmlAttribute.Namespace != null) ? atts.XmlAttribute.Namespace : "";
if (typeData.IsComplexType)
mapAttribute.MappedType = ImportTypeMapping (typeData.Type, null, mapAttribute.Namespace);
-
+
+ if (atts.XmlAttribute.Namespace != null && atts.XmlAttribute.Namespace != defaultNamespace)
+ {
+ if (atts.XmlAttribute.Form == XmlSchemaForm.Unqualified)
+ throw new InvalidOperationException ("The Form property may not be 'Unqualified' when an explicit Namespace property is present");
+ mapAttribute.Form = XmlSchemaForm.Qualified;
+ mapAttribute.Namespace = atts.XmlAttribute.Namespace;
+ }
+ else
+ {
+ mapAttribute.Form = atts.XmlAttribute.Form;
+ if (atts.XmlAttribute.Form == XmlSchemaForm.Qualified)
+ mapAttribute.Namespace = defaultNamespace;
+ else
+ mapAttribute.Namespace = "";
+ }
+
typeData = TypeTranslator.GetTypeData(rmember.MemberType, atts.XmlAttribute.DataType);
mapMember = mapAttribute;
}
@@ -587,6 +617,7 @@ namespace System.Xml.Serialization {
elem.ElementName = (atts.XmlArray != null && atts.XmlArray.ElementName != null) ? atts.XmlArray.ElementName : rmember.MemberName;
elem.Namespace = (atts.XmlArray != null && atts.XmlArray.Namespace != null) ? atts.XmlArray.Namespace : defaultNamespace;
elem.MappedType = ImportListMapping (rmember.MemberType, null, elem.Namespace, atts, 0);
+ elem.IsNullable = (atts.XmlArray != null) ? atts.XmlArray.IsNullable : false;
member.ElementInfo.Add (elem);
mapMember = member;
}
@@ -631,6 +662,10 @@ namespace System.Xml.Serialization {
elem.Namespace = (att.Namespace != null) ? att.Namespace : defaultNamespace;
elem.Form = att.Form;
elem.IsNullable = att.IsNullable;
+
+ if (elem.IsNullable && elem.TypeData.IsValueType)
+ throw new InvalidOperationException ("IsNullable may not be 'true' for value type " + elem.TypeData.FullTypeName);
+
if (elem.TypeData.IsComplexType)
{
if (att.DataType != null) throw new InvalidOperationException ("'" + att.DataType + "' is an invalid value for the XmlElementAttribute.DateTime property. The property may only be specified for primitive types.");
@@ -651,18 +686,27 @@ namespace System.Xml.Serialization {
return list;
}
- XmlTypeMapElementInfoList ImportAnyElementInfo (string defaultNamespace, Type defaultType, XmlTypeMapMemberElement member, XmlAttributes atts)
+ XmlTypeMapElementInfoList ImportAnyElementInfo (string defaultNamespace, XmlReflectionMember rmember, XmlTypeMapMemberElement member, XmlAttributes atts)
{
XmlTypeMapElementInfoList list = new XmlTypeMapElementInfoList();
- ImportTextElementInfo (list, defaultType, member, atts);
+ ImportTextElementInfo (list, rmember.MemberType, member, atts);
foreach (XmlAnyElementAttribute att in atts.XmlAnyElements)
{
XmlTypeMapElementInfo elem = new XmlTypeMapElementInfo (member, TypeTranslator.GetTypeData(typeof(XmlElement)));
- if (att.Name != null && att.Name != string.Empty) elem.ElementName = att.Name;
- else elem.IsUnnamedAnyElement = true;
- elem.Namespace = (att.Namespace != null) ? att.Namespace : "";
+ if (att.Name != null && att.Name != string.Empty)
+ {
+ elem.ElementName = att.Name;
+ elem.Namespace = (att.Namespace != null) ? att.Namespace : "";
+ }
+ else
+ {
+ elem.IsUnnamedAnyElement = true;
+ elem.Namespace = defaultNamespace;
+ if (att.Namespace != null)
+ throw new InvalidOperationException ("The element " + rmember.MemberName + " has been attributed with an XmlAnyElementAttribute and a namespace '" + att.Namespace + "', but no name. When a namespace is supplied, a name is also required. Supply a name or remove the namespace.");
+ }
list.Add (elem);
}
return list;
diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlSchemaExporter.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlSchemaExporter.cs
index d24bcc3648e..dc686344222 100644
--- a/mcs/class/System.XML/System.Xml.Serialization/XmlSchemaExporter.cs
+++ b/mcs/class/System.XML/System.Xml.Serialization/XmlSchemaExporter.cs
@@ -55,11 +55,11 @@ namespace System.Xml.Serialization {
internal void ExportMembersMapping (XmlMembersMapping xmlMembersMapping, bool exportEnclosingType)
{
- XmlSchema schema = GetSchema (xmlMembersMapping.Namespace);
ClassMap cmap = (ClassMap) xmlMembersMapping.ObjectMap;
if (xmlMembersMapping.HasWrapperElement && exportEnclosingType)
{
+ XmlSchema schema = GetSchema (xmlMembersMapping.Namespace);
XmlSchemaComplexType stype = new XmlSchemaComplexType ();
XmlSchemaSequence particle;
@@ -86,31 +86,63 @@ namespace System.Xml.Serialization {
ICollection members = cmap.ElementMembers;
if (members != null)
{
- XmlSchemaObjectCollection itemsCol = schema.Items;
-
- // In encoded format, the schema elements are not needed
- if (encodedFormat) itemsCol = new XmlSchemaObjectCollection ();
-
foreach (XmlTypeMapMemberElement member in members)
{
- XmlSchemaElement exe = FindElement (itemsCol, ((XmlTypeMapElementInfo)member.ElementInfo [0]).ElementName);
+ if (member is XmlTypeMapMemberAnyElement && member.TypeData.IsListType)
+ {
+ XmlSchema mschema = GetSchema (xmlMembersMapping.Namespace);
+ XmlSchemaParticle par = GetSchemaArrayElement (mschema, member.ElementInfo);
+ if (par is XmlSchemaAny)
+ {
+ XmlSchemaComplexType ct = FindComplexType (mschema.Items, "any");
+ if (ct != null) continue;
+
+ ct = new XmlSchemaComplexType ();
+ ct.Name = "any";
+ ct.IsMixed = true;
+ XmlSchemaSequence seq = new XmlSchemaSequence ();
+ ct.Particle = seq;
+ seq.Items.Add (par);
+ mschema.Items.Add (ct);
+ continue;
+ }
+ }
+
+
+ XmlTypeMapElementInfo einfo = (XmlTypeMapElementInfo) member.ElementInfo [0];
+ XmlSchema schema;
+
+ if (encodedFormat)
+ {
+ schema = GetSchema (xmlMembersMapping.Namespace);
+ ImportNamespace (schema, XmlSerializer.EncodingNamespace);
+ }
+ else
+ schema = GetSchema (einfo.Namespace);
+
+
+ XmlSchemaElement exe = FindElement (schema.Items, einfo.ElementName);
XmlSchemaElement elem;
Type memType = member.GetType();
if (member is XmlTypeMapMemberFlatList)
throw new InvalidOperationException ("Unwrapped arrays not supported as parameters");
else if (memType == typeof(XmlTypeMapMemberElement))
- elem = (XmlSchemaElement) AddSchemaElement (itemsCol, schema, (XmlTypeMapElementInfo) member.ElementInfo [0], member.DefaultValue, false);
+ elem = (XmlSchemaElement) GetSchemaElement (schema, einfo, member.DefaultValue, false);
else
- elem = (XmlSchemaElement) AddSchemaElement (itemsCol, schema, (XmlTypeMapElementInfo) member.ElementInfo [0], false);
-
+ elem = (XmlSchemaElement) GetSchemaElement (schema, einfo, false);
+
+ // In encoded format, the schema elements are not needed
+ if (!encodedFormat)
+ schema.Items.Add (elem);
+
if (exe != null)
{
if (exe.SchemaTypeName.Equals (elem.SchemaTypeName))
- itemsCol.Remove (elem);
+ schema.Items.Remove (elem);
else
{
- string s = "The XML element named '" + ((XmlTypeMapElementInfo)member.ElementInfo [0]).ElementName + "' ";
+ string s = "The XML element named '" + einfo.ElementName + "' ";
s += "from namespace '" + schema.TargetNamespace + "' references distinct types " + elem.SchemaTypeName.Name + " and " + exe.SchemaTypeName.Name + ". ";
s += "Use XML attributes to specify another XML name or namespace for the element or types.";
throw new InvalidOperationException (s);
@@ -120,9 +152,6 @@ namespace System.Xml.Serialization {
}
}
- if (encodedFormat)
- ImportNamespace (schema, XmlSerializer.EncodingNamespace);
-
CompileSchemas ();
}
@@ -152,7 +181,7 @@ namespace System.Xml.Serialization {
if (xmlTypeMapping.TypeData.IsComplexType)
einfo.MappedType = xmlTypeMapping;
einfo.IsNullable = false;
- AddSchemaElement (schema.Items, schema, einfo, false);
+ schema.Items.Add (GetSchemaElement (schema, einfo, false));
SetElementExported (xmlTypeMapping);
}
@@ -200,7 +229,7 @@ namespace System.Xml.Serialization {
ext.Particle = particle;
ext.AnyAttribute = anyAttribute;
- ImportNamespace (schema, map.BaseMap.Namespace);
+ ImportNamespace (schema, map.BaseMap.XmlTypeNamespace);
ExportClassSchema (map.BaseMap);
}
else
@@ -232,19 +261,19 @@ namespace System.Xml.Serialization {
Type memType = member.GetType();
if (memType == typeof(XmlTypeMapMemberFlatList))
{
- AddSchemaArrayElement (seq.Items, schema, member.ElementInfo);
+ seq.Items.Add (GetSchemaArrayElement (schema, member.ElementInfo));
}
else if (memType == typeof(XmlTypeMapMemberAnyElement))
{
- AddSchemaArrayElement (seq.Items, schema, member.ElementInfo);
+ seq.Items.Add (GetSchemaArrayElement (schema, member.ElementInfo));
}
else if (memType == typeof(XmlTypeMapMemberElement))
{
- XmlSchemaElement selem = (XmlSchemaElement) AddSchemaElement (seq.Items, schema, (XmlTypeMapElementInfo) member.ElementInfo [0], member.DefaultValue, true);
+ seq.Items.Add (GetSchemaElement (schema, (XmlTypeMapElementInfo) member.ElementInfo [0], member.DefaultValue, true));
}
else
{
- AddSchemaElement (seq.Items, schema, (XmlTypeMapElementInfo) member.ElementInfo [0], true);
+ seq.Items.Add (GetSchemaElement (schema, (XmlTypeMapElementInfo) member.ElementInfo [0], true));
}
}
}
@@ -259,7 +288,7 @@ namespace System.Xml.Serialization {
{
foreach (XmlTypeMapMemberAttribute attr in attributes) {
if (baseMap != null && DefinedInBaseMap (baseMap, attr)) continue;
- outAttributes.Add (GetSchemaAttribute (schema, attr));
+ outAttributes.Add (GetSchemaAttribute (schema, attr, true));
}
}
@@ -280,17 +309,33 @@ namespace System.Xml.Serialization {
return null;
}
- XmlSchemaAttribute GetSchemaAttribute (XmlSchema currentSchema, XmlTypeMapMemberAttribute attinfo)
+ XmlSchemaComplexType FindComplexType (XmlSchemaObjectCollection col, string name)
+ {
+ foreach (XmlSchemaObject ob in col)
+ {
+ XmlSchemaComplexType ctype = ob as XmlSchemaComplexType;
+ if (ctype != null && ctype.Name == name) return ctype;
+ }
+ return null;
+ }
+
+ XmlSchemaAttribute GetSchemaAttribute (XmlSchema currentSchema, XmlTypeMapMemberAttribute attinfo, bool isTypeMember)
{
XmlSchemaAttribute sat = new XmlSchemaAttribute ();
if (attinfo.DefaultValue != System.DBNull.Value) sat.DefaultValue = XmlCustomFormatter.ToXmlString (attinfo.TypeData, attinfo.DefaultValue);
ImportNamespace (currentSchema, attinfo.Namespace);
- XmlSchema memberSchema = GetSchema (attinfo.Namespace);
+ XmlSchema memberSchema;
+ if (attinfo.Namespace.Length == 0 && attinfo.Form != XmlSchemaForm.Qualified)
+ memberSchema = currentSchema;
+ else
+ memberSchema = GetSchema (attinfo.Namespace);
+
if (currentSchema == memberSchema || encodedFormat)
{
sat.Name = attinfo.AttributeName;
+ if (isTypeMember) sat.Form = attinfo.Form;
if (attinfo.TypeData.SchemaType == SchemaTypes.Enum)
{
ImportNamespace (currentSchema, attinfo.DataTypeNamespace);
@@ -307,17 +352,21 @@ namespace System.Xml.Serialization {
else
{
sat.RefName = new XmlQualifiedName (attinfo.AttributeName, attinfo.Namespace);
- memberSchema.Items.Add (GetSchemaAttribute (memberSchema, attinfo));
+ foreach (XmlSchemaObject ob in memberSchema.Items)
+ if (ob is XmlSchemaAttribute && ((XmlSchemaAttribute)ob).Name == attinfo.AttributeName)
+ return sat;
+
+ memberSchema.Items.Add (GetSchemaAttribute (memberSchema, attinfo, false));
}
return sat;
}
- XmlSchemaParticle AddSchemaElement (XmlSchemaObjectCollection destcol, XmlSchema currentSchema, XmlTypeMapElementInfo einfo, bool isTypeMember)
+ XmlSchemaParticle GetSchemaElement (XmlSchema currentSchema, XmlTypeMapElementInfo einfo, bool isTypeMember)
{
- return AddSchemaElement (destcol, currentSchema, einfo, System.DBNull.Value, isTypeMember);
+ return GetSchemaElement (currentSchema, einfo, System.DBNull.Value, isTypeMember);
}
- XmlSchemaParticle AddSchemaElement (XmlSchemaObjectCollection destcol, XmlSchema currentSchema, XmlTypeMapElementInfo einfo, object defaultValue, bool isTypeMember)
+ XmlSchemaParticle GetSchemaElement (XmlSchema currentSchema, XmlTypeMapElementInfo einfo, object defaultValue, bool isTypeMember)
{
if (einfo.IsTextElement) return null;
@@ -326,20 +375,17 @@ namespace System.Xml.Serialization {
XmlSchemaAny any = new XmlSchemaAny ();
any.MinOccurs = 0;
any.MaxOccurs = 1;
- destcol.Add (any);
return any;
}
XmlSchemaElement selem = new XmlSchemaElement ();
- destcol.Add (selem);
if (isTypeMember)
{
selem.MaxOccurs = 1;
selem.MinOccurs = einfo.IsNullable ? 1 : 0;
- if ((einfo.IsPrimitive && einfo.TypeData.Type != typeof(string)) ||
- einfo.TypeData.Type.IsEnum || encodedFormat)
+ if ((einfo.TypeData.IsValueType && einfo.Member != null && !einfo.Member.IsOptionalValueType) || encodedFormat)
selem.MinOccurs = 1;
}
@@ -349,9 +395,9 @@ namespace System.Xml.Serialization {
{
memberSchema = GetSchema (einfo.Namespace);
ImportNamespace (currentSchema, einfo.Namespace);
- }
-
- if (currentSchema == memberSchema || encodedFormat)
+ }
+
+ if (currentSchema == memberSchema || encodedFormat || !isTypeMember)
{
if (isTypeMember) selem.IsNillable = einfo.IsNullable;
selem.Name = einfo.ElementName;
@@ -400,7 +446,11 @@ namespace System.Xml.Serialization {
else
{
selem.RefName = new XmlQualifiedName (einfo.ElementName, einfo.Namespace);
- AddSchemaElement (memberSchema.Items, memberSchema, einfo, defaultValue, false);
+ foreach (XmlSchemaObject ob in memberSchema.Items)
+ if (ob is XmlSchemaElement && ((XmlSchemaElement)ob).Name == einfo.ElementName)
+ return selem;
+
+ memberSchema.Items.Add (GetSchemaElement (memberSchema, einfo, defaultValue, false));
}
return selem;
}
@@ -459,7 +509,7 @@ namespace System.Xml.Serialization {
return stype;
}
- XmlSchemaParticle AddSchemaArrayElement (XmlSchemaObjectCollection destcol, XmlSchema currentSchema, XmlTypeMapElementInfoList infos)
+ XmlSchemaParticle GetSchemaArrayElement (XmlSchema currentSchema, XmlTypeMapElementInfoList infos)
{
int numInfos = infos.Count;
if (numInfos > 0 && ((XmlTypeMapElementInfo)infos[0]).IsTextElement) numInfos--;
@@ -467,7 +517,7 @@ namespace System.Xml.Serialization {
if (numInfos == 1)
{
- XmlSchemaParticle selem = AddSchemaElement (destcol, currentSchema, (XmlTypeMapElementInfo) infos[infos.Count-1], true);
+ XmlSchemaParticle selem = GetSchemaElement (currentSchema, (XmlTypeMapElementInfo) infos[infos.Count-1], true);
selem.MinOccursString = "0";
selem.MaxOccursString = "unbounded";
return selem;
@@ -475,13 +525,12 @@ namespace System.Xml.Serialization {
else
{
XmlSchemaChoice schoice = new XmlSchemaChoice ();
- destcol.Add (schoice);
schoice.MinOccursString = "0";
schoice.MaxOccursString = "unbounded";
foreach (XmlTypeMapElementInfo einfo in infos)
{
if (einfo.IsTextElement) continue;
- AddSchemaElement (schoice.Items, currentSchema, einfo, true);
+ schoice.Items.Add (GetSchemaElement (currentSchema, einfo, true));
}
return schoice;
}
@@ -492,7 +541,7 @@ namespace System.Xml.Serialization {
if (IsMapExported (map)) return;
SetMapExported (map);
- XmlSchema schema = GetSchema (map.Namespace);
+ XmlSchema schema = GetSchema (map.XmlTypeNamespace);
XmlSchemaSimpleType stype = new XmlSchemaSimpleType ();
stype.Name = map.ElementName;
schema.Items.Add (stype);
@@ -570,17 +619,20 @@ namespace System.Xml.Serialization {
if (IsMapExported (map)) return new XmlQualifiedName (map.XmlType, map.XmlTypeNamespace);
SetMapExported (map);
- XmlSchema schema = GetSchema (map.Namespace);
+ XmlSchema schema = GetSchema (map.XmlTypeNamespace);
XmlSchemaComplexType stype = new XmlSchemaComplexType ();
stype.Name = map.ElementName;
schema.Items.Add (stype);
- XmlSchemaSequence seq = new XmlSchemaSequence ();
- XmlSchemaParticle spart = AddSchemaArrayElement (seq.Items, schema, lmap.ItemInfo);
+ XmlSchemaParticle spart = GetSchemaArrayElement (schema, lmap.ItemInfo);
if (spart is XmlSchemaChoice)
stype.Particle = spart;
else
+ {
+ XmlSchemaSequence seq = new XmlSchemaSequence ();
+ seq.Items.Add (spart);
stype.Particle = seq;
+ }
return new XmlQualifiedName (map.XmlType, map.XmlTypeNamespace);
}
@@ -621,7 +673,7 @@ namespace System.Xml.Serialization {
string GetMapKey (XmlTypeMapping map)
{
- return map.TypeData.FullTypeName + " " + map.Namespace;
+ return map.TypeData.FullTypeName + " " + map.XmlTypeNamespace;
}
void CompileSchemas ()
diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlSchemaImporter.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlSchemaImporter.cs
index f07fc9f3aaa..75d53e82b34 100644
--- a/mcs/class/System.XML/System.Xml.Serialization/XmlSchemaImporter.cs
+++ b/mcs/class/System.XML/System.Xml.Serialization/XmlSchemaImporter.cs
@@ -72,14 +72,37 @@ namespace System.Xml.Serialization {
public XmlMembersMapping ImportAnyType (XmlQualifiedName typeName, string elementName)
{
- XmlTypeMapMemberAnyElement mapMem = new XmlTypeMapMemberAnyElement ();
- mapMem.Name = typeName.Name;
- mapMem.TypeData = TypeTranslator.GetTypeData(typeof(XmlNode));
- mapMem.ElementInfo.Add (CreateElementInfo (typeName.Namespace, mapMem, typeName.Name, mapMem.TypeData, true));
-
- XmlMemberMapping[] mm = new XmlMemberMapping [1];
- mm[0] = new XmlMemberMapping (typeName.Name, typeName.Namespace, mapMem, encodedFormat);
- return new XmlMembersMapping (mm);
+ if (typeName == XmlQualifiedName.Empty)
+ {
+ XmlTypeMapMemberAnyElement mapMem = new XmlTypeMapMemberAnyElement ();
+ mapMem.Name = typeName.Name;
+ mapMem.TypeData = TypeTranslator.GetTypeData(typeof(XmlNode));
+ mapMem.ElementInfo.Add (CreateElementInfo (typeName.Namespace, mapMem, typeName.Name, mapMem.TypeData, true));
+
+ XmlMemberMapping[] mm = new XmlMemberMapping [1];
+ mm[0] = new XmlMemberMapping (typeName.Name, typeName.Namespace, mapMem, encodedFormat);
+ return new XmlMembersMapping (mm);
+ }
+ else
+ {
+ XmlSchemaComplexType stype = (XmlSchemaComplexType) schemas.Find (typeName, typeof (XmlSchemaComplexType));
+ if (stype == null)
+ throw new InvalidOperationException ("Referenced type '" + typeName + "' not found");
+
+ if (!CanBeAnyElement (stype))
+ throw new InvalidOperationException ("The type '" + typeName + "' is not valid for a collection of any elements");
+
+ ClassMap cmap = new ClassMap ();
+ CodeIdentifiers classIds = new CodeIdentifiers ();
+ bool isMixed = stype.IsMixed;
+ ImportSequenceContent (typeName, cmap, ((XmlSchemaSequence) stype.Particle).Items, classIds, false, ref isMixed);
+ XmlTypeMapMemberAnyElement mapMem = (XmlTypeMapMemberAnyElement) cmap.AllMembers[0];
+ mapMem.Name = typeName.Name;
+
+ XmlMemberMapping[] mm = new XmlMemberMapping [1];
+ mm[0] = new XmlMemberMapping (typeName.Name, typeName.Namespace, mapMem, encodedFormat);
+ return new XmlMembersMapping (mm);
+ }
}
public XmlTypeMapping ImportDerivedTypeMapping (XmlQualifiedName name, Type baseType)
@@ -265,13 +288,17 @@ namespace System.Xml.Serialization {
if (type == null) throw new InvalidOperationException ("Schema type '" + elem.SchemaTypeName + "' not found");
stype = (XmlSchemaType) type;
qname = stype.QualifiedName;
+
+ XmlSchemaType btype = stype.BaseSchemaType as XmlSchemaType;
+ if (btype != null && btype.QualifiedName == elem.SchemaTypeName)
+ throw new InvalidOperationException ("Cannot import schema for type '" + elem.SchemaTypeName.Name + "' from namespace '" + elem.SchemaTypeName.Namespace + "'. Redefine not supported");
}
if (stype is XmlSchemaSimpleType) return false;
return true;
}
- public XmlTypeMapping ImportType (XmlQualifiedName name, XmlQualifiedName root)
+ XmlTypeMapping ImportType (XmlQualifiedName name, XmlQualifiedName root)
{
XmlTypeMapping map = GetRegisteredTypeMapping (name);
if (map != null) return map;
@@ -329,7 +356,10 @@ namespace System.Xml.Serialization {
}
else if (CanBeAnyElement (stype))
{
- return GetTypeMapping (TypeTranslator.GetTypeData(typeof(XmlElement)));
+ if (stype.IsMixed)
+ return GetTypeMapping (TypeTranslator.GetTypeData(typeof(XmlNode)));
+ else
+ return GetTypeMapping (TypeTranslator.GetTypeData(typeof(XmlElement)));
}
else if (CanBeIXmlSerializable (stype))
{
@@ -433,7 +463,12 @@ namespace System.Xml.Serialization {
member.Namespace = ns;
member.Form = refAttr.Form;
member.TypeData = GetAttributeTypeData (typeQName, attr);
- if (refAttr.DefaultValue != null) member.DefaultValue = XmlCustomFormatter.FromXmlString (member.TypeData, refAttr.DefaultValue);
+
+ if (refAttr.DefaultValue != null)
+ member.DefaultValue = XmlCustomFormatter.FromXmlString (member.TypeData, refAttr.DefaultValue);
+ else if (member.TypeData.IsValueType)
+ member.IsOptionalValueType = true;
+
if (member.TypeData.IsComplexType)
member.MappedType = GetTypeMapping (member.TypeData);
cmap.AddMember (member);
@@ -493,7 +528,7 @@ namespace System.Xml.Serialization {
{
ClassMap cmap = new ClassMap ();
CodeIdentifiers classIds = new CodeIdentifiers();
- ImportParticleComplexContent (typeQName, cmap, stype.Particle, classIds, false);
+ ImportParticleComplexContent (typeQName, cmap, stype.Particle, classIds, stype.IsMixed);
XmlTypeMapMemberFlatList list = (cmap.AllMembers.Count == 1) ? cmap.AllMembers[0] as XmlTypeMapMemberFlatList : null;
if (list != null && list.ChoiceMember == null)
@@ -601,8 +636,6 @@ namespace System.Xml.Serialization {
{
foreach (XmlSchemaObject item in items)
{
- XmlTypeMapMember mapMember;
-
if (item is XmlSchemaElement)
{
string ns;
@@ -629,6 +662,9 @@ namespace System.Xml.Serialization {
else
member = new XmlTypeMapMemberList ();
+ if (elem.MinOccurs == 0 && typeData.IsValueType)
+ member.IsOptionalValueType = true;
+
member.Name = classIds.AddUnique(CodeIdentifier.MakeValid(refElem.Name), member);
member.Documentation = GetDocumentation (elem);
member.TypeData = typeData;
@@ -653,9 +689,9 @@ namespace System.Xml.Serialization {
XmlTypeMapMemberAnyElement member = new XmlTypeMapMemberAnyElement ();
member.Name = classIds.AddUnique ("Any", member);
member.Documentation = GetDocumentation (elem);
-
+
Type ctype;
- if (elem.MaxOccurs > 1 || multiValue)
+ if (elem.MaxOccurs != 1 || multiValue)
ctype = isMixed ? typeof(XmlNode[]) : typeof(XmlElement[]);
else
ctype = isMixed ? typeof(XmlNode) : typeof(XmlElement);
@@ -680,8 +716,7 @@ namespace System.Xml.Serialization {
}
}
}
-
-
+
void ImportChoiceContent (XmlQualifiedName typeQName, ClassMap cmap, XmlSchemaChoice choice, CodeIdentifiers classIds, bool multiValue)
{
XmlTypeMapElementInfoList choices = new XmlTypeMapElementInfoList ();
@@ -1224,9 +1259,18 @@ namespace System.Xml.Serialization {
TypeData typeData = new TypeData (typeName, typeName, typeName, schemaType, null);
- XmlQualifiedName elemName = (root != null) ? root : typeQName;
+ string rootElem;
+ string rootNs;
+ if (root != null) {
+ rootElem = root.Name;
+ rootNs = root.Namespace;
+ }
+ else {
+ rootElem = typeQName.Name;
+ rootNs = "";
+ }
- XmlTypeMapping map = new XmlTypeMapping (elemName.Name, elemName.Namespace, typeData, typeQName.Name, typeQName.Namespace);
+ XmlTypeMapping map = new XmlTypeMapping (rootElem, rootNs, typeData, typeQName.Name, typeQName.Namespace);
map.IncludeInSchema = true;
mappedTypes [typeQName] = map;
dataMappedTypes [typeData] = map;
@@ -1267,7 +1311,9 @@ namespace System.Xml.Serialization {
if (!attr.RefName.IsEmpty)
{
ns = attr.RefName.Namespace;
- return FindRefAttribute (attr.RefName);
+ XmlSchemaAttribute at = FindRefAttribute (attr.RefName);
+ if (at == null) throw new InvalidOperationException ("The attribute " + attr.RefName + " is missing");
+ return at;
}
else
{
diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationReaderInterpreter.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationReaderInterpreter.cs
index 579c1007380..f8aa4782d6e 100644
--- a/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationReaderInterpreter.cs
+++ b/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationReaderInterpreter.cs
@@ -122,7 +122,7 @@ namespace System.Xml.Serialization
}
}
else
- ReadMembers ((ClassMap)typeMap.ObjectMap, parameters, true, true);
+ ReadMembers ((ClassMap)typeMap.ObjectMap, parameters, true, _format == SerializationFormat.Encoded);
if (_format == SerializationFormat.Encoded)
ReadReferencedElements();
@@ -132,10 +132,17 @@ namespace System.Xml.Serialization
object ReadRoot (XmlTypeMapping rootMap)
{
- if (Reader.LocalName != rootMap.ElementName || Reader.NamespaceURI != rootMap.Namespace)
- throw CreateUnknownNodeException();
+ if (rootMap.TypeData.SchemaType == SchemaTypes.XmlNode)
+ {
+ return ReadXmlNodeElement (rootMap, true);
+ }
+ else
+ {
+ if (Reader.LocalName != rootMap.ElementName || Reader.NamespaceURI != rootMap.Namespace)
+ throw CreateUnknownNodeException();
- return ReadObject (rootMap, true, true);
+ return ReadObject (rootMap, true, true);
+ }
}
@@ -429,7 +436,11 @@ namespace System.Xml.Serialization
void SetMemberValue (XmlTypeMapMember member, object ob, object value, bool isValueList)
{
if (isValueList) ((object[])ob)[member.Index] = value;
- else member.SetValue (ob, value);
+ else {
+ member.SetValue (ob, value);
+ if (member.IsOptionalValueType)
+ member.SetValueSpecified (ob, true);
+ }
}
object GetMemberValue (XmlTypeMapMember member, object ob, bool isValueList)
diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationWriter.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationWriter.cs
index 5ee92414676..d16178a9ae9 100644
--- a/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationWriter.cs
+++ b/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationWriter.cs
@@ -48,7 +48,8 @@ namespace System.Xml.Serialization {
{
namespaces = new ArrayList ();
foreach (XmlQualifiedName ns in nss.ToArray())
- namespaces.Add (ns);
+ if (ns.Name != "")
+ namespaces.Add (ns);
}
}
@@ -200,6 +201,8 @@ namespace System.Xml.Serialization {
private string GetQualifiedName (string name, string ns)
{
+ if (ns == String.Empty) return name;
+
string prefix = GetNamespacePrefix (ns);
if (prefix == String.Empty)
return name;
diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationWriterInterpreter.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationWriterInterpreter.cs
index 965aa062977..1f64cfeb11e 100644
--- a/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationWriterInterpreter.cs
+++ b/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationWriterInterpreter.cs
@@ -113,7 +113,7 @@ namespace System.Xml.Serialization
}
if (needType)
- WriteXsiType(map.XmlType, map.Namespace);
+ WriteXsiType(map.XmlType, map.XmlTypeNamespace);
switch (map.TypeData.SchemaType)
{
@@ -212,8 +212,7 @@ namespace System.Xml.Serialization
if (memType == typeof(XmlTypeMapMemberList))
{
- if (memberValue != null)
- WriteMemberElement ((XmlTypeMapElementInfo) member.ElementInfo[0], memberValue);
+ WriteMemberElement ((XmlTypeMapElementInfo) member.ElementInfo[0], memberValue);
}
else if (memType == typeof(XmlTypeMapMemberFlatList))
{
@@ -267,6 +266,9 @@ namespace System.Xml.Serialization
}
if (val != null && val.Equals (member.DefaultValue)) return false;
}
+ else if (member.IsOptionalValueType)
+ return member.GetValueSpecified (ob);
+
return true;
}
@@ -290,6 +292,7 @@ namespace System.Xml.Serialization
case SchemaTypes.Array:
if (memberValue == null) {
+ if (!elem.IsNullable) return;
if (_format == SerializationFormat.Literal) WriteNullTagLiteral (elem.ElementName, elem.Namespace);
else WriteNullTagEncoded (elem.ElementName, elem.Namespace);
}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlTypeMapMember.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlTypeMapMember.cs
index c7d47eaff87..39e41253405 100644
--- a/mcs/class/System.XML/System.Xml.Serialization/XmlTypeMapMember.cs
+++ b/mcs/class/System.XML/System.Xml.Serialization/XmlTypeMapMember.cs
@@ -22,8 +22,10 @@ namespace System.Xml.Serialization
int _index;
TypeData _typeData;
MemberInfo _member;
+ MemberInfo _specifiedMember;
object _defaultValue = System.DBNull.Value;
string documentation;
+ bool _isOptional;
public XmlTypeMapMember()
{
@@ -78,6 +80,9 @@ namespace System.Xml.Serialization
{
MemberInfo[] mems = type.GetMember (_name, BindingFlags.Instance|BindingFlags.Public);
_member = mems[0];
+
+ mems = type.GetMember (_name + "Specified", BindingFlags.Instance|BindingFlags.Public);
+ if (mems.Length > 0) _specifiedMember = mems[0];
}
public TypeData TypeData
@@ -91,5 +96,29 @@ namespace System.Xml.Serialization
get { return _index; }
set { _index = value; }
}
+
+ public bool IsOptionalValueType
+ {
+ get { return _isOptional; }
+ set { _isOptional = value; }
+ }
+
+ public void CheckOptionalValueType (Type type)
+ {
+ if (_member == null) InitMember (type);
+ _isOptional = (_specifiedMember != null);
+ }
+
+ public bool GetValueSpecified (object ob)
+ {
+ if (_specifiedMember is PropertyInfo) return (bool) ((PropertyInfo)_specifiedMember).GetValue (ob, null);
+ else return (bool) ((FieldInfo)_specifiedMember).GetValue (ob);
+ }
+
+ public void SetValueSpecified (object ob, bool value)
+ {
+ if (_specifiedMember is PropertyInfo) ((PropertyInfo)_specifiedMember).SetValue (ob, value, null);
+ else ((FieldInfo)_specifiedMember).SetValue (ob, value);
+ }
}
}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlTypeMapping.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlTypeMapping.cs
index d3b4175711f..aa6991950fe 100644
--- a/mcs/class/System.XML/System.Xml.Serialization/XmlTypeMapping.cs
+++ b/mcs/class/System.XML/System.Xml.Serialization/XmlTypeMapping.cs
@@ -122,9 +122,10 @@ namespace System.Xml.Serialization
internal XmlTypeMapping GetRealElementMap (string name, string ens)
{
- if (xmlType == name && ns == ens) return this;
+ if (xmlType == name && xmlTypeNamespace == ens) return this;
foreach (XmlTypeMapping map in _derivedTypes)
- if (map.xmlType == name && map.ns == ens) return map;
+ if (map.xmlType == name && map.xmlTypeNamespace == ens) return map;
+
return null;
}
}
diff --git a/mcs/class/System.XML/System.Xml.XPath/ChangeLog b/mcs/class/System.XML/System.Xml.XPath/ChangeLog
index aaaea363fc7..fd1d6b3151e 100644
--- a/mcs/class/System.XML/System.Xml.XPath/ChangeLog
+++ b/mcs/class/System.XML/System.Xml.XPath/ChangeLog
@@ -1,3 +1,14 @@
+2004-01-27 Atsushi Enomoto <atsushi@ximian.com>
+
+ * DefaultContext.cs : Avoid exception if possible.
+ * Iterator.cs : Fixed PrecedingSiblingIterator.MoveNext(). When the
+ nav was positioned at the first, it incorrectly points itself.
+ Don't add names to name table while it is useless and expensive.
+
+2004-01-08 Nick Drochak <ndrochak@ieee.org>
+
+ * Iterator.cs: Removed unused variable.
+
2003-12-18 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
* Parser.jay : now it supresses error output from jay.
diff --git a/mcs/class/System.XML/System.Xml.XPath/DefaultContext.cs b/mcs/class/System.XML/System.Xml.XPath/DefaultContext.cs
index 41b394a7139..4e3480cb118 100644
--- a/mcs/class/System.XML/System.Xml.XPath/DefaultContext.cs
+++ b/mcs/class/System.XML/System.Xml.XPath/DefaultContext.cs
@@ -64,9 +64,12 @@ namespace System.Xml.XPath
throw new ArgumentNullException ();
if (arg is string)
{
+ string s = arg as string;
+ if (s.Length == 0)
+ return double.NaN;
try
{
- return XmlConvert.ToDouble ((string) arg); // TODO: spec? convert string to number
+ return XmlConvert.ToDouble (s); // TODO: spec? convert string to number
}
catch (System.FormatException)
{
@@ -84,6 +87,10 @@ namespace System.Xml.XPath
public static double ToNumber (string arg)
{
+ if (arg == null)
+ throw new ArgumentNullException ();
+ if (arg.Length == 0)
+ return double.NaN;
try {
return XmlConvert.ToDouble ((string) arg.Trim (XmlChar.WhitespaceChars));
} catch (System.OverflowException) {
diff --git a/mcs/class/System.XML/System.Xml.XPath/Iterator.cs b/mcs/class/System.XML/System.Xml.XPath/Iterator.cs
index e0e806584fa..42f9abfdab7 100644
--- a/mcs/class/System.XML/System.Xml.XPath/Iterator.cs
+++ b/mcs/class/System.XML/System.Xml.XPath/Iterator.cs
@@ -300,7 +300,7 @@ namespace System.Xml.XPath
}
_nav.MoveToFirst ();
- if (_nav.ComparePosition (startPosition) == XmlNodeOrder.Same) {
+ if (_nav.ComparePosition (startPosition) != XmlNodeOrder.Same) {
_pos++;
_current = _nav.Clone ();
return true;
@@ -763,11 +763,11 @@ namespace System.Xml.XPath
_iter = iter;
_test = test;
test.GetInfo (out name, out ns, out matchType, NamespaceManager);
- if (name != null)
- name = Current.NameTable.Add (name);
+// if (name != null)
+// name = Current.NameTable.Add (name);
- if (ns != null)
- ns = Current.NameTable.Add (ns);
+// if (ns != null)
+// ns = Current.NameTable.Add (ns);
}
protected AxisIterator (AxisIterator other) : base (other)
@@ -1021,8 +1021,6 @@ namespace System.Xml.XPath
{
while (_iter.MoveNext ())
{
- bool fTrue = true;
-
switch (resType) {
case XPathResultType.Number:
if (_pred.EvaluateNumber (_iter) != _iter.ComparablePosition)
diff --git a/mcs/class/System.XML/System.Xml.Xsl/ChangeLog b/mcs/class/System.XML/System.Xml.Xsl/ChangeLog
index 4e7403ebb3e..7e9bfffadc2 100644
--- a/mcs/class/System.XML/System.Xml.Xsl/ChangeLog
+++ b/mcs/class/System.XML/System.Xml.Xsl/ChangeLog
@@ -1,3 +1,15 @@
+2004-01-16 Atsushi Enomoto <atsushi@ximian.com>
+
+ * Multiplexer.cs : Pass stream parameters as is (to handle
+ encoding correctly). Patch by Dariusz Olszewski. Bug #52913 fixed.
+ * ManagedXslTransform.cs : In ctor() with stream, pass encoding
+ parameter also for managed transformer.
+
+2004-01-15 Atsushi Enomoto <atsushi@ximian.com>
+
+ * ManagedXslTransform.cs : Pass TextReader's encoding for outputter.
+ don't write start and end document.
+
2003-12-25 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
* Multiplexer.cs : Now we use managed XSLT engine by default.
diff --git a/mcs/class/System.XML/System.Xml.Xsl/ManagedXslTransform.cs b/mcs/class/System.XML/System.Xml.Xsl/ManagedXslTransform.cs
index 8d0b04c4172..c2cb602a441 100644
--- a/mcs/class/System.XML/System.Xml.Xsl/ManagedXslTransform.cs
+++ b/mcs/class/System.XML/System.Xml.Xsl/ManagedXslTransform.cs
@@ -31,20 +31,13 @@ namespace System.Xml.Xsl {
if (s == null)
throw new XsltException ("No stylesheet was loaded.", null);
- Outputter outputter = new GenericOutputter(output, s.Outputs);
- bool wroteStartDocument = false;
- if (output.WriteState == WriteState.Start) {
- outputter.WriteStartDocument ();
- wroteStartDocument = true;
- }
+ Outputter outputter = new GenericOutputter (output, s.Outputs, null);
new XslTransformProcessor (s).Process (input, outputter, args, resolver);
- if (wroteStartDocument)
- outputter.WriteEndDocument ();
output.Flush ();
}
public override void Transform (XPathNavigator input, XsltArgumentList args, TextWriter output, XmlResolver resolver) {
- Outputter outputter = new GenericOutputter(output, s.Outputs);
+ Outputter outputter = new GenericOutputter(output, s.Outputs, output.Encoding);
// outputter.WriteStartDocument();
new XslTransformProcessor (s).Process (input, outputter, args, resolver);
switch (outputter.WriteState) {
@@ -61,10 +54,7 @@ namespace System.Xml.Xsl {
public override void Transform (XPathNavigator input, XsltArgumentList args, Stream output, XmlResolver resolver)
{
XslOutput xslOutput = (XslOutput)s.Outputs[String.Empty];
- if (xslOutput == null)
- Transform (input, args, new StreamWriter (output), resolver);
- else
- Transform (input, args, new StreamWriter (output, xslOutput.Encoding), resolver);
+ Transform (input, args, new XmlTextWriter (output, xslOutput.Encoding), resolver);
}
}
}
diff --git a/mcs/class/System.XML/System.Xml.Xsl/Multiplexer.cs b/mcs/class/System.XML/System.Xml.Xsl/Multiplexer.cs
index cf5b575e8b0..8758a9b6504 100644
--- a/mcs/class/System.XML/System.Xml.Xsl/Multiplexer.cs
+++ b/mcs/class/System.XML/System.Xml.Xsl/Multiplexer.cs
@@ -150,7 +150,7 @@ namespace System.Xml.Xsl {
#endif
public void Transform (XPathNavigator input, XsltArgumentList args, Stream output)
{
- impl.Transform (input, args, new XmlTextWriter (output, null), xmlResolver);
+ impl.Transform (input, args, output, xmlResolver);
}
#if NET_1_1
public void Transform (XPathNavigator input, XsltArgumentList args, Stream output, XmlResolver resolver)
@@ -158,7 +158,7 @@ namespace System.Xml.Xsl {
void Transform (XPathNavigator input, XsltArgumentList args, Stream output, XmlResolver resolver)
#endif
{
- impl.Transform (input, args, new XmlTextWriter (output, null), resolver);
+ impl.Transform (input, args, output, resolver);
}
#if NET_1_1
diff --git a/mcs/class/System.XML/System.Xml.dll.sources b/mcs/class/System.XML/System.Xml.dll.sources
index 6c2d6d0fc7e..1e7857a8ea3 100755
--- a/mcs/class/System.XML/System.Xml.dll.sources
+++ b/mcs/class/System.XML/System.Xml.dll.sources
@@ -174,6 +174,7 @@ System.Xml.Xsl/XsltCompileException.cs
System.Xml.Xsl/XsltContext.cs
System.Xml.Xsl/XsltException.cs
System.Xml.Schema/BuiltInDatatype.cs
+System.Xml.Schema/SchemaDataValueType.cs
System.Xml.Schema/ValidationEventArgs.cs
System.Xml.Schema/XmlSchema.cs
System.Xml.Schema/XmlSchemaAll.cs
diff --git a/mcs/class/System.XML/System.Xml/ChangeLog b/mcs/class/System.XML/System.Xml/ChangeLog
index 01374bdee74..357ef6fb580 100644
--- a/mcs/class/System.XML/System.Xml/ChangeLog
+++ b/mcs/class/System.XML/System.Xml/ChangeLog
@@ -1,3 +1,158 @@
+2004-01-28 Atsushi Enomoto <atsushi@ximian.com>
+
+ * DTDReader.cs : Added Normalization. Parameter Entity declaration
+ should block invalid characters. (GEDecl should be fixed as well.)
+ * XmlConstruct.cs : Should allow surrogate chars.
+ * XmlNotation.cs : When prefix is empty (i.e. almost all cases)
+ Name should not add ':'. Patch by Boris Kirzner.
+ * XmlTextReader.cs : Modified private ReadCharacterReference() to
+ return the character (or -1 when should not return anything).
+ Now Text character reference are checked their character range.
+ Set DTDReader.Normalization as well as the reader itself.
+
+2004-01-28 Atsushi Enomoto <atsushi@ximian.com>
+
+ * DTDReader.cs : Make sure that parameter entities are not allowed
+ inside internal subset unless it appears as a markupdecl.
+ * DTDValidatingReader.cs : ENTITY or ENTITIES type attributes must have
+ a value that indicates *unparsed* entity (i.e. NDATA required).
+
+2004-01-26 Atsushi Enomoto <atsushi@ximian.com>
+
+ * XmlTextWriter.cs : quick performance fix.
+ Reduced memoty allocation (e.g. 12% when writing XMLSchema.xsd.)
+
+2004-01-26 Atsushi Enomoto <atsushi@ximian.com>
+
+ * DTDObjectModel.cs :
+ - DTDNode's BaseURI should not always refer to that of DTD's.
+ - Use absolute URI's .ToString() instead of AbsolutePath.
+ * DTDReader.cs : Throw XmlException for illegal character references.
+ * DTDValidatingReader.cs :
+ - Share XmlResolver when the actual reader is XmlTextReader.
+ (MS's XmlValidatingReader and XmlTextReader do this.)
+ - Added its own EntityHandling property.
+ * XmlValidatingReader.cs : Share XmlResolver with XmlTextReader.
+ * XmlReader.cs,
+ XmlTextReader.cs : Added new NET_1_2 members.
+ * XmlElement.cs : Removed extra lines (caused by XmlTextWriter bugs).
+ * XmlEntityReference.cs : Forgot to add, the real fix by Boris.
+
+2004-01-23 Atsushi Enomoto <atsushi@ximian.com>
+
+ * XmlWriter.cs, XmlTextWriter.cs :
+ Several namespace related fixes.
+ - Current element's NamespaceURI should be immediately available
+ after the call of WriteStartElement() for LookupPrefix(), so
+ AddMissingElementXmlns() only affects on output. This is
+ now identified by shouldCheckElementXmlns field.
+ - Attribute's overraped xmlns should be ignored for LookupPrefix(),
+ Especially, when the owner element is written with the default
+ namespace. HOWEVER, the attribute should be *written*. This is
+ identified by shouldAddSavedNsToManager field.
+ - In AddMissingElementXmlns(), non-empty prefix namespace was not
+ checked user-written attributes.
+ - XmlWriter.WriteAttributeString() never supplies namespace URI for
+ xmlns attributes for other versions than NET_1_0. Instead, added
+ ns check logic in WriteStartAttribute() only with NET_1_0.
+ - WriteEndAttribute() should reject zero-length namespace for
+ non-default xmlns declarations.
+ - LookupPrefix() should reject argument null and empty.
+
+ (added 2004-01-24 : forgot to mention more)
+ - WriteAttributeString() w/o namespace should supply null, not ""
+ - Added .NET 1.2 members.
+ - Regard any name with "xml" prefix as in "namespace for XML".
+
+2004-01-22 Atsushi Enomoto <atsushi@ximian.com>
+
+ * XmlElement.cs : Reverted previous fix since it broke monodoc web
+ service.
+
+2004-01-20 Atsushi Enomoto <atsushi@ximian.com>
+
+ * XmlNode.cs : When adding a node to child list, it should reject its
+ ancestors. Patch by Boris Kirzner.
+ * XmlNodeReader.cs : Related fix to the fix above. It should not move
+ to children of XmlEntityReference nodes.
+ * XmlTextWriter.cs : FixedWriteStartElement() not to write default
+ namespace when ns is null (while ns is "", it writes default ns).
+ * XmlElement.cs : Fixed WriteTo() to call WriteStartElement(localName)
+ when NamespaceURI is an empty string.
+
+2004-01-14 Atsushi Enomoto <atsushi@ximian.com>
+
+ * XmlAttribute.cs : when set a value, it is no longer default
+ (even if the value is the same as default value).
+ * XmlAttributeCollection.cs : Remove() should recover default attribute
+ value to default, not specified value.
+ Patch by Boris Kirzner (modified a bit)
+ * XmlDocument.cs : Reference to undeclared entity is not allowed in
+ Load(), while allowed in ReadNode(). Added such distinguishing logic.
+
+2004-01-13 Atsushi Enomoto <atsushi@ximian.com>
+
+ * XmlValidatingReader.cs : Throw exception only in case of errors.
+ Added NET_1_2 Evidences property.
+
+2004-01-12 Atsushi Enomoto <atsushi@ximian.com>
+
+ * XmlElement.cs : Fixed .ctor(). Default attribute was not treated as
+ Specified = false. Patch by Boris Kirzner.
+
+2004-01-11 Atsushi Enomoto <atsushi@ximian.com>
+
+ * XmlException.cs : Fixed incorrect .ctor signature.
+ * XmlParserInput.cs : Fixed in sync with the above fix.
+
+2004-01-08 Atsushi Enomoto <atsushi@ximian.com>
+
+ * XmlAttribute.cs, XmlElement.cs :
+ Fixed incorrect protected .ctor modification.
+
+2004-01-08 Nick Drochak <ndrochak@ieee.org>
+
+ * DTDValidatingReader.cs: Removed unused variable
+
+2004-01-07 Atsushi Enomoto <atsushi@ximian.com>
+
+ * XmlNamespaceManager.cs : Implemented .NET 1.2 methods that take
+ atomizedNames argument.
+ * XmlTextReader.cs : Use new namespace manager methods.
+ Reduced NameTable.Add().
+ * DTDObjectModel.cs : fixed incorrectly commented-out line.
+
+2004-01-07 Atsushi Enomoto <atsushi@ximian.com>
+
+ * XmlAttribute.cs, XmlDocument.cs, XmlElement.cs :
+ set_Prefix should atomize to name table.
+ Avoided extraneous atomization attempt a bit.
+
+2004-01-07 Atsushi Enomoto <atsushi@ximian.com>
+
+ * DTDObjectModel.cs, DTDReader.cs, XmlSecureResolver.cs :
+ avoiding obvious exception.
+ * DTDReader.cs, XmlTextReader.cs : Some optimization.
+ Avoided extraneous PeekChar() and reduced name string creation.
+
+2004-01-05 David Sheldon <dave-mono@earth.li>
+
+ * XmlTextReader.cs: Fixed constructors taking string url to not
+ loose the absolute part of the path.
+
+2004-01-04 Atsushi Enomoto <atsushi@ximian.com>
+
+ * XmlDocument.cs : Fixed Load() to set XmlResolver correctly. Patch
+ by Benjamin Jemlich.
+ Assure closing XmlTextReader which are internally used.
+
+2004-01-03 Atsushi Enomoto <atsushi@ximian.com>
+
+ * XmlTextWriter.cs : trivial character-case fix
+ * XmlUrlResolver.cs : It downloads network stream content at
+ GetEntity() call. You can try like below:
+ for (int i=0;i<100;i++) u.GetEntity(url, null, typeof(Stream));
+
2003-12-23 Atsushi Enomoto <atsushi@ximian.com>
* XmlNamedNodeMap.cs : Fixed internal SetNamedItem(node, pos) to set
diff --git a/mcs/class/System.XML/System.Xml/DTDObjectModel.cs b/mcs/class/System.XML/System.Xml/DTDObjectModel.cs
index 31feda211c8..e9306da59f1 100644
--- a/mcs/class/System.XML/System.Xml/DTDObjectModel.cs
+++ b/mcs/class/System.XML/System.Xml/DTDObjectModel.cs
@@ -490,7 +490,7 @@ namespace Mono.Xml
int lineNumber;
int linePosition;
- public string BaseURI {
+ public virtual string BaseURI {
get { return baseURI; }
set { baseURI = value; }
}
@@ -518,7 +518,7 @@ namespace Mono.Xml
internal void SetRoot (DTDObjectModel root)
{
this.root = root;
- if (BaseURI == null)
+ if (baseURI == null)
this.BaseURI = root.BaseURI;
}
@@ -759,6 +759,12 @@ namespace Mono.Xml
string publicId;
string systemId;
string literalValue;
+ bool isInvalid;
+
+ internal bool IsInvalid {
+ get { return isInvalid; }
+ set { isInvalid = value; }
+ }
public string Name {
get { return name; }
@@ -813,6 +819,9 @@ namespace Mono.Xml
public string EntityValue {
get {
+ if (this.IsInvalid)
+ return String.Empty;
+
if (PublicId == null && SystemId == null && LiteralEntityValue == null)
return String.Empty;
@@ -909,7 +918,7 @@ namespace Mono.Xml
if (resolver == null)
return String.Empty;
- string baseUri = Root.BaseURI;
+ string baseUri = this.BaseURI;
if (baseUri == "")
baseUri = null;
Uri uri = resolver.ResolveUri (
@@ -923,7 +932,7 @@ namespace Mono.Xml
}
if (stream == null)
return String.Empty;
- XmlTextReader extEntReader = new XmlTextReader (uri.AbsolutePath, stream, this.Root.NameTable);
+ XmlTextReader extEntReader = new XmlTextReader (uri.ToString (), stream, this.Root.NameTable);
extEntReader.SkipTextDeclaration ();
TextReader reader = extEntReader.GetRemainder ();
extEntReader.Close ();
@@ -1057,7 +1066,8 @@ namespace Mono.Xml
Uri baseUri = null;
try {
- baseUri = new Uri (BaseURI);
+ if (BaseURI != null && BaseURI.Length > 0)
+ baseUri = new Uri (BaseURI);
} catch (UriFormatException) {
}
diff --git a/mcs/class/System.XML/System.Xml/DTDReader.cs b/mcs/class/System.XML/System.Xml/DTDReader.cs
index ec84db594c9..9385a63a8a8 100644
--- a/mcs/class/System.XML/System.Xml/DTDReader.cs
+++ b/mcs/class/System.XML/System.Xml/DTDReader.cs
@@ -40,6 +40,10 @@ namespace System.Xml
// Parameter entity placeholder
private int dtdIncludeSect;
+ private bool normalization;
+
+ private bool processingInternalSubset;
+
string cachedPublicId;
string cachedSystemId;
@@ -63,6 +67,11 @@ namespace System.Xml
get { return currentInput.BaseURI; }
}
+ public bool Normalization {
+ get { return normalization; }
+ set { normalization = value; }
+ }
+
// A buffer for ReadContent for ReadOuterXml
private StringBuilder CurrentTag {
get {
@@ -91,7 +100,9 @@ namespace System.Xml
int originalParserDepth = parserInputStack.Count;
bool more;
if (DTD.InternalSubset != null && DTD.InternalSubset.Length > 0) {
+ this.processingInternalSubset = true;
XmlParserInput original = currentInput;
+
currentInput = new XmlParserInput (
new StringReader (DTD.InternalSubset),
DTD.BaseURI,
@@ -105,7 +116,9 @@ namespace System.Xml
} while (more || parserInputStack.Count > originalParserDepth);
if (dtdIncludeSect != 0)
throw new XmlException (this as IXmlLineInfo,"INCLUDE section is not ended correctly.");
+
currentInput = original;
+ this.processingInternalSubset = false;
}
if (DTD.SystemId != null && DTD.SystemId != String.Empty && DTD.Resolver != null) {
PushParserInput (DTD.SystemId);
@@ -118,13 +131,13 @@ namespace System.Xml
}
StringCollection sc = new StringCollection ();
-// /*
// Entity recursion check.
foreach (DTDEntityDeclaration ent in DTD.EntityDecls.Values) {
- ent.ScanEntityValue (sc);
- sc.Clear ();
+ if (ent.NotationName != null) {
+ ent.ScanEntityValue (sc);
+ sc.Clear ();
+ }
}
-// */
return DTD;
}
@@ -137,15 +150,14 @@ namespace System.Xml
private bool ProcessDTDSubset ()
{
SkipWhitespace ();
- switch(PeekChar ())
+ switch(ReadChar ())
{
case -1:
return false;
case '%':
// It affects on entity references' well-formedness
- if (this.parserInputStack.Count == 0)
+ if (this.processingInternalSubset)
DTD.InternalSubsetHasPEReference = true;
- ReadChar ();
string peName = ReadName ();
Expect (';');
currentInput.InsertParameterEntityBuffer (" ");
@@ -161,7 +173,6 @@ namespace System.Xml
"Incorrectly nested parameter entity.");
break;
case '<':
- ReadChar ();
int c = ReadChar ();
switch(c)
{
@@ -182,7 +193,7 @@ namespace System.Xml
if (dtdIncludeSect == 0)
throw new XmlException (this as IXmlLineInfo, "Unbalanced end of INCLUDE/IGNORE section.");
// End of inclusion
- Expect ("]]>");
+ Expect ("]>");
dtdIncludeSect--;
SkipWhitespace ();
// return false;
@@ -254,13 +265,11 @@ namespace System.Xml
// conditional sections
SkipWhitespace ();
TryExpandPERef ();
- SkipWhitespace ();
- Expect ('I');
+ ExpectAfterWhitespace ('I');
switch (ReadChar ()) {
case 'N':
Expect ("CLUDE");
- SkipWhitespace ();
- Expect ('[');
+ ExpectAfterWhitespace ('[');
dtdIncludeSect++;
break;
case 'G':
@@ -277,8 +286,7 @@ namespace System.Xml
private void ReadIgnoreSect ()
{
bool skip = false;
- SkipWhitespace ();
- Expect ('[');
+ ExpectAfterWhitespace ('[');
int dtdIgnoreSect = 1;
while (dtdIgnoreSect > 0) {
switch (skip ? PeekChar () : ReadChar ()) {
@@ -319,8 +327,7 @@ namespace System.Xml
SkipWhitespace ();
// This expanding is only allowed as a non-validating parser.
TryExpandPERef ();
- SkipWhitespace ();
- Expect ('>');
+ ExpectAfterWhitespace ('>');
return decl;
}
@@ -329,19 +336,18 @@ namespace System.Xml
{
TryExpandPERef ();
SkipWhitespace ();
- switch(PeekChar ())
+ switch(ReadChar ())
{
case 'E':
decl.IsEmpty = true;
- Expect ("EMPTY");
+ Expect ("MPTY");
break;
case 'A':
decl.IsAny = true;
- Expect ("ANY");
+ Expect ("NY");
break;
case '(':
DTDContentModel model = decl.ContentModel;
- ReadChar ();
SkipWhitespace ();
TryExpandPERef ();
SkipWhitespace ();
@@ -478,8 +484,7 @@ namespace System.Xml
break;
}
while(true);
- SkipWhitespace ();
- Expect (')');
+ ExpectAfterWhitespace (')');
}
else {
TryExpandPERef ();
@@ -553,49 +558,49 @@ namespace System.Xml
ClearValueBuffer ();
bool loop = true;
while (loop) {
- int c = PeekChar ();
+ int c = ReadChar ();
switch (c) {
case -1:
throw new XmlException ("unexpected end of stream in entity value definition.");
case '"':
- ReadChar ();
if (quoteChar == '"')
loop = false;
else
AppendValueChar ('"');
break;
case '\'':
- ReadChar ();
if (quoteChar == '\'')
loop = false;
else
AppendValueChar ('\'');
break;
case '&':
- ReadChar ();
if (PeekChar () == '#') {
ReadChar ();
- ReadCharacterReference ();
+ c = ReadCharacterReference ();
+ if (XmlConstructs.IsInvalid (c))
+ throw new XmlException (this as IXmlLineInfo, "Invalid character was used to define parameter entity.");
+
}
else
AppendValueChar ('&');
break;
case '%':
- ReadChar ();
string peName = ReadName ();
Expect (';');
valueBuffer.Append (GetPEValue (peName));
break;
default:
- AppendValueChar (ReadChar ());
+ if (XmlConstructs.IsInvalid (c))
+ throw new XmlException (this as IXmlLineInfo, "Invalid character was used to define parameter entity.");
+ AppendValueChar (c);
break;
}
}
decl.LiteralEntityValue = CreateValueString (); // currentTag.ToString (start, currentTag.Length - start - 1);
ClearValueBuffer ();
}
- SkipWhitespace ();
- Expect ('>');
+ ExpectAfterWhitespace ('>');
if (DTD.PEDecls [decl.Name] == null) {
DTD.PEDecls.Add (decl.Name, decl);
}
@@ -619,6 +624,8 @@ namespace System.Xml
private void TryExpandPERef ()
{
if (PeekChar () == '%') {
+ if (this.processingInternalSubset)
+ throw new XmlException (this as IXmlLineInfo, "Parameter entity reference is not allowed inside internal subset.");
ExpandPERef ();
}
}
@@ -676,8 +683,7 @@ namespace System.Xml
SkipWhitespace ();
// This expanding is only allowed as a non-validating parser.
TryExpandPERef ();
- SkipWhitespace ();
- Expect ('>');
+ ExpectAfterWhitespace ('>');
return decl;
}
@@ -693,9 +699,14 @@ namespace System.Xml
ClearValueBuffer ();
while (PeekChar () != quoteChar) {
- switch (PeekChar ()) {
+ int ch = ReadChar ();
+ /*
+ FIXME: Here, character reference range validity
+ should be checked, but also should consider
+ how to handle them e.g. &#38amp;
+ */
+ switch (ch) {
case '%':
- ReadChar ();
string name = ReadName ();
Expect (';');
if (decl.IsInternalSubset)
@@ -706,7 +717,9 @@ namespace System.Xml
case -1:
throw new XmlException ("unexpected end of stream.");
default:
- AppendValueChar (ReadChar ());
+ if (this.normalization && XmlConstructs.IsInvalid (ch))
+ throw new XmlException (this as IXmlLineInfo, "Invalid character was found in the entity declaration.");
+ AppendValueChar (ch);
break;
}
}
@@ -763,8 +776,7 @@ namespace System.Xml
SkipWhitespace ();
// This expanding is only allowed as a non-validating parser.
TryExpandPERef ();
- SkipWhitespace ();
- Expect ('>');
+ ExpectAfterWhitespace ('>');
return decl;
}
@@ -853,8 +865,7 @@ namespace System.Xml
default: // Enumerated Values
def.Datatype = XmlSchemaDatatype.FromName ("NMTOKEN");
TryExpandPERef ();
- SkipWhitespace ();
- Expect ('(');
+ ExpectAfterWhitespace ('(');
SkipWhitespace ();
def.EnumeratedAttributeDeclaration.Add (
def.Datatype.Normalize (ReadNmToken ())); // enum value
@@ -1010,8 +1021,7 @@ namespace System.Xml
throw new XmlException ("public or system declaration required for \"NOTATION\" declaration.");
// This expanding is only allowed as a non-validating parser.
TryExpandPERef ();
- SkipWhitespace ();
- Expect ('>');
+ ExpectAfterWhitespace ('>');
return decl;
}
@@ -1138,6 +1148,18 @@ namespace System.Xml
Expect (expected[i]);
}
+ private void ExpectAfterWhitespace (char c)
+ {
+ while (true) {
+ int i = ReadChar ();
+ if (XmlChar.IsWhitespace (i))
+ continue;
+ if (c != i)
+ throw new XmlException (String.Join (String.Empty, new string [] {"Expected ", c.ToString (), ", but found " + (char) i, "[", i.ToString (), "]"}));
+ break;
+ }
+ }
+
// Does not consume the first non-whitespace character.
private bool SkipWhitespace ()
{
@@ -1155,24 +1177,30 @@ namespace System.Xml
if(next < 0)
return unresolved;
- while(next >= 0) {
+ while (next >= 0) {
if(pos < next)
resolved.Append (unresolved.Substring (pos, next - pos));// - 1);
int endPos = unresolved.IndexOf (';', next+1);
+ if (endPos < 0)
+ throw new XmlException (this as IXmlLineInfo, "Could not resolve entity reference since it did not end with character ';'.");
string entityName =
unresolved.Substring (next + 1, endPos - next - 1);
if(entityName [0] == '#') {
- char c;
- // character entity
- if(entityName [1] == 'x') {
- // hexadecimal
- c = (char) int.Parse ("0" + entityName.Substring (2),
- System.Globalization.NumberStyles.HexNumber);
- } else {
- // decimal
- c = (char) int.Parse (entityName.Substring (1));
+ try {
+ char c;
+ // character entity
+ if(entityName [1] == 'x') {
+ // hexadecimal
+ c = (char) int.Parse ("0" + entityName.Substring (2),
+ System.Globalization.NumberStyles.HexNumber);
+ } else {
+ // decimal
+ c = (char) int.Parse (entityName.Substring (1));
+ }
+ resolved.Append (c);
+ } catch (FormatException) {
+ throw new XmlException (this as IXmlLineInfo, "Invalid character entity reference was found.");
}
- resolved.Append (c);
} else {
char predefined = XmlChar.GetPredefinedEntity (entityName);
if (expandPredefined && predefined != 0)
@@ -1301,8 +1329,7 @@ namespace System.Xml
// version decl
if (PeekChar () == 'v') {
Expect ("version");
- SkipWhitespace ();
- Expect ('=');
+ ExpectAfterWhitespace ('=');
SkipWhitespace ();
int quoteChar = ReadChar ();
char [] expect1_0 = new char [3];
@@ -1336,8 +1363,7 @@ namespace System.Xml
if (PeekChar () == 'e') {
Expect ("encoding");
- SkipWhitespace ();
- Expect ('=');
+ ExpectAfterWhitespace ('=');
SkipWhitespace ();
int quoteChar = ReadChar ();
switch (quoteChar) {
@@ -1363,7 +1389,9 @@ namespace System.Xml
Expect ("?>");
}
- private void ReadCharacterReference ()
+ // Note that now this method behaves differently from
+ // XmlTextReader's one. It calles AppendValueChar() internally.
+ private int ReadCharacterReference ()
{
int value = 0;
@@ -1408,6 +1436,7 @@ namespace System.Xml
throw new XmlException (this as IXmlLineInfo,
"Referenced character was not allowed in XML.");
AppendValueChar (value);
+ return value;
}
private void AppendNameChar (int ch)
@@ -1503,7 +1532,8 @@ namespace System.Xml
{
Uri baseUri = null;
try {
- baseUri = new Uri (DTD.BaseURI);
+ if (DTD.BaseURI != null && DTD.BaseURI.Length > 0)
+ baseUri = new Uri (DTD.BaseURI);
} catch (UriFormatException) {
}
diff --git a/mcs/class/System.XML/System.Xml/DTDValidatingReader.cs b/mcs/class/System.XML/System.Xml/DTDValidatingReader.cs
index 1e1e446fd13..bb329018210 100644
--- a/mcs/class/System.XML/System.Xml/DTDValidatingReader.cs
+++ b/mcs/class/System.XML/System.Xml/DTDValidatingReader.cs
@@ -15,7 +15,7 @@ namespace Mono.Xml
{
}
- public DTDValidatingReader (XmlReader reader,
+ internal DTDValidatingReader (XmlReader reader,
XmlValidatingReader validatingReader)
{
entityReaderStack = new Stack ();
@@ -33,7 +33,11 @@ namespace Mono.Xml
valueBuilder = new StringBuilder ();
idList = new ArrayList ();
missingIDReferences = new ArrayList ();
- resolver = new XmlUrlResolver ();
+ XmlTextReader xtReader = reader as XmlTextReader;
+ if (xtReader != null)
+ resolver = xtReader.Resolver;
+ else
+ resolver = new XmlUrlResolver ();
}
Stack entityReaderStack;
@@ -76,6 +80,11 @@ namespace Mono.Xml
get { return dtd; }
}
+ public EntityHandling EntityHandling {
+ get { return currentEntityHandling; }
+ set { currentEntityHandling = value; }
+ }
+
public override void Close ()
{
reader.Close ();
@@ -296,7 +305,8 @@ namespace Mono.Xml
// Don't output the same errors so many times.
this.missingIDReferences.Clear ();
}
- currentEntityHandling = validatingReader.EntityHandling;
+ if (validatingReader != null)
+ EntityHandling = validatingReader.EntityHandling;
return b;
}
@@ -581,7 +591,6 @@ namespace Mono.Xml
attributes.Add (attrName);
attributeLocalNames.Add (attrName, reader.LocalName);
attributeNamespaces.Add (attrName, reader.NamespaceURI);
- bool hasError = false;
XmlReader targetReader = reader;
string attrValue = null;
if (currentEntityHandling == EntityHandling.ExpandCharEntities)
@@ -601,7 +610,6 @@ namespace Mono.Xml
if (edecl == null) {
HandleError (String.Format ("Referenced entity {0} is not declared.", targetReader.Name),
XmlSeverityType.Error);
- hasError = true;
} else {
XmlTextReader etr = new XmlTextReader (edecl.EntityValue, XmlNodeType.Attribute, ParserContext);
attributeValueEntityStack.Push (targetReader);
@@ -651,6 +659,7 @@ namespace Mono.Xml
normalized = FilterNormalization (def.Name, attrValue);
else
normalized = attrValue;
+ DTDEntityDeclaration ent;
switch (def.Datatype.TokenizedType) {
case XmlTokenizedType.ID:
if (!XmlChar.IsName (normalized))
@@ -684,16 +693,20 @@ namespace Mono.Xml
}
break;
case XmlTokenizedType.ENTITY:
- if (dtd.EntityDecls [normalized] == null)
- HandleError (String.Format ("Reference to undeclared entity was found in attribute {0}.", reader.Name),
- XmlSeverityType.Error);
+ ent = dtd.EntityDecls [normalized];
+ if (ent == null)
+ HandleError ("Reference to undeclared entity was found in attribute: " + reader.Name + ".", XmlSeverityType.Error);
+ else if (ent.NotationName == null)
+ HandleError ("The entity specified by entity type value must be an unparsed entity. The entity definition has no NDATA in attribute: " + reader.Name + ".", XmlSeverityType.Error);
break;
case XmlTokenizedType.ENTITIES:
string [] entrefs = def.Datatype.ParseValue (normalized, NameTable, null) as string [];
foreach (string entref in entrefs) {
- if (dtd.EntityDecls [ FilterNormalization (reader.Name, entref) ] == null)
- HandleError (String.Format ("Reference to undeclared entity was found in attribute {0}.", reader.Name),
- XmlSeverityType.Error);
+ ent = dtd.EntityDecls [FilterNormalization (reader.Name, entref)];
+ if (ent == null)
+ HandleError ("Reference to undeclared entity was found in attribute: " + reader.Name + ".", XmlSeverityType.Error);
+ else if (ent.NotationName == null)
+ HandleError ("The entity specified by ENTITIES type value must be an unparsed entity. The entity definition has no NDATA in attribute: " + reader.Name + ".", XmlSeverityType.Error);
}
break;
case XmlTokenizedType.NMTOKEN:
@@ -1056,7 +1069,6 @@ namespace Mono.Xml
}
// As to this property, MS.NET seems ignorant of EntityHandling...
else if (NodeType == XmlNodeType.Attribute)// &&
- // currentEntityHandling == EntityHandling.ExpandEntities)
return FilterNormalization (Name, attributeValues [currentAttribute]);
else if (consumedAttribute)
return FilterNormalization (Name, attributeValues [this.currentAttribute]);
diff --git a/mcs/class/System.XML/System.Xml/XmlAttribute.cs b/mcs/class/System.XML/System.Xml/XmlAttribute.cs
index dd1906646d9..07bbea33134 100644
--- a/mcs/class/System.XML/System.Xml/XmlAttribute.cs
+++ b/mcs/class/System.XML/System.Xml/XmlAttribute.cs
@@ -34,7 +34,16 @@ namespace System.Xml
string prefix,
string localName,
string namespaceURI,
- XmlDocument doc) : base (doc)
+ XmlDocument doc) : this (prefix, localName, namespaceURI, doc, false)
+ {
+ }
+
+ internal XmlAttribute (
+ string prefix,
+ string localName,
+ string namespaceURI,
+ XmlDocument doc,
+ bool atomizedNames) : base (doc)
{
if (prefix == null)
prefix = String.Empty;
@@ -56,9 +65,15 @@ namespace System.Xml
else if (!XmlChar.IsName (localName))
throw new ArgumentException ("Invalid attribute local name.");
- this.prefix = doc.NameTable.Add (prefix);
- this.localName = doc.NameTable.Add (localName);
- this.namespaceURI = doc.NameTable.Add (namespaceURI);
+ if (atomizedNames) {
+ this.prefix = prefix;
+ this.localName = localName;
+ this.namespaceURI = namespaceURI;
+ } else {
+ this.prefix = doc.NameTable.Add (prefix);
+ this.localName = doc.NameTable.Add (localName);
+ this.namespaceURI = doc.NameTable.Add (namespaceURI);
+ }
}
#endregion
@@ -164,7 +179,7 @@ namespace System.Xml
if (prefix == "xmlns" && value != "xmlns")
throw new ArgumentException ("Cannot bind to the reserved namespace.");
- prefix = value;
+ prefix = OwnerDocument.NameTable.Add (value);
}
get {
@@ -196,6 +211,7 @@ namespace System.Xml
}
else
firstChild.Value = value;
+ isDefault = false;
}
}
@@ -214,7 +230,7 @@ namespace System.Xml
public override XmlNode CloneNode (bool deep)
{
XmlNode node = new XmlAttribute (prefix, localName, namespaceURI,
- OwnerDocument);
+ OwnerDocument, true);
if (deep) {
foreach (XmlNode child in this.ChildNodes)
node.AppendChild (child.CloneNode (deep));
diff --git a/mcs/class/System.XML/System.Xml/XmlAttributeCollection.cs b/mcs/class/System.XML/System.Xml/XmlAttributeCollection.cs
index 473e80c44d6..cb24ab1d044 100644
--- a/mcs/class/System.XML/System.Xml/XmlAttributeCollection.cs
+++ b/mcs/class/System.XML/System.Xml/XmlAttributeCollection.cs
@@ -168,12 +168,13 @@ namespace System.Xml
ownerDocument.onNodeRemoved (node, null);
}
// If it is default, then directly create new attribute.
- if (!retAttr.Specified) {
- XmlAttribute attr = ownerDocument.CreateAttribute (retAttr.Prefix,
- retAttr.LocalName, retAttr.NamespaceURI);
+ DTDAttListDeclaration attList = ownerDocument.DocumentType != null ? ownerDocument.DocumentType.DTD.AttListDecls [ownerElement.Name] : null;
+ DTDAttributeDefinition def = attList != null ? attList [retAttr.Name] : null;
+ if (def != null && def.DefaultValue != null) {
+ XmlAttribute attr = ownerDocument.CreateAttribute (
+ retAttr.Prefix, retAttr.LocalName, retAttr.NamespaceURI);
+ attr.Value = def.DefaultValue;
attr.SetDefault ();
- foreach (XmlNode child in retAttr.ChildNodes)
- attr.AppendChild (child);
this.SetNamedItem (attr);
}
retAttr.SetOwnerElement (null);
diff --git a/mcs/class/System.XML/System.Xml/XmlConstructs.cs b/mcs/class/System.XML/System.Xml/XmlConstructs.cs
index 119a4ffa818..df5e18c118c 100755
--- a/mcs/class/System.XML/System.Xml/XmlConstructs.cs
+++ b/mcs/class/System.XML/System.Xml/XmlConstructs.cs
@@ -322,12 +322,12 @@ namespace System.Xml
/// <param name="c">The character to check.</param>
public static bool IsValid(char c)
{
- return (CHARS[c] & VALID) != 0;
+ return c > 0 && ((int) c > 0xffff || ((CHARS[c] & VALID) != 0));
}
public static bool IsValid(int c)
{
- return c > 0 && c < CHARS.Length && (CHARS[c] & VALID) != 0;
+ return c > 0 && ((int) c > 0xffff || (CHARS[c] & VALID) != 0);
}
/// <summary>
diff --git a/mcs/class/System.XML/System.Xml/XmlDocument.cs b/mcs/class/System.XML/System.Xml/XmlDocument.cs
index 86cf8ff9de7..d8ad9b298a8 100644
--- a/mcs/class/System.XML/System.Xml/XmlDocument.cs
+++ b/mcs/class/System.XML/System.Xml/XmlDocument.cs
@@ -37,6 +37,12 @@ namespace System.Xml
XmlResolver resolver;
Hashtable idTable = new Hashtable ();
+ // MS.NET rejects undeclared entities _only_ during Load(),
+ // while ReadNode() never rejects such node. So it signs
+ // whether we are on Load() or not (MS.NET uses Loader class,
+ // but we don't have to implement Load() as such)
+ bool loadMode;
+
#endregion
#region Constructors
@@ -257,7 +263,7 @@ namespace System.Xml
if ((localName == null) || (localName == String.Empty))
throw new ArgumentException ("The attribute local name cannot be empty.");
- return new XmlAttribute (prefix, localName, namespaceURI, this);
+ return new XmlAttribute (prefix, localName, namespaceURI, this, false);
}
public virtual XmlCDataSection CreateCDataSection (string data)
@@ -322,7 +328,7 @@ namespace System.Xml
// I leave it as it is.
if (!XmlChar.IsName (localName))
throw new ArgumentException ("Invalid name.", "localName");
- return new XmlElement (prefix != null ? prefix : String.Empty, localName, namespaceURI != null ? namespaceURI : String.Empty, this);
+ return new XmlElement (prefix != null ? prefix : String.Empty, localName, namespaceURI != null ? namespaceURI : String.Empty, this, false);
}
public virtual XmlEntityReference CreateEntityReference (string name)
@@ -556,15 +562,20 @@ namespace System.Xml
public virtual void Load (Stream inStream)
{
- Load (new XmlTextReader (inStream));
+ XmlTextReader reader = new XmlTextReader (inStream);
+ reader.XmlResolver = resolver;
+ Load (reader);
}
public virtual void Load (string filename)
{
XmlTextReader xr = new XmlTextReader (filename);
- xr.XmlResolver = resolver;
- Load (xr);
- xr.Close ();
+ try {
+ xr.XmlResolver = resolver;
+ Load (xr);
+ } finally {
+ xr.Close ();
+ }
}
public virtual void Load (TextReader txtReader)
@@ -584,19 +595,28 @@ namespace System.Xml
this.baseURI = xmlReader.BaseURI;
// create all contents with use of ReadNode()
- do {
- XmlNode n = ReadNode (xmlReader);
- if(n == null) break;
- AppendChild (n);
- } while (true);
+ try {
+ loadMode = true;
+ do {
+ XmlNode n = ReadNode (xmlReader);
+ if(n == null) break;
+ AppendChild (n);
+ } while (true);
+ } finally {
+ loadMode = false;
+ }
}
public virtual void LoadXml (string xml)
{
XmlTextReader xmlReader = new XmlTextReader (
xml, XmlNodeType.Document, null);
- xmlReader.XmlResolver = resolver;
- Load (xmlReader);
+ try {
+ xmlReader.XmlResolver = resolver;
+ Load (xmlReader);
+ } finally {
+ xmlReader.Close ();
+ }
}
internal void onNodeChanged (XmlNode node, XmlNode Parent)
@@ -819,6 +839,9 @@ namespace System.Xml
break;
case XmlNodeType.EntityReference:
+ if (this.loadMode && this.DocumentType != null &&
+ DocumentType.Entities.GetNamedItem (reader.Name) == null)
+ throw new XmlException ("Reference to undeclared entity was found.");
newNode = CreateEntityReference (reader.Name);
if(currentNode != null)
currentNode.AppendChild (newNode);
@@ -875,9 +898,12 @@ namespace System.Xml
public virtual void Save (string filename)
{
XmlTextWriter xmlWriter = new XmlTextWriter (filename, TextEncoding);
- xmlWriter.Formatting = Formatting.Indented;
- WriteContentTo (xmlWriter);
- xmlWriter.Close ();
+ try {
+ xmlWriter.Formatting = Formatting.Indented;
+ WriteContentTo (xmlWriter);
+ } finally {
+ xmlWriter.Close ();
+ }
}
public virtual void Save (TextWriter writer)
diff --git a/mcs/class/System.XML/System.Xml/XmlElement.cs b/mcs/class/System.XML/System.Xml/XmlElement.cs
index 2b4e6ef288a..c24f0c67f95 100644
--- a/mcs/class/System.XML/System.Xml/XmlElement.cs
+++ b/mcs/class/System.XML/System.Xml/XmlElement.cs
@@ -36,11 +36,26 @@ namespace System.Xml
string prefix,
string localName,
string namespaceURI,
- XmlDocument doc) : base (doc)
+ XmlDocument doc) : this (prefix, localName, namespaceURI, doc, false)
{
- this.prefix = doc.NameTable.Add (prefix);
- this.localName = doc.NameTable.Add (localName);
- this.namespaceURI = doc.NameTable.Add (namespaceURI);
+ }
+
+ internal XmlElement (
+ string prefix,
+ string localName,
+ string namespaceURI,
+ XmlDocument doc,
+ bool atomizedNames) : base (doc)
+ {
+ if (atomizedNames) {
+ this.prefix = prefix;
+ this.localName = localName;
+ this.namespaceURI = namespaceURI;
+ } else {
+ this.prefix = doc.NameTable.Add (prefix);
+ this.localName = doc.NameTable.Add (localName);
+ this.namespaceURI = doc.NameTable.Add (namespaceURI);
+ }
attributes = new XmlAttributeCollection (this);
@@ -50,8 +65,10 @@ namespace System.Xml
if (attlist != null) {
for (int i = 0; i < attlist.Definitions.Count; i++) {
DTDAttributeDefinition def = attlist [i];
- if (def.DefaultValue != null)
+ if (def.DefaultValue != null) {
SetAttribute (def.Name, def.DefaultValue);
+ attributes [def.Name].SetDefault ();
+ }
}
}
}
@@ -177,7 +194,7 @@ namespace System.Xml
if (!XmlChar.IsNCName (value))
throw new ArgumentException ("Specified name is not a valid NCName: " + value);
- prefix = value;
+ prefix = OwnerDocument.NameTable.Add (value);
}
}
@@ -188,7 +205,7 @@ namespace System.Xml
public override XmlNode CloneNode (bool deep)
{
XmlElement node = new XmlElement (
- prefix, localName, namespaceURI, OwnerDocument);
+ prefix, localName, namespaceURI, OwnerDocument, true);
for (int i = 0; i < Attributes.Count; i++)
node.SetAttributeNode ((XmlAttribute)
@@ -329,7 +346,7 @@ namespace System.Xml
public virtual XmlAttribute SetAttributeNode (string localName, string namespaceURI)
{
XmlDocument xmlDoc = this.OwnerDocument;
- XmlAttribute xmlAttribute = new XmlAttribute (String.Empty, localName, namespaceURI, xmlDoc);
+ XmlAttribute xmlAttribute = new XmlAttribute (String.Empty, localName, namespaceURI, xmlDoc, false);
return this.attributes.Append (xmlAttribute);
}
@@ -341,7 +358,7 @@ namespace System.Xml
public override void WriteTo (XmlWriter w)
{
- w.WriteStartElement(Prefix, LocalName, NamespaceURI);
+ w.WriteStartElement (NamespaceURI == null || NamespaceURI.Length == 0 ? String.Empty : Prefix, LocalName, NamespaceURI);
foreach(XmlAttribute attributeNode in Attributes)
if (attributeNode.Specified)
diff --git a/mcs/class/System.XML/System.Xml/XmlEntityReference.cs b/mcs/class/System.XML/System.Xml/XmlEntityReference.cs
index dd46e1942d4..8a3a8c86cac 100644
--- a/mcs/class/System.XML/System.Xml/XmlEntityReference.cs
+++ b/mcs/class/System.XML/System.Xml/XmlEntityReference.cs
@@ -19,6 +19,14 @@ namespace System.Xml
: base (doc)
{
entityName = doc.NameTable.Add (name);
+ // fetch entity reference value from document dtd
+ // and add it as a text child to entity reference
+ string entityValueText = (doc.DocumentType != null) ? doc.DocumentType.DTD.ResolveEntity (name) : null;
+ if (entityValueText != null && entityValueText.Length > 0) {
+ XmlNode entityValueNode = new XmlText (entityValueText,doc);
+ //can't just AppendChild because EntityReference node is always read-only
+ this.insertBeforeIntern (entityValueNode,null);
+ }
}
// Properties
diff --git a/mcs/class/System.XML/System.Xml/XmlException.cs b/mcs/class/System.XML/System.Xml/XmlException.cs
index 615aa191fd9..c51360b995b 100755
--- a/mcs/class/System.XML/System.Xml/XmlException.cs
+++ b/mcs/class/System.XML/System.Xml/XmlException.cs
@@ -61,11 +61,11 @@ namespace System.Xml
}
#if NET_1_0
- internal XmlException (string message, int lineNumber, int linePosition)
+ internal XmlException (string message, Exception innerException, int lineNumber, int linePosition)
#else
- public XmlException (string message, int lineNumber, int linePosition)
+ public XmlException (string message, Exception innerException, int lineNumber, int linePosition)
#endif
- : base (message)
+ : base (message, innerException)
{
this.lineNumber = lineNumber;
this.linePosition = linePosition;
diff --git a/mcs/class/System.XML/System.Xml/XmlNamespaceManager.cs b/mcs/class/System.XML/System.Xml/XmlNamespaceManager.cs
index 2dba87bea72..1a7370f5278 100644
--- a/mcs/class/System.XML/System.Xml/XmlNamespaceManager.cs
+++ b/mcs/class/System.XML/System.Xml/XmlNamespaceManager.cs
@@ -65,6 +65,8 @@ namespace System.Xml
private XmlNameTable nameTable;
internal const string XmlnsXml = "http://www.w3.org/XML/1998/namespace";
internal const string XmlnsXmlns = "http://www.w3.org/2000/xmlns/";
+ internal const string PrefixXml = "xml";
+ internal const string PrefixXmlns = "xmlns";
#endregion
@@ -75,8 +77,8 @@ namespace System.Xml
{
this.nameTable = nameTable;
- nameTable.Add ("xmlns");
- nameTable.Add ("xml");
+ nameTable.Add (PrefixXmlns);
+ nameTable.Add (PrefixXml);
nameTable.Add (String.Empty);
nameTable.Add (XmlnsXmlns);
nameTable.Add (XmlnsXml);
@@ -102,22 +104,32 @@ namespace System.Xml
public virtual void AddNamespace (string prefix, string uri)
{
+ AddNamespace (prefix, uri, false);
+ }
+
+#if NET_1_2
+ public virtual void AddNamespace (string prefix, string uri, bool atomizedNames)
+#else
+ internal virtual void AddNamespace (string prefix, string uri, bool atomizedNames)
+#endif
+ {
if (prefix == null)
throw new ArgumentNullException ("prefix", "Value cannot be null.");
if (uri == null)
throw new ArgumentNullException ("uri", "Value cannot be null.");
-
- prefix = nameTable.Add (prefix);
- uri = nameTable.Add (uri);
+ if (!atomizedNames) {
+ prefix = nameTable.Add (prefix);
+ uri = nameTable.Add (uri);
+ }
IsValidDeclaration (prefix, uri, true);
- if (prefix == string.Empty)
+ if (prefix.Length == 0)
defaultNamespace = uri;
for (int i = declPos; i > declPos - count; i--) {
- if (decls [i].Prefix == prefix) {
+ if (object.ReferenceEquals (decls [i].Prefix, prefix)) {
decls [i].Uri = uri;
return;
}
@@ -135,7 +147,7 @@ namespace System.Xml
internal static string IsValidDeclaration (string prefix, string uri, bool throwException)
{
string message = null;
- if (prefix == "xml" && uri != XmlnsXml)
+ if (prefix == PrefixXml && uri != XmlnsXml)
message = String.Format ("Prefix \"xml\" is only allowed to the fixed uri \"{0}\"", XmlnsXml);
else if (uri == XmlnsXml)
message = String.Format ("Namespace URI \"{0}\" can only be declared with the fixed prefix \"xml\"", XmlnsXml);
@@ -162,8 +174,8 @@ namespace System.Xml
}
ht [string.Empty] = DefaultNamespace;
- ht ["xml"] = XmlnsXml;
- ht ["xmlns"] = XmlnsXmlns;
+ ht [PrefixXml] = XmlnsXml;
+ ht [PrefixXmlns] = XmlnsXmlns;
return ht.Keys.GetEnumerator ();
}
@@ -183,17 +195,28 @@ namespace System.Xml
public virtual string LookupNamespace (string prefix)
{
+ return LookupNamespace (prefix, false);
+ }
+
+#if NET_1_2
+ public string LookupNamespace (string prefix, bool atomizedName)
+#else
+ internal string LookupNamespace (string prefix, bool atomizedName)
+#endif
+ {
switch (prefix) {
- case "xmlns":
+ case PrefixXmlns:
return nameTable.Get (XmlnsXmlns);
- case "xml":
+ case PrefixXml:
return nameTable.Get (XmlnsXml);
case "":
return DefaultNamespace;
+ case null:
+ return null;
}
-
+
for (int i = declPos; i >= 0; i--) {
- if (decls [i].Prefix == prefix && decls [i].Uri != null /* null == flag for removed */)
+ if (CompareString (decls [i].Prefix, prefix, atomizedName) && decls [i].Uri != null /* null == flag for removed */)
return decls [i].Uri;
}
@@ -202,21 +225,37 @@ namespace System.Xml
public virtual string LookupPrefix (string uri)
{
+ return LookupPrefix (uri, false);
+ }
+
+ private bool CompareString (string s1, string s2, bool atomizedNames)
+ {
+ if (atomizedNames)
+ return object.ReferenceEquals (s1, s2);
+ else
+ return s1 == s2;
+ }
+
+#if NET_1_2
+ public string LookupPrefix (string uri, bool atomizedName)
+#else
+ internal string LookupPrefix (string uri, bool atomizedName)
+#endif
+ {
if (uri == null)
return null;
-
- if (uri == DefaultNamespace)
+
+ if (CompareString (uri, DefaultNamespace, atomizedName))
return string.Empty;
-
- if (uri == XmlnsXml)
- return nameTable.Add ("xml");
-
- if (uri == XmlnsXmlns)
- return nameTable.Add ("xmlns");
-
+
+ if (CompareString (uri, XmlnsXml, atomizedName))
+ return PrefixXml;
+ if (CompareString (uri, XmlnsXmlns, atomizedName))
+ return PrefixXmlns;
+
for (int i = declPos; i >= 0; i--) {
- if (decls [i].Uri == uri && decls [i].Prefix != string.Empty) // we already looked for ""
+ if (CompareString (decls [i].Uri, uri, atomizedName) && decls [i].Prefix.Length > 0) // we already looked for ""
return decls [i].Prefix;
}
@@ -251,8 +290,18 @@ namespace System.Xml
count = 0;
}
+ // It is rarely used, so we don't need NameTable optimization on it.
public virtual void RemoveNamespace (string prefix, string uri)
{
+ RemoveNamespace (prefix, uri, false);
+ }
+
+#if NET_1_2
+ public virtual void RemoveNamespace (string prefix, string uri, bool atomizedNames)
+#else
+ internal virtual void RemoveNamespace (string prefix, string uri, bool atomizedNames)
+#endif
+ {
if (prefix == null)
throw new ArgumentNullException ("prefix");
@@ -260,10 +309,10 @@ namespace System.Xml
throw new ArgumentNullException ("uri");
if (count == 0)
- return;
+ return;
for (int i = declPos; i > declPos - count; i--) {
- if (decls [i].Prefix == prefix && decls [i].Uri == uri)
+ if (CompareString (decls [i].Prefix, prefix, atomizedNames) && CompareString (decls [i].Uri, uri, atomizedNames))
decls [i].Uri = null;
}
}
diff --git a/mcs/class/System.XML/System.Xml/XmlNode.cs b/mcs/class/System.XML/System.Xml/XmlNode.cs
index a1163b74b29..d549b2f62d2 100644
--- a/mcs/class/System.XML/System.Xml/XmlNode.cs
+++ b/mcs/class/System.XML/System.Xml/XmlNode.cs
@@ -401,16 +401,31 @@ namespace System.Xml
if (refChild != null && newChild.OwnerDocument != refChild.OwnerDocument)
throw new ArgumentException ("argument nodes are on the different documents.");
- // This check is done by MS.NET 1.0, but isn't done for MS.NET 1.1.
- // Skip this check in the meantime...
-// if(this == ownerDoc && ownerDoc.DocumentElement != null && (newChild is XmlElement))
-// throw new XmlException ("multiple document element not allowed.");
+ if(this == ownerDoc && ownerDoc.DocumentElement != null && (newChild is XmlElement))
+ throw new XmlException ("multiple document element not allowed.");
// checking validity finished. then appending...
+
+ if (newChild == this || isAncestorIntern(newChild))
+ throw new ArgumentException("Cannot insert a node or any ancestor of that node as a child of itself.");
+
return insertBeforeIntern (newChild, refChild);
}
+ // check for the node to be one of node ancestors
+ internal bool isAncestorIntern(XmlNode newChild)
+ {
+ XmlNode currNode = this.ParentNode;
+ while(currNode != null)
+ {
+ if(currNode == newChild)
+ return true;
+ currNode = currNode.ParentNode;
+ }
+ return false;
+ }
+
internal XmlNode insertBeforeIntern (XmlNode newChild, XmlNode refChild)
{
XmlDocument ownerDoc = (NodeType == XmlNodeType.Document) ? (XmlDocument)this : OwnerDocument;
@@ -593,12 +608,10 @@ namespace System.Xml
{
if(oldChild.ParentNode != this)
throw new InvalidOperationException ("oldChild is not a child of this node.");
- XmlNode parent = this.ParentNode;
- while(parent != null) {
- if(newChild == parent)
- throw new InvalidOperationException ("newChild is ancestor of this node.");
- parent = parent.ParentNode;
- }
+
+ if (newChild == this || isAncestorIntern(newChild))
+ throw new ArgumentException("Cannot insert a node or any ancestor of that node as a child of itself.");
+
foreach(XmlNode n in ChildNodes) {
if(n == oldChild) {
XmlNode prev = oldChild.PreviousSibling;
diff --git a/mcs/class/System.XML/System.Xml/XmlNodeReader.cs b/mcs/class/System.XML/System.Xml/XmlNodeReader.cs
index 23c6f1219a7..1fe34504781 100755
--- a/mcs/class/System.XML/System.Xml/XmlNodeReader.cs
+++ b/mcs/class/System.XML/System.Xml/XmlNodeReader.cs
@@ -772,7 +772,7 @@ namespace System.Xml
return current != null;
}
- if (!isEndElement && current.FirstChild != null) {
+ if (!isEndElement && current.FirstChild != null && current.NodeType != XmlNodeType.EntityReference) {
isEndElement = false;
current = current.FirstChild;
depth++;
diff --git a/mcs/class/System.XML/System.Xml/XmlNotation.cs b/mcs/class/System.XML/System.Xml/XmlNotation.cs
index 8345a7ba822..0eac3565baf 100755
--- a/mcs/class/System.XML/System.Xml/XmlNotation.cs
+++ b/mcs/class/System.XML/System.Xml/XmlNotation.cs
@@ -60,7 +60,7 @@ namespace System.Xml
}
public override string Name {
- get { return prefix + ":" + localName; }
+ get { return (prefix != String.Empty) ? (prefix + ":" + localName) : localName; }
}
public override XmlNodeType NodeType {
diff --git a/mcs/class/System.XML/System.Xml/XmlParserInput.cs b/mcs/class/System.XML/System.Xml/XmlParserInput.cs
index 74575664fe6..715b30aa51d 100644
--- a/mcs/class/System.XML/System.Xml/XmlParserInput.cs
+++ b/mcs/class/System.XML/System.Xml/XmlParserInput.cs
@@ -192,7 +192,7 @@ namespace Mono.Xml.Native
private XmlException ReaderError (string message)
{
- return new XmlException (message, line, column);
+ return new XmlException (message, null, line, column);
}
#endregion
}
diff --git a/mcs/class/System.XML/System.Xml/XmlReader.cs b/mcs/class/System.XML/System.Xml/XmlReader.cs
index acfa455ccfb..73115075e68 100644
--- a/mcs/class/System.XML/System.Xml/XmlReader.cs
+++ b/mcs/class/System.XML/System.Xml/XmlReader.cs
@@ -11,13 +11,19 @@
// (C) 2003 Atsushi Enomoto
//
using System.IO;
+using System.Security.Policy;
using System.Text;
namespace System.Xml
{
+#if NET_1_2
+ public abstract class XmlReader : IDisposable, IXmlDataEvidence
+#else
public abstract class XmlReader
+#endif
{
private StringBuilder readStringBuffer;
+ private Evidence [] evidences;
#region Constructor
@@ -42,6 +48,13 @@ namespace System.Xml
public abstract bool EOF { get; }
+#if NET_1_2
+ [MonoTODO]
+ public virtual Evidence [] Evidences {
+ get { return evidences; }
+ }
+#endif
+
public virtual bool HasAttributes
{
get { return AttributeCount > 0; }
@@ -90,6 +103,14 @@ namespace System.Xml
public abstract void Close ();
+#if NET_1_2
+ [MonoTODO]
+ public virtual void Dispose ()
+ {
+ Close ();
+ }
+#endif
+
public abstract string GetAttribute (int i);
public abstract string GetAttribute (string name);
diff --git a/mcs/class/System.XML/System.Xml/XmlSecureResolver.cs b/mcs/class/System.XML/System.Xml/XmlSecureResolver.cs
index 1a2bb1da176..2b80b7aea81 100644
--- a/mcs/class/System.XML/System.Xml/XmlSecureResolver.cs
+++ b/mcs/class/System.XML/System.Xml/XmlSecureResolver.cs
@@ -28,19 +28,23 @@ namespace System.Xml
Zone zone = null;
Site site = null;
- try {
- url = new Url (securityUrl);
- } catch (ArgumentException) {
- }
-
- try {
- zone = Zone.CreateFromUrl (securityUrl);
- } catch (ArgumentException) {
- }
-
- try {
- site = Site.CreateFromUrl (securityUrl);
- } catch (ArgumentException) {
+ if (securityUrl != null) {
+ try {
+ if (securityUrl.Length > 0)
+ url = new Url (securityUrl);
+ } catch (ArgumentException) {
+ }
+
+ try {
+ zone = Zone.CreateFromUrl (securityUrl);
+ } catch (ArgumentException) {
+ }
+
+ try {
+ if (securityUrl.Length > 0)
+ site = Site.CreateFromUrl (securityUrl);
+ } catch (ArgumentException) {
+ }
}
if (url != null)
diff --git a/mcs/class/System.XML/System.Xml/XmlTextReader.cs b/mcs/class/System.XML/System.Xml/XmlTextReader.cs
index fb463e49481..500cb9858a9 100644
--- a/mcs/class/System.XML/System.Xml/XmlTextReader.cs
+++ b/mcs/class/System.XML/System.Xml/XmlTextReader.cs
@@ -24,6 +24,7 @@ using System;
using System.Collections;
using System.Collections.Specialized;
using System.IO;
+using System.Security.Policy;
using System.Text;
using System.Xml.Schema;
using Mono.Xml;
@@ -83,7 +84,7 @@ namespace System.Xml
new XmlNamespaceManager (nt),
String.Empty,
XmlSpace.None);
- this.InitializeContext (url, ctx, new XmlStreamReader (s), XmlNodeType.Document);
+ this.InitializeContext (uri.ToString(), ctx, new XmlStreamReader (s), XmlNodeType.Document);
}
public XmlTextReader (TextReader input, XmlNameTable nt)
@@ -151,6 +152,12 @@ namespace System.Xml
{
get { return parserContext.Encoding; }
}
+#if NET_1_2
+ [MonoTODO]
+ public EntityHandling EntityHandling {
+ get { throw new NotImplementedException (); }
+ }
+#endif
public override bool EOF
{
@@ -162,6 +169,13 @@ namespace System.Xml
}
}
+#if NET_1_2
+ [MonoTODO]
+ public override Evidence [] Evidences {
+ get { return base.Evidences; }
+ }
+#endif
+
public override bool HasValue
{
get {
@@ -314,6 +328,8 @@ namespace System.Xml
cursorToken.Clear ();
currentToken.Clear ();
attributeCount = 0;
+ if (reader != null)
+ reader.Close();
}
public override string GetAttribute (int i)
@@ -390,7 +406,12 @@ namespace System.Xml
public override string LookupNamespace (string prefix)
{
- return parserContext.NamespaceManager.LookupNamespace (prefix);
+ return LookupNamespace (prefix, false);
+ }
+
+ internal string LookupNamespace (string prefix, bool atomizedName)
+ {
+ return parserContext.NamespaceManager.LookupNamespace (prefix, atomizedName);
}
public override void MoveToAttribute (int i)
@@ -742,6 +763,13 @@ namespace System.Xml
throw new InvalidOperationException ("XmlTextReader cannot resolve external entities.");
}
+#if NET_1_2
+ [MonoTODO ("Implement for performance reason")]
+ public override void Skip ()
+ {
+ base.Skip ();
+ }
+#endif
#endregion
#region Internals
@@ -749,6 +777,10 @@ namespace System.Xml
internal DTDObjectModel DTD {
get { return parserContext.Dtd; }
}
+
+ internal XmlResolver Resolver {
+ get { return resolver; }
+ }
#endregion
#region Privates
@@ -809,8 +841,13 @@ namespace System.Xml
Prefix = String.Empty;
LocalName = Name;
} else {
- Prefix = Reader.NameTable.Add (Name.Substring (0, indexOfColon));
- LocalName = Reader.NameTable.Add (Name.Substring (indexOfColon + 1));
+ // This improves speed by at least nearly 5%, but eats more memory at least nearly 0.3%
+ // However, this might be reverted if NameTable is got improved.
+ char [] nameArr = Name.ToCharArray ();
+ Prefix = Reader.NameTable.Add (nameArr, 0, indexOfColon);
+ LocalName = Reader.NameTable.Add (nameArr, indexOfColon + 1, nameArr.Length - indexOfColon - 1);
+// Prefix = Reader.NameTable.Add (Name.Substring (0, indexOfColon));
+// LocalName = Reader.NameTable.Add (Name.Substring (indexOfColon + 1));
}
// NamespaceURI
@@ -819,12 +856,12 @@ namespace System.Xml
if (Prefix == string.Empty)
NamespaceURI = string.Empty;
else
- NamespaceURI = Reader.LookupNamespace (Prefix);
+ NamespaceURI = Reader.LookupNamespace (Prefix, true);
break;
case XmlNodeType.Element:
case XmlNodeType.EndElement:
- NamespaceURI = Reader.LookupNamespace (Prefix);
+ NamespaceURI = Reader.LookupNamespace (Prefix, true);
break;
default:
NamespaceURI = "";
@@ -1061,7 +1098,7 @@ namespace System.Xml
XmlSpace.None);
}
- if (url != null && url != String.Empty) {
+ if (url != null && url.Length > 0) {
Uri uri = null;
try {
uri = new Uri (url);
@@ -1380,8 +1417,7 @@ namespace System.Xml
throw new XmlException (this as IXmlLineInfo,String.Format ("unmatched closing element: expected {0} but found {1}", expected, name));
parserContext.PopScope ();
- SkipWhitespace ();
- Expect ('>');
+ ExpectAfterWhitespace ('>');
--depth;
@@ -1450,22 +1486,28 @@ namespace System.Xml
while (ch != '<' && ch != -1) {
if (ch == '&') {
ReadChar ();
- if (ReadReference (false))
+ ch = ReadReference (false);
+ if (returnEntityReference) // Returns -1 if char validation should not be done
break;
- } else {
- if (normalization && XmlConstructs.IsInvalid (ch))
- throw new XmlException (this as IXmlLineInfo,
- "Not allowed character was found.");
- AppendValueChar (ReadChar ());
- if (ch == ']') {
- if (previousCloseBracketColumn == LinePosition - 1 &&
- previousCloseBracketLine == LineNumber)
- if (PeekChar () == '>')
- throw new XmlException (this as IXmlLineInfo,
- "Inside text content, character sequence ']]>' is not allowed.");
- previousCloseBracketColumn = LinePosition;
- previousCloseBracketLine = LineNumber;
- }
+ }
+ else
+ ch = ReadChar ();
+
+ if (normalization && XmlConstructs.IsInvalid (ch))
+ throw new XmlException (this as IXmlLineInfo,
+ "Not allowed character was found.");
+ AppendValueChar (ch);
+
+ // Block "]]>"
+ if (ch == ']') {
+ if (previousCloseBracketColumn == LinePosition - 1 &&
+ previousCloseBracketLine == LineNumber)
+ if (PeekChar () == '>')
+ throw new XmlException (this as IXmlLineInfo,
+ "Inside text content, character sequence ']]>' is not allowed.");
+ // This tricky style is required to check "] ]]>"
+ previousCloseBracketColumn = LinePosition;
+ previousCloseBracketLine = LineNumber;
}
ch = PeekChar ();
notWhitespace = true;
@@ -1491,18 +1533,16 @@ namespace System.Xml
// character reference or one of the predefined entities.
// This allows the ReadText method to break so that the
// next call to Read will return the EntityReference node.
- private bool ReadReference (bool ignoreEntityReferences)
+ private int ReadReference (bool ignoreEntityReferences)
{
if (PeekChar () == '#') {
ReadChar ();
- ReadCharacterReference ();
+ return ReadCharacterReference ();
} else
- ReadEntityReference (ignoreEntityReferences);
-
- return returnEntityReference;
+ return ReadEntityReference (ignoreEntityReferences);
}
- private void ReadCharacterReference ()
+ private int ReadCharacterReference ()
{
int value = 0;
@@ -1546,10 +1586,12 @@ namespace System.Xml
if (normalization && value < 0xffff && !XmlConstructs.IsValid (value))
throw new XmlException (this as IXmlLineInfo,
"Referenced character was not allowed in XML.");
- AppendValueChar (value);
+ return value;
}
- private void ReadEntityReference (bool ignoreEntityReferences)
+ // Returns -1 if it should not be validated.
+ // Real EOF must not be detected here.
+ private int ReadEntityReference (bool ignoreEntityReferences)
{
nameLength = 0;
@@ -1569,7 +1611,8 @@ namespace System.Xml
char predefined = XmlChar.GetPredefinedEntity (name);
if (predefined != 0)
- AppendValueChar (predefined);
+// AppendValueChar (predefined);
+ return predefined;
else {
if (ignoreEntityReferences) {
AppendValueChar ('&');
@@ -1584,6 +1627,7 @@ namespace System.Xml
entityReferenceName = name;
}
}
+ return -1;
}
// The reader is positioned on the first character of
@@ -1604,8 +1648,7 @@ namespace System.Xml
currentAttributeToken.LinePosition = column;
currentAttributeToken.Name = ReadName ();
- SkipWhitespace ();
- Expect ('=');
+ ExpectAfterWhitespace ('=');
SkipWhitespace ();
ReadAttributeValueTokens (-1);
attributeCount++;
@@ -1613,7 +1656,7 @@ namespace System.Xml
if (currentAttributeToken.Name == "xmlns")
parserContext.NamespaceManager.AddNamespace (String.Empty, GetAttribute (currentAttribute));
else if (currentAttributeToken.Name.StartsWith ("xmlns:")) {
- string nsPrefix = NameTable.Add (currentAttributeToken.Name.Substring (6));
+ string nsPrefix = currentAttributeToken.Name.Substring (6);
parserContext.NamespaceManager.AddNamespace (nsPrefix, GetAttribute (currentAttribute));
}
@@ -1691,7 +1734,12 @@ namespace System.Xml
bool incrementToken = false;
bool isNewToken = true;
bool loop = true;
- while (loop && PeekChar () != quoteChar) {
+ int ch = 0;
+ while (loop) {
+ ch = ReadChar ();
+ if (ch == quoteChar)
+ break;
+
if (incrementToken) {
IncrementAttributeValueToken ();
currentAttributeValueToken.LineNumber = line;
@@ -1700,8 +1748,6 @@ namespace System.Xml
isNewToken = true;
}
- int ch = ReadChar ();
-
switch (ch)
{
case '<':
@@ -1716,7 +1762,8 @@ namespace System.Xml
int startPosition = currentTag.Length - 1;
if (PeekChar () == '#') {
ReadChar ();
- this.ReadCharacterReference ();
+ ch = ReadCharacterReference ();
+ AppendValueChar (ch);
break;
}
// Check XML 1.0 section 3.1 WFC.
@@ -1762,8 +1809,6 @@ namespace System.Xml
}
currentAttributeToken.ValueTokenEndIndex = currentAttributeValue;
- if (dummyQuoteChar < 0)
- ReadChar (); // quoteChar
}
// The reader is positioned on the first character
@@ -1894,8 +1939,7 @@ namespace System.Xml
// version decl
if (PeekChar () == 'v') {
Expect ("version");
- SkipWhitespace ();
- Expect ('=');
+ ExpectAfterWhitespace ('=');
SkipWhitespace ();
int quoteChar = ReadChar ();
char [] expect1_0 = new char [3];
@@ -1929,8 +1973,7 @@ namespace System.Xml
if (PeekChar () == 'e') {
Expect ("encoding");
- SkipWhitespace ();
- Expect ('=');
+ ExpectAfterWhitespace ('=');
SkipWhitespace ();
int quoteChar = ReadChar ();
switch (quoteChar) {
@@ -2114,8 +2157,7 @@ namespace System.Xml
parserContext.InternalSubset = currentTag.ToString (startPos, endPos - startPos);
}
// end of DOCTYPE decl.
- SkipWhitespace ();
- Expect ('>');
+ ExpectAfterWhitespace ('>');
GenerateDTDObjectModel (doctypeName, publicId,
systemId, parserContext.InternalSubset,
@@ -2157,7 +2199,9 @@ namespace System.Xml
DTD.LineNumber = line;
DTD.LinePosition = column;
- return new DTDReader (DTD, intSubsetStartLine, intSubsetStartColumn).GenerateDTDObjectModel ();
+ DTDReader dr = new DTDReader (DTD, intSubsetStartLine, intSubsetStartColumn);
+ dr.Normalization = this.normalization;
+ return dr.GenerateDTDObjectModel ();
}
private enum DtdInputState
@@ -2431,6 +2475,18 @@ namespace System.Xml
Expect (expected[i]);
}
+ private void ExpectAfterWhitespace (char c)
+ {
+ while (true) {
+ int i = ReadChar ();
+ if (XmlChar.IsWhitespace (i))
+ continue;
+ if (c != i)
+ throw new XmlException (String.Join (String.Empty, new string [] {"Expected ", c.ToString (), ", but found " + (char) i, "[", i.ToString (), "]"}));
+ break;
+ }
+ }
+
// Does not consume the first non-whitespace character.
private bool SkipWhitespace ()
{
diff --git a/mcs/class/System.XML/System.Xml/XmlTextWriter.cs b/mcs/class/System.XML/System.Xml/XmlTextWriter.cs
index 4a78afc7819..17053c9872c 100644
--- a/mcs/class/System.XML/System.Xml/XmlTextWriter.cs
+++ b/mcs/class/System.XML/System.Xml/XmlTextWriter.cs
@@ -8,7 +8,6 @@
// (C) 2002 Kral Ferch
// (C) 2003 Atsushi Enomoto
//
-
using System;
using System.Collections;
using System.IO;
@@ -52,8 +51,10 @@ namespace System.Xml
XmlNamespaceManager namespaceManager = new XmlNamespaceManager (new NameTable ());
string savingAttributeValue = String.Empty;
- bool saveAttributeValue = false;
+ bool saveAttributeValue;
string savedAttributePrefix;
+ bool shouldAddSavedNsToManager;
+ bool shouldCheckElementXmlns;
#endregion
@@ -196,32 +197,26 @@ namespace System.Xml
// LAMESPEC: If prefix was already assigned another nsuri, then this element's nsuri goes away!
- if (ns != null)
- {
+ if (this.shouldCheckElementXmlns) {
string formatXmlns = String.Empty;
- if (ns != String.Empty)
- {
- string existingPrefix = namespaceManager.LookupPrefix (ns);
-
- if (existingPrefix != prefix)
- {
- if (prefix != string.Empty)
- formatXmlns = String.Format ("xmlns:{0}={1}{2}{1}", prefix, quoteChar, EscapeString (ns, false));
- else
- formatXmlns = String.Format ("xmlns={0}{1}{0}", quoteChar, EscapeString (ns, false));
- namespaceManager.AddNamespace (prefix, ns);
+ if (userWrittenNamespaces [prefix] == null) {
+ if (prefix != string.Empty) {
+ w.Write (" xmlns:");
+ w.Write (prefix);
+ w.Write ('=');
+ w.Write (quoteChar);
+ w.Write (EscapeString (ns, false));
+ w.Write (quoteChar);
+ }
+ else {
+ w.Write (" xmlns=");
+ w.Write (quoteChar);
+ w.Write (EscapeString (ns, false));
+ w.Write (quoteChar);
}
- }
- else if ((prefix == String.Empty) &&
- (namespaceManager.LookupNamespace (prefix) != ns) &&
- userWrittenNamespaces [prefix] == null) {
- namespaceManager.AddNamespace (prefix, ns);
- formatXmlns = String.Format ("xmlns={0}{0}", quoteChar);
- }
- if(formatXmlns != String.Empty) {
- w.Write (' ');
- w.Write(formatXmlns);
}
+
+ shouldCheckElementXmlns = false;
}
if (newAttributeNamespaces.Count > 0)
@@ -234,11 +229,15 @@ namespace System.Xml
if (namespaceManager.LookupNamespace (aprefix) == ans)
continue;
- string formatXmlns = String.Format (" xmlns:{0}={1}{2}{1}", aprefix, quoteChar, EscapeString (ans, false));
- w.Write(formatXmlns);
+ w.Write (" xmlns:");
+ w.Write (aprefix);
+ w.Write ('=');
+ w.Write (quoteChar);
+ w.Write (EscapeString (ans, false));
+ w.Write (quoteChar);
}
+ newAttributeNamespaces.Clear ();
}
- newAttributeNamespaces.Clear ();
}
private void CheckState ()
@@ -300,12 +299,13 @@ namespace System.Xml
public override string LookupPrefix (string ns)
{
+ if (ns == null || ns == String.Empty)
+ throw new ArgumentException ("The Namespace cannot be empty.");
+
string prefix = namespaceManager.LookupPrefix (ns);
// XmlNamespaceManager has changed to return null when NSURI not found.
- // (Contradiction to the documentation.)
- //if (prefix == String.Empty)
- // prefix = null;
+ // (Contradiction to the ECMA documentation.)
return prefix;
}
@@ -328,7 +328,6 @@ namespace System.Xml
w.Write (Convert.ToBase64String (buffer, index, count));
}
- // BinHex??
public override void WriteBinHex (byte[] buffer, int index, int count)
{
CheckState ();
@@ -471,9 +470,12 @@ namespace System.Xml
openAttribute = false;
if (saveAttributeValue) {
+ if (savedAttributePrefix.Length > 0 && savingAttributeValue.Length == 0)
+ throw new ArgumentException ("Cannot use prefix with an empty namespace.");
+
// add namespace
- namespaceManager.AddNamespace (
- savedAttributePrefix, savingAttributeValue);
+ if (shouldAddSavedNsToManager) // not OLD one
+ namespaceManager.AddNamespace (savedAttributePrefix, savingAttributeValue);
userWrittenNamespaces [savedAttributePrefix] = savingAttributeValue;
saveAttributeValue = false;
savedAttributePrefix = String.Empty;
@@ -621,20 +623,31 @@ namespace System.Xml
public override void WriteStartAttribute (string prefix, string localName, string ns)
{
- if ((prefix == "xml") && (localName == "lang")) {
+ if (prefix == "xml") {
+ // MS.NET looks to allow other names than
+ // lang and space (e.g. xml:link, xml:hack).
ns = XmlNamespaceManager.XmlnsXml;
- openXmlLang = true;
+ if (localName == "lang")
+ openXmlLang = true;
+ else if (localName == "space")
+ openXmlSpace = true;
}
+ if (prefix == null)
+ prefix = String.Empty;
- if ((prefix == "xml") && (localName == "space")) {
- ns = XmlNamespaceManager.XmlnsXml;
- openXmlSpace = true;
- }
+ if (prefix.Length > 0 && (ns == null || ns.Length == 0))
+ if (prefix != "xmlns")
+ throw new ArgumentException ("Cannot use prefix with an empty namespace.");
if ((prefix == "xmlns") && (localName.ToLower ().StartsWith ("xml")))
throw new ArgumentException ("Prefixes beginning with \"xml\" (regardless of whether the characters are uppercase, lowercase, or some combination thereof) are reserved for use by XML: " + prefix + ":" + localName);
- if ((prefix == "xmlns") && (ns != XmlnsNamespace))
+ // Note that null namespace with "xmlns" are allowed.
+#if NET_1_0
+ if ((prefix == "xmlns" || localName == "xmlns" && prefix == String.Empty) && ns != XmlnsNamespace)
+#else
+ if ((prefix == "xmlns" || localName == "xmlns" && prefix == String.Empty) && ns != null && ns != XmlnsNamespace)
+#endif
throw new ArgumentException (String.Format ("The 'xmlns' attribute is bound to the reserved namespace '{0}'", XmlnsNamespace));
CheckState ();
@@ -651,12 +664,10 @@ namespace System.Xml
string formatPrefix = "";
string formatSpace = "";
- if (ns != String.Empty && prefix != "xmlns")
- {
+ if (ns != String.Empty && prefix != "xmlns") {
string existingPrefix = namespaceManager.LookupPrefix (ns);
- if (existingPrefix == null || existingPrefix == "")
- {
+ if (existingPrefix == null || existingPrefix == "") {
bool createPrefix = false;
if (prefix == "")
createPrefix = true;
@@ -704,6 +715,8 @@ namespace System.Xml
ws = WriteState.Attribute;
if (prefix == "xmlns" || prefix == String.Empty && localName == "xmlns") {
+ if (prefix != openElementPrefix || openElementNS == null)
+ shouldAddSavedNsToManager = true;
saveAttributeValue = true;
savedAttributePrefix = (prefix == "xmlns") ? localName : String.Empty;
savingAttributeValue = String.Empty;
@@ -755,9 +768,7 @@ namespace System.Xml
throw new ArgumentException ("Cannot use a prefix with an empty namespace.");
// ignore non-namespaced node's prefix.
- if (ns == null)
- ns = String.Empty;
- if (ns == String.Empty)
+ if (ns == null || ns == String.Empty)
prefix = String.Empty;
@@ -771,8 +782,9 @@ namespace System.Xml
CloseStartElement ();
newAttributeNamespaces.Clear ();
userWrittenNamespaces.Clear ();
+ shouldCheckElementXmlns = false;
- if (prefix == null)
+ if (prefix == null && ns != null)
prefix = namespaceManager.LookupPrefix (ns);
if (prefix == null)
prefix = String.Empty;
@@ -793,6 +805,21 @@ namespace System.Xml
namespaceManager.PushScope ();
indentLevel++;
+
+ if (ns != null) {
+ if (ns.Length > 0) {
+ string existing = LookupPrefix (ns);
+ if (existing != prefix) {
+ shouldCheckElementXmlns = true;
+ namespaceManager.AddNamespace (prefix, ns);
+ }
+ } else {
+ if (ns != namespaceManager.DefaultNamespace) {
+ shouldCheckElementXmlns = true;
+ namespaceManager.AddNamespace ("", ns);
+ }
+ }
+ }
}
public override void WriteString (string text)
@@ -808,11 +835,12 @@ namespace System.Xml
savingAttributeValue += text;
}
+ string [] replacements = new string [] {
+ "&amp;", "&lt;", "&gt;", "&quot;", "&apos;",
+ "&#xD;", "&#xA;"};
+
private string EscapeString (string source, bool skipQuotations)
{
- string [] replacements = new string [] {
- "&amp;", "&lt;", "&gt;", "&quot;", "&apos;",
- "&#xD;", "&#xA;"};
int start = 0;
int pos = 0;
int count = source.Length;
@@ -908,7 +936,7 @@ namespace System.Xml
}
w.Write ("&#x");
- w.Write (((int) ((highChar - 0xD800) * 0x400 + (lowChar - 0xDC00) + 0x10000)).ToString ("x"));
+ w.Write (((int) ((highChar - 0xD800) * 0x400 + (lowChar - 0xDC00) + 0x10000)).ToString ("X"));
w.Write (';');
}
diff --git a/mcs/class/System.XML/System.Xml/XmlUrlResolver.cs b/mcs/class/System.XML/System.Xml/XmlUrlResolver.cs
index 8dd1835d190..4deb0f2aafc 100755
--- a/mcs/class/System.XML/System.Xml/XmlUrlResolver.cs
+++ b/mcs/class/System.XML/System.Xml/XmlUrlResolver.cs
@@ -57,21 +57,9 @@ namespace System.Xml
using (s) {
WebClient wc = new WebClient ();
wc.Credentials = credential;
- s = wc.OpenRead (absoluteUri.ToString ());
-
- // Returned stream does not keep connection, so
- // it should read up all the stream content.
- MemoryStream ms = new MemoryStream ();
- byte [] data = new byte [10000];
- int length = 0;
- do {
- length = s.Read (data, 0, 10000);
- if (length > 0)
- ms.Write (data, 0, length);
- } while (length == 10000);
- s.Close ();
- ms.Close ();
- return new MemoryStream (ms.GetBuffer (), 0, (int) ms.Length);
+ byte [] data = wc.DownloadData (absoluteUri.ToString ());
+ wc.Dispose ();
+ return new MemoryStream (data, 0, data.Length);
}
}
diff --git a/mcs/class/System.XML/System.Xml/XmlValidatingReader.cs b/mcs/class/System.XML/System.Xml/XmlValidatingReader.cs
index 6e8df197b0b..9deea5ed38b 100644
--- a/mcs/class/System.XML/System.Xml/XmlValidatingReader.cs
+++ b/mcs/class/System.XML/System.Xml/XmlValidatingReader.cs
@@ -10,6 +10,7 @@
//
using System.IO;
+using System.Security.Policy;
using System.Text;
using System.Xml.Schema;
using Mono.Xml;
@@ -24,7 +25,7 @@ namespace System.Xml {
XmlReader sourceReader;
XmlTextReader xmlTextReader;
XmlReader validatingReader;
- XmlResolver resolver;
+ XmlResolver resolver; // Only used to non-XmlTextReader XmlReader
bool specifiedResolver;
ValidationType validationType;
XmlSchemaCollection schemas;
@@ -38,8 +39,10 @@ namespace System.Xml {
public XmlValidatingReader (XmlReader reader)
{
- this.sourceReader = reader;
- this.xmlTextReader = reader as XmlTextReader;
+ sourceReader = reader;
+ xmlTextReader = reader as XmlTextReader;
+ if (xmlTextReader == null)
+ resolver = new XmlUrlResolver ();
entityHandling = EntityHandling.ExpandEntities;
validationType = ValidationType.Auto;
schemas = new XmlSchemaCollection ();
@@ -95,6 +98,14 @@ namespace System.Xml {
get { return validatingReader == null ? false : validatingReader.EOF; }
}
+#if NET_1_2
+ [MonoTODO]
+ public override Evidence [] Evidences {
+ get { throw new NotImplementedException ();
+ }
+ }
+#endif
+
public override bool HasValue {
get { return validatingReader == null ? false : validatingReader.HasValue; }
}
@@ -213,6 +224,19 @@ namespace System.Xml {
}
}
+ internal XmlResolver Resolver {
+ get {
+ // This is special rule... MS.NET shares the
+ // XmlResolver between XmlTextReader and
+ // XmlValidatingReader, so we mimick that
+ // silly behavior here.
+ if (this.xmlTextReader != null)
+ return this.xmlTextReader.Resolver;
+ else
+ return resolver;
+ }
+ }
+
public XmlSchemaCollection Schemas {
get { return schemas; }
}
@@ -251,12 +275,14 @@ namespace System.Xml {
public XmlResolver XmlResolver {
set {
specifiedResolver = true;
- resolver = value;
- /*
+ if (xmlTextReader != null)
+ xmlTextReader.XmlResolver = value;
+ else
+ resolver = value;
+
XsdValidatingReader xsvr = validatingReader as XsdValidatingReader;
if (xsvr != null)
xsvr.XmlResolver = value;
- */
DTDValidatingReader dvr = validatingReader as DTDValidatingReader;
if (dvr != null)
dvr.XmlResolver = value;
@@ -367,8 +393,7 @@ namespace System.Xml {
goto case ValidationType.Schema; // might be specified by xsi:schemaLocation.
case ValidationType.DTD:
validatingReader = dtdReader = new DTDValidatingReader (sourceReader, this);
- if (specifiedResolver)
- dtdReader.XmlResolver = resolver;
+ dtdReader.XmlResolver = Resolver;
break;
case ValidationType.Schema:
dtdReader = new DTDValidatingReader (sourceReader, this);
@@ -376,9 +401,8 @@ namespace System.Xml {
foreach (XmlSchema schema in Schemas)
xsvr.Schemas.Add (schema);
validatingReader = xsvr;
- if (specifiedResolver) {
- dtdReader.XmlResolver = resolver;
- }
+ xsvr.XmlResolver = Resolver;
+ dtdReader.XmlResolver = Resolver;
break;
case ValidationType.XDR:
throw new NotSupportedException ();
@@ -473,7 +497,7 @@ namespace System.Xml {
{
if (ValidationEventHandler != null)
ValidationEventHandler (o, e);
- else if (ValidationType != ValidationType.None)
+ else if (ValidationType != ValidationType.None && e.Severity == XmlSeverityType.Error)
throw e.Exception;
}
#endregion // Methods
diff --git a/mcs/class/System.XML/System.Xml/XmlWriter.cs b/mcs/class/System.XML/System.Xml/XmlWriter.cs
index eba4dfa783f..a89e9a27128 100644
--- a/mcs/class/System.XML/System.Xml/XmlWriter.cs
+++ b/mcs/class/System.XML/System.Xml/XmlWriter.cs
@@ -13,7 +13,11 @@ using System;
namespace System.Xml
{
+#if NET_1_2
+ public abstract class XmlWriter : IDisposable
+#else
public abstract class XmlWriter
+#endif
{
#region Constructors
@@ -35,6 +39,13 @@ namespace System.Xml
public abstract void Close ();
+#if NET_1_2
+ public virtual void Dispose ()
+ {
+ Close ();
+ }
+#endif
+
public abstract void Flush ();
public abstract string LookupPrefix (string ns);
@@ -87,7 +98,7 @@ namespace System.Xml
public void WriteAttributeString (string localName, string value)
{
- WriteAttributeString ("", localName, "", value);
+ WriteAttributeString ("", localName, null, value);
}
public void WriteAttributeString (string localName, string ns, string value)
@@ -99,9 +110,11 @@ namespace System.Xml
{
// In MS.NET (1.0), this check is done *here*, not at WriteStartAttribute.
// (XmlTextWriter.WriteStartAttribute("xmlns", "anyname", null) throws an exception.
- if ((prefix == "xmlns") || (prefix == "" && localName == "xmlns"))
- if (ns == null)
- ns = "http://www.w3.org/2000/xmlns/";
+
+#if NET_1_0
+ if ((prefix == "xmlns" || (prefix == "" && localName == "xmlns")) && ns == null)
+ ns = "http://www.w3.org/2000/xmlns/";
+#endif
WriteStartAttribute (prefix, localName, ns);
WriteString (value);
diff --git a/mcs/class/System.XML/Test/System.Xml.Schema/XmlSchemaCollectionTests.cs b/mcs/class/System.XML/Test/System.Xml.Schema/XmlSchemaCollectionTests.cs
new file mode 100755
index 00000000000..e0b75573233
--- /dev/null
+++ b/mcs/class/System.XML/Test/System.Xml.Schema/XmlSchemaCollectionTests.cs
@@ -0,0 +1,74 @@
+//
+// System.Xml.XmlSchemaCollectionTests.cs
+//
+// Author:
+// Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
+//
+// (C) 2002 Atsushi Enomoto
+//
+
+using System;
+using System.IO;
+using System.Xml;
+using System.Xml.Schema;
+using NUnit.Framework;
+
+namespace MonoTests.System.Xml
+{
+ [TestFixture]
+ public class XmlSchemaCollectionTests : Assertion
+ {
+ private XmlSchema GetSchema (string path)
+ {
+ return XmlSchema.Read (new XmlTextReader (path), null);
+ }
+
+ private XmlQualifiedName QName (string name, string ns)
+ {
+ return new XmlQualifiedName (name, ns);
+ }
+
+ [Test]
+ public void TestAdd ()
+ {
+ XmlSchemaCollection col = new XmlSchemaCollection ();
+ XmlSchema schema = new XmlSchema ();
+ XmlSchemaElement elem = new XmlSchemaElement ();
+ elem.Name = "foo";
+ schema.Items.Add (elem);
+ schema.TargetNamespace = "urn:foo";
+ col.Add (schema);
+ col.Add (schema); // No problem !?
+
+ XmlSchema schema2 = new XmlSchema ();
+ schema2.Items.Add (elem);
+ schema2.TargetNamespace = "urn:foo";
+ col.Add (schema2); // No problem !!
+
+ schema.Compile (null);
+ col.Add (schema);
+ col.Add (schema); // Still no problem !!!
+
+ schema2.Compile (null);
+ col.Add (schema2);
+
+ schema = GetSchema ("Test/XmlFiles/xsd/3.xsd");
+ schema.Compile (null);
+ col.Add (schema);
+
+ schema2 = GetSchema ("Test/XmlFiles/xsd/3.xsd");
+ schema2.Compile (null);
+ col.Add (schema2);
+ }
+
+ [Test]
+ public void TestAddDoesCompilation ()
+ {
+ XmlSchema schema = new XmlSchema ();
+ Assert (!schema.IsCompiled);
+ XmlSchemaCollection col = new XmlSchemaCollection ();
+ col.Add (schema);
+ Assert (schema.IsCompiled);
+ }
+ }
+}
diff --git a/mcs/class/System.XML/Test/System.Xml.Schema/XmlSchemaDatatypeTests.cs b/mcs/class/System.XML/Test/System.Xml.Schema/XmlSchemaDatatypeTests.cs
new file mode 100755
index 00000000000..a0d23a0ea61
--- /dev/null
+++ b/mcs/class/System.XML/Test/System.Xml.Schema/XmlSchemaDatatypeTests.cs
@@ -0,0 +1,75 @@
+//
+// System.Xml.XmlSchemaDatatypeTests.cs
+//
+// Author:
+// Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
+//
+// (C) 2002 Atsushi Enomoto
+//
+
+using System;
+using System.IO;
+using System.Xml;
+using System.Xml.Schema;
+using NUnit.Framework;
+
+namespace MonoTests.System.Xml
+{
+ [TestFixture]
+ public class XmlSchemaDatatypeTests : Assertion
+ {
+ private XmlSchema GetSchema (string path)
+ {
+ return XmlSchema.Read (new XmlTextReader (path), null);
+ }
+
+ private XmlQualifiedName QName (string name, string ns)
+ {
+ return new XmlQualifiedName (name, ns);
+ }
+
+ private void AssertDatatype (XmlSchema schema, int index,
+ XmlTokenizedType tokenizedType, Type type, string rawValue, object parsedValue)
+ {
+ XmlSchemaElement element = schema.Items [index] as XmlSchemaElement;
+ XmlSchemaDatatype dataType = element.ElementType as XmlSchemaDatatype;
+ AssertEquals (tokenizedType, dataType.TokenizedType);
+ AssertEquals (type, dataType.ValueType);
+ AssertEquals (parsedValue, dataType.ParseValue (rawValue, null, null));
+ }
+
+ [Test]
+ public void TestAnyType ()
+ {
+ XmlSchema schema = GetSchema ("Test/XmlFiles/xsd/datatypesTest.xsd");
+ schema.Compile (null);
+ XmlSchemaElement any = schema.Elements [QName ("e00", "urn:bar")] as XmlSchemaElement;
+ XmlSchemaComplexType cType = any.ElementType as XmlSchemaComplexType;
+ AssertEquals (typeof (XmlSchemaComplexType), cType.GetType ());
+ AssertNotNull (cType);
+ AssertEquals (XmlQualifiedName.Empty, cType.QualifiedName);
+ AssertNull (cType.BaseSchemaType);
+ // In MS.NET its type is "XmlSchemaParticle.EmptyParticle"
+ AssertNotNull (cType.ContentTypeParticle);
+ }
+
+ [Test]
+ public void TestAll ()
+ {
+ XmlSchema schema = GetSchema ("Test/XmlFiles/xsd/datatypesTest.xsd");
+ schema.Compile (null);
+
+ AssertDatatype (schema, 1, XmlTokenizedType.CDATA, typeof (string), " f o o ", " f o o ");
+ AssertDatatype (schema, 2, XmlTokenizedType.CDATA, typeof (string), " f o o ", " f o o ");
+ // token shouldn't allow " f o o "
+ AssertDatatype (schema, 3, XmlTokenizedType.CDATA, typeof (string), "f o o", "f o o");
+ // language seems to be checked strictly
+ AssertDatatype (schema, 4, XmlTokenizedType.CDATA, typeof (string), "x-foo", "x-foo");
+
+ // NMTOKEN shouldn't allow " f o o "
+// AssertDatatype (schema, 5, XmlTokenizedType.NMTOKEN, typeof (string), "foo", "foo");
+// AssertDatatype (schema, 6, XmlTokenizedType.NMTOKEN, typeof (string []), "f o o", new string [] {"f", "o", "o"});
+ }
+
+ }
+}
diff --git a/mcs/class/System.XML/Test/System.Xml.Schema/XmlSchemaTests.cs b/mcs/class/System.XML/Test/System.Xml.Schema/XmlSchemaTests.cs
index 73afb5c8054..cd683c837bc 100644
--- a/mcs/class/System.XML/Test/System.Xml.Schema/XmlSchemaTests.cs
+++ b/mcs/class/System.XML/Test/System.Xml.Schema/XmlSchemaTests.cs
@@ -1,5 +1,5 @@
//
-// System.Xml.XmlSchema.cs
+// System.Xml.XmlSchemaTests.cs
//
// Author:
// Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
@@ -8,6 +8,7 @@
//
using System;
+using System.IO;
using System.Xml;
using System.Xml.Schema;
using NUnit.Framework;
@@ -98,7 +99,7 @@ namespace MonoTests.System.Xml
[Test]
public void TestRead ()
{
- XmlSchema schema = GetSchema ("XmlFiles/xsd/1.xsd");
+ XmlSchema schema = GetSchema ("Test/XmlFiles/xsd/1.xsd");
AssertEquals (6, schema.Items.Count);
bool fooValidated = false;
@@ -126,6 +127,30 @@ namespace MonoTests.System.Xml
}
[Test]
+ public void TestReadFlags ()
+ {
+ XmlSchema schema = GetSchema ("Test/XmlFiles/xsd/2.xsd");
+ schema.Compile (null);
+ XmlSchemaElement el = schema.Items [0] as XmlSchemaElement;
+ AssertNotNull (el);
+ AssertEquals (XmlSchemaDerivationMethod.Extension, el.Block);
+
+ el = schema.Items [1] as XmlSchemaElement;
+ AssertNotNull (el);
+ AssertEquals (XmlSchemaDerivationMethod.Extension |
+ XmlSchemaDerivationMethod.Restriction, el.Block);
+ }
+
+ [Test]
+ public void TestWriteFlags ()
+ {
+ XmlSchema schema = GetSchema ("Test/XmlFiles/xsd/2.xsd");
+ StringWriter sw = new StringWriter ();
+ XmlTextWriter xtw = new XmlTextWriter (sw);
+ schema.Write (xtw);
+ }
+
+ [Test]
public void TestCompile ()
{
XmlQualifiedName qname;
@@ -133,10 +158,17 @@ namespace MonoTests.System.Xml
XmlSchemaComplexType cType;
XmlSchemaSequence seq;
- XmlSchema schema = GetSchema ("XmlFiles/xsd/1.xsd");
+ XmlSchema schema = GetSchema ("Test/XmlFiles/xsd/1.xsd");
+// Assert (!schema.IsCompiled);
schema.Compile (null);
+ Assert (schema.IsCompiled);
string ns = "urn:bar";
+ XmlSchemaElement foo = (XmlSchemaElement) schema.Elements [QName ("Foo", ns)];
+ AssertNotNull (foo);
+ XmlSchemaDatatype stringDatatype = foo.ElementType as XmlSchemaDatatype;
+ AssertNotNull (stringDatatype);
+
// HogeType
qname = QName ("HogeType", ns);
cType = schema.SchemaTypes [qname] as XmlSchemaComplexType;
@@ -148,8 +180,7 @@ namespace MonoTests.System.Xml
AssertNotNull (seq);
AssertEquals (2, seq.Items.Count);
XmlSchemaElement refFoo = seq.Items [0] as XmlSchemaElement;
- AssertCompiledElement (refFoo, QName ("Foo", ns),
- ((XmlSchemaElement) schema.Elements [QName ("Foo", ns)]).ElementType);
+ AssertCompiledElement (refFoo, QName ("Foo", ns), stringDatatype);
// FugaType
qname = QName ("FugaType", ns);
@@ -169,12 +200,58 @@ namespace MonoTests.System.Xml
AssertEquals (1, seq.Items.Count);
XmlSchemaElement refBaz = seq.Items [0] as XmlSchemaElement;
AssertNotNull (refBaz);
- AssertCompiledElement (refBaz, QName ("Baz", ""),
- ((XmlSchemaElement) schema.Elements [QName ("Foo", ns)]).ElementType);
+ AssertCompiledElement (refBaz, QName ("Baz", ""), stringDatatype);
qname = QName ("Bar", ns);
XmlSchemaElement element = schema.Elements [qname] as XmlSchemaElement;
AssertCompiledElement (element, qname, cType);
}
+
+ [Test]
+ [ExpectedException (typeof (XmlSchemaException))]
+ public void TestCompileNonSchema ()
+ {
+ XmlTextReader xtr = new XmlTextReader ("<root/>", XmlNodeType.Document, null);
+ XmlSchema schema = XmlSchema.Read (xtr, null);
+ }
+
+ [Test]
+ public void TestSimpleImport ()
+ {
+ XmlSchema schema = XmlSchema.Read (new XmlTextReader ("Test/XmlFiles/xsd/3.xsd"), null);
+ AssertEquals ("urn:foo", schema.TargetNamespace);
+ XmlSchemaImport import = schema.Includes [0] as XmlSchemaImport;
+ AssertNotNull (import);
+
+ schema.Compile (null);
+ AssertEquals (4, schema.Elements.Count);
+ AssertNotNull (schema.Elements [QName ("Foo", "urn:foo")]);
+ AssertNotNull (schema.Elements [QName ("Bar", "urn:foo")]);
+ AssertNotNull (schema.Elements [QName ("Foo", "urn:bar")]);
+ AssertNotNull (schema.Elements [QName ("Bar", "urn:bar")]);
+
+ }
+
+ [Test]
+ public void TestQualification ()
+ {
+ XmlSchema schema = XmlSchema.Read (new XmlTextReader ("Test/XmlFiles/xsd/5.xsd"), null);
+ schema.Compile (null);
+ XmlSchemaElement el = schema.Elements [QName ("Foo", "urn:bar")] as XmlSchemaElement;
+ AssertNotNull (el);
+ XmlSchemaComplexType ct = el.ElementType as XmlSchemaComplexType;
+ XmlSchemaSequence seq = ct.ContentTypeParticle as XmlSchemaSequence;
+ XmlSchemaElement elp = seq.Items [0] as XmlSchemaElement;
+ AssertEquals (QName ("Bar", ""), elp.QualifiedName);
+
+ schema = XmlSchema.Read (new XmlTextReader ("Test/XmlFiles/xsd/6.xsd"), null);
+ schema.Compile (null);
+ el = schema.Elements [QName ("Foo", "urn:bar")] as XmlSchemaElement;
+ AssertNotNull (el);
+ ct = el.ElementType as XmlSchemaComplexType;
+ seq = ct.ContentTypeParticle as XmlSchemaSequence;
+ elp = seq.Items [0] as XmlSchemaElement;
+ AssertEquals (QName ("Bar", "urn:bar"), elp.QualifiedName);
+ }
}
}
diff --git a/mcs/class/System.XML/Test/System.Xml.Schema/standalone_tests/ChangeLog b/mcs/class/System.XML/Test/System.Xml.Schema/standalone_tests/ChangeLog
new file mode 100755
index 00000000000..0f3e74b1d7a
--- /dev/null
+++ b/mcs/class/System.XML/Test/System.Xml.Schema/standalone_tests/ChangeLog
@@ -0,0 +1,15 @@
+2004-01-20 Atsushi Enomoto <atsushi@ximian.com>
+
+ * Added set of Post Schema Compilation Information tests, i.e.
+ xs-psci-compare.cs and psci-ms-all.zip.
+ * Makefile: Added test-psci target.
+ * README: Added notes on PSCI tests (however it is not for today's
+ implementation, but for the very near future with bunch of fixes)
+
+2004-01-08 Atsushi Enomoto <atsushi@ximian.com>
+
+ * xsdtest.cs : XmlReaders should be closed in case of errors.
+
+2004-01-05 Atsushi Enomoto <atsushi@ximian.com>
+
+ * README, Makefile, test-masters.tar.gz, xsdtest.cs : Initial checkin.
diff --git a/mcs/class/System.XML/Test/System.Xml.Schema/standalone_tests/Makefile b/mcs/class/System.XML/Test/System.Xml.Schema/standalone_tests/Makefile
new file mode 100755
index 00000000000..816fe016665
--- /dev/null
+++ b/mcs/class/System.XML/Test/System.Xml.Schema/standalone_tests/Makefile
@@ -0,0 +1,35 @@
+RUNTIME = mono
+MCS_RUNTIME =
+MCS = mcs
+TESTS = xsd-test-suite/suntest/SunTestsAll/xsiType1.xsd
+MASTERS = xsd-test-suite/suntest/tests-all.xml
+TEST_ARCHIVE = XSTC-20020116.tar.gz
+MASTER_ARCHIVE = test-masters.tar.gz
+
+xsdtest.exe : xsdtest.cs $(TESTS)
+ $(MCS_RUNTIME) $(MCS) xsdtest.cs
+
+xs-psci-compare.exe : xs-psci-compare.cs
+ $(MCS_RUNTIME) $(MCS) xs-psci-compare.cs
+
+$(MASTERS) : $(MASTER_ARCHIVE) xsd-test-suite
+ cd xsd-test-suite; tar zxvf ../$(MASTER_ARCHIVE); cd ..
+
+$(TESTS) : $(TEST_ARCHIVE) $(MASTERS) xsd-test-suite
+ cd xsd-test-suite; tar zxvf ../$(TEST_ARCHIVE); cd ..
+
+$(TEST_ARCHIVE) :
+ wget http://www.w3.org/2001/05/xmlschema-test-collection/XSTC-20020116.tar.gz
+
+xsd-test-suite:
+ mkdir xsd-test-suite
+
+test : xsdtest.exe
+ $(RUNTIME) xsdtest.exe
+
+test-psci : xs-psci-compare.exe
+ $(RUNTIME) xs-psci-compare.exe xsd-test-suite/msxsdtest/tests-all.xml > psci-mono-msxsd.txt
+
+# be careful to use it. This removes ALL files in xsd-test-suite!
+# clean:
+# rm -rf xsd-test-suite
diff --git a/mcs/class/System.XML/Test/System.Xml.Schema/standalone_tests/README b/mcs/class/System.XML/Test/System.Xml.Schema/standalone_tests/README
new file mode 100755
index 00000000000..0a466966f4c
--- /dev/null
+++ b/mcs/class/System.XML/Test/System.Xml.Schema/standalone_tests/README
@@ -0,0 +1,41 @@
+* System.Xml.Schema standalone test collections
+
+
+** Small XML Schema validation test system::
+
+This is a small standalone test system using W3C XML Schema test collection.
+http://www.w3.org/2001/05/xmlschema-test-collection.html
+
+"make" will do what you need (downloading test archive, expanding,
+compiling test runner).
+
+"make test" will do the actual tests.
+
+
+** Post Schema Compilation Information comparison test::
+
+This is a test for Post Schema Compilation Information properties.
+
+xs-pcsi-compare.exe emits properties of schema object model. pcsi-ms-all.zip contains msxsdtest result I got from MS.NET 1.1.
+
+(Currently no other way to compare the results by hands.)
+
+As for the result differences, some notes would be required:
+
+ - MS.NET holds incorrect base schema type for simple list and union
+ types. Their base type is simple ur-type (3.14.7) but MS.NET holds
+ item type(s) there.
+
+ - For unspecified types for element and attribute, they incorrectly
+ specifies xs:string type. However in those cases, attribute types
+ should be mapped to simple ur-type and element types should be
+ (complex) ur-type (3.4.7)
+
+This will be added in the future (currently Mono has the same problem).
+
+ - MS.NET does not remove "pointless" choice particle (see 3.9.6).
+ However it results in incorrect validation.
+ (e.g. msxsdtest/Particles/particlesHb010.xsd)
+
+
+Atsushi Eno <atsushi@ximian.com>
diff --git a/mcs/class/System.XML/Test/System.Xml.Schema/standalone_tests/psci-ms-all.zip b/mcs/class/System.XML/Test/System.Xml.Schema/standalone_tests/psci-ms-all.zip
new file mode 100755
index 00000000000..547e6671e34
--- /dev/null
+++ b/mcs/class/System.XML/Test/System.Xml.Schema/standalone_tests/psci-ms-all.zip
Binary files differ
diff --git a/mcs/class/System.XML/Test/System.Xml.Schema/standalone_tests/test-masters.tar.gz b/mcs/class/System.XML/Test/System.Xml.Schema/standalone_tests/test-masters.tar.gz
new file mode 100755
index 00000000000..55941dba3e0
--- /dev/null
+++ b/mcs/class/System.XML/Test/System.Xml.Schema/standalone_tests/test-masters.tar.gz
Binary files differ
diff --git a/mcs/class/System.XML/Test/System.Xml.Schema/standalone_tests/xs-psci-compare.cs b/mcs/class/System.XML/Test/System.Xml.Schema/standalone_tests/xs-psci-compare.cs
new file mode 100755
index 00000000000..4d91dcdde62
--- /dev/null
+++ b/mcs/class/System.XML/Test/System.Xml.Schema/standalone_tests/xs-psci-compare.cs
@@ -0,0 +1,302 @@
+using System;
+using System.Collections;
+using System.IO;
+using System.Xml;
+using System.Xml.Schema;
+
+public class Test
+{
+ public static void Main (string [] args)
+ {
+ if (args.Length == 0) {
+ Console.WriteLine ("USAGE: xsdump masterlistname");
+ return;
+ }
+
+ try {
+ SchemaDumper.TestDir (args [0], Console.Out);
+ } catch (Exception ex) {
+ Console.WriteLine (ex);
+ }
+ }
+}
+
+public class SchemaDumper
+{
+ public static void TestDir (string masterlist, TextWriter w)
+ {
+ FileInfo fi = new FileInfo (masterlist);
+ string dirname = fi.Directory.Parent.FullName;
+
+ SchemaDumper d = new SchemaDumper (w);
+#if false
+ foreach (DirectoryInfo di in new DirectoryInfo (dirname).GetDirectories ())
+ foreach (FileInfo fi in di.GetFiles ("*.xsd")) {
+ try {
+ d.IndentLine ("**** File : " + fi.Name);
+ d.DumpSchema (XmlSchema.Read (new XmlTextReader (fi.FullName), null));
+ } catch (Exception ex) {
+ d.IndentLine ("**** Error in " + fi.Name);
+ }
+ }
+#else
+ XmlDocument doc = new XmlDocument ();
+ doc.Load (fi.FullName);
+
+ foreach (XmlElement test in doc.SelectNodes ("/tests/test")) {
+ // Test schema
+ string schemaFile = test.SelectSingleNode ("@schema").InnerText;
+ if (schemaFile.Length > 2)
+ schemaFile = schemaFile.Substring (2);
+ bool isValidSchema = test.SelectSingleNode ("@out_s").InnerText == "1";
+
+ if (!isValidSchema)
+ continue;
+#endif
+ try {
+ d.IndentLine ("**** File : " + schemaFile);
+ d.depth++;
+ XmlTextReader xtr = new XmlTextReader (dirname + "/" + schemaFile);
+ d.DumpSchema (XmlSchema.Read (xtr, null));
+ xtr.Close ();
+ } catch (Exception ex) {
+ d.IndentLine ("**** Error in " + schemaFile);
+ } finally {
+ d.depth--;
+ }
+ }
+ }
+
+ public int depth;
+ TextWriter w;
+ public SchemaDumper (TextWriter w)
+ {
+ this.w = w;
+ }
+
+ public void IndentLine (object s)
+ {
+ for (int i = 0; i < depth * 2; i++)
+ w.Write (' ');
+ w.WriteLine (s);
+ }
+
+ public void DumpSchema (XmlSchema schema)
+ {
+ schema.Compile (null);
+
+ SortedList sl = new SortedList ();
+
+ IndentLine ("**XmlSchema**");
+ IndentLine ("TargetNamespace: " + schema.TargetNamespace);
+ IndentLine ("AttributeGroups:");
+ foreach (DictionaryEntry entry in schema.AttributeGroups)
+ sl.Add (entry.Key.ToString (), entry.Value);
+ foreach (DictionaryEntry entry in sl)
+ DumpAttributeGroup ((XmlSchemaAttributeGroup) entry.Value);
+ sl.Clear ();
+
+ IndentLine ("Attributes:");
+ foreach (DictionaryEntry entry in schema.Attributes)
+ sl.Add (entry.Key.ToString (), entry.Value);
+ foreach (DictionaryEntry entry in sl)
+ DumpAttribute ((XmlSchemaAttribute) entry.Value);
+ sl.Clear ();
+
+ IndentLine ("Elements:");
+ foreach (DictionaryEntry entry in schema.Elements)
+ sl.Add (entry.Key.ToString (), entry.Value);
+ foreach (DictionaryEntry entry in sl)
+ DumpElement ((XmlSchemaElement) entry.Value);
+ sl.Clear ();
+
+ IndentLine ("Groups");
+ foreach (DictionaryEntry entry in schema.Groups)
+ sl.Add (entry.Key.ToString (), entry.Value);
+ foreach (DictionaryEntry entry in sl)
+ DumpGroup ((XmlSchemaGroup) entry.Value);
+ sl.Clear ();
+
+ IndentLine ("IsCompiled: " + schema.IsCompiled);
+
+ IndentLine ("Notations");
+ foreach (DictionaryEntry entry in schema.Notations)
+ sl.Add (entry.Key.ToString (), entry.Value);
+ foreach (DictionaryEntry entry in sl)
+ DumpNotation ((XmlSchemaNotation) entry.Value);
+ sl.Clear ();
+
+ IndentLine ("SchemaTypes:");
+ foreach (DictionaryEntry entry in schema.Notations)
+ sl.Add (entry.Key.ToString (), entry.Value);
+ foreach (DictionaryEntry entry in sl)
+ if (entry.Value is XmlSchemaSimpleType)
+ DumpSimpleType ((XmlSchemaSimpleType) entry.Value);
+ else
+ DumpComplexType ((XmlSchemaComplexType) entry.Value);
+ sl.Clear ();
+
+ }
+
+ public void DumpAttributeGroup (XmlSchemaAttributeGroup ag)
+ {
+ depth++;
+
+ IndentLine ("**AttributeGroup**");
+ IndentLine ("Name = " + ag.Name);
+ if (ag.RedefinedAttributeGroup != null) {
+ IndentLine ("RedefinedGroup:");
+ DumpAttributeGroup (ag.RedefinedAttributeGroup);
+ }
+
+ depth--;
+ }
+
+ public void DumpAttribute (XmlSchemaAttribute a)
+ {
+ depth++;
+
+ IndentLine ("**Attribute**");
+ IndentLine ("QualifiedName: " + a.QualifiedName);
+ IndentLine ("RefName: " + a.RefName);
+ IndentLine ("AttributeType:");
+ DumpType (a.AttributeType);
+
+ depth--;
+ }
+
+ public void DumpElement (XmlSchemaElement e)
+ {
+ depth++;
+
+ IndentLine ("**Element**");
+ IndentLine ("QualifiedName: " + e.QualifiedName);
+ IndentLine ("ElementType:");
+ DumpType (e.ElementType);
+
+ depth--;
+ }
+
+ public void DumpGroup (XmlSchemaGroup g)
+ {
+ depth++;
+
+ IndentLine ("**Group**");
+ IndentLine ("Name: " + g.Name);
+
+ depth--;
+ }
+
+ public void DumpNotation (XmlSchemaNotation n)
+ {
+ depth++;
+
+ IndentLine ("**Notation**");
+ IndentLine ("Name: " + n.Name);
+
+
+ depth--;
+ }
+
+ public void DumpType (object type)
+ {
+ depth++;
+
+ if (type is XmlSchemaComplexType)
+ DumpComplexType ((XmlSchemaComplexType) type);
+ else if (type is XmlSchemaSimpleType)
+ DumpSimpleType ((XmlSchemaSimpleType) type);
+ else if (type is XmlSchemaDatatype)
+ DumpDatatype ((XmlSchemaDatatype) type);
+ else
+ IndentLine ("Unexpected Type: " + type);
+
+ depth--;
+ }
+
+ public void DumpSimpleType (XmlSchemaSimpleType s)
+ {
+ depth++;
+
+ IndentLine ("**SimpleType**");
+ IndentLine ("QualifiedName: " + s.QualifiedName);
+ IndentLine ("BaseSchemaType:");
+ DumpType (s.BaseSchemaType);
+
+ depth--;
+ }
+
+ public void DumpComplexType (XmlSchemaComplexType c)
+ {
+ depth++;
+
+ IndentLine ("**ComplexType**");
+ IndentLine ("QualifiedName: " + c.QualifiedName);
+ IndentLine ("ContentType: " + c.ContentType);
+ IndentLine ("ContentTypeParticle: ");
+ DumpParticle (c.ContentTypeParticle);
+ IndentLine ("BaseSchemaType:");
+ DumpType (c.BaseSchemaType);
+
+ depth--;
+ }
+
+ public void DumpParticle (XmlSchemaParticle p)
+ {
+ if (p is XmlSchemaGroupBase)
+ DumpGroupBase ((XmlSchemaGroupBase) p);
+ else if (p is XmlSchemaElement)
+ DumpElementNoRecurse ((XmlSchemaElement) p);
+ else if (p is XmlSchemaAny)
+ DumpAny ((XmlSchemaAny) p);
+ else
+ IndentLine (p);
+ }
+
+ public void DumpDatatype (XmlSchemaDatatype d)
+ {
+ depth++;
+
+ IndentLine ("**Datatype**");
+ IndentLine ("TokenizedType: " + d.TokenizedType);
+ IndentLine ("ValueType: " + d.ValueType);
+
+ depth--;
+ }
+
+ public void DumpGroupBase (XmlSchemaGroupBase gb)
+ {
+ depth++;
+
+ IndentLine ("**GroupBase**");
+ IndentLine ("Type: " + gb);
+ IndentLine ("MinOccurs: " + gb.MinOccurs);
+ IndentLine ("MaxOccurs: " + gb.MaxOccurs);
+ IndentLine ("Items: ");
+ foreach (XmlSchemaParticle p in gb.Items)
+ DumpParticle (p);
+
+ depth--;
+ }
+
+ public void DumpElementNoRecurse (XmlSchemaElement e)
+ {
+ depth++;
+
+ IndentLine ("**Element**");
+ IndentLine ("QualifiedName: " + e.QualifiedName);
+
+ depth--;
+ }
+
+ public void DumpAny (XmlSchemaAny any)
+ {
+ depth++;
+
+ IndentLine ("**Any**");
+// IndentLine ("Namespace: " + any.Namespace);
+
+ depth--;
+ }
+}
+
diff --git a/mcs/class/System.XML/Test/System.Xml.Schema/standalone_tests/xsdtest.cs b/mcs/class/System.XML/Test/System.Xml.Schema/standalone_tests/xsdtest.cs
new file mode 100755
index 00000000000..3e21d85784a
--- /dev/null
+++ b/mcs/class/System.XML/Test/System.Xml.Schema/standalone_tests/xsdtest.cs
@@ -0,0 +1,78 @@
+using System;
+using System.IO;
+using System.Xml;
+using System.Xml.Schema;
+using System.Xml.Serialization;
+
+public class Test
+{
+ static char SEP = Path.DirectorySeparatorChar;
+
+ public static void Main ()
+ {
+ RunTest ("msxsdtest");
+ RunTest ("nisttest");
+ RunTest ("suntest");
+ }
+
+ static void RunTest (string subdir)
+ {
+Console.WriteLine ("Started: " + DateTime.Now);
+ string basePath = @"Xsd-Test-Suite" + SEP;
+ XmlDocument doc = new XmlDocument ();
+ doc.Load (basePath + subdir + SEP + "tests-all.xml");
+ foreach (XmlElement test in doc.SelectNodes ("/tests/test")) {
+ // Test schema
+ string schemaFile = test.SelectSingleNode ("@schema").InnerText;
+ if (schemaFile.Length > 2)
+ schemaFile = schemaFile.Substring (2);
+ bool isValidSchema = test.SelectSingleNode ("@out_s").InnerText == "1";
+ XmlSchema schema = null;
+ XmlTextReader sxr = null;
+ try {
+ sxr = new XmlTextReader (basePath + schemaFile);
+ schema = XmlSchema.Read (sxr, null);
+ sxr.Close ();
+ schema.Compile (null);
+ if (!isValidSchema) {
+ Console.WriteLine ("Incorrectly Valid schema : " + schemaFile);
+ continue;
+ }
+ } catch (XmlSchemaException ex) {
+ if (isValidSchema) {
+ Console.WriteLine ("Incorrectly Invalid schema : " + schemaFile + " " + ex.Message);
+ continue;
+ }
+ } catch (Exception ex) {
+ Console.WriteLine ("Unexpected Exception on schema: " + schemaFile + " " + ex.Message);
+ continue;
+ } finally {
+ sxr.Close ();
+ }
+ // Test instances
+ string instanceFile = test.SelectSingleNode ("@instance").InnerText;
+ if (instanceFile.Length == 0)
+ continue;
+ else if (instanceFile.StartsWith ("./"))
+ instanceFile = instanceFile.Substring (2);
+ bool isValidInstance = test.SelectSingleNode ("@out_x").InnerText == "1";
+ XmlValidatingReader xvr = null;
+ try {
+ xvr = new XmlValidatingReader (new XmlTextReader (basePath + "\\" + instanceFile));
+ xvr.Schemas.Add (schema);
+ while (!xvr.EOF)
+ xvr.Read ();
+ if (!isValidInstance)
+ Console.WriteLine ("Incorrectly Valid instance: " + schemaFile);
+ } catch (XmlSchemaException ex) {
+ if (isValidInstance)
+ Console.WriteLine ("Incorrectly Invalid instance: " + schemaFile + " " + ex.Message);
+ } catch (Exception ex) {
+ Console.WriteLine ("Unexpected Exception on instance: " + schemaFile + " " + ex.Message);
+ } finally {
+ xvr.Close ();
+ }
+ }
+Console.WriteLine ("Finished: " + DateTime.Now);
+ }
+}
diff --git a/mcs/class/System.XML/Test/System.Xml.XPath/ChangeLog b/mcs/class/System.XML/Test/System.Xml.XPath/ChangeLog
index 81c1e50e881..65c38339714 100644
--- a/mcs/class/System.XML/Test/System.Xml.XPath/ChangeLog
+++ b/mcs/class/System.XML/Test/System.Xml.XPath/ChangeLog
@@ -1,3 +1,8 @@
+2004-01-28 Atsushi Enomoto <atsushi@ximian.com>
+
+ * XPathNavigatorCommonTests.cs : Added MoveToNamespace and IsDescendant.
+ * XPathNavigatorTests.cs : Close XmlTextReader.
+
2003-12-18 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
* XPathNavigatorTests.cs : Added XPathDocumentMoveToId().
diff --git a/mcs/class/System.XML/Test/System.Xml.XPath/XPathNavigatorCommonTests.cs b/mcs/class/System.XML/Test/System.Xml.XPath/XPathNavigatorCommonTests.cs
index df525ce8aa5..0786668f9de 100644
--- a/mcs/class/System.XML/Test/System.Xml.XPath/XPathNavigatorCommonTests.cs
+++ b/mcs/class/System.XML/Test/System.Xml.XPath/XPathNavigatorCommonTests.cs
@@ -318,5 +318,60 @@ namespace MonoTests.System.Xml
nav.MoveToRoot ();
AssertNavigator (nav, XPathNodeType.Root, "", "", "", "", "test.", false, true, false);
}
+
+ [Test]
+ public void MoveToNamespaces ()
+ {
+ string xml = "<a xmlns:x='urn:x'><b xmlns:y='urn:y'/><c/><d><e attr='a'/></d></a>";
+
+ nav = GetXmlDocumentNavigator (xml);
+ MoveToNamespaces (nav);
+ nav = GetXPathDocumentNavigator (document);
+ MoveToNamespaces (nav);
+ }
+
+ private void MoveToNamespaces (XPathNavigator nav)
+ {
+ XPathNodeIterator iter = nav.Select ("//e");
+ iter.MoveNext ();
+ nav.MoveTo (iter.Current);
+ AssertEquals ("e", nav.Name);
+ nav.MoveToFirstNamespace ();
+ AssertEquals ("x", nav.Name);
+ nav.MoveToNextNamespace ();
+ AssertEquals ("xml", nav.Name);
+ }
+
+ [Test]
+ public void IsDescendant ()
+ {
+ string xml = "<a><b/><c/><d><e attr='a'/></d></a>";
+
+ nav = GetXmlDocumentNavigator (xml);
+ IsDescendant (nav);
+ nav = GetXPathDocumentNavigator (document);
+ IsDescendant (nav);
+ }
+
+ private void IsDescendant (XPathNavigator nav)
+ {
+ XPathNavigator tmp = nav.Clone ();
+ XPathNodeIterator iter = nav.Select ("//e");
+ iter.MoveNext ();
+ nav.MoveTo (iter.Current);
+ nav.MoveToFirstAttribute ();
+ AssertEquals ("attr", nav.Name);
+ AssertEquals ("", tmp.Name);
+ Assert (tmp.IsDescendant (nav));
+ Assert (!nav.IsDescendant (tmp));
+ tmp.MoveToFirstChild ();
+ AssertEquals ("a", tmp.Name);
+ Assert (tmp.IsDescendant (nav));
+ Assert (!nav.IsDescendant (tmp));
+ tmp.MoveTo (iter.Current);
+ AssertEquals ("e", tmp.Name);
+ Assert (tmp.IsDescendant (nav));
+ Assert (!nav.IsDescendant (tmp));
+ }
}
}
diff --git a/mcs/class/System.XML/Test/System.Xml.XPath/XPathNavigatorTests.cs b/mcs/class/System.XML/Test/System.Xml.XPath/XPathNavigatorTests.cs
index 7a115ec98e5..2076621a0e8 100644
--- a/mcs/class/System.XML/Test/System.Xml.XPath/XPathNavigatorTests.cs
+++ b/mcs/class/System.XML/Test/System.Xml.XPath/XPathNavigatorTests.cs
@@ -250,6 +250,7 @@ namespace MonoTests.System.Xml
XmlTextReader xtr = new XmlTextReader (xml, XmlNodeType.Document, null);
nav = new XPathDocument (xtr).CreateNavigator ();
Assert ("ctor() from XmlTextReader", !nav.MoveToId ("aaa"));
+ xtr.Close ();
}
}
}
diff --git a/mcs/class/System.XML/Test/System.Xml.Xsl/ChangeLog b/mcs/class/System.XML/Test/System.Xml.Xsl/ChangeLog
index 1f8737f49a8..d997dee41d9 100644
--- a/mcs/class/System.XML/Test/System.Xml.Xsl/ChangeLog
+++ b/mcs/class/System.XML/Test/System.Xml.Xsl/ChangeLog
@@ -1,3 +1,8 @@
+2004-01-03 Atsushi Enomoto <atsushi@ximian.com>
+
+ * XslTransformTests.cs : fixed incorrect file path, and output childnode
+ count.
+
2003-05-13 Martin Willemoes Hansen <mwh@sysrq.dk>
* XslTransformTests.cs: Inherits from Assertion and Assertion.
diff --git a/mcs/class/System.XML/Test/System.Xml.Xsl/XslTransformTests.cs b/mcs/class/System.XML/Test/System.Xml.Xsl/XslTransformTests.cs
index 428645495cd..4d05cef2cd9 100644
--- a/mcs/class/System.XML/Test/System.Xml.Xsl/XslTransformTests.cs
+++ b/mcs/class/System.XML/Test/System.Xml.Xsl/XslTransformTests.cs
@@ -33,10 +33,10 @@ namespace MonoTests.System.Xml.Xsl
public void TestBasicTransform ()
{
doc.LoadXml ("<root/>");
- xslt.Load ("XmlFiles/xsl/empty.xsl");
- xslt.Transform ("XmlFiles/xsl/empty.xsl", "XmlFiles/xsl/result.xml");
- result.Load ("XmlFiles/xsl/result.xml");
- AssertEquals ("count", 1, result.ChildNodes.Count);
+ xslt.Load ("Test/XmlFiles/xsl/empty.xsl");
+ xslt.Transform ("Test/XmlFiles/xsl/empty.xsl", "Test/XmlFiles/xsl/result.xml");
+ result.Load ("Test/XmlFiles/xsl/result.xml");
+ AssertEquals ("count", 2, result.ChildNodes.Count);
}
}
}
diff --git a/mcs/class/System.XML/Test/System.Xml.Xsl/standalone_tests/ChangeLog b/mcs/class/System.XML/Test/System.Xml.Xsl/standalone_tests/ChangeLog
index 6da03540404..2833e2100d4 100755
--- a/mcs/class/System.XML/Test/System.Xml.Xsl/standalone_tests/ChangeLog
+++ b/mcs/class/System.XML/Test/System.Xml.Xsl/standalone_tests/ChangeLog
@@ -1,3 +1,7 @@
+2004-01-28 Atsushi Enomoto <atsushi@ximian.com>
+
+ * xslttest.cs : Now it tests against XPathDocument. Reduced error msgs.
+
2003-12-24 Atsushi Enomoto <atsushi@ximian.com>
* Added testresults.tar.gz and README.
diff --git a/mcs/class/System.XML/Test/System.Xml.Xsl/standalone_tests/xslttest.cs b/mcs/class/System.XML/Test/System.Xml.Xsl/standalone_tests/xslttest.cs
index dc123617c7f..991ddfa2990 100755
--- a/mcs/class/System.XML/Test/System.Xml.Xsl/standalone_tests/xslttest.cs
+++ b/mcs/class/System.XML/Test/System.Xml.Xsl/standalone_tests/xslttest.cs
@@ -3,6 +3,7 @@ using System.Collections;
using System.IO;
using System.Text;
using System.Xml;
+using System.Xml.XPath;
using System.Xml.Xsl;
namespace XsltTest
@@ -14,7 +15,7 @@ namespace XsltTest
// output22,77: not-supported encoding, but MS passes...?
// output72.xsl: should not pass
ArrayList expectedExceptions = new ArrayList
-(new string [] {"lre12.xsl", "namespace40.xsl", "namespace42.xsl", "namespace43.xsl",
+(new string [] {"attribset15.xsl", "lre12.xsl", "namespace40.xsl", "namespace42.xsl", "namespace43.xsl",
"namespace48.xsl", "namespace60.xsl", "namespace73.xsl", "namespace106.xsl",
"output22.xsl", "output72.xsl", "output77.xsl"});
@@ -37,17 +38,17 @@ if (expectedExceptions.Contains (stylesheetBase))
continue;
XmlTextReader stylextr = new XmlTextReader (stylesheet);
XmlValidatingReader stylexvr = new XmlValidatingReader (stylextr);
- XmlDocument styledoc = new XmlDocument ();
- styledoc.Load (stylesheet);
+// XmlDocument styledoc = new XmlDocument ();
+// styledoc.Load (stylesheet);
trans.Load (stylesheet);
// trans.Load (styledoc);
XmlTextReader xtr = new XmlTextReader (srcxml);
XmlValidatingReader xvr = new XmlValidatingReader (xtr);
xvr.ValidationType = ValidationType.None;
- XmlDocument input = new XmlDocument ();
- input.Load (xvr);
+// XmlDocument input = new XmlDocument ();
+// input.Load (xvr);
// input.Load (xtr);
-// XPathDocument input = new XPathDocument (xtr);
+ XPathDocument input = new XPathDocument (xvr);
StringWriter sw = new StringWriter ();
trans.Transform (input, null, sw);
string outfile = path + scenario.SelectSingleNode ("output-file[@role='principal']").InnerText;
@@ -59,7 +60,7 @@ if (expectedExceptions.Contains (stylesheetBase))
string reference_out = sr.ReadToEnd ();
string actual_out = sw.ToString ();
if (reference_out != actual_out)
-#if false
+#if true
Console.WriteLine ("Different: " + testCase.GetAttribute ("id"));
#else
Console.WriteLine ("Different: " +
diff --git a/mcs/class/System.XML/Test/System.Xml/ChangeLog b/mcs/class/System.XML/Test/System.Xml/ChangeLog
index 36b1ce0b6cf..909f986be62 100644
--- a/mcs/class/System.XML/Test/System.Xml/ChangeLog
+++ b/mcs/class/System.XML/Test/System.Xml/ChangeLog
@@ -1,3 +1,42 @@
+2004-01-28 Atsushi Enomoto <atsushi@ximian.com>
+
+ * XmlDocumentTypeTests.cs : Added IncorrectInternalSubset().
+ * XmlNodeTests.cs : Since .NET 1.1 also prohibits multiple document
+ element, removed extraneous test switch for InsertBefore().
+ * XsdParticleValidationTests.cs,
+ XsdValidatingReaderTests.cs : These test class names are too
+ ambiguous so just renamed them. (No bug reports are found on them,
+ but should be warned in the meantime.)
+
+2004-01-23 Atsushi Enomoto <atsushi@ximian.com>
+
+ * XmlElementTests.cs : Added SetAttributeXmlns.
+ * XmlTextWriterTests.cs : Added several xmlns-related tests.
+
+2004-01-22 Atsushi Enomoto <atsushi@ximian.com>
+
+ * XmlTextWriterTests.cs : Added *Do*OutputRemovalDefaultNSDeclaration.
+
+2004-01-20 Atsushi Enomoto <atsushi@ximian.com>
+
+ * XmlElementTests.cs : Added WriteToMakesNonsenseForDefaultNSChildren.
+ * XmlTextWriterTests.cs : Added DontOutputRemovalDefaultNSDeclaration.
+
+2004-01-14 Atsushi Enomoto <atsushi@ximian.com>
+
+ * XmlAttributeCollectionTests.cs : Added RemoveDefaultAttribute().
+ * XmlDocumentTests.cs, XmlElementTests.cs, XmlNodeReaderTests.cs,
+ XmlTextReaderTests.cs, XmlTextWriter.cs, XmlWriterTests.cs :
+ Close or avoid XmlTextReader.
+
+2004-01-03 Atsushi Enomoto <atsushi@ximian.com>
+
+ * XmlAttributeCollectionTests.cs :
+ added InsertAfterReplacesInCorrectOrder().
+ * XmlUrlResolverTests.cs : fixed file path.
+ * XmlTextReaderTests.cs : fixed file path.
+ * XmlTextWriterTests.cs : added ElementXmlnsNeedEscape().
+
2003-12-21 Atsushi Enomoto <atsushi@ximian.com>
* XmlDocumentTests.cs, XmlElementTests.cs :
diff --git a/mcs/class/System.XML/Test/System.Xml/XmlAttributeCollectionTests.cs b/mcs/class/System.XML/Test/System.Xml/XmlAttributeCollectionTests.cs
index 2100687af38..0226c806ff5 100644
--- a/mcs/class/System.XML/Test/System.Xml/XmlAttributeCollectionTests.cs
+++ b/mcs/class/System.XML/Test/System.Xml/XmlAttributeCollectionTests.cs
@@ -136,6 +136,34 @@ namespace MonoTests.System.Xml
}
[Test]
+ public void InsertAfterReplacesInCorrectOrder ()
+ {
+ XmlDocument testDoc = new XmlDocument ();
+ XmlElement testElement = testDoc.CreateElement ("TestElement" );
+ testDoc.AppendChild (testElement);
+
+ XmlAttribute testAttr1 = testDoc.CreateAttribute ("TestAttribute1");
+ testAttr1.Value = "First attribute";
+ testElement.Attributes.Prepend (testAttr1);
+
+ XmlAttribute testAttr2 = testDoc.CreateAttribute ("TestAttribute2");
+ testAttr2.Value = "Second attribute";
+ testElement.Attributes.InsertAfter (testAttr2, testAttr1);
+
+ XmlAttribute testAttr3 = testDoc.CreateAttribute ("TestAttribute3");
+ testAttr3.Value = "Third attribute";
+ testElement.Attributes.InsertAfter (testAttr3, testAttr2);
+
+ XmlAttribute outOfOrder = testDoc.CreateAttribute ("TestAttribute2");
+ outOfOrder.Value = "Should still be second attribute";
+ testElement.Attributes.InsertAfter (outOfOrder, testElement.Attributes [0]);
+
+ AssertEquals ("First attribute", testElement.Attributes [0].Value);
+ AssertEquals ("Should still be second attribute", testElement.Attributes [1].Value);
+ AssertEquals ("Third attribute", testElement.Attributes [2].Value);
+ }
+
+ [Test]
public void Remove ()
{
XmlDocument xmlDoc = new XmlDocument ();
@@ -153,5 +181,24 @@ namespace MonoTests.System.Xml
AssertEquals("RemoveAt", null, el.GetAttributeNode("a6"));
AssertEquals("Remove.Removed", "pearl", attr.Value);
}
+
+ [Test]
+ public void RemoveDefaultAttribute ()
+ {
+ string dtd = "<!DOCTYPE root [<!ELEMENT root EMPTY><!ATTLIST root attr CDATA 'default'>]>";
+ string xml = dtd + "<root/>";
+ XmlDocument doc = new XmlDocument();
+ doc.LoadXml (xml);
+
+ doc.DocumentElement.Attributes ["attr"].Value = "modified";
+ doc.DocumentElement.RemoveAttribute("attr");
+
+ XmlAttribute defAttr = doc.DocumentElement.Attributes ["attr"];
+ AssertNotNull (defAttr);
+ AssertEquals ("default", defAttr.Value);
+
+ defAttr.Value = "default"; // same value as default
+ AssertEquals (true, defAttr.Specified);
+ }
}
}
diff --git a/mcs/class/System.XML/Test/System.Xml/XmlDocumentTests.cs b/mcs/class/System.XML/Test/System.Xml/XmlDocumentTests.cs
index d0430bf02b4..fd953449bee 100644
--- a/mcs/class/System.XML/Test/System.Xml/XmlDocumentTests.cs
+++ b/mcs/class/System.XML/Test/System.Xml/XmlDocumentTests.cs
@@ -1033,6 +1033,7 @@ namespace MonoTests.System.Xml
string xml = dtd + "<root>&ent3;&ent2;</root>";
XmlTextReader xtr = new XmlTextReader (xml, XmlNodeType.Document, null);
document.Load (xtr);
+ xtr.Close ();
}
[Test]
diff --git a/mcs/class/System.XML/Test/System.Xml/XmlDocumentTypeTests.cs b/mcs/class/System.XML/Test/System.Xml/XmlDocumentTypeTests.cs
index 75712b45eb6..3d5b667ffc0 100644
--- a/mcs/class/System.XML/Test/System.Xml/XmlDocumentTypeTests.cs
+++ b/mcs/class/System.XML/Test/System.Xml/XmlDocumentTypeTests.cs
@@ -89,6 +89,19 @@ namespace MonoTests.System.Xml
}
[Test]
+ [ExpectedException (typeof (XmlException))]
+ public void IncorrectInternalSubset ()
+ {
+ XmlDocument doc = new XmlDocument ();
+ XmlDocumentType doctype = doc.CreateDocumentType (
+ "root", "public-hogehoge", null,
+ "invalid_intsubset");
+ doctype = doc.CreateDocumentType ("root",
+ "public-hogehoge", null,
+ "<!ENTITY % pe1 '>'> <!ELEMENT e EMPTY%pe1;");
+ }
+
+ [Test]
public void CloneNode ()
{
XmlNode original = docType;
diff --git a/mcs/class/System.XML/Test/System.Xml/XmlElementTests.cs b/mcs/class/System.XML/Test/System.Xml/XmlElementTests.cs
index 534ce665a0a..f5024999201 100644
--- a/mcs/class/System.XML/Test/System.Xml/XmlElementTests.cs
+++ b/mcs/class/System.XML/Test/System.Xml/XmlElementTests.cs
@@ -91,9 +91,9 @@ namespace MonoTests.System.Xml
{
string dtd = "<!DOCTYPE root [<!ELEMENT root EMPTY><!ATTLIST root foo CDATA 'def'>]>";
string xml = dtd + "<root />";
- XmlValidatingReader xvr = new XmlValidatingReader (new XmlTextReader (xml, XmlNodeType.Document, null));
+// XmlValidatingReader xvr = new XmlValidatingReader (new XmlTextReader (xml, XmlNodeType.Document, null));
XmlDocument doc = new XmlDocument ();
- doc.Load (xvr);
+ doc.LoadXml (xml);
Console.WriteLine (doc.DocumentElement.Attributes.Count);
Console.WriteLine (doc.CreateElement ("root").Attributes.Count);
Console.WriteLine (doc.CreateElement ("root2").Attributes.Count);
@@ -382,6 +382,15 @@ namespace MonoTests.System.Xml
}
[Test]
+ public void SetAttributeXmlns ()
+ {
+ // should not affect Element node's xmlns
+ XmlElement el = document.CreateElement ("root");
+ el.SetAttribute ("xmlns", "urn:foo");
+ AssertEquals (String.Empty, el.NamespaceURI);
+ }
+
+ [Test]
public void InnerTextAndEvent ()
{
XmlDocument doc = new XmlDocument ();
@@ -472,6 +481,22 @@ namespace MonoTests.System.Xml
}
[Test]
+ public void WriteToMakesNonsenseForDefaultNSChildren ()
+ {
+ XmlDocument d = new XmlDocument ();
+ XmlElement x = d.CreateElement ("root");
+ d.AppendChild (x);
+ XmlElement a = d.CreateElement ("a");
+ XmlElement b = d.CreateElement ("b");
+ b.SetAttribute ("xmlns","probe");
+ x.AppendChild (a);
+ x.AppendChild (b);
+ XmlElement b2 = d.CreateElement ("p2", "b2", "");
+ b.AppendChild (b2);
+ AssertEquals ("<root><a /><b xmlns=\"probe\"><b2 /></b></root>", d.OuterXml);
+ }
+
+ [Test]
public void WriteToWithDeletedNamespacePrefix ()
{
XmlDocument doc = new XmlDocument ();
diff --git a/mcs/class/System.XML/Test/System.Xml/XmlNodeReaderTests.cs b/mcs/class/System.XML/Test/System.Xml/XmlNodeReaderTests.cs
index f079f34603c..6847aa37bea 100644
--- a/mcs/class/System.XML/Test/System.Xml/XmlNodeReaderTests.cs
+++ b/mcs/class/System.XML/Test/System.Xml/XmlNodeReaderTests.cs
@@ -37,7 +37,7 @@ namespace MonoTests.System.Xml
try {
nrdr = new XmlNodeReader (null);
Fail ("null reference exception is preferable.");
- } catch (NullReferenceException ex) {
+ } catch (NullReferenceException) {
}
nrdr = new XmlNodeReader (new XmlDocument ());
nrdr.Read ();
@@ -105,6 +105,7 @@ namespace MonoTests.System.Xml
AssertEquals (XmlNodeType.EntityReference, nr.NodeType);
AssertEquals (1, nr.Depth);
nr.ResolveEntity ();
+ AssertEquals (xml, document.OuterXml);
// It is still entity reference.
AssertEquals (XmlNodeType.EntityReference, nr.NodeType);
// It now became element node.
@@ -127,6 +128,7 @@ namespace MonoTests.System.Xml
xtr.Read ();
document.AppendChild (document.ReadNode (xtr));
document.AppendChild (document.ReadNode (xtr));
+ xtr.Close ();
AssertEquals (xml, document.OuterXml);
XmlNodeReader nr = new XmlNodeReader (document);
nr.Read (); // DTD
@@ -156,6 +158,7 @@ namespace MonoTests.System.Xml
XmlTextReader xtr = new XmlTextReader (xml, XmlNodeType.Document, null);
xtr.Read ();
document.AppendChild (document.ReadNode (xtr));
+ xtr.Close ();
AssertEquals (xml, document.OuterXml);
XmlNodeReader nr = new XmlNodeReader (document);
nr.Read (); // root
diff --git a/mcs/class/System.XML/Test/System.Xml/XmlNodeTests.cs b/mcs/class/System.XML/Test/System.Xml/XmlNodeTests.cs
index 89798c150b0..a9aa52eae8c 100644
--- a/mcs/class/System.XML/Test/System.Xml/XmlNodeTests.cs
+++ b/mcs/class/System.XML/Test/System.Xml/XmlNodeTests.cs
@@ -158,17 +158,9 @@ namespace MonoTests.System.Xml
// These are required for .NET 1.0 but not for .NET 1.1.
try {
document.InsertBefore (document.CreateElement ("BAD_MAN"), docelem);
-#if !USE_VERSION_1_1
Fail ("#InsertBefore.BadPositionButNoError.1");
-#endif
- }
-#if USE_VERSION_1_1
- catch (XmlException ex) {
- throw ex;
}
-#else
catch (Exception) {}
-#endif
}
[Test]
diff --git a/mcs/class/System.XML/Test/System.Xml/XmlTextReaderTests.cs b/mcs/class/System.XML/Test/System.Xml/XmlTextReaderTests.cs
index fcde6e751f4..aa4b0aae48e 100644
--- a/mcs/class/System.XML/Test/System.Xml/XmlTextReaderTests.cs
+++ b/mcs/class/System.XML/Test/System.Xml/XmlTextReaderTests.cs
@@ -588,6 +588,7 @@ namespace MonoTests.System.Xml
null);
xtr.Read (); // ws
xtr.Read (); // not-wf xmldecl
+ xtr.Close ();
}
[Test]
@@ -600,6 +601,7 @@ namespace MonoTests.System.Xml
null);
xtr.Read (); // comment
xtr.Read (); // not-wf xmldecl
+ xtr.Close ();
}
[Test]
@@ -612,6 +614,7 @@ namespace MonoTests.System.Xml
null);
xtr.Read (); // PI
xtr.Read (); // not-wf xmldecl
+ xtr.Close ();
}
[Test]
@@ -623,6 +626,7 @@ namespace MonoTests.System.Xml
XmlNodeType.Document,
null);
xtr.Read ();
+ xtr.Close ();
}
[Test]
@@ -631,6 +635,7 @@ namespace MonoTests.System.Xml
XmlTextReader xtr = new XmlTextReader (
"<foo /><bar />", XmlNodeType.Element, null);
xtr.Read ();
+ xtr.Close ();
}
[Test]
@@ -639,13 +644,14 @@ namespace MonoTests.System.Xml
XmlTextReader xtr = new XmlTextReader (
"test", XmlNodeType.Attribute, null);
xtr.Read ();
+ xtr.Close ();
}
[Test]
public void ExternalDocument ()
{
XmlDocument doc = new XmlDocument ();
- doc.Load ("XmlFiles/nested-dtd-test.xml");
+ doc.Load ("Test/XmlFiles/nested-dtd-test.xml");
}
[Test]
@@ -657,6 +663,7 @@ namespace MonoTests.System.Xml
xtr.Normalization = true;
xtr.Read ();
xtr.Read ();
+ xtr.Close ();
}
[Test]
@@ -666,6 +673,7 @@ namespace MonoTests.System.Xml
XmlTextReader xtr = new XmlTextReader (xml, XmlNodeType.Document, null);
xtr.Read ();
xtr.Read ();
+ xtr.Close ();
}
[Test]
@@ -679,6 +687,7 @@ namespace MonoTests.System.Xml
XmlTextReader xtr = new XmlTextReader (xml, XmlNodeType.Document, null);
while (!xtr.EOF)
xtr.Read ();
+ xtr.Close ();
}
[Test]
@@ -693,6 +702,7 @@ namespace MonoTests.System.Xml
XmlTextReader xtr = new XmlTextReader (xml, XmlNodeType.Document, null);
while (!xtr.EOF)
xtr.Read ();
+ xtr.Close ();
}
[Test]
@@ -741,6 +751,7 @@ namespace MonoTests.System.Xml
AssertEquals (134, bytes2 [4]);
AssertEquals (184, bytes2 [5]);
AssertEquals (0, bytes2 [6]);
+ xtr.Close ();
xtr = new XmlTextReader (base64, XmlNodeType.Document, null);
bytes2 = new byte [10];
@@ -765,6 +776,7 @@ namespace MonoTests.System.Xml
AssertEquals (134, bytes2 [3]);
AssertEquals (184, bytes2 [4]);
AssertEquals (0, bytes2 [5]);
+ xtr.Close ();
}
}
}
diff --git a/mcs/class/System.XML/Test/System.Xml/XmlTextWriterTests.cs b/mcs/class/System.XML/Test/System.Xml/XmlTextWriterTests.cs
index 8154ac87528..0cf04a16710 100644
--- a/mcs/class/System.XML/Test/System.Xml/XmlTextWriterTests.cs
+++ b/mcs/class/System.XML/Test/System.Xml/XmlTextWriterTests.cs
@@ -364,6 +364,15 @@ namespace MonoTests.System.Xml
}
[Test]
+ public void ElementXmlnsNeedEscape ()
+ {
+ xtw.WriteStartElement ("test", "foo", "'");
+ xtw.WriteEndElement ();
+ // MS.NET fails this case.
+ AssertEquals ("<test:foo xmlns:test='&apos;' />", StringWriterText);
+ }
+
+ [Test]
public void ElementEmpty ()
{
xtw.WriteStartElement ("foo");
@@ -1036,6 +1045,7 @@ namespace MonoTests.System.Xml
wr.Close();
// This method don't always have to take this double-quoted style...
AssertEquals("#WriteAttributes.Element", "<root a1=\"A\" b2=\"B\" c3=\"C\" />", sw.ToString().Trim());
+ xtr.Close ();
}
[Test]
@@ -1092,5 +1102,146 @@ namespace MonoTests.System.Xml
doc2.LoadXml(doc.InnerXml);
AssertEquals (xml.Replace ('\'', '"'), doc2.OuterXml);
}
+
+ [Test]
+ public void DontOutputRemovalDefaultNSDeclaration ()
+ {
+ xtw.WriteStartDocument ();
+ xtw.WriteStartElement ("foo");
+ xtw.WriteAttributeString ("xmlns", "probe");
+ AssertEquals (String.Empty, xtw.LookupPrefix ("probe"));
+ xtw.WriteStartElement ("b");
+ AssertEquals (String.Empty, xtw.LookupPrefix ("probe"));
+ xtw.WriteStartElement (null, "b2", null); // *Don't* output xmlns=""
+ xtw.WriteEndElement (); // b2
+ xtw.WriteStartElement (null, "b2", ""); // *Do* output xmlns=""
+ xtw.WriteEndElement (); // b2
+ xtw.WriteEndElement (); // b
+ xtw.WriteEndElement (); // foo
+ xtw.WriteEndDocument ();
+ xtw.Close ();
+
+ AssertEquals ("<?xml version='1.0' encoding='utf-16'?><foo xmlns='probe'><b><b2 /><b2 xmlns='' /></b></foo>", StringWriterText);
+ }
+
+ [Test]
+ public void DontOutputRemovalDefaultNSDeclaration2 ()
+ {
+ xtw.WriteStartDocument ();
+ // IMPORTANT DIFFERENCE!! ns = "", not null
+ xtw.WriteStartElement ("foo", "");
+ xtw.WriteAttributeString ("xmlns", "probe");
+ AssertNull (xtw.LookupPrefix ("probe"));
+ xtw.WriteStartElement ("b");
+ AssertNull (xtw.LookupPrefix ("probe"));
+ xtw.WriteStartElement (null, "b2", null); // *Don't* output xmlns=""
+ xtw.WriteEndElement (); // b2
+ xtw.WriteStartElement (null, "b2", ""); // *Do* output xmlns=""
+ xtw.WriteEndElement (); // b2
+ xtw.WriteEndElement (); // b
+ xtw.WriteEndElement (); // foo
+ xtw.WriteEndDocument ();
+ xtw.Close ();
+
+ AssertEquals ("<?xml version='1.0' encoding='utf-16'?><foo xmlns='probe'><b><b2 /><b2 /></b></foo>", StringWriterText);
+ }
+
+ [Test]
+ public void DoOutputRemovalDefaultNSDeclaration ()
+ {
+ xtw.WriteStartElement ("docelem", "a-namespace");
+
+ XmlDocument doc = new XmlDocument ();
+ doc.CreateElement ("hola").WriteTo (xtw);
+ // This means, WriteTo never passes null NamespaceURI argument to XmlWriter.
+ xtw.WriteEndElement ();
+ xtw.Close ();
+
+ AssertEquals ("<docelem xmlns='a-namespace'><hola xmlns='' /></docelem>", StringWriterText);
+ }
+
+ [Test]
+ public void WriteAttributeTakePrecedenceOnXmlns ()
+ {
+ xtw.WriteStartElement ("root", "urn:foo");
+ xtw.WriteAttributeString ("xmlns", "urn:bar");
+ xtw.WriteEndElement ();
+ xtw.Close ();
+ AssertEquals ("<root xmlns='urn:bar' />", StringWriterText);
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentException))]
+ public void LookupPrefixNull ()
+ {
+ xtw.LookupPrefix (null);
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentException))]
+ public void LookupPrefixEmpty ()
+ {
+ xtw.LookupPrefix (String.Empty);
+ }
+
+ [Test]
+ public void LookupPrefixIgnoresXmlnsAttribute ()
+ {
+ AssertNull (xtw.LookupPrefix ("urn:foo"));
+ xtw.WriteStartElement ("root");
+ AssertNull (xtw.LookupPrefix ("urn:foo"));
+ xtw.WriteAttributeString ("xmlns", "urn:foo");
+ // Surprisingly to say, it is ignored!!
+ AssertEquals (String.Empty, xtw.LookupPrefix ("urn:foo"));
+ xtw.WriteStartElement ("hoge");
+ // (still after flushing previous start element.)
+ AssertEquals (String.Empty, xtw.LookupPrefix ("urn:foo"));
+ xtw.WriteStartElement ("fuga", "urn:foo");
+ // Is this testing on the correct way? Yes, here it is.
+ AssertEquals (String.Empty, xtw.LookupPrefix ("urn:foo"));
+ }
+
+ [Test]
+ public void WriteInvalidNames ()
+ {
+ xtw.WriteStartElement ("foo<>");
+ xtw.WriteAttributeString ("ho<>ge", "value");
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentException))]
+ public void AttributeWriteStartAttributePrefixWithoutNS ()
+ {
+ xtw.WriteStartAttribute ("some", "foo", null);
+ }
+
+ [Test]
+ public void AttributeWriteStartAttributeXmlnsNullNS ()
+ {
+ xtw.WriteStartAttribute ("xmlns", "foo", null);
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentException))]
+ public void AttributeWriteEndAttributeXmlnsNullNs ()
+ {
+ // Compare with the test AttributeWriteStartAttributeXmlnsNullNS().
+ xtw.WriteStartAttribute ("xmlns", "foo", null);
+ xtw.WriteEndAttribute ();
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentException))]
+ public void AttributeWriteStartAttributePrefixXmlnsNonW3CNS ()
+ {
+ xtw.WriteStartAttribute ("xmlns", "foo", "urn:foo");
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentException))]
+ public void AttributeWriteStartAttributeLocalXmlnsNonW3CNS ()
+ {
+ xtw.WriteStartAttribute ("", "xmlns", "urn:foo");
+ }
}
}
diff --git a/mcs/class/System.XML/Test/System.Xml/XmlUrlResolverTests.cs b/mcs/class/System.XML/Test/System.Xml/XmlUrlResolverTests.cs
index f9c3d078fdb..bff6d3ad206 100644
--- a/mcs/class/System.XML/Test/System.Xml/XmlUrlResolverTests.cs
+++ b/mcs/class/System.XML/Test/System.Xml/XmlUrlResolverTests.cs
@@ -27,7 +27,7 @@ namespace MonoTests.System.Xml
[Test]
public void FileUri ()
{
- Uri resolved = resolver.ResolveUri (null, "XmlFiles/xsd/xml.xsd");
+ Uri resolved = resolver.ResolveUri (null, "Test/XmlFiles/xsd/xml.xsd");
AssertEquals ("file", resolved.Scheme);
Stream s = resolver.GetEntity (resolved, null, typeof (Stream)) as Stream;
}
diff --git a/mcs/class/System.XML/Test/System.Xml/XmlWriterTests.cs b/mcs/class/System.XML/Test/System.Xml/XmlWriterTests.cs
index bb12d23a73e..2d7a10964c9 100644
--- a/mcs/class/System.XML/Test/System.Xml/XmlWriterTests.cs
+++ b/mcs/class/System.XML/Test/System.Xml/XmlWriterTests.cs
@@ -54,6 +54,7 @@ namespace MonoTests.System.Xml
xtr = new XmlTextReader (xml, XmlNodeType.Document, null);
xtw.WriteNode (xtr, false);
AssertEquals (xml, writer.ToString ());
+ xtr.Close ();
}
[Test]
@@ -67,6 +68,7 @@ namespace MonoTests.System.Xml
xtw.WriteNode (xtr, false);
AssertEquals ("<?xml version='1.0'?>",
writer.ToString ());
+ xtr.Close ();
}
[Test]
@@ -79,6 +81,7 @@ namespace MonoTests.System.Xml
xtw.WriteNode (xtr, false);
AssertEquals (xml.Replace ("'", "\""),
writer.ToString ());
+ xtr.Close ();
}
[Test]
@@ -100,6 +103,7 @@ namespace MonoTests.System.Xml
xtw.WriteNode (xtr, false);
AssertEquals (xml.Replace ("'", "\""),
writer.ToString ());
+ xtr.Close ();
}
[Test]
@@ -109,6 +113,7 @@ namespace MonoTests.System.Xml
XmlTextReader xtr = new XmlTextReader ("", XmlNodeType.Element, null);
xtr.Read ();
xtw.WriteNode (xtr, false); // does not report any errors
+ xtr.Close ();
}
[Test]
@@ -116,7 +121,7 @@ namespace MonoTests.System.Xml
{
setupWriter ();
xtw.WriteSurrogateCharEntity ('\udfff', '\udb00');
- AssertEquals ("&#xd03ff;", writer.ToString ());
+ AssertEquals ("&#xD03FF;", writer.ToString ());
try {
xtw.WriteSurrogateCharEntity ('\ud800', '\udc00');
diff --git a/mcs/class/System.XML/Test/System.Xml/XsdParticleValidationTests.cs b/mcs/class/System.XML/Test/System.Xml/XsdParticleValidationTests.cs
index f6462e28197..fbb16db0481 100644
--- a/mcs/class/System.XML/Test/System.Xml/XsdParticleValidationTests.cs
+++ b/mcs/class/System.XML/Test/System.Xml/XsdParticleValidationTests.cs
@@ -16,7 +16,7 @@ namespace MonoTests.System.Xml
// using XmlValidatingReader = XmlTextReader;
[TestFixture]
- public class XsdValidatingReaderTests : Assertion
+ public class XsdParticleValidationTests : Assertion
{
XmlSchema schema;
XmlReader xr;
@@ -24,7 +24,7 @@ namespace MonoTests.System.Xml
private void PrepareReader1 (string xsdUrl, string xml)
{
- schema = XmlSchema.Read (new XmlTextReader ("XmlFiles/XsdValidation/" + xsdUrl), null);
+ schema = XmlSchema.Read (new XmlTextReader ("Test/XmlFiles/XsdValidation/" + xsdUrl), null);
xr = new XmlTextReader (xml, XmlNodeType.Document, null);
xvr = new XmlValidatingReader (xr);
xvr.Schemas.Add (schema);
@@ -36,6 +36,9 @@ namespace MonoTests.System.Xml
{
PrepareReader1 ("1.xsd", "<root xmlns='urn:foo' />");
xvr.Read ();
+ PrepareReader1 ("1.xsd", "<root xmlns='urn:foo'></root>");
+ xvr.Read ();
+ xvr.Read ();
}
[Test]
diff --git a/mcs/class/System.XML/Test/System.Xml/XsdValidatingReaderTests.cs b/mcs/class/System.XML/Test/System.Xml/XsdValidatingReaderTests.cs
index 4c7313bbf0b..b6b5295712e 100644
--- a/mcs/class/System.XML/Test/System.Xml/XsdValidatingReaderTests.cs
+++ b/mcs/class/System.XML/Test/System.Xml/XsdValidatingReaderTests.cs
@@ -14,9 +14,9 @@ using NUnit.Framework;
namespace MonoTests.System.Xml
{
[TestFixture]
- public class XsdValidationTests : Assertion
+ public class XsdValidatingReaderTests : Assertion
{
- public XsdValidationTests ()
+ public XsdValidatingReaderTests ()
{
}
@@ -97,6 +97,8 @@ namespace MonoTests.System.Xml
xvr.Read (); // element root
AssertEquals (XmlNodeType.Element, xvr.NodeType);
+ AssertNotNull (xvr.SchemaType);
+ Assert (xvr.SchemaType is XmlSchemaDatatype);
o = xvr.ReadTypedValue (); // read "12"
AssertEquals (XmlNodeType.EndElement, xvr.NodeType);
AssertNotNull (o);
diff --git a/mcs/class/System.XML/Test/System.Xml/standalone_tests/ChangeLog b/mcs/class/System.XML/Test/System.Xml/standalone_tests/ChangeLog
new file mode 100755
index 00000000000..3e9c627654e
--- /dev/null
+++ b/mcs/class/System.XML/Test/System.Xml/standalone_tests/ChangeLog
@@ -0,0 +1,7 @@
+2004-01-28 Atsushi Enomoto <atsushi@ximian.com>
+
+ * xmltest.cs : several bugfixes.
+
+2004-01-14 Atsushi Enomoto <atsushi@ximian.com>
+
+ * README, Makefile, xmltest.cs : Initial checkin.
diff --git a/mcs/class/System.XML/Test/System.Xml/standalone_tests/Makefile b/mcs/class/System.XML/Test/System.Xml/standalone_tests/Makefile
new file mode 100755
index 00000000000..8491922205e
--- /dev/null
+++ b/mcs/class/System.XML/Test/System.Xml/standalone_tests/Makefile
@@ -0,0 +1,24 @@
+RUNTIME = mono
+MCS_RUNTIME =
+MCS = mcs
+TESTS = xsd-test-suite/suntest/SunTestsAll/xsiType1.xsd
+TEST_ARCHIVE = xmlts20031210.zip
+
+xmltest.exe : xmltest.cs $(TESTS)
+ $(MCS_RUNTIME) $(MCS) xmltest.cs
+
+$(TESTS) : $(TEST_ARCHIVE) xml-test-suite
+ cd xml-test-suite; unzip -n ../$(TEST_ARCHIVE); cd ..
+
+$(TEST_ARCHIVE) :
+ wget http://www.w3.org/XML/Test/xmlts20031210.zip
+
+xml-test-suite:
+ mkdir xml-test-suite
+
+test :
+ $(RUNTIME) xmltest.exe
+
+# be careful to use it. This removes ALL files in xml-test-suite!
+# clean:
+# rm -rf xml-test-suite
diff --git a/mcs/class/System.XML/Test/System.Xml/standalone_tests/README b/mcs/class/System.XML/Test/System.Xml/standalone_tests/README
new file mode 100755
index 00000000000..36609d2bdc0
--- /dev/null
+++ b/mcs/class/System.XML/Test/System.Xml/standalone_tests/README
@@ -0,0 +1,13 @@
+
+Small XML test system::
+
+This is a small standalone test system using W3C XML test collection.
+http://www.w3.org/XML/Test/
+
+"make" will do what you need (downloading test archive, expanding,
+compiling test runner).
+
+"make test" will do the actual tests.
+
+Atsushi Eno <atsushi@ximian.com>
+
diff --git a/mcs/class/System.XML/Test/System.Xml/standalone_tests/xmltest.cs b/mcs/class/System.XML/Test/System.Xml/standalone_tests/xmltest.cs
new file mode 100755
index 00000000000..ee98da75c52
--- /dev/null
+++ b/mcs/class/System.XML/Test/System.Xml/standalone_tests/xmltest.cs
@@ -0,0 +1,147 @@
+using System;
+using System.IO;
+using System.Xml;
+using System.Xml.Schema;
+using System.Xml.Serialization;
+
+public class Test
+{
+ static char SEP = Path.DirectorySeparatorChar;
+
+ public static void Main ()
+ {
+ RunInvalidTest ("xmltest", false);
+ RunInvalidTest ("ibm", false);
+ RunInvalidTest ("sun", true);
+
+ RunValidTest ("xmltest", false);
+ RunValidTest ("ibm", false);
+ RunValidTest ("sun", true);
+
+ RunNotWellFormedTest ("xmltest", false);
+ RunNotWellFormedTest ("ibm", false);
+ RunNotWellFormedTest ("sun", true);
+
+ RunOASISTest ();
+ }
+
+ static void RunOASISTest ()
+ {
+ XmlDocument doc = new XmlDocument ();
+ foreach (FileInfo fi in
+ new DirectoryInfo (@"XML-Test-Suite/xmlconf/oasis").GetFiles ("*.xml")) {
+ try {
+ XmlTextReader xtr = new XmlTextReader (fi.FullName);
+ xtr.Namespaces = false;
+ xtr.Normalization = true;
+ doc.RemoveAll ();
+ doc.Load (xtr);
+ if (fi.Name.IndexOf ("fail") >= 0)
+ Console.WriteLine ("Incorrectly valid: " + fi.FullName);
+ } catch (Exception ex) {
+ if (fi.Name.IndexOf ("pass") >= 0)
+ Console.WriteLine ("Incorrectly invalid: " + fi.FullName + "\n" + ex.Message);
+ }
+ }
+ }
+
+ static void RunNotWellFormedTest (string subdir, bool isSunTest)
+ {
+ string basePath = @"xml-test-suite/xmlconf/" + subdir + @"/not-wf";
+ DirectoryInfo [] dirs = null;
+ if (isSunTest)
+ dirs = new DirectoryInfo [] {new DirectoryInfo (basePath)};
+ else
+ dirs = new DirectoryInfo (basePath).GetDirectories ();
+
+ XmlDocument doc = new XmlDocument ();
+ foreach (DirectoryInfo di in dirs) {
+ foreach (FileInfo fi in di.GetFiles ("*.xml")) {
+ try {
+ XmlTextReader xtr = new XmlTextReader (fi.FullName);
+ xtr.Namespaces = false;
+ doc.RemoveAll ();
+ doc.Load (xtr);
+ Console.WriteLine ("Incorrectly wf: " + fi.FullName);
+ } catch (XmlException) {
+ // expected
+ } catch (Exception ex) {
+ Console.WriteLine ("Unexpected Error: " + fi.FullName + "\n" + ex.Message);
+ }
+ }
+ }
+ }
+
+ static void RunValidTest (string subdir, bool isSunTest)
+ {
+ string basePath = @"xml-test-suite/xmlconf/" + subdir + @"/valid";
+ DirectoryInfo [] dirs = null;
+ if (isSunTest)
+ dirs = new DirectoryInfo [] {new DirectoryInfo (basePath)};
+ else
+ dirs = new DirectoryInfo (basePath).GetDirectories ();
+
+ XmlDocument doc = new XmlDocument ();
+ foreach (DirectoryInfo di in dirs) {
+ foreach (FileInfo fi in di.GetFiles ("*.xml")) {
+ try {
+ XmlTextReader xtr = new XmlTextReader (fi.FullName);
+ xtr.Namespaces = false;
+ xtr.Normalization = true;
+ XmlReader xr = new XmlValidatingReader (xtr);
+ while (!xr.EOF)
+ xr.Read ();
+ } catch (XmlException ex) {
+ Console.WriteLine ("Incorrectly not-wf: " + fi.FullName + " " + ex.Message);
+ } catch (XmlSchemaException ex) {
+ Console.WriteLine ("Incorrectly invalid: " + fi.FullName + " " + ex.Message);
+ } catch (Exception ex) {
+ Console.WriteLine ("Unexpected Error: " + fi.FullName + "\n" + ex.Message);
+ }
+ }
+ }
+ }
+
+ static void RunInvalidTest (string subdir, bool isSunTest)
+ {
+ string basePath = @"xml-test-suite/xmlconf/" + subdir + @"/invalid";
+ DirectoryInfo [] dirs = null;
+ if (isSunTest)
+ dirs = new DirectoryInfo [] {new DirectoryInfo (basePath)};
+ else
+ dirs = new DirectoryInfo (basePath).GetDirectories ();
+
+ XmlDocument doc = new XmlDocument ();
+ foreach (DirectoryInfo di in dirs) {
+ foreach (FileInfo fi in di.GetFiles ("*.xml")) {
+ try {
+ XmlTextReader xtr = new XmlTextReader (fi.FullName);
+ xtr.Namespaces = false;
+ xtr.Normalization = true;
+ doc.RemoveAll ();
+ while (!xtr.EOF)
+ xtr.Read ();
+ } catch (Exception ex) {
+ Console.WriteLine ("Incorrectly not-wf: " + fi.FullName + String.Concat ("(", ex.GetType ().Name, ") " + ex.Message));
+ }
+ }
+ }
+
+ foreach (DirectoryInfo di in dirs) {
+ foreach (FileInfo fi in di.GetFiles ("*.xml")) {
+ try {
+ XmlTextReader xtr = new XmlTextReader (fi.FullName);
+ xtr.Namespaces = false;
+ xtr.Normalization = true;
+ doc.RemoveAll ();
+ doc.Load (new XmlValidatingReader (xtr));
+ Console.WriteLine ("Incorrectly valid: " + fi.FullName);
+ } catch (XmlSchemaException) {
+ // expected
+ } catch (Exception ex) {
+ Console.WriteLine ("Unexpected Error: " + fi.FullName + "\n" + ex.Message);
+ }
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.XML/Test/XmlFiles/xsd/2.xsd b/mcs/class/System.XML/Test/XmlFiles/xsd/2.xsd
new file mode 100755
index 00000000000..7e640228c0a
--- /dev/null
+++ b/mcs/class/System.XML/Test/XmlFiles/xsd/2.xsd
@@ -0,0 +1,11 @@
+<xs:schema
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns="urn:bar"
+ targetNamespace="urn:bar"
+>
+
+<!-- just for flag deserialization -->
+<xs:element name="Foo" type="xs:string" block="extension" />
+<xs:element name="Bar" type="xs:string" block="extension restriction" />
+
+</xs:schema>
diff --git a/mcs/class/System.XML/Test/XmlFiles/xsd/3.xsd b/mcs/class/System.XML/Test/XmlFiles/xsd/3.xsd
new file mode 100755
index 00000000000..b0d6700b6f5
--- /dev/null
+++ b/mcs/class/System.XML/Test/XmlFiles/xsd/3.xsd
@@ -0,0 +1,11 @@
+<xs:schema
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns="urn:bar"
+ targetNamespace="urn:foo"
+>
+
+<xs:import schemaLocation="4.xsd" namespace="urn:bar" />
+<xs:element name="Foo" type="xs:string" />
+<xs:element name="Bar" type="xs:string" />
+
+</xs:schema>
diff --git a/mcs/class/System.XML/Test/XmlFiles/xsd/4.xsd b/mcs/class/System.XML/Test/XmlFiles/xsd/4.xsd
new file mode 100755
index 00000000000..9139bd69eaf
--- /dev/null
+++ b/mcs/class/System.XML/Test/XmlFiles/xsd/4.xsd
@@ -0,0 +1,11 @@
+<xs:schema
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns="urn:bar"
+ targetNamespace="urn:bar"
+>
+
+<!-- to be included from 3.xsd -->
+<xs:element name="Foo" type="xs:int" />
+<xs:element name="Bar" type="xs:int" />
+
+</xs:schema>
diff --git a/mcs/class/System.XML/Test/XmlFiles/xsd/5.xsd b/mcs/class/System.XML/Test/XmlFiles/xsd/5.xsd
new file mode 100755
index 00000000000..49d78a8afc6
--- /dev/null
+++ b/mcs/class/System.XML/Test/XmlFiles/xsd/5.xsd
@@ -0,0 +1,14 @@
+<xs:schema
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="urn:bar"
+>
+
+<xs:element name="Foo">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="Bar" form="unqualified" />
+ </xs:sequence>
+ </xs:complexType>
+</xs:element>
+
+</xs:schema>
diff --git a/mcs/class/System.XML/Test/XmlFiles/xsd/6.xsd b/mcs/class/System.XML/Test/XmlFiles/xsd/6.xsd
new file mode 100755
index 00000000000..8448b81b207
--- /dev/null
+++ b/mcs/class/System.XML/Test/XmlFiles/xsd/6.xsd
@@ -0,0 +1,15 @@
+<xs:schema
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="urn:bar"
+ elementFormDefault="unqualified"
+>
+
+<xs:element name="Foo">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="Bar" form="qualified" />
+ </xs:sequence>
+ </xs:complexType>
+</xs:element>
+
+</xs:schema>
diff --git a/mcs/class/System.XML/Test/XmlFiles/xsd/ChangeLog b/mcs/class/System.XML/Test/XmlFiles/xsd/ChangeLog
index 350f206dbf3..cca4c6dd8d2 100644
--- a/mcs/class/System.XML/Test/XmlFiles/xsd/ChangeLog
+++ b/mcs/class/System.XML/Test/XmlFiles/xsd/ChangeLog
@@ -1,3 +1,7 @@
+2004-01-03 Atsushi Enomoto <atsushi@ximian.com>
+
+ * Added 2,3,4,5 and 6.xsd
+
2003-07-19 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
* added 1.xsd.
diff --git a/mcs/class/System/.cvsignore b/mcs/class/System/.cvsignore
index 715bf593fe7..da1f33de3a0 100644
--- a/mcs/class/System/.cvsignore
+++ b/mcs/class/System/.cvsignore
@@ -1,3 +1,5 @@
+System_test.dll
+System_test.pdb
System.dll
list
.makefrag
diff --git a/mcs/class/System/ChangeLog b/mcs/class/System/ChangeLog
index 20be7ebe36e..94f6dc8f388 100644
--- a/mcs/class/System/ChangeLog
+++ b/mcs/class/System/ChangeLog
@@ -1,3 +1,13 @@
+2004-01-21 Atsushi Enomoto <atsushi@ximian.com>
+
+ * System_test.dll.sources : Added CodeGeneratorIdentifierTest.cs
+
+2004-01-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * System.dll.sources: added new files.
+
+ * System_test.dll.sources: added new test.
+
2004-01-01 Nick Drochak <ndrochak@gol.com>
* Makefile: Suppress warnings about multiple Regex defs and obsolete
diff --git a/mcs/class/System/Microsoft.CSharp/CSharpCodeCompiler.cs b/mcs/class/System/Microsoft.CSharp/CSharpCodeCompiler.cs
index 09ee6b98b20..a8fd829e1cd 100644
--- a/mcs/class/System/Microsoft.CSharp/CSharpCodeCompiler.cs
+++ b/mcs/class/System/Microsoft.CSharp/CSharpCodeCompiler.cs
@@ -49,7 +49,7 @@ namespace Mono.CSharp
foreach (CodeCompileUnit e in ea) {
fileNames [i] = GetTempFileNameWithExtension ("cs");
FileStream f=new FileStream(fileNames[i],FileMode.OpenOrCreate);
- StreamWriter s=new StreamWriter(f);
+ StreamWriter s=new StreamWriter(f, Encoding.UTF8);
if (e.ReferencedAssemblies != null) {
foreach (string str in e.ReferencedAssemblies) {
if (!assemblies.Contains (str))
diff --git a/mcs/class/System/Microsoft.CSharp/CSharpCodeGenerator.cs b/mcs/class/System/Microsoft.CSharp/CSharpCodeGenerator.cs
index d120b7568e9..174aa27914d 100644
--- a/mcs/class/System/Microsoft.CSharp/CSharpCodeGenerator.cs
+++ b/mcs/class/System/Microsoft.CSharp/CSharpCodeGenerator.cs
@@ -504,11 +504,11 @@ namespace Mono.CSharp
MemberAttributes attributes = method.Attributes;
- if (method.PrivateImplementationType == null)
- {
+ if (method.PrivateImplementationType == null && !declaration.IsInterface)
OutputMemberAccessModifier( attributes );
- };
- OutputMemberScopeModifier( attributes );
+
+ if (!declaration.IsInterface)
+ OutputMemberScopeModifier( attributes );
OutputType( method.ReturnType );
@@ -786,16 +786,24 @@ namespace Mono.CSharp
* ICodeGenerator
*/
- //[MonoTODO]
- protected override string CreateEscapedIdentifier( string value )
+ protected override string CreateEscapedIdentifier (string value)
{
- return value;
+ return GetSafeName (value);
}
- //[MonoTODO]
- protected override string CreateValidIdentifier( string value )
+ protected override string CreateValidIdentifier (string value)
{
- return value;
+ if (value == null)
+ throw new NullReferenceException ();
+
+ if (keywordsTable == null) {
+ FillKeywordTable ();
+ }
+
+ if (keywordsTable.Contains (value))
+ return "_" + value;
+ else
+ return value;
}
protected override string GetTypeOutput( CodeTypeReference type )
@@ -902,13 +910,18 @@ namespace Mono.CSharp
string GetSafeName (string id)
{
if (keywordsTable == null) {
- keywordsTable = new Hashtable ();
- foreach (string keyword in keywords) keywordsTable.Add (keyword,keyword);
+ FillKeywordTable ();
}
if (keywordsTable.Contains (id)) return "@" + id;
else return id;
}
+ static void FillKeywordTable ()
+ {
+ keywordsTable = new Hashtable ();
+ foreach (string keyword in keywords) keywordsTable.Add (keyword,keyword);
+ }
+
static Hashtable keywordsTable;
static string[] keywords = new string[] {
"abstract","event","new","struct","as","explicit","null","switch","base","extern",
diff --git a/mcs/class/System/Microsoft.CSharp/ChangeLog b/mcs/class/System/Microsoft.CSharp/ChangeLog
index 7e0a2c11c03..ec78cc8b140 100644
--- a/mcs/class/System/Microsoft.CSharp/ChangeLog
+++ b/mcs/class/System/Microsoft.CSharp/ChangeLog
@@ -1,13 +1,28 @@
+2004-01-21 Atsushi Enomoto <atsushi@ximian.com>
+
+ * CSharpCodeGenerator.cs: Implemented CreateEscapedIdentifier() and
+ CreateValidIdentifier().
+
+2004-01-19 Lluis Sanchez Gual <lluis@ximian.com>
+
+ * CSharpCodeGenerator.cs: Do not generate access and scope modifiers for
+ interface methods.
+
+2004-01-10 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * CSharpCodeCompiler.cs: when generating files from DOM, set the
+ encoding to UTF-8 with BOM marker. Fixes bug #52604.
+
2003-11-12 Lluis Sanchez Gual <lluis@ximian.com>
- * CSharpCodeCompiler.cs: In BuildArgs, add "--" separator between options
- and source files.
+ * CSharpCodeCompiler.cs: In BuildArgs, add "--" separator between
+ options and source files.
2003-10-15 Lluis Sanchez Gual <lluis@ximian.com>
* CSharpCodeGenerator.cs: added override for the method
- GenerateParameterDeclarationExpression. The parameter must be generated
- with a safe C# name.
+ GenerateParameterDeclarationExpression. The parameter must be
+ generated with a safe C# name.
2003-09-18 Gonzalo Paniagua Javier <gonzalo@ximian.com>
diff --git a/mcs/class/System/System.CodeDom/ChangeLog b/mcs/class/System/System.CodeDom/ChangeLog
index dd4757d1e8c..55336616552 100644
--- a/mcs/class/System/System.CodeDom/ChangeLog
+++ b/mcs/class/System/System.CodeDom/ChangeLog
@@ -1,3 +1,9 @@
+2003-12-23 Jaroslaw Kowalski <jaak@zd.com.pl>
+
+ * CodeAttributeDeclaration.cs:
+ * CodeDelegateInvokeExpression:
+ -Added "params" keyword to constructors
+
2003-08-15 Jaroslaw Kowalski <jarek@atm.com.pl>
* CodeTypeDeclaration.cs:
diff --git a/mcs/class/System/System.CodeDom/CodeAttributeDeclaration.cs b/mcs/class/System/System.CodeDom/CodeAttributeDeclaration.cs
index 49d0c8d7ca3..1e365466225 100755
--- a/mcs/class/System/System.CodeDom/CodeAttributeDeclaration.cs
+++ b/mcs/class/System/System.CodeDom/CodeAttributeDeclaration.cs
@@ -32,7 +32,7 @@ namespace System.CodeDom
this.name = name;
}
- public CodeAttributeDeclaration (string name, CodeAttributeArgument [] arguments)
+ public CodeAttributeDeclaration (string name, params CodeAttributeArgument [] arguments)
{
this.name = name;
Arguments.AddRange (arguments);
diff --git a/mcs/class/System/System.CodeDom/CodeDelegateInvokeExpression.cs b/mcs/class/System/System.CodeDom/CodeDelegateInvokeExpression.cs
index 84fa6a69669..c6126c08811 100755
--- a/mcs/class/System/System.CodeDom/CodeDelegateInvokeExpression.cs
+++ b/mcs/class/System/System.CodeDom/CodeDelegateInvokeExpression.cs
@@ -34,7 +34,7 @@ namespace System.CodeDom
}
public CodeDelegateInvokeExpression (CodeExpression targetObject,
- CodeExpression [] parameters)
+ params CodeExpression [] parameters)
{
this.targetObject = targetObject;
this.Parameters.AddRange( parameters );
diff --git a/mcs/class/System/System.IO/ChangeLog b/mcs/class/System/System.IO/ChangeLog
index 7364988b9b3..34b54eef895 100755
--- a/mcs/class/System/System.IO/ChangeLog
+++ b/mcs/class/System/System.IO/ChangeLog
@@ -1,6 +1,43 @@
+2004-01-27 Nick Drochak <ndrochak@ieee.org>
+
+ * FAMWatcher.cs:
+ * FileSystemWatcher.cs: Remove unused variables. Eliminates a couple of
+ build warnings.
+
+2004-01-26 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * DefaultWatcher.cs: fixed condition for removal from the watches list.
+
+2004-01-26 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * DefaultWatcher.cs: check if the FileSystemWatcher is in WaitForChange
+ and call Monitor.PulseAll in that case.
+
+2004-01-21 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * DefaultWatcher.cs: implemented.
+ * FAMWatcher.cs: don't stop the thread when we add a new watch.
+ * FileSystemWatcher.cs: on windows we use the default watcher by now.
+
+2004-01-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * DefaultWatcher.cs: stub for the default watcher.
+ * WindowsWatcher.cs: stub for the windows watcher.
+
+ * FAMWatcher.cs: FAM watcher.
+
+ * FileAction.cs: enum with event types.
+
+ * FileSystemEventArgs.cs: added SetName property.
+ * FileSystemWatcher.cs: added support for the 3 watchers.
+
+ * IFileWatcher.cs: interface implemented by the watchers.
+ * SearchPattern.cs: copied from corlib.
+
2003-07-17 Andreas Nahr <ClassDevelopment@A-SoftTech.com>
- * FileSystemWatcher.cs: Reworked attributes based on the new Consts scheme
+ * FileSystemWatcher.cs: Reworked attributes based on the new Consts
+ scheme
2003-07-13 Andreas Nahr <ClassDevelopment@A-SoftTech.com>
diff --git a/mcs/class/System/System.IO/DefaultWatcher.cs b/mcs/class/System/System.IO/DefaultWatcher.cs
new file mode 100644
index 00000000000..ddb55ea26b4
--- /dev/null
+++ b/mcs/class/System/System.IO/DefaultWatcher.cs
@@ -0,0 +1,262 @@
+//
+// System.IO.DefaultWatcher.cs: default IFileWatcher
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (c) 2004 Novell, Inc. (http://www.novell.com)
+//
+
+using System;
+using System.Collections;
+using System.IO;
+using System.Threading;
+
+namespace System.IO {
+ class DefaultWatcherData {
+ public FileSystemWatcher FSW;
+ public string Directory;
+ public string FileMask;
+ public bool IncludeSubdirs;
+ public bool Enabled;
+ public DateTime DisabledTime;
+ public Hashtable Files;
+ }
+
+ class FileData {
+ public string Directory;
+ public FileAttributes Attributes;
+ public bool NotExists;
+ public DateTime CreationTime;
+ public DateTime LastWriteTime;
+ }
+
+ class DefaultWatcher : IFileWatcher
+ {
+ static DefaultWatcher instance;
+ static Thread thread;
+ static Hashtable watches;
+
+ private DefaultWatcher ()
+ {
+ }
+
+ public static bool GetInstance (out IFileWatcher watcher)
+ {
+ lock (typeof (DefaultWatcher)) {
+ if (instance != null) {
+ watcher = instance;
+ return true;
+ }
+
+ instance = new DefaultWatcher ();
+ watcher = instance;
+ return true;
+ }
+ }
+
+ public void StartDispatching (FileSystemWatcher fsw)
+ {
+ DefaultWatcherData data;
+ lock (this) {
+ if (watches == null)
+ watches = new Hashtable ();
+
+ if (thread == null) {
+ thread = new Thread (new ThreadStart (Monitor));
+ thread.IsBackground = true;
+ thread.Start ();
+ }
+ }
+
+ lock (watches) {
+ data = (DefaultWatcherData) watches [fsw];
+ if (data == null) {
+ data = new DefaultWatcherData ();
+ data.Files = new Hashtable ();
+ watches [fsw] = data;
+ }
+
+ data.FSW = fsw;
+ data.Directory = fsw.FullPath;
+ data.FileMask = fsw.Filter;
+ data.IncludeSubdirs = fsw.IncludeSubdirectories;
+ data.Enabled = true;
+ data.DisabledTime = DateTime.MaxValue;
+ UpdateDataAndDispatch (data, false);
+ }
+ }
+
+ public void StopDispatching (FileSystemWatcher fsw)
+ {
+ DefaultWatcherData data;
+ lock (watches) {
+ data = (DefaultWatcherData) watches [fsw];
+ if (data != null) {
+ data.Enabled = false;
+ data.DisabledTime = DateTime.Now;
+ }
+ }
+ }
+
+
+ void Monitor ()
+ {
+ int zeroes = 0;
+
+ while (true) {
+ lock (watches) {
+ if (watches.Count > 0) {
+ zeroes = 0;
+ ArrayList removed = null;
+ foreach (DefaultWatcherData data in watches.Values) {
+ bool remove = UpdateDataAndDispatch (data, true);
+ if (remove) {
+ if (removed == null)
+ removed = new ArrayList ();
+
+ removed.Add (data);
+ }
+ }
+
+ if (removed != null) {
+ foreach (DefaultWatcherData data in removed)
+ watches.Remove (data.FSW);
+
+ removed.Clear ();
+ removed = null;
+ }
+ } else {
+ zeroes++;
+ if (zeroes == 20)
+ break;
+ }
+ }
+ Thread.Sleep (750);
+ }
+
+ lock (this) {
+ thread = null;
+ }
+ }
+
+ bool UpdateDataAndDispatch (DefaultWatcherData data, bool dispatch)
+ {
+ if (!data.Enabled) {
+ return (data.DisabledTime != DateTime.MaxValue &&
+ (DateTime.Now - data.DisabledTime).TotalSeconds > 5);
+ }
+
+ DoFiles (data, data.Directory, data.FileMask, dispatch);
+ if (!data.IncludeSubdirs)
+ return false;
+
+ foreach (string directory in Directory.GetDirectories (data.Directory)) {
+ DoFiles (data, directory, data.FileMask, dispatch);
+ }
+
+ return false;
+ }
+
+ static void DispatchEvents (FileSystemWatcher fsw, FileAction action, string filename)
+ {
+ RenamedEventArgs renamed = null;
+
+ lock (fsw) {
+ fsw.DispatchEvents (action, filename, ref renamed);
+ if (fsw.Waiting) {
+ fsw.Waiting = false;
+ System.Threading.Monitor.PulseAll (fsw);
+ }
+ }
+ }
+
+ void DoFiles (DefaultWatcherData data, string directory, string filemask, bool dispatch)
+ {
+ string [] files = Directory.GetFiles (directory, filemask);
+ /* Set all as untested */
+ foreach (string filename in data.Files.Keys) {
+ FileData fd = (FileData) data.Files [filename];
+ if (fd.Directory == directory)
+ fd.NotExists = true;
+ }
+
+ /* New files */
+ foreach (string filename in files) {
+ FileData fd = (FileData) data.Files [filename];
+ if (fd == null) {
+ data.Files.Add (filename, CreateFileData (directory, filename));
+ if (dispatch)
+ DispatchEvents (data.FSW, FileAction.Added, filename);
+ } else if (fd.Directory == directory) {
+ fd.NotExists = false;
+ }
+ }
+
+ if (!dispatch) // We only initialize the file list
+ return;
+
+ /* Removed files */
+ ArrayList removed = null;
+ foreach (string filename in data.Files.Keys) {
+ FileData fd = (FileData) data.Files [filename];
+ if (fd.NotExists) {
+ if (removed == null)
+ removed = new ArrayList ();
+
+ removed.Add (filename);
+ DispatchEvents (data.FSW, FileAction.Removed, filename);
+ }
+ }
+
+ if (removed != null) {
+ foreach (string filename in removed)
+ data.Files.Remove (filename);
+
+ removed = null;
+ }
+
+ /* Changed files */
+ foreach (string filename in data.Files.Keys) {
+ FileData fd = (FileData) data.Files [filename];
+ DateTime creation, write;
+ try {
+ creation = File.GetCreationTime (filename);
+ write = File.GetLastWriteTime (filename);
+ } catch {
+ /* Deleted */
+ if (removed == null)
+ removed = new ArrayList ();
+
+ removed.Add (filename);
+ DispatchEvents (data.FSW, FileAction.Removed, filename);
+ continue;
+ }
+
+ if (creation != fd.CreationTime || write != fd.LastWriteTime) {
+ fd.CreationTime = creation;
+ fd.LastWriteTime = write;
+ DispatchEvents (data.FSW, FileAction.Modified, filename);
+ }
+ }
+
+ if (removed != null) {
+ foreach (string filename in removed)
+ data.Files.Remove (filename);
+ }
+
+ }
+
+ static FileData CreateFileData (string directory, string filename)
+ {
+ FileData fd = new FileData ();
+ string fullpath = Path.Combine (directory, filename);
+ fd.Directory = directory;
+ fd.Attributes = File.GetAttributes (fullpath);
+ fd.CreationTime = File.GetCreationTime (fullpath);
+ fd.LastWriteTime = File.GetLastWriteTime (fullpath);
+ return fd;
+ }
+ }
+}
+
diff --git a/mcs/class/System/System.IO/FAMWatcher.cs b/mcs/class/System/System.IO/FAMWatcher.cs
new file mode 100644
index 00000000000..a85123fbdce
--- /dev/null
+++ b/mcs/class/System/System.IO/FAMWatcher.cs
@@ -0,0 +1,263 @@
+//
+// System.IO.FAM.cs: interface with libfam
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (c) 2004 Novell, Inc. (http://www.novell.com)
+//
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Text;
+using System.Threading;
+
+namespace System.IO {
+ struct FAMConnection {
+ public int FD;
+ IntPtr opaque;
+ }
+
+ struct FAMRequest {
+ public int ReqNum;
+ }
+
+ enum FAMCodes {
+ Changed = 1,
+ Deleted = 2,
+ StartExecuting = 3,
+ StopExecuting = 4,
+ Created = 5,
+ Moved = 6,
+ Acknowledge = 7,
+ Exists = 8,
+ EndExist = 9
+ };
+
+ class FAMData {
+ public FileSystemWatcher FSW;
+ public string Directory;
+ public string FileMask;
+ public bool IncludeSubdirs;
+ public bool Enabled;
+ public FAMRequest Request;
+ }
+
+ class FAMWatcher : IFileWatcher
+ {
+ static bool failed;
+ static FAMWatcher instance;
+ static Hashtable watches;
+ static Hashtable requests;
+ static FAMConnection conn;
+ static Thread thread;
+ static bool stop;
+
+ private FAMWatcher ()
+ {
+ }
+
+ public static bool GetInstance (out IFileWatcher watcher)
+ {
+ lock (typeof (FAMWatcher)) {
+ if (failed == true) {
+ watcher = null;
+ return false;
+ }
+
+ if (instance != null) {
+ watcher = instance;
+ return true;
+ }
+
+ watches = new Hashtable ();
+ requests = new Hashtable ();
+ if (FAMOpen (out conn) == -1) {
+ failed = true;
+ watcher = null;
+ return false;
+ }
+
+ instance = new FAMWatcher ();
+ watcher = instance;
+ return true;
+ }
+ }
+
+ public void StartDispatching (FileSystemWatcher fsw)
+ {
+ FAMData data;
+ lock (this) {
+ if (thread == null) {
+ thread = new Thread (new ThreadStart (Monitor));
+ thread.IsBackground = true;
+ thread.Start ();
+ }
+
+ data = (FAMData) watches [fsw];
+ }
+
+ if (data == null) {
+ data = new FAMData ();
+ data.FSW = fsw;
+ data.Directory = fsw.FullPath;
+ data.FileMask = fsw.Filter;
+ data.IncludeSubdirs = fsw.IncludeSubdirectories;
+ data.Enabled = true;
+ lock (this) {
+ StartMonitoringDirectory (data);
+ watches [fsw] = data;
+ requests [data.Request.ReqNum] = data;
+ stop = false;
+ }
+ }
+ }
+
+ static void StartMonitoringDirectory (FAMData data)
+ {
+ FAMRequest fr;
+ if (FAMMonitorDirectory (ref conn, data.Directory, out fr, IntPtr.Zero) == -1)
+ throw new Win32Exception ();
+
+ data.Request = fr;
+ }
+
+ public void StopDispatching (FileSystemWatcher fsw)
+ {
+ FAMData data;
+ lock (this) {
+ data = (FAMData) watches [fsw];
+ if (data == null)
+ return;
+
+ StopMonitoringDirectory (data);
+ watches.Remove (fsw);
+ requests.Remove (data.Request.ReqNum);
+ if (watches.Count == 0)
+ stop = true;
+ }
+ }
+
+ static void StopMonitoringDirectory (FAMData data)
+ {
+ if (FAMCancelMonitor (ref conn, ref data.Request) == -1)
+ throw new Win32Exception ();
+ }
+
+ void Monitor ()
+ {
+ while (!stop) {
+ int haveEvents;
+ lock (this) {
+ haveEvents = FAMPending (ref conn);
+ }
+
+ if (haveEvents > 0) {
+ ProcessEvents ();
+ } else {
+ Thread.Sleep (500);
+ }
+ }
+
+ lock (this) {
+ thread = null;
+ stop = false;
+ }
+ }
+
+ const NotifyFilters changed = NotifyFilters.Attributes |
+ NotifyFilters.LastAccess |
+ NotifyFilters.Size |
+ NotifyFilters.LastWrite;
+
+ void ProcessEvents ()
+ {
+ lock (this) {
+ do {
+ int code;
+ string filename;
+ int requestNumber;
+ FileSystemWatcher fsw;
+
+ if (InternalFAMNextEvent (ref conn, out filename,
+ out code, out requestNumber) != 1)
+ return;
+
+ bool found = false;
+ switch ((FAMCodes) code) {
+ case FAMCodes.Changed:
+ case FAMCodes.Deleted:
+ case FAMCodes.Created:
+ found = requests.ContainsKey (requestNumber);
+ break;
+ case FAMCodes.Moved:
+ case FAMCodes.StartExecuting:
+ case FAMCodes.StopExecuting:
+ case FAMCodes.Acknowledge:
+ case FAMCodes.Exists:
+ case FAMCodes.EndExist:
+ default:
+ found = false;
+ break;
+ }
+
+ if (!found)
+ continue;
+
+ FAMData data = (FAMData) requests [requestNumber];
+ if (!data.Enabled)
+ continue;
+
+ fsw = data.FSW;
+ NotifyFilters flt = fsw.NotifyFilter;
+ RenamedEventArgs renamed = null;
+ FileAction fa = 0;
+ if (code == (int) FAMCodes.Changed && (flt & changed) != 0)
+ fa = FileAction.Modified;
+ else if (code == (int) FAMCodes.Deleted)
+ fa = FileAction.Removed;
+ else if (code == (int) FAMCodes.Created)
+ fa = FileAction.Added;
+
+ if (fa != 0) {
+ if (filename != data.Directory && !fsw.Pattern.IsMatch (filename))
+ continue;
+
+ lock (fsw) {
+ fsw.DispatchEvents (fa, filename, ref renamed);
+ if (fsw.Waiting) {
+ fsw.Waiting = false;
+ System.Threading.Monitor.PulseAll (fsw);
+ }
+ }
+ }
+
+ } while (FAMPending (ref conn) > 0);
+ }
+ }
+
+ [DllImport ("fam")]
+ extern static int FAMOpen (out FAMConnection fc);
+
+ [DllImport ("fam")]
+ extern static int FAMClose (ref FAMConnection fc);
+
+ [DllImport ("fam")]
+ extern static int FAMMonitorDirectory (ref FAMConnection fc, string filename,
+ out FAMRequest fr, IntPtr user_data);
+
+ [DllImport ("fam")]
+ extern static int FAMCancelMonitor (ref FAMConnection fc, ref FAMRequest fr);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ extern static int InternalFAMNextEvent (ref FAMConnection fc, out string filename,
+ out int code, out int reqnum);
+
+ [DllImport ("fam")]
+ extern static int FAMPending (ref FAMConnection fc);
+ }
+}
+
diff --git a/mcs/class/System/System.IO/FileAction.cs b/mcs/class/System/System.IO/FileAction.cs
new file mode 100644
index 00000000000..d5827cf7cb5
--- /dev/null
+++ b/mcs/class/System/System.IO/FileAction.cs
@@ -0,0 +1,18 @@
+//
+// System.IO.FileAction.cs
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (c) 2004 Novell, Inc. (http://www.novell.com)
+//
+
+namespace System.IO {
+ enum FileAction {
+ Added = 1,
+ Removed = 2,
+ Modified = 3,
+ RenamedOldName = 4,
+ RenamedNewName = 5
+ }
+}
diff --git a/mcs/class/System/System.IO/FileSystemEventArgs.cs b/mcs/class/System/System.IO/FileSystemEventArgs.cs
index 924ed7e1c2a..05ddecfbeb6 100644
--- a/mcs/class/System/System.IO/FileSystemEventArgs.cs
+++ b/mcs/class/System/System.IO/FileSystemEventArgs.cs
@@ -29,6 +29,10 @@ namespace System.IO {
this.name = name;
}
+ internal void SetName (string name)
+ {
+ this.name = name;
+ }
#endregion // Constructors
#region Properties
diff --git a/mcs/class/System/System.IO/FileSystemWatcher.cs b/mcs/class/System/System.IO/FileSystemWatcher.cs
index ccd21674e12..883c81b76d5 100644
--- a/mcs/class/System/System.IO/FileSystemWatcher.cs
+++ b/mcs/class/System/System.IO/FileSystemWatcher.cs
@@ -1,258 +1,463 @@
-//
-// System.IO.FileSystemWatcher.cs
-//
-// Authors:
-// Tim Coleman (tim@timcoleman.com)
-// Gonzalo Paniagua Javier (gonzalo@ximian.com)
-//
-// Copyright (C) Tim Coleman, 2002
-// (c) 2003 Ximian, Inc. (http://www.ximian.com)
-//
-
-using System;
-using System.ComponentModel;
-using System.Threading;
-
-namespace System.IO {
- [DefaultEvent("Changed")]
- public class FileSystemWatcher : Component, ISupportInitialize {
-
- #region Fields
-
- bool enableRaisingEvents;
- string filter;
- bool includeSubdirectories;
- int internalBufferSize;
- NotifyFilters notifyFilter;
- string path;
- ISite site;
- ISynchronizeInvoke synchronizingObject;
-
- #endregion // Fields
-
- #region Constructors
-
- public FileSystemWatcher ()
- {
- this.notifyFilter = NotifyFilters.LastWrite | NotifyFilters.FileName | NotifyFilters.DirectoryName;
- this.enableRaisingEvents = false;
- this.filter = "*.*";
- this.includeSubdirectories = false;
- this.internalBufferSize = 8192;
- this.path = "";
- }
-
- public FileSystemWatcher (string path)
- : this (path, String.Empty)
- {
- }
-
- public FileSystemWatcher (string path, string filter)
- {
- if (path == null)
- throw new ArgumentNullException ("path");
-
- if (filter == null)
- throw new ArgumentNullException ("filter");
-
- if (path == String.Empty)
- throw new ArgumentException ("Empty path", "path");
-
- if (!Directory.Exists (path))
- throw new ArgumentException ("Directory does not exists", "path");
-
- this.enableRaisingEvents = false;
- this.filter = filter;
- this.includeSubdirectories = false;
- this.internalBufferSize = 8192;
- this.notifyFilter = NotifyFilters.LastWrite | NotifyFilters.FileName | NotifyFilters.DirectoryName;
- this.path = path;
- this.synchronizingObject = null;
- }
-
- #endregion // Constructors
-
- #region Properties
-
- [DefaultValue(false)]
- [IODescription("Flag to indicate if this instance is active")]
- public bool EnableRaisingEvents {
- get { return enableRaisingEvents; }
- set { enableRaisingEvents = value; }
- }
-
- [DefaultValue("*.*")]
- [IODescription("File name filter pattern")]
+//
+// System.IO.FileSystemWatcher.cs
+//
+// Authors:
+// Tim Coleman (tim@timcoleman.com)
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// Copyright (C) Tim Coleman, 2002
+// (c) 2003 Ximian, Inc. (http://www.ximian.com)
+// (c) 2004 Novell, Inc. (http://www.novell.com)
+//
+
+using System;
+using System.ComponentModel;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Threading;
+
+namespace System.IO {
+ [DefaultEvent("Changed")]
+ public class FileSystemWatcher : Component, ISupportInitialize {
+
+ #region Fields
+
+ bool enableRaisingEvents;
+ string filter;
+ bool includeSubdirectories;
+ int internalBufferSize;
+ NotifyFilters notifyFilter;
+ string path;
+ string fullpath;
+ ISynchronizeInvoke synchronizingObject;
+ WaitForChangedResult lastData;
+ bool waiting;
+ SearchPattern2 pattern;
+ static IFileWatcher watcher;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public FileSystemWatcher ()
+ {
+ this.notifyFilter = NotifyFilters.LastWrite | NotifyFilters.FileName | NotifyFilters.DirectoryName;
+ this.enableRaisingEvents = false;
+ this.filter = "*.*";
+ this.includeSubdirectories = false;
+ this.internalBufferSize = 8192;
+ this.path = "";
+ InitWatcher ();
+ }
+
+ public FileSystemWatcher (string path)
+ : this (path, "*.*")
+ {
+ }
+
+ public FileSystemWatcher (string path, string filter)
+ {
+ if (path == null)
+ throw new ArgumentNullException ("path");
+
+ if (filter == null)
+ throw new ArgumentNullException ("filter");
+
+ if (path == String.Empty)
+ throw new ArgumentException ("Empty path", "path");
+
+ if (!Directory.Exists (path))
+ throw new ArgumentException ("Directory does not exists", "path");
+
+ this.enableRaisingEvents = false;
+ this.filter = filter;
+ this.includeSubdirectories = false;
+ this.internalBufferSize = 8192;
+ this.notifyFilter = NotifyFilters.LastWrite | NotifyFilters.FileName | NotifyFilters.DirectoryName;
+ this.path = path;
+ this.synchronizingObject = null;
+ InitWatcher ();
+ }
+
+ void InitWatcher ()
+ {
+ lock (typeof (FileSystemWatcher)) {
+ if (watcher != null)
+ return;
+
+ string managed = Environment.GetEnvironmentVariable ("MONO_MANAGED_WATCHER");
+ int mode = 0;
+ if (managed == null)
+ mode = InternalSupportsFSW ();
+
+ bool ok = false;
+ if (mode == 2)
+ ok = FAMWatcher.GetInstance (out watcher);
+ else if (mode == 1)
+ ok = DefaultWatcher.GetInstance (out watcher);
+ //ok = WindowsWatcher.GetInstance (out watcher);
+
+ if (mode == 0 || !ok)
+ DefaultWatcher.GetInstance (out watcher);
+ }
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ /* If this is enabled, we Pulse this instance */
+ internal bool Waiting {
+ get { return waiting; }
+ set { waiting = value; }
+ }
+
+ internal SearchPattern2 Pattern {
+ get {
+ if (pattern == null) {
+ string f = Filter;
+ if (f == "*.*" && !(watcher.GetType () == typeof (WindowsWatcher)))
+ f = "*";
+
+ pattern = new SearchPattern2 (f);
+ }
+ return pattern;
+ }
+ }
+
+ internal string FullPath {
+ get {
+ if (fullpath == null) {
+ if (path == null || path == "")
+ fullpath = Environment.CurrentDirectory;
+ else
+ fullpath = System.IO.Path.GetFullPath (path);
+ }
+
+ return fullpath;
+ }
+ }
+
+ [DefaultValue(false)]
+ [IODescription("Flag to indicate if this instance is active")]
+ public bool EnableRaisingEvents {
+ get { return enableRaisingEvents; }
+ set {
+ if (value == enableRaisingEvents)
+ return; // Do nothing
+
+ enableRaisingEvents = value;
+ if (value) {
+ Start ();
+ } else {
+ Stop ();
+ }
+ }
+ }
+
+ [DefaultValue("*.*")]
+ [IODescription("File name filter pattern")]
[RecommendedAsConfigurable(true)]
- [TypeConverter ("System.Diagnostics.Design.StringValueConverter, " + Consts.AssemblySystem_Design)]
- public string Filter {
- get { return filter; }
- set {
- filter = value;
- if (filter == null || filter == "")
- filter = "*.*";
- }
- }
-
- [DefaultValue(false)]
- [IODescription("Flag to indicate we want to watch subdirectories")]
- public bool IncludeSubdirectories {
- get { return includeSubdirectories; }
- set { includeSubdirectories = value; }
- }
-
- [Browsable(false)]
- [DefaultValue(8192)]
- public int InternalBufferSize {
- get { return internalBufferSize; }
- set { internalBufferSize = value; }
- }
-
- [DefaultValue(NotifyFilters.FileName | NotifyFilters.DirectoryName | NotifyFilters.LastWrite)]
- [IODescription("Flag to indicate which change event we want to monitor")]
- public NotifyFilters NotifyFilter {
- get { return notifyFilter; }
- [MonoTODO ("Perform validation.")]
- set { notifyFilter = value; }
- }
-
- [DefaultValue("")]
- [IODescription("The directory to monitor")]
+ [TypeConverter ("System.Diagnostics.Design.StringValueConverter, " + Consts.AssemblySystem_Design)]
+ public string Filter {
+ get { return filter; }
+ set {
+ if (value == null || value == "")
+ value = "*.*";
+
+ if (filter != value) {
+ filter = value;
+ pattern = null;
+ }
+ }
+ }
+
+ [DefaultValue(false)]
+ [IODescription("Flag to indicate we want to watch subdirectories")]
+ public bool IncludeSubdirectories {
+ get { return includeSubdirectories; }
+ set {
+ if (includeSubdirectories == value)
+ return;
+
+ includeSubdirectories = value;
+ if (value && enableRaisingEvents) {
+ Stop ();
+ Start ();
+ }
+ }
+ }
+
+ [Browsable(false)]
+ [DefaultValue(8192)]
+ public int InternalBufferSize {
+ get { return internalBufferSize; }
+ set {
+ if (internalBufferSize == value)
+ return;
+
+ if (value < 4196)
+ value = 4196;
+
+ internalBufferSize = value;
+ if (enableRaisingEvents) {
+ Stop ();
+ Start ();
+ }
+ }
+ }
+
+ [DefaultValue(NotifyFilters.FileName | NotifyFilters.DirectoryName | NotifyFilters.LastWrite)]
+ [IODescription("Flag to indicate which change event we want to monitor")]
+ public NotifyFilters NotifyFilter {
+ get { return notifyFilter; }
+ set {
+ if (notifyFilter == value)
+ return;
+
+ notifyFilter = value;
+ if (enableRaisingEvents) {
+ Stop ();
+ Start ();
+ }
+ }
+ }
+
+ [DefaultValue("")]
+ [IODescription("The directory to monitor")]
[RecommendedAsConfigurable(true)]
[TypeConverter ("System.Diagnostics.Design.StringValueConverter, " + Consts.AssemblySystem_Design)]
- [Editor ("System.Diagnostics.Design.FSWPathEditor, " + Consts.AssemblySystem_Design, "System.Drawing.Design.UITypeEditor, " + Consts.AssemblySystem_Drawing)]
- public string Path {
- get { return path; }
- set {
- bool exists = false;
- Exception exc = null;
-
- try {
- exists = Directory.Exists (value);
- } catch (Exception e) {
- exists = false;
- exc = e;
- }
-
- if (exc != null)
- throw new ArgumentException ("Invalid directory name", "value", exc);
-
- if (!exists)
- throw new ArgumentException ("Directory does not exists", "value");
-
- path = value;
- }
- }
-
- [Browsable(false)]
- public override ISite Site {
- get { return site; }
- set { site = value; }
- }
-
- [DefaultValue(null)]
- [IODescription("The object used to marshal the event handler calls resulting from a directory change")]
- public ISynchronizeInvoke SynchronizingObject {
- get { return synchronizingObject; }
- set { synchronizingObject = value; }
- }
-
- #endregion // Properties
-
- #region Methods
-
- [MonoTODO]
- public void BeginInit ()
- {
- throw new NotImplementedException ();
- }
-
- [MonoTODO]
- protected override void Dispose (bool disposing)
- {
- if (disposing) {
- //
- }
- base.Dispose (disposing);
- }
-
- [MonoTODO]
- public void EndInit ()
- {
- throw new NotImplementedException ();
- }
-
- private void RaiseEvent (Delegate ev, EventArgs arg)
- {
- if (ev == null)
- return;
-
- object [] args = new object [] {this, arg};
-
- if (synchronizingObject == null) {
- ev.DynamicInvoke (args);
- return;
- }
-
- synchronizingObject.BeginInvoke (ev, args);
- }
-
- protected void OnChanged (FileSystemEventArgs e)
- {
- RaiseEvent (Changed, e);
- }
-
- protected void OnCreated (FileSystemEventArgs e)
- {
- RaiseEvent (Created, e);
- }
-
- protected void OnDeleted (FileSystemEventArgs e)
- {
- RaiseEvent (Deleted, e);
- }
-
- protected void OnError (ErrorEventArgs e)
- {
- RaiseEvent (Error, e);
- }
-
- protected void OnRenamed (RenamedEventArgs e)
- {
- RaiseEvent (Renamed, e);
- }
-
- public WaitForChangedResult WaitForChanged (WatcherChangeTypes changeType)
- {
- return WaitForChanged (changeType, Timeout.Infinite);
- }
-
- [MonoTODO]
- public WaitForChangedResult WaitForChanged (WatcherChangeTypes changeType, int timeout)
- {
- throw new NotImplementedException ();
- }
-
- #endregion // Methods
-
- #region Events and Delegates
-
- [IODescription("Occurs when a file/directory change matches the filter")]
- public event FileSystemEventHandler Changed;
-
-
- [IODescription("Occurs when a file/directory creation matches the filter")]
- public event FileSystemEventHandler Created;
-
- [IODescription("Occurs when a file/directory deletion matches the filter")]
- public event FileSystemEventHandler Deleted;
-
- [Browsable(false)]
- public event ErrorEventHandler Error;
-
- [IODescription("Occurs when a file/directory rename matches the filter")]
- public event RenamedEventHandler Renamed;
-
- #endregion // Events and Delegates
- }
-}
+ [Editor ("System.Diagnostics.Design.FSWPathEditor, " + Consts.AssemblySystem_Design, "System.Drawing.Design.UITypeEditor, " + Consts.AssemblySystem_Drawing)]
+ public string Path {
+ get { return path; }
+ set {
+ if (path == value)
+ return;
+
+ bool exists = false;
+ Exception exc = null;
+
+ try {
+ exists = Directory.Exists (value);
+ } catch (Exception e) {
+ exc = e;
+ }
+
+ if (exc != null)
+ throw new ArgumentException ("Invalid directory name", "value", exc);
+
+ if (!exists)
+ throw new ArgumentException ("Directory does not exists", "value");
+
+ path = value;
+ fullpath = null;
+ if (enableRaisingEvents) {
+ Stop ();
+ Start ();
+ }
+ }
+ }
+
+ [Browsable(false)]
+ public override ISite Site {
+ get { return base.Site; }
+ set { base.Site = value; }
+ }
+
+ [DefaultValue(null)]
+ [IODescription("The object used to marshal the event handler calls resulting from a directory change")]
+ public ISynchronizeInvoke SynchronizingObject {
+ get { return synchronizingObject; }
+ set { synchronizingObject = value; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ [MonoTODO]
+ public void BeginInit ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ protected override void Dispose (bool disposing)
+ {
+ if (disposing) {
+ Stop ();
+ }
+ base.Dispose (disposing);
+ }
+
+ [MonoTODO]
+ public void EndInit ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ private void RaiseEvent (Delegate ev, EventArgs arg)
+ {
+ if (ev == null)
+ return;
+
+ object [] args = new object [] {this, arg};
+
+ if (synchronizingObject == null) {
+ ev.DynamicInvoke (args);
+ return;
+ }
+
+ synchronizingObject.BeginInvoke (ev, args);
+ }
+
+ protected void OnChanged (FileSystemEventArgs e)
+ {
+ RaiseEvent (Changed, e);
+ }
+
+ protected void OnCreated (FileSystemEventArgs e)
+ {
+ RaiseEvent (Created, e);
+ }
+
+ protected void OnDeleted (FileSystemEventArgs e)
+ {
+ RaiseEvent (Deleted, e);
+ }
+
+ protected void OnError (ErrorEventArgs e)
+ {
+ RaiseEvent (Error, e);
+ }
+
+ protected void OnRenamed (RenamedEventArgs e)
+ {
+ RaiseEvent (Renamed, e);
+ }
+
+ public WaitForChangedResult WaitForChanged (WatcherChangeTypes changeType)
+ {
+ return WaitForChanged (changeType, Timeout.Infinite);
+ }
+
+ public WaitForChangedResult WaitForChanged (WatcherChangeTypes changeType, int timeout)
+ {
+ WaitForChangedResult result = new WaitForChangedResult ();
+ bool prevEnabled = EnableRaisingEvents;
+ if (!prevEnabled)
+ EnableRaisingEvents = true;
+
+ bool gotData;
+ lock (this) {
+ waiting = true;
+ gotData = Monitor.Wait (this, timeout);
+ if (gotData)
+ result = this.lastData;
+ }
+
+ EnableRaisingEvents = prevEnabled;
+ if (!gotData)
+ result.TimedOut = true;
+
+ return result;
+ }
+
+ internal void DispatchEvents (FileAction act, string filename, ref RenamedEventArgs renamed)
+ {
+ if (waiting) {
+ lastData = new WaitForChangedResult ();
+ }
+
+ switch (act) {
+ case FileAction.Added:
+ lastData.Name = filename;
+ lastData.ChangeType = WatcherChangeTypes.Created;
+ OnCreated (new FileSystemEventArgs (WatcherChangeTypes.Created, path, filename));
+ break;
+ case FileAction.Removed:
+ lastData.Name = filename;
+ lastData.ChangeType = WatcherChangeTypes.Deleted;
+ OnDeleted (new FileSystemEventArgs (WatcherChangeTypes.Deleted, path, filename));
+ break;
+ case FileAction.Modified:
+ lastData.Name = filename;
+ lastData.ChangeType = WatcherChangeTypes.Changed;
+ OnChanged (new FileSystemEventArgs (WatcherChangeTypes.Changed, path, filename));
+ break;
+ case FileAction.RenamedOldName:
+ if (renamed != null) {
+ OnRenamed (renamed);
+ }
+ lastData.OldName = filename;
+ lastData.ChangeType = WatcherChangeTypes.Renamed;
+ renamed = new RenamedEventArgs (WatcherChangeTypes.Renamed, path, null, filename);
+ break;
+ case FileAction.RenamedNewName:
+ lastData.Name = filename;
+ lastData.ChangeType = WatcherChangeTypes.Renamed;
+ if (renamed != null) {
+ renamed.SetName (filename);
+ } else {
+ renamed = new RenamedEventArgs (WatcherChangeTypes.Renamed, path, filename, null);
+ }
+ OnRenamed (renamed);
+ renamed = null;
+ break;
+ default:
+ break;
+ }
+ }
+
+ void Start ()
+ {
+ watcher.StartDispatching (this);
+ }
+
+ void Stop ()
+ {
+ watcher.StopDispatching (this);
+ }
+ #endregion // Methods
+
+ #region Events and Delegates
+
+ [IODescription("Occurs when a file/directory change matches the filter")]
+ public event FileSystemEventHandler Changed;
+
+ [IODescription("Occurs when a file/directory creation matches the filter")]
+ public event FileSystemEventHandler Created;
+
+ [IODescription("Occurs when a file/directory deletion matches the filter")]
+ public event FileSystemEventHandler Deleted;
+
+ [Browsable(false)]
+ public event ErrorEventHandler Error;
+
+ [IODescription("Occurs when a file/directory rename matches the filter")]
+ public event RenamedEventHandler Renamed;
+
+ #endregion // Events and Delegates
+
+ /* 0 -> not supported */
+ /* 1 -> windows */
+ /* 2 -> FAM */
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ static extern int InternalSupportsFSW ();
+
+ /*[MethodImplAttribute(MethodImplOptions.InternalCall)]
+ static extern IntPtr InternalOpenDirectory (string path, IntPtr reserved);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ static extern IntPtr InternalCloseDirectory (IntPtr handle);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ static extern bool InternalReadDirectoryChanges (IntPtr handle,
+ byte [] buffer,
+ bool includeSubdirectories,
+ NotifyFilters notifyFilter,
+ out NativeOverlapped overlap,
+ OverlappedHandler overlappedCallback);
+
+ */
+ }
+}
diff --git a/mcs/class/System/System.IO/IFileWatcher.cs b/mcs/class/System/System.IO/IFileWatcher.cs
new file mode 100644
index 00000000000..6b9bf6a8316
--- /dev/null
+++ b/mcs/class/System/System.IO/IFileWatcher.cs
@@ -0,0 +1,16 @@
+//
+// System.IO.IFileWatcher.cs
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (c) 2004 Novell, Inc. (http://www.novell.com)
+//
+
+namespace System.IO {
+ interface IFileWatcher {
+ void StartDispatching (FileSystemWatcher fsw);
+ void StopDispatching (FileSystemWatcher fsw);
+ }
+}
+
diff --git a/mcs/class/System/System.IO/SearchPattern.cs b/mcs/class/System/System.IO/SearchPattern.cs
new file mode 100644
index 00000000000..b2bd7839336
--- /dev/null
+++ b/mcs/class/System/System.IO/SearchPattern.cs
@@ -0,0 +1,170 @@
+//
+// System.IO.SearchPattern2.cs: Filename glob support.
+//
+// Author:
+// Dan Lewis (dihlewis@yahoo.co.uk)
+//
+// (C) 2002
+//
+
+// Copied from corlib/System.IO/SearchPatter.cs
+using System;
+
+namespace System.IO {
+
+ // FIXME: there's a complication with this algorithm under windows.
+ // the pattern '*.*' matches all files (i think . matches the extension),
+ // whereas under UNIX it should only match files containing the '.' character.
+
+ class SearchPattern2 {
+ public SearchPattern2 (string pattern) : this (pattern, false) { }
+
+ public SearchPattern2 (string pattern, bool ignore)
+ {
+ this.ignore = ignore;
+ Compile (pattern);
+ }
+
+ public bool IsMatch (string text)
+ {
+ return Match (ops, text, 0);
+ }
+
+ // private
+
+ private Op ops; // the compiled pattern
+ private bool ignore; // ignore case
+
+ private void Compile (string pattern)
+ {
+ if (pattern == null || pattern.IndexOfAny (InvalidChars) >= 0)
+ throw new ArgumentException ("Invalid search pattern.");
+
+ if (pattern == "*") { // common case
+ ops = new Op (OpCode.True);
+ return;
+ }
+
+ ops = null;
+
+ int ptr = 0;
+ Op last_op = null;
+ while (ptr < pattern.Length) {
+ Op op;
+
+ switch (pattern [ptr]) {
+ case '?':
+ op = new Op (OpCode.AnyChar);
+ ++ ptr;
+ break;
+
+ case '*':
+ op = new Op (OpCode.AnyString);
+ ++ ptr;
+ break;
+
+ default:
+ op = new Op (OpCode.ExactString);
+ int end = pattern.IndexOfAny (WildcardChars, ptr);
+ if (end < 0)
+ end = pattern.Length;
+
+ op.Argument = pattern.Substring (ptr, end - ptr);
+ if (ignore)
+ op.Argument = op.Argument.ToLower ();
+
+ ptr = end;
+ break;
+ }
+
+ if (last_op == null)
+ ops = op;
+ else
+ last_op.Next = op;
+
+ last_op = op;
+ }
+
+ if (last_op == null)
+ ops = new Op (OpCode.End);
+ else
+ last_op.Next = new Op (OpCode.End);
+ }
+
+ private bool Match (Op op, string text, int ptr)
+ {
+ while (op != null) {
+ switch (op.Code) {
+ case OpCode.True:
+ return true;
+
+ case OpCode.End:
+ if (ptr == text.Length)
+ return true;
+
+ return false;
+
+ case OpCode.ExactString:
+ int length = op.Argument.Length;
+ if (ptr + length > text.Length)
+ return false;
+
+ string str = text.Substring (ptr, length);
+ if (ignore)
+ str = str.ToLower ();
+
+ if (str != op.Argument)
+ return false;
+
+ ptr += length;
+ break;
+
+ case OpCode.AnyChar:
+ if (++ ptr > text.Length)
+ return false;
+ break;
+
+ case OpCode.AnyString:
+ while (ptr <= text.Length) {
+ if (Match (op.Next, text, ptr))
+ return true;
+
+ ++ ptr;
+ }
+
+ return false;
+ }
+
+ op = op.Next;
+ }
+
+ return true;
+ }
+
+ // private static
+
+ internal static readonly char [] WildcardChars = { '*', '?' };
+ internal static readonly char [] InvalidChars = { Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar };
+
+ private class Op {
+ public Op (OpCode code)
+ {
+ this.Code = code;
+ this.Argument = null;
+ this.Next = null;
+ }
+
+ public OpCode Code;
+ public string Argument;
+ public Op Next;
+ }
+
+ private enum OpCode {
+ ExactString, // literal
+ AnyChar, // ?
+ AnyString, // *
+ End, // end of pattern
+ True // always succeeds
+ };
+ }
+}
diff --git a/mcs/class/System/System.IO/WindowsWatcher.cs b/mcs/class/System/System.IO/WindowsWatcher.cs
new file mode 100644
index 00000000000..9a3f930add3
--- /dev/null
+++ b/mcs/class/System/System.IO/WindowsWatcher.cs
@@ -0,0 +1,31 @@
+//
+// System.IO.WindowsWatcher.cs: windows IFileWatcher
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (c) 2004 Novell, Inc. (http://www.novell.com)
+//
+
+namespace System.IO {
+ class WindowsWatcher : IFileWatcher
+ {
+ private WindowsWatcher ()
+ {
+ }
+
+ public static bool GetInstance (out IFileWatcher watcher)
+ {
+ throw new NotSupportedException ();
+ }
+
+ public void StartDispatching (FileSystemWatcher fsw)
+ {
+ }
+
+ public void StopDispatching (FileSystemWatcher fsw)
+ {
+ }
+ }
+}
+
diff --git a/mcs/class/System/System.Net.Sockets/ChangeLog b/mcs/class/System/System.Net.Sockets/ChangeLog
index 57294c6570d..772650aa634 100644
--- a/mcs/class/System/System.Net.Sockets/ChangeLog
+++ b/mcs/class/System/System.Net.Sockets/ChangeLog
@@ -1,7 +1,24 @@
+2004-01-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Socket.cs: handle WSAEWOULDBLOCK for non-blocking sockets. Fixes
+ bug #53168. Avoid the creation of the ManualResetEvent in class Worker
+ whenever possible.
+
+2004-01-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Socket.cs: if we have a pending async event, delay socket closing
+ until EndX is called. Fixes bug #53229. Check parameters and if the
+ socket has been disposed. Implemented IDisposable explicitly. The
+ threads created have IsBackground = true now.
+
+2004-01-10 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Socket.cs: patch from Brad Fitzpatrick <brad@danga.com> episode 2.
+
2003-12-30 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* Socket.cs: fix for several asynchronous methods to delay exception
- throwing. Patch by Brad FitzpatrickBrad Fitzpatrick <brad@danga.com>.
+ throwing. Patch by Brad Fitzpatrick <brad@danga.com>.
2003-12-18 Gonzalo Paniagua Javier <gonzalo@ximian.com>
diff --git a/mcs/class/System/System.Net.Sockets/Socket.cs b/mcs/class/System/System.Net.Sockets/Socket.cs
index 8f098029906..748f7ba4dce 100644
--- a/mcs/class/System/System.Net.Sockets/Socket.cs
+++ b/mcs/class/System/System.Net.Sockets/Socket.cs
@@ -30,7 +30,6 @@ namespace System.Net.Sockets
public SocketAsyncResult(object state) {
this.state=state;
- waithandle=new ManualResetEvent(false);
completed_sync=completed=false;
}
@@ -51,7 +50,10 @@ namespace System.Net.Sockets
public WaitHandle AsyncWaitHandle {
get {
- return(waithandle);
+ if (waithandle == null)
+ waithandle = new ManualResetEvent (completed);
+
+ return waithandle;
}
set {
waithandle=value;
@@ -70,6 +72,9 @@ namespace System.Net.Sockets
}
set {
completed=value;
+ if (waithandle != null && value) {
+ ((ManualResetEvent) waithandle).Set ();
+ }
}
}
@@ -144,7 +149,6 @@ namespace System.Net.Sockets
}
private void End() {
- ((ManualResetEvent)result.AsyncWaitHandle).Set();
result.IsCompleted=true;
if (callback != null)
callback(result);
@@ -152,7 +156,11 @@ namespace System.Net.Sockets
public void Accept() {
lock(result) {
- acc_socket=socket.Accept();
+ try {
+ acc_socket=socket.Accept();
+ } catch (Exception e) {
+ result.SetDelayedException(e);
+ }
End();
}
}
@@ -174,8 +182,11 @@ namespace System.Net.Sockets
socket.Connect (endpoint);
} catch (SocketException e) {
//WSAEINPROGRESS
- if (e.NativeErrorCode != 10036)
- throw;
+ if (e.NativeErrorCode != 10036) {
+ result.SetDelayedException(e);
+ End ();
+ return;
+ }
socket.Poll (-1, SelectMode.SelectWrite);
try {
@@ -184,17 +195,21 @@ namespace System.Net.Sockets
rethrow = e2;
}
}
- End ();
if (rethrow != null)
- throw rethrow;
+ result.SetDelayedException(rethrow);
+ End ();
}
}
public void Receive() {
lock(result) {
if (socket.Blocking) {
- total=socket.Receive(buffer, offset,
- size, sockflags);
+ try {
+ total=socket.Receive(buffer, offset,
+ size, sockflags);
+ } catch (Exception e) {
+ result.SetDelayedException(e);
+ }
End();
return;
}
@@ -204,8 +219,11 @@ namespace System.Net.Sockets
total = socket.Receive (buffer, offset, size, sockflags);
} catch (SocketException e) {
//WSAEWOULDBLOCK
- if (e.NativeErrorCode != 10035)
- throw;
+ if (e.NativeErrorCode != 10035) {
+ result.SetDelayedException(e);
+ End ();
+ return;
+ }
socket.Poll (-1, SelectMode.SelectRead);
try {
@@ -214,44 +232,129 @@ namespace System.Net.Sockets
rethrow = e2;
}
}
- End ();
if (rethrow != null)
- throw rethrow;
+ result.SetDelayedException(rethrow);
+ End ();
}
}
public void ReceiveFrom() {
lock(result) {
- total=socket.ReceiveFrom(buffer,
- offset, size,
- sockflags,
- ref endpoint);
- End();
+ if (socket.Blocking) {
+ try {
+ total=socket.ReceiveFrom(buffer,
+ offset, size,
+ sockflags,
+ ref endpoint);
+ } catch (Exception e) {
+ result.SetDelayedException(e);
+ }
+ End();
+ return;
+ }
+
+ SocketException rethrow = null;
+ try {
+ total = socket.ReceiveFrom (buffer, offset, size,
+ sockflags, ref endpoint);
+ } catch (SocketException e) {
+ //WSAEWOULDBLOCK
+ if (e.NativeErrorCode != 10035) {
+ result.SetDelayedException(e);
+ End ();
+ return;
+ }
+
+ socket.Poll (-1, SelectMode.SelectRead);
+ try {
+ total = socket.ReceiveFrom (buffer, offset, size,
+ sockflags, ref endpoint);
+ } catch (SocketException e2) {
+ rethrow = e2;
+ }
+ }
+ if (rethrow != null)
+ result.SetDelayedException(rethrow);
+ End ();
}
}
public void Send() {
lock(result) {
+ if (socket.Blocking) {
+ try {
+ total=socket.Send(buffer, offset, size,
+ sockflags);
+ } catch (Exception e) {
+ result.SetDelayedException(e);
+ }
+ End();
+ return;
+ }
+
+ SocketException rethrow = null;
try {
- total=socket.Send(buffer, offset, size,
- sockflags);
- } catch (Exception e) {
- result.SetDelayedException(e);
+ total = socket.Send (buffer, offset, size, sockflags);
+ } catch (SocketException e) {
+ //WSAEWOULDBLOCK
+ if (e.NativeErrorCode != 10035) {
+ result.SetDelayedException(e);
+ End ();
+ return;
+ }
+
+ socket.Poll (-1, SelectMode.SelectWrite);
+ try {
+ total = socket.Send (buffer, offset, size, sockflags);
+ } catch (SocketException e2) {
+ rethrow = e2;
+ }
}
- End();
+
+ if (rethrow != null)
+ result.SetDelayedException(rethrow);
+ End ();
}
}
public void SendTo() {
lock(result) {
+ if (socket.Blocking) {
+ try {
+ total=socket.SendTo(buffer, offset,
+ size, sockflags,
+ endpoint);
+ } catch (Exception e) {
+ result.SetDelayedException(e);
+ }
+ End();
+ return;
+ }
+
+ SocketException rethrow = null;
try {
- total=socket.SendTo(buffer, offset,
- size, sockflags,
- endpoint);
- } catch (Exception e) {
- result.SetDelayedException(e);
- }
- End();
+ total = socket.SendTo (buffer, offset, size,
+ sockflags, endpoint);
+ } catch (SocketException e) {
+ //WSAEWOULDBLOCK
+ if (e.NativeErrorCode != 10035) {
+ result.SetDelayedException(e);
+ End ();
+ return;
+ }
+
+ socket.Poll (-1, SelectMode.SelectWrite);
+ try {
+ total = socket.SendTo (buffer, offset, size,
+ sockflags, endpoint);
+ } catch (SocketException e2) {
+ rethrow = e2;
+ }
+ }
+
+ if (rethrow != null)
+ result.SetDelayedException(rethrow);
+ End ();
}
}
@@ -280,6 +383,8 @@ namespace System.Net.Sockets
private SocketType socket_type;
private ProtocolType protocol_type;
private bool blocking=true;
+ private int pendingEnds;
+ private int closeDelayed;
/*
* These two fields are looked up by name by the runtime, don't change
@@ -291,6 +396,8 @@ namespace System.Net.Sockets
* the last IO operation
*/
private bool connected=false;
+ /* true if we called Close_internal */
+ private bool closed;
/* Used in LocalEndPoint and RemoteEndPoint if the
* Mono.Posix assembly is available
@@ -450,6 +557,9 @@ namespace System.Net.Sockets
public int Available {
get {
+ if (disposed && closed)
+ throw new ObjectDisposedException (GetType ().ToString ());
+
return(Available_internal(socket));
}
}
@@ -487,6 +597,9 @@ namespace System.Net.Sockets
[MonoTODO("Support non-IP endpoints")]
public EndPoint LocalEndPoint {
get {
+ if (disposed && closed)
+ throw new ObjectDisposedException (GetType ().ToString ());
+
SocketAddress sa;
sa=LocalEndPoint_internal(socket);
@@ -517,6 +630,9 @@ namespace System.Net.Sockets
[MonoTODO("Support non-IP endpoints")]
public EndPoint RemoteEndPoint {
get {
+ if (disposed && closed)
+ throw new ObjectDisposedException (GetType ().ToString ());
+
SocketAddress sa;
sa=RemoteEndPoint_internal(socket);
@@ -609,6 +725,9 @@ namespace System.Net.Sockets
private extern static IntPtr Accept_internal(IntPtr sock);
public Socket Accept() {
+ if (disposed && closed)
+ throw new ObjectDisposedException (GetType ().ToString ());
+
IntPtr sock=Accept_internal(socket);
return(new Socket(this.AddressFamily, this.SocketType,
@@ -617,10 +736,16 @@ namespace System.Net.Sockets
public IAsyncResult BeginAccept(AsyncCallback callback,
object state) {
+
+ if (disposed && closed)
+ throw new ObjectDisposedException (GetType ().ToString ());
+
+ Interlocked.Increment (ref pendingEnds);
SocketAsyncResult req=new SocketAsyncResult(state);
Worker worker=new Worker(this, callback, req);
req.Worker=worker;
Thread child=new Thread(new ThreadStart(worker.Accept));
+ child.IsBackground = true;
child.Start();
return(req);
}
@@ -628,11 +753,20 @@ namespace System.Net.Sockets
public IAsyncResult BeginConnect(EndPoint end_point,
AsyncCallback callback,
object state) {
+
+ if (disposed && closed)
+ throw new ObjectDisposedException (GetType ().ToString ());
+
+ if (end_point == null)
+ throw new ArgumentNullException ("end_point");
+
+ Interlocked.Increment (ref pendingEnds);
SocketAsyncResult req=new SocketAsyncResult(state);
Worker worker=new Worker(this, end_point, callback,
req);
req.Worker=worker;
Thread child=new Thread(new ThreadStart(worker.Connect));
+ child.IsBackground = true;
child.Start();
return(req);
}
@@ -642,11 +776,29 @@ namespace System.Net.Sockets
SocketFlags socket_flags,
AsyncCallback callback,
object state) {
+
+ if (disposed && closed)
+ throw new ObjectDisposedException (GetType ().ToString ());
+
+ if (buffer == null)
+ throw new ArgumentNullException ("buffer");
+
+ if (offset < 0)
+ throw new ArgumentOutOfRangeException ("offset must be >= 0");
+
+ if (size < 0)
+ throw new ArgumentOutOfRangeException ("size must be >= 0");
+
+ if (offset + size > buffer.Length)
+ throw new ArgumentOutOfRangeException ("offset + size exceeds the buffer length");
+
+ Interlocked.Increment (ref pendingEnds);
SocketAsyncResult req=new SocketAsyncResult(state);
Worker worker=new Worker(this, buffer, offset, size,
socket_flags, callback, req);
req.Worker=worker;
Thread child=new Thread(new ThreadStart(worker.Receive));
+ child.IsBackground = true;
child.Start();
return(req);
}
@@ -657,12 +809,29 @@ namespace System.Net.Sockets
ref EndPoint remote_end,
AsyncCallback callback,
object state) {
+ if (disposed && closed)
+ throw new ObjectDisposedException (GetType ().ToString ());
+
+ if (buffer == null)
+ throw new ArgumentNullException ("buffer");
+
+ if (offset < 0)
+ throw new ArgumentOutOfRangeException ("offset must be >= 0");
+
+ if (size < 0)
+ throw new ArgumentOutOfRangeException ("size must be >= 0");
+
+ if (offset + size > buffer.Length)
+ throw new ArgumentOutOfRangeException ("offset + size exceeds the buffer length");
+
+ Interlocked.Increment (ref pendingEnds);
SocketAsyncResult req=new SocketAsyncResult(state);
Worker worker=new Worker(this, buffer, offset, size,
socket_flags, remote_end,
callback, req);
req.Worker=worker;
Thread child=new Thread(new ThreadStart(worker.ReceiveFrom));
+ child.IsBackground = true;
child.Start();
return(req);
}
@@ -672,11 +841,28 @@ namespace System.Net.Sockets
SocketFlags socket_flags,
AsyncCallback callback,
object state) {
+ if (disposed && closed)
+ throw new ObjectDisposedException (GetType ().ToString ());
+
+ if (buffer == null)
+ throw new ArgumentNullException ("buffer");
+
+ if (offset < 0)
+ throw new ArgumentOutOfRangeException ("offset must be >= 0");
+
+ if (size < 0)
+ throw new ArgumentOutOfRangeException ("size must be >= 0");
+
+ if (offset + size > buffer.Length)
+ throw new ArgumentOutOfRangeException ("offset + size exceeds the buffer length");
+
+ Interlocked.Increment (ref pendingEnds);
SocketAsyncResult req=new SocketAsyncResult(state);
Worker worker=new Worker(this, buffer, offset, size,
socket_flags, callback, req);
req.Worker=worker;
Thread child=new Thread(new ThreadStart(worker.Send));
+ child.IsBackground = true;
child.Start();
return(req);
}
@@ -687,12 +873,29 @@ namespace System.Net.Sockets
EndPoint remote_end,
AsyncCallback callback,
object state) {
+ if (disposed && closed)
+ throw new ObjectDisposedException (GetType ().ToString ());
+
+ if (buffer == null)
+ throw new ArgumentNullException ("buffer");
+
+ if (offset < 0)
+ throw new ArgumentOutOfRangeException ("offset must be >= 0");
+
+ if (size < 0)
+ throw new ArgumentOutOfRangeException ("size must be >= 0");
+
+ if (offset + size > buffer.Length)
+ throw new ArgumentOutOfRangeException ("offset + size exceeds the buffer length");
+
+ Interlocked.Increment (ref pendingEnds);
SocketAsyncResult req=new SocketAsyncResult(state);
Worker worker=new Worker(this, buffer, offset, size,
socket_flags, remote_end,
callback, req);
req.Worker=worker;
Thread child=new Thread(new ThreadStart(worker.SendTo));
+ child.IsBackground = true;
child.Start();
return(req);
}
@@ -703,8 +906,11 @@ namespace System.Net.Sockets
SocketAddress sa);
public void Bind(EndPoint local_end) {
+ if (disposed && closed)
+ throw new ObjectDisposedException (GetType ().ToString ());
+
if(local_end==null) {
- throw new ArgumentNullException();
+ throw new ArgumentNullException("local_end");
}
Bind_internal(socket, local_end.Serialize());
@@ -715,7 +921,7 @@ namespace System.Net.Sockets
private extern static void Close_internal(IntPtr socket);
public void Close() {
- this.Dispose();
+ ((IDisposable) this).Dispose ();
}
// Connects to the remote address
@@ -724,8 +930,11 @@ namespace System.Net.Sockets
SocketAddress sa);
public void Connect(EndPoint remote_end) {
+ if (disposed && closed)
+ throw new ObjectDisposedException (GetType ().ToString ());
+
if(remote_end==null) {
- throw new ArgumentNullException();
+ throw new ArgumentNullException("remote_end");
}
Connect_internal(socket, remote_end.Serialize());
@@ -733,51 +942,135 @@ namespace System.Net.Sockets
}
public Socket EndAccept(IAsyncResult result) {
- SocketAsyncResult req=(SocketAsyncResult)result;
+ if (disposed && closed)
+ throw new ObjectDisposedException (GetType ().ToString ());
+
+ if (result == null)
+ throw new ArgumentNullException ("result");
- result.AsyncWaitHandle.WaitOne();
+ SocketAsyncResult req = result as SocketAsyncResult;
+ if (req == null)
+ throw new ArgumentException ("Invalid IAsyncResult");
+
+ if (!result.IsCompleted)
+ result.AsyncWaitHandle.WaitOne();
+
+ Interlocked.Decrement (ref pendingEnds);
+ CheckIfClose ();
+ req.CheckIfThrowDelayedException();
return(req.Worker.Socket);
}
public void EndConnect(IAsyncResult result) {
- SocketAsyncResult req=(SocketAsyncResult)result;
+ if (disposed && closed)
+ throw new ObjectDisposedException (GetType ().ToString ());
+
+ if (result == null)
+ throw new ArgumentNullException ("result");
+
+ SocketAsyncResult req = result as SocketAsyncResult;
+ if (req == null)
+ throw new ArgumentException ("Invalid IAsyncResult");
- result.AsyncWaitHandle.WaitOne();
+ if (!result.IsCompleted)
+ result.AsyncWaitHandle.WaitOne();
+
+ Interlocked.Decrement (ref pendingEnds);
+ CheckIfClose ();
req.CheckIfThrowDelayedException();
}
public int EndReceive(IAsyncResult result) {
- SocketAsyncResult req=(SocketAsyncResult)result;
+ if (disposed && closed)
+ throw new ObjectDisposedException (GetType ().ToString ());
+
+ if (result == null)
+ throw new ArgumentNullException ("result");
+
+ SocketAsyncResult req = result as SocketAsyncResult;
+ if (req == null)
+ throw new ArgumentException ("Invalid IAsyncResult");
- result.AsyncWaitHandle.WaitOne();
+ if (!result.IsCompleted)
+ result.AsyncWaitHandle.WaitOne();
+
+ Interlocked.Decrement (ref pendingEnds);
+ CheckIfClose ();
+ req.CheckIfThrowDelayedException();
return(req.Worker.Total);
}
public int EndReceiveFrom(IAsyncResult result,
ref EndPoint end_point) {
- SocketAsyncResult req=(SocketAsyncResult)result;
+ if (disposed && closed)
+ throw new ObjectDisposedException (GetType ().ToString ());
- result.AsyncWaitHandle.WaitOne();
+ if (result == null)
+ throw new ArgumentNullException ("result");
+
+ SocketAsyncResult req = result as SocketAsyncResult;
+ if (req == null)
+ throw new ArgumentException ("Invalid IAsyncResult");
+
+ if (!result.IsCompleted)
+ result.AsyncWaitHandle.WaitOne();
+
+ Interlocked.Decrement (ref pendingEnds);
+ CheckIfClose ();
+ req.CheckIfThrowDelayedException();
end_point=req.Worker.EndPoint;
return(req.Worker.Total);
}
public int EndSend(IAsyncResult result) {
- SocketAsyncResult req=(SocketAsyncResult)result;
+ if (disposed && closed)
+ throw new ObjectDisposedException (GetType ().ToString ());
+
+ if (result == null)
+ throw new ArgumentNullException ("result");
+
+ SocketAsyncResult req = result as SocketAsyncResult;
+ if (req == null)
+ throw new ArgumentException ("Invalid IAsyncResult");
- result.AsyncWaitHandle.WaitOne();
+ if (!result.IsCompleted)
+ result.AsyncWaitHandle.WaitOne();
+
+ Interlocked.Decrement (ref pendingEnds);
+ CheckIfClose ();
req.CheckIfThrowDelayedException();
return(req.Worker.Total);
}
public int EndSendTo(IAsyncResult result) {
- SocketAsyncResult req=(SocketAsyncResult)result;
+ if (disposed && closed)
+ throw new ObjectDisposedException (GetType ().ToString ());
+
+ if (result == null)
+ throw new ArgumentNullException ("result");
+
+ SocketAsyncResult req = result as SocketAsyncResult;
+ if (req == null)
+ throw new ArgumentException ("Invalid IAsyncResult");
- result.AsyncWaitHandle.WaitOne();
+ if (!result.IsCompleted)
+ result.AsyncWaitHandle.WaitOne();
+
+ Interlocked.Decrement (ref pendingEnds);
+ CheckIfClose ();
req.CheckIfThrowDelayedException();
return(req.Worker.Total);
}
+ void CheckIfClose ()
+ {
+ if (Interlocked.CompareExchange (ref closeDelayed, 0, 1) == 1 &&
+ Interlocked.CompareExchange (ref pendingEnds, 0, 0) == 0) {
+ closed = true;
+ Close_internal(socket);
+ }
+ }
+
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private extern static void GetSocketOption_obj_internal(IntPtr socket, SocketOptionLevel level, SocketOptionName name, out object obj_val);
[MethodImplAttribute(MethodImplOptions.InternalCall)]
@@ -1127,7 +1420,7 @@ namespace System.Net.Sockets
return (int) socket;
}
- private bool disposed = false;
+ private bool disposed;
protected virtual void Dispose(bool explicitDisposing) {
// Check to see if Dispose has already been called
@@ -1142,16 +1435,21 @@ namespace System.Net.Sockets
this.disposed=true;
connected=false;
- Close_internal(socket);
+ if (Interlocked.CompareExchange (ref pendingEnds, 0, 0) == 0) {
+ closed = true;
+ Close_internal(socket);
+ } else {
+ Interlocked.CompareExchange (ref closeDelayed, 1, 0);
+ }
}
}
- public void Dispose() {
- Dispose(true);
- // Take yourself off the Finalization queue
- GC.SuppressFinalize(this);
+ void IDisposable.Dispose ()
+ {
+ Dispose (true);
+ GC.SuppressFinalize (this);
}
-
+
~Socket () {
Dispose(false);
}
diff --git a/mcs/class/System/System.Net/ChangeLog b/mcs/class/System/System.Net/ChangeLog
index 075a18a4b1c..f924908f3a0 100644
--- a/mcs/class/System/System.Net/ChangeLog
+++ b/mcs/class/System/System.Net/ChangeLog
@@ -1,3 +1,71 @@
+2004-01-27 Nick Drochak <ndrochak@ieee.org>
+
+ * DigestClient.cs:
+ * HttpWebRequest.cs:
+ * IPv6Address.cs:
+ * WebClient.cs:
+ * WebConnection.cs:
+ * WebConnectionStream.cs: Remove unused variables thus eliminating some
+ build warnings.
+
+
+
+2004-01-26 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * WebConnection.cs: patch by Yaacov Akiba Slama that fixes 100-continue
+ handling for the case when the same packet also contains the actual
+ [2-5]xx response.
+
+2004-01-24 Lluis Sanchez Gual <lluis@ximian.com>
+
+ * HttpWebRequest.cs: Added missing property.
+
+2004-01-23 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Dns.cs: don't block forever in EndResolve and EndGetHostByName. Fixes
+ bug #53222.
+
+2004-01-16 Lluis Sanchez Gual <lluis@ximian.com>
+
+ * ChunkStream.cs: The "size" parameter of Write is not the number of
+ bytes to write, but the last offset to be written. Thus, in WriteAndRead
+ Back, since "read" is not an offset but the number of bytes, it must be
+ added to the offset. Maybe it would be a good idea to change the name of
+ the parameter, since it is confusing. This should fix bug #52591.
+
+2004-01-12 Lluis Sanchez Gual <lluis@ximian.com>
+
+ * WebConnection.cs: Yet another fix for WebConnection. This fixes
+ bug #52169.
+
+2004-01-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * WebConnection.cs: Data.Init is a bad boy. Lluis realized. He also
+ tidied up the end of ReadDone. Disabled relaunching the request if 2
+ InitRead are called, since now we don't throw everything into
+ RegisterWaitForSingleObject but one request at a time.
+
+ * WebConnectionGroup.cs: when checking available connections, allow them
+ not to be Connected but allocated to honor the connection limit.
+
+ * WebConnectionStream.cs: CheckComplete() now checks for nextReadCalled
+ too. ReadAll don't mess contentLength if it's provided in the headers.
+
+ BIG thanks to Lluis. Turns out that we were debugging the same stuff and
+ his Data.Init discovery was THE thing I was missing.
+
+ Fixes bug #51277.
+
+2004-01-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ServicePointManager.cs: use GetMaxConnections to get the appropiate
+ number of connections limit.
+
+2004-01-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * MonoHttpDate.cs: use the invariant culture, not en-US. Suspected
+ guilty for bug 52629.
+
2003-12-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* CredentialCache.cs: return null instead of throwing NotImplemented.
diff --git a/mcs/class/System/System.Net/ChunkStream.cs b/mcs/class/System/System.Net/ChunkStream.cs
index 7929d98c217..1f212dbefee 100644
--- a/mcs/class/System/System.Net/ChunkStream.cs
+++ b/mcs/class/System/System.Net/ChunkStream.cs
@@ -53,7 +53,7 @@ namespace System.Net
public void WriteAndReadBack (byte [] buffer, int offset, int size, ref int read)
{
- Write (buffer, offset, read);
+ Write (buffer, offset, offset+read);
read = Read (buffer, offset, size);
}
diff --git a/mcs/class/System/System.Net/DigestClient.cs b/mcs/class/System/System.Net/DigestClient.cs
index fe137c7bd46..898fb11c4cf 100644
--- a/mcs/class/System/System.Net/DigestClient.cs
+++ b/mcs/class/System/System.Net/DigestClient.cs
@@ -39,7 +39,6 @@ namespace System.Net
string header;
int length;
int pos;
- string realm, opaque, nonce, algorithm;
static string [] keywords = { "realm", "opaque", "nonce", "algorithm", "qop" };
string [] values = new string [keywords.Length];
diff --git a/mcs/class/System/System.Net/Dns.cs b/mcs/class/System/System.Net/Dns.cs
index 7b4f09925cc..104dd72bcc7 100644
--- a/mcs/class/System/System.Net/Dns.cs
+++ b/mcs/class/System/System.Net/Dns.cs
@@ -50,7 +50,6 @@ namespace System.Net {
throw new ArgumentNullException ("asyncResult");
AsyncResult async = (AsyncResult) asyncResult;
GetHostByNameCallback cb = (GetHostByNameCallback) async.AsyncDelegate;
- asyncResult.AsyncWaitHandle.WaitOne ();
return cb.EndInvoke(asyncResult);
}
@@ -60,7 +59,6 @@ namespace System.Net {
throw new ArgumentNullException ("asyncResult");
AsyncResult async = (AsyncResult) asyncResult;
ResolveCallback cb = (ResolveCallback) async.AsyncDelegate;
- asyncResult.AsyncWaitHandle.WaitOne ();
return cb.EndInvoke(asyncResult);
}
diff --git a/mcs/class/System/System.Net/HttpWebRequest.cs b/mcs/class/System/System.Net/HttpWebRequest.cs
index 9b5cad20f6c..05d04a2a1cf 100644
--- a/mcs/class/System/System.Net/HttpWebRequest.cs
+++ b/mcs/class/System/System.Net/HttpWebRequest.cs
@@ -48,14 +48,12 @@ namespace System.Net
bool preAuthenticate;
Version version = HttpVersion.Version11;
IWebProxy proxy;
- bool manualProxy;
bool sendChunked;
ServicePoint servicePoint;
int timeout = 100000;
WebConnectionStream writeStream;
HttpWebResponse webResponse;
- AutoResetEvent requestEndEvent;
WebAsyncResult asyncWrite;
WebAsyncResult asyncRead;
EventHandler abortHandler;
@@ -399,6 +397,15 @@ namespace System.Net
set { webHeaders.SetInternal ("User-Agent", value); }
}
+#if NET_1_1
+ [MonoTODO]
+ public bool UnsafeAuthenticatedConnectionSharing
+ {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+#endif
+
internal bool GotRequestStream {
get { return gotRequestStream; }
}
diff --git a/mcs/class/System/System.Net/IPv6Address.cs b/mcs/class/System/System.Net/IPv6Address.cs
index 3f3a1cc920e..c7a13682186 100644
--- a/mcs/class/System/System.Net/IPv6Address.cs
+++ b/mcs/class/System/System.Net/IPv6Address.cs
@@ -250,7 +250,6 @@ namespace System.Net {
/// </summary>
public override string ToString ()
{
- bool bZeroUsed = false;
StringBuilder s = new StringBuilder ();
diff --git a/mcs/class/System/System.Net/MonoHttpDate.cs b/mcs/class/System/System.Net/MonoHttpDate.cs
index e7ebfe419f5..b4d9330d634 100644
--- a/mcs/class/System/System.Net/MonoHttpDate.cs
+++ b/mcs/class/System/System.Net/MonoHttpDate.cs
@@ -20,14 +20,13 @@ namespace System.Net
private static readonly string asctime_date = "ddd MMM d HH:mm:ss yyyy";
private static readonly string [] formats =
new string [] {rfc1123_date, rfc850_date, asctime_date};
- private static readonly CultureInfo enUS = new CultureInfo("en-US", false);
internal static DateTime Parse (string dateStr)
{
return DateTime.ParseExact (dateStr,
formats,
- enUS,
+ CultureInfo.InvariantCulture,
DateTimeStyles.AllowWhiteSpaces);
}
}
-} \ No newline at end of file
+}
diff --git a/mcs/class/System/System.Net/ServicePointManager.cs b/mcs/class/System/System.Net/ServicePointManager.cs
index 8e29d49945d..a08bab55024 100644
--- a/mcs/class/System/System.Net/ServicePointManager.cs
+++ b/mcs/class/System/System.Net/ServicePointManager.cs
@@ -60,13 +60,11 @@ namespace System.Net
public const int DefaultPersistentConnectionLimit = 2;
const string configKey = "system.net/connectionManagement";
- static Hashtable config;
+ static ConnectionManagementData manager;
static ServicePointManager ()
{
- ConnectionManagementData manager;
manager = (ConnectionManagementData) ConfigurationSettings.GetConfig (configKey);
- config = manager.Data;
}
// Constructors
private ServicePointManager ()
@@ -153,10 +151,7 @@ namespace System.Net
throw new InvalidOperationException ("maximum number of service points reached");
string addr = address.ToString ();
- int limit = defaultConnectionLimit;
- if (config.Contains (addr))
- limit = (int) config [addr];
-
+ int limit = (int) manager.GetMaxConnections (addr);
sp = new ServicePoint (address, limit, maxServicePointIdleTime);
sp.UsesProxy = usesProxy;
servicePoints.Add (address, sp);
diff --git a/mcs/class/System/System.Net/WebClient.cs b/mcs/class/System/System.Net/WebClient.cs
index e27c80afc5c..ca424855e3f 100644
--- a/mcs/class/System/System.Net/WebClient.cs
+++ b/mcs/class/System/System.Net/WebClient.cs
@@ -295,7 +295,7 @@ namespace System.Net
try {
return new Uri (path);
}
- catch (System.UriFormatException ufe) {
+ catch (System.UriFormatException) {
if ((path[0] == Path.DirectorySeparatorChar) || (path[1] == ':' && Char.ToLower(path[0]) > 'a' && Char.ToLower(path[0]) < 'z')) {
return new Uri ("file://" + path);
}
diff --git a/mcs/class/System/System.Net/WebConnection.cs b/mcs/class/System/System.Net/WebConnection.cs
index e9f96d68673..bf72a3c7290 100644
--- a/mcs/class/System/System.Net/WebConnection.cs
+++ b/mcs/class/System/System.Net/WebConnection.cs
@@ -32,7 +32,6 @@ namespace System.Net
bool busy;
WaitOrTimerCallback initConn;
bool keepAlive;
- bool aborted;
byte [] buffer;
static AsyncCallback readDoneDelegate = new AsyncCallback (ReadDone);
EventHandler abortHandler;
@@ -117,7 +116,7 @@ namespace System.Net
lock (this) {
busy = false;
if (st == WebExceptionStatus.RequestCanceled)
- Data.Init ();
+ Data = new WebConnectionData ();
status = st;
}
@@ -237,20 +236,19 @@ namespace System.Net
cnc.chunkStream.Write (cnc.buffer, pos, nread);
}
- bool more = false;
- lock (cnc) {
- more = (cnc.queue.Count > 0);
- }
-
- if (more)
- stream.ReadAll ();
-
data.stream = stream;
- stream.CheckComplete ();
- data.request.SetResponseData (data);
+
lock (cnc) {
- cnc.prevStream = stream;
+ if (cnc.queue.Count > 0)
+ stream.ReadAll ();
+ else
+ {
+ cnc.prevStream = stream;
+ stream.CheckComplete ();
+ }
}
+
+ data.request.SetResponseData (data);
}
static void InitRead (object state)
@@ -270,67 +268,81 @@ namespace System.Net
int pos = 0;
string line = null;
bool lineok = false;
-
- if (readState == ReadState.None) {
- lineok = ReadLine (buffer, ref pos, max, ref line);
- if (!lineok)
- return -1;
+ bool isContinue = false;
+ do {
+ if (readState == ReadState.None) {
+ lineok = ReadLine (buffer, ref pos, max, ref line);
+ if (!lineok)
+ return -1;
- readState = ReadState.Status;
+ readState = ReadState.Status;
- string [] parts = line.Split (' ');
- if (parts.Length < 3)
- return -1;
+ string [] parts = line.Split (' ');
+ if (parts.Length < 3)
+ return -1;
- if (String.Compare (parts [0], "HTTP/1.1", true) == 0) {
- Data.Version = HttpVersion.Version11;
- } else {
- Data.Version = HttpVersion.Version10;
- }
+ if (String.Compare (parts [0], "HTTP/1.1", true) == 0) {
+ Data.Version = HttpVersion.Version11;
+ } else {
+ Data.Version = HttpVersion.Version10;
+ }
- Data.StatusCode = (int) UInt32.Parse (parts [1]);
- Data.StatusDescription = String.Join (" ", parts, 2, parts.Length - 2);
- if (pos >= max)
- return pos;
- }
+ Data.StatusCode = (int) UInt32.Parse (parts [1]);
+ Data.StatusDescription = String.Join (" ", parts, 2, parts.Length - 2);
- if (readState == ReadState.Status) {
- readState = ReadState.Headers;
- Data.Headers = new WebHeaderCollection ();
- ArrayList headers = new ArrayList ();
- bool finished = false;
- while (!finished) {
- if (ReadLine (buffer, ref pos, max, ref line) == false)
- break;
+ if (pos >= max)
+ return pos;
+
+ }
+
+ if (readState == ReadState.Status) {
+ readState = ReadState.Headers;
+ Data.Headers = new WebHeaderCollection ();
+ ArrayList headers = new ArrayList ();
+ bool finished = false;
+ while (!finished) {
+ if (ReadLine (buffer, ref pos, max, ref line) == false)
+ break;
- if (line == null) {
- // Empty line: end of headers
- finished = true;
- continue;
- }
+ if (line == null) {
+ // Empty line: end of headers
+ finished = true;
+ continue;
+ }
- if (line.Length > 0 && (line [0] == ' ' || line [0] == '\t')) {
- int count = headers.Count - 1;
- if (count < 0)
- break;
+ if (line.Length > 0 && (line [0] == ' ' || line [0] == '\t')) {
+ int count = headers.Count - 1;
+ if (count < 0)
+ break;
+
+ string prev = (string) headers [count] + line;
+ headers [count] = prev;
+ } else {
+ headers.Add (line);
+ }
+ }
- string prev = (string) headers [count] + line;
- headers [count] = prev;
+ if (!finished) {
+ // handle the error...
} else {
- headers.Add (line);
+ foreach (string s in headers)
+ Data.Headers.Add (s);
+
+ if (Data.StatusCode == (int) HttpStatusCode.Continue) {
+ if (pos >= max)
+ return pos;
+ if (Data.request.ExpectContinue)
+ Data.request.DoContinueDelegate (Data.StatusCode, Data.Headers);
+ readState = ReadState.None;
+ isContinue = true;
+ }
+ else {
+ readState = ReadState.Content;
+ return pos;
+ }
}
}
-
- if (!finished) {
- // handle the error...
- } else {
- foreach (string s in headers)
- Data.Headers.Add (s);
-
- readState = ReadState.Content;
- return pos;
- }
- }
+ } while (isContinue == true);
return -1;
}
@@ -339,30 +351,16 @@ namespace System.Net
{
HttpWebRequest request = (HttpWebRequest) state;
- // Just in case 2 requests are released
- bool relaunch = false;
- lock (this) {
- relaunch = busy;
- busy = true;
- }
-
- if (relaunch) {
- SendRequest (request);
- return;
- }
- //
-
if (status == WebExceptionStatus.RequestCanceled) {
busy = false;
- Data.Init ();
+ Data = new WebConnectionData ();
goAhead.Set ();
- aborted = false;
SendNext ();
return;
}
keepAlive = request.KeepAlive;
- Data.Init ();
+ Data = new WebConnectionData ();
Data.request = request;
Connect ();
@@ -392,6 +390,7 @@ namespace System.Net
}
if (!busy) {
+ busy = true;
ThreadPool.RegisterWaitForSingleObject (goAhead, initConn,
request, -1, true);
} else {
diff --git a/mcs/class/System/System.Net/WebConnectionGroup.cs b/mcs/class/System/System.Net/WebConnectionGroup.cs
index 307b921bec3..35e9d7d7103 100644
--- a/mcs/class/System/System.Net/WebConnectionGroup.cs
+++ b/mcs/class/System/System.Net/WebConnectionGroup.cs
@@ -19,7 +19,6 @@ namespace System.Net
ServicePoint sPoint;
string name;
ArrayList connections;
- static ConnectionManagementData manager;
Random rnd;
public WebConnectionGroup (ServicePoint sPoint, string name)
@@ -70,7 +69,7 @@ namespace System.Net
for (int i = 0; i < count; i++) {
WeakReference wr = connections [i] as WeakReference;
cnc = wr.Target as WebConnection;
- if (cnc == null || !cnc.Connected) {
+ if (cnc == null) {
connections.RemoveAt (i);
count--;
continue;
@@ -81,7 +80,7 @@ namespace System.Net
return cnc;
}
-
+
if (sPoint.ConnectionLimit > count) {
cnc = new WebConnection (this, sPoint);
connections.Add (new WeakReference (cnc));
diff --git a/mcs/class/System/System.Net/WebConnectionStream.cs b/mcs/class/System/System.Net/WebConnectionStream.cs
index cf74554b9ec..10546abd143 100644
--- a/mcs/class/System/System.Net/WebConnectionStream.cs
+++ b/mcs/class/System/System.Net/WebConnectionStream.cs
@@ -69,7 +69,7 @@ namespace System.Net
internal void CheckComplete ()
{
- if (readBufferSize - readBufferOffset == contentLength) {
+ if (!nextReadCalled && readBufferSize - readBufferOffset == contentLength) {
nextReadCalled = true;
cnc.NextRead ();
}
@@ -101,6 +101,7 @@ namespace System.Net
b = ms.GetBuffer ();
new_size = (int) ms.Length;
+ contentLength = new_size;
} else {
new_size = contentLength - totalRead;
b = new byte [new_size];
@@ -119,7 +120,6 @@ namespace System.Net
readBuffer = b;
readBufferOffset = 0;
readBufferSize = new_size;
- contentLength = new_size;
totalRead = 0;
nextReadCalled = true;
}
@@ -291,10 +291,10 @@ namespace System.Net
if (!allowBuffering) {
try {
Write (buffer, offset, size);
- } catch (IOException e) {
+ } catch (IOException) {
if (cnc.Connected)
throw;
-
+
if (!cnc.TryReconnect ())
throw;
diff --git a/mcs/class/System/System.Text.RegularExpressions/ChangeLog b/mcs/class/System/System.Text.RegularExpressions/ChangeLog
index b0ac318e006..7baae4c93fd 100644
--- a/mcs/class/System/System.Text.RegularExpressions/ChangeLog
+++ b/mcs/class/System/System.Text.RegularExpressions/ChangeLog
@@ -1,3 +1,13 @@
+2004-01-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * parser.cs: an opening brace without a
+ quantifier do not cause a parse error. Fixes bug #52924.
+
+2004-01-07 Lluis Sanchez Gual <lluis@ximian.com>
+
+ * regex.cs: In Split(), if the last match is at the end of the string,
+ an empty string must be added to the array of results.
+
2003-12-15 Sanjay Gupta <gsanjay@novell.com>
* match.cs: Check for null value before Substring method call.
Fixes bug #52034.
diff --git a/mcs/class/System/System.Text.RegularExpressions/notes.txt b/mcs/class/System/System.Text.RegularExpressions/notes.txt
index 56b047ec76e..e385869d063 100644
--- a/mcs/class/System/System.Text.RegularExpressions/notes.txt
+++ b/mcs/class/System/System.Text.RegularExpressions/notes.txt
@@ -20,12 +20,6 @@ TODO:
* Octal/backreference parsing needs a big fix. The rules are ridiculously complex.
-* Add a check in QuickSearch for single character substrings. This is likely to
- be a common case. There's no need to go through a shift table. Also, have a
- look at just computing a relevant subset of the shift table and using an
- (offset, size) pair to help test inclusion. Characters not in the table get
- the default len + 1 shift.
-
* Improve the perl test suite. Run under MS runtime to generate checksums for
each trial. Checksums should incorporate: all captures (index, length) for all
groups; names of explicit capturing groups, and the numbers they map to. Any
diff --git a/mcs/class/System/System.Text.RegularExpressions/parser.cs b/mcs/class/System/System.Text.RegularExpressions/parser.cs
index 1804b9289e0..3543b4b0931 100644
--- a/mcs/class/System/System.Text.RegularExpressions/parser.cs
+++ b/mcs/class/System/System.Text.RegularExpressions/parser.cs
@@ -247,7 +247,7 @@ namespace System.Text.RegularExpressions.Syntax {
continue;
}
- case '*': case '+': case '?': case '{': {
+ case '*': case '+': case '?': {
throw NewParseException ("Bad quantifier.");
}
@@ -1011,10 +1011,10 @@ namespace System.Text.RegularExpressions.Syntax {
string result = "";
while (ptr < pattern.Length) {
- int c = pattern[ptr ++];
+ int c = pattern[ptr];
if (c == '\\')
c = ParseEscape ();
-
+ ptr ++;
result += (char)c;
}
diff --git a/mcs/class/System/System.Text.RegularExpressions/regex.cs b/mcs/class/System/System.Text.RegularExpressions/regex.cs
index bca4fab53f9..b972bea35a8 100644
--- a/mcs/class/System/System.Text.RegularExpressions/regex.cs
+++ b/mcs/class/System/System.Text.RegularExpressions/regex.cs
@@ -337,7 +337,7 @@ namespace System.Text.RegularExpressions {
ptr = m.Index + m.Length;
}
- if (ptr < input.Length) {
+ if (ptr <= input.Length) {
splits.Add (input.Substring (ptr));
}
diff --git a/mcs/class/System/System.dll.sources b/mcs/class/System/System.dll.sources
index 544b32264f9..242cbf70e97 100755
--- a/mcs/class/System/System.dll.sources
+++ b/mcs/class/System/System.dll.sources
@@ -384,11 +384,15 @@ System.Diagnostics/TraceLevel.cs
System.Diagnostics/TraceListenerCollection.cs
System.Diagnostics/TraceListener.cs
System.Diagnostics/TraceSwitch.cs
+System.IO/DefaultWatcher.cs
System.IO/ErrorEventArgs.cs
System.IO/ErrorEventHandler.cs
+System.IO/FAMWatcher.cs
+System.IO/FileAction.cs
System.IO/FileSystemEventArgs.cs
System.IO/FileSystemEventHandler.cs
System.IO/FileSystemWatcher.cs
+System.IO/IFileWatcher.cs
System.IO/InternalBufferOverflowException.cs
System.IO/IODescriptionAttribute.cs
System.IO/MonoIO.cs
@@ -396,8 +400,10 @@ System.IO/MonoIOError.cs
System.IO/NotifyFilters.cs
System.IO/RenamedEventArgs.cs
System.IO/RenamedEventHandler.cs
+System.IO/SearchPattern.cs
System.IO/WaitForChangedResult.cs
System.IO/WatcherChangeTypes.cs
+System.IO/WindowsWatcher.cs
System.Net/AuthenticationManager.cs
System.Net/Authorization.cs
System.Net/BasicClient.cs
diff --git a/mcs/class/System/System/ChangeLog b/mcs/class/System/System/ChangeLog
index ebc13ddc7df..3dd6de70b99 100644
--- a/mcs/class/System/System/ChangeLog
+++ b/mcs/class/System/System/ChangeLog
@@ -1,3 +1,23 @@
+2004-01-12 Atsushi Enomoto <atsushi@ximian.com>
+
+ * Uri.cs : should not escape already-escaped string (Patch by
+ Boris Kirzner). File LocalPath should unespace return value.
+ ToString() should be unescaped only when it is not an UNC path.
+ (UNC looks not to be unescaped).
+
+2004-01-06 Atsushi Enomoto <atsushi@ximian.com>
+
+ * Uri.cs : quick fix on local file relative uri.
+
+2004-01-06 Atsushi Enomoto <atsushi@ximian.com>
+
+ * Uri.cs : Fixed Parse(). Should not allow relative URIs.
+
+2004-01-05 Atsushi Enomoto <atsushi@ximian.com>
+
+ * Uri.cs : fixed IsBadFileSystemCharacter() to reject more characters
+ based on MS.NET experiment.
+
2003-12-08 Atsushi Enomoto <atsushi@ximian.com>
* Uri.cs : more fixes. More presice UNC handling, opaque part
diff --git a/mcs/class/System/System/Uri.cs b/mcs/class/System/System/Uri.cs
index e5208cc2d00..ba6680e3553 100755
--- a/mcs/class/System/System/Uri.cs
+++ b/mcs/class/System/System/Uri.cs
@@ -324,10 +324,11 @@ namespace System
if (!IsFile)
return path;
if (!IsUnc) {
+ string p = Unescape (path);
if (System.IO.Path.DirectorySeparatorChar == '\\')
- return path.Replace ('/', '\\');
+ return p.Replace ('/', '\\');
else
- return path;
+ return p;
}
// support *nix and W32 styles
@@ -664,7 +665,10 @@ namespace System
{
if (cachedToString != null)
return cachedToString;
- cachedToString = AbsoluteUri;
+ if (IsFile && !IsUnc)
+ cachedToString = Unescape (AbsoluteUri);
+ else
+ cachedToString = AbsoluteUri;
return cachedToString;
}
@@ -704,6 +708,19 @@ namespace System
// delims = "<" | ">" | "#" | "%" | <">
// unwise = "{" | "}" | "|" | "\" | "^" | "[" | "]" | "`"
+ // check for escape code already placed in str,
+ // i.e. for encoding that follows the pattern
+ // "%hexhex" in a string, where "hex" is a digit from 0-9
+ // or a letter from A-F (case-insensitive).
+ if('%'.Equals(c) && IsHexEncoding(str,i))
+ {
+ // if ,yes , copy it as is
+ s.Append(c);
+ s.Append(str[++i]);
+ s.Append(str[++i]);
+ continue;
+ }
+
if ((c <= 0x20) || (c >= 0x7f) ||
("<>%\"{}|\\^`".IndexOf (c) != -1) ||
(escapeHex && (c == '#')) ||
@@ -713,6 +730,7 @@ namespace System
s.Append (HexEscape (c));
continue;
}
+
s.Append (c);
}
@@ -790,6 +808,8 @@ namespace System
if (c == ':') {
if (pos == 1) {
// a windows filepath
+ if (uriString.Length < 3 || (uriString [2] != '\\' && uriString [2] != '/'))
+ throw new UriFormatException ("Invalid URI: The format of the URI could not be determined.");
isWindowsFilePath = true;
scheme = Uri.UriSchemeFile;
path = uriString.Replace ('\\', '/');
@@ -807,6 +827,8 @@ namespace System
// unix UNC (kind of)
isUnc = true;
} else {
+ if (uriString [0] != '\\' && uriString [0] != '/' && !uriString.StartsWith ("file://"))
+ throw new UriFormatException ("Invalid URI: The format of the URI could not be determined.");
scheme = Uri.UriSchemeFile;
if (uriString.StartsWith ("\\\\")) {
isUnc = true;
@@ -957,9 +979,23 @@ namespace System
protected virtual bool IsBadFileSystemCharacter (char ch)
{
- foreach (char c in System.IO.Path.InvalidPathChars)
- if (c == ch)
- return true;
+ // It does not always overlap with InvalidPathChars.
+ int chInt = (int) ch;
+ if (chInt < 32 || (chInt < 64 && chInt > 57))
+ return true;
+ switch (chInt) {
+ case 0:
+ case 34: // "
+ case 38: // &
+ case 42: // *
+ case 44: // ,
+ case 47: // /
+ case 92: // \
+ case 94: // ^
+ case 124: // |
+ return true;
+ }
+
return false;
}
diff --git a/mcs/class/System/System_test.dll.sources b/mcs/class/System/System_test.dll.sources
index 4562ac9f67c..5a430de194d 100644
--- a/mcs/class/System/System_test.dll.sources
+++ b/mcs/class/System/System_test.dll.sources
@@ -3,6 +3,7 @@ Microsoft.CSharp/CodeGeneratorFromExpressionTest.cs
Microsoft.CSharp/CodeGeneratorFromNamespaceTest.cs
Microsoft.CSharp/CodeGeneratorFromStatementTest.cs
Microsoft.CSharp/CodeGeneratorFromTypeTest.cs
+Microsoft.CSharp/CodeGeneratorIdentifierTest.cs
Microsoft.CSharp/CodeGeneratorTestBase.cs
Microsoft.VisualBasic/VBCodeProviderTest.cs
System/UriBuilderTest.cs
@@ -19,6 +20,7 @@ System.ComponentModel.Design/ServiceContainerTest.cs
System.Diagnostics/TraceTest.cs
System.Diagnostics/SwitchesTest.cs
System.Diagnostics/DiagnosticsConfigurationHandlerTest.cs
+System.IO/FileSystemWatcherTest.cs
System.Net/CookieCollectionTest.cs
System.Net/CookieTest.cs
System.Net/CredentialCacheTest.cs
diff --git a/mcs/class/System/Test/Microsoft.CSharp/ChangeLog b/mcs/class/System/Test/Microsoft.CSharp/ChangeLog
index 3462d1fd8e4..069ee667f8c 100644
--- a/mcs/class/System/Test/Microsoft.CSharp/ChangeLog
+++ b/mcs/class/System/Test/Microsoft.CSharp/ChangeLog
@@ -1,3 +1,7 @@
+2004-01-21 Atsushi Enomoto <atsushi@ximian.com>
+
+ * Added CodeGeneratorIdentifierTest.cs.
+
2003-11-21 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* Test/Microsoft.CSharp/CodeGeneratorFromCompileUnitTest.cs: don't
diff --git a/mcs/class/System/Test/Microsoft.CSharp/CodeGeneratorIdentifierTest.cs b/mcs/class/System/Test/Microsoft.CSharp/CodeGeneratorIdentifierTest.cs
new file mode 100755
index 00000000000..3f03af8fb8f
--- /dev/null
+++ b/mcs/class/System/Test/Microsoft.CSharp/CodeGeneratorIdentifierTest.cs
@@ -0,0 +1,75 @@
+//
+// CodeGeneratorIdentifierTest.cs
+//
+// Author:
+// Atsushi Enomoto <atsushi@ximian.com>
+//
+// (C)2004 Novell inc.
+//
+using System;
+using System.CodeDom.Compiler;
+using NUnit.Framework;
+using Microsoft.CSharp;
+
+namespace MonoTests.Microsoft.CSharp
+{
+ public class CodeGeneratorIdentifierTest : Assertion
+ {
+ private ICodeGenerator gen;
+
+ public CodeGeneratorIdentifierTest ()
+ {
+ gen = new CSharpCodeProvider ().CreateGenerator ();
+ }
+
+ [Test]
+ [ExpectedException (typeof (NullReferenceException))]
+ public void TestCreateValidIdentifierNullArg ()
+ {
+ gen.CreateValidIdentifier (null);
+ }
+
+ [Test]
+ public void TestCreateValidIdentifier ()
+ {
+
+ AssertEquals ("a", gen.CreateValidIdentifier ("a"));
+ AssertEquals ("_int", gen.CreateValidIdentifier ("int"));
+ AssertEquals ("_", gen.CreateValidIdentifier ("_"));
+ AssertEquals ("1", gen.CreateValidIdentifier ("1"));
+ AssertEquals ("1a", gen.CreateValidIdentifier ("1a"));
+ AssertEquals ("1*2", gen.CreateValidIdentifier ("1*2"));
+ AssertEquals ("-", gen.CreateValidIdentifier ("-"));
+ AssertEquals ("+", gen.CreateValidIdentifier ("+"));
+ AssertEquals ("", gen.CreateValidIdentifier (""));
+ AssertEquals ("--", gen.CreateValidIdentifier ("--"));
+ AssertEquals ("++", gen.CreateValidIdentifier ("++"));
+ AssertEquals ("\u3042", gen.CreateValidIdentifier ("\u3042"));
+ }
+
+ [Test]
+ [ExpectedException (typeof (NullReferenceException))]
+ public void TestCreateEscapedIdentifierNullArg ()
+ {
+ gen.CreateEscapedIdentifier (null);
+ }
+
+ [Test]
+ public void TestCreateEscapedIdentifier ()
+ {
+
+ AssertEquals ("a", gen.CreateEscapedIdentifier ("a"));
+ AssertEquals ("@int", gen.CreateEscapedIdentifier ("int"));
+ AssertEquals ("_", gen.CreateEscapedIdentifier ("_"));
+ AssertEquals ("1", gen.CreateEscapedIdentifier ("1"));
+ AssertEquals ("1a", gen.CreateEscapedIdentifier ("1a"));
+ AssertEquals ("1*2", gen.CreateEscapedIdentifier ("1*2"));
+ AssertEquals ("-", gen.CreateEscapedIdentifier ("-"));
+ AssertEquals ("+", gen.CreateEscapedIdentifier ("+"));
+ AssertEquals ("", gen.CreateEscapedIdentifier (""));
+ AssertEquals ("--", gen.CreateEscapedIdentifier ("--"));
+ AssertEquals ("++", gen.CreateEscapedIdentifier ("++"));
+ AssertEquals ("\u3042", gen.CreateEscapedIdentifier ("\u3042"));
+ }
+ }
+}
diff --git a/mcs/class/System/Test/System.IO/ChangeLog b/mcs/class/System/Test/System.IO/ChangeLog
new file mode 100644
index 00000000000..dc67d5f307d
--- /dev/null
+++ b/mcs/class/System/Test/System.IO/ChangeLog
@@ -0,0 +1,4 @@
+2004-01-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * FileSystemWatcherTest.cs: new test.
+
diff --git a/mcs/class/System/Test/System.IO/FileSystemWatcherTest.cs b/mcs/class/System/Test/System.IO/FileSystemWatcherTest.cs
new file mode 100755
index 00000000000..b3e7348544d
--- /dev/null
+++ b/mcs/class/System/Test/System.IO/FileSystemWatcherTest.cs
@@ -0,0 +1,86 @@
+// FileSystemWatcherTest.cs - NUnit Test Cases for the System.IO.FileSystemWatcher class
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2004 Novell, Inc. http://www.novell.com
+//
+
+using NUnit.Framework;
+using System;
+using System.IO;
+
+namespace MonoTests.System.IO
+{
+ [TestFixture]
+ public class FileSystemWatcherTest : Assertion
+ {
+ [Test]
+ public void CheckDefaults ()
+ {
+ FileSystemWatcher fw = new FileSystemWatcher ();
+ AssertEquals ("#01", fw.EnableRaisingEvents, false);
+ AssertEquals ("#02", fw.Filter, "*.*");
+ AssertEquals ("#03", fw.IncludeSubdirectories, false);
+ AssertEquals ("#04", fw.InternalBufferSize, 8192);
+ AssertEquals ("#05", fw.NotifyFilter, NotifyFilters.FileName | NotifyFilters.DirectoryName | NotifyFilters.LastWrite);
+ AssertEquals ("#06", fw.Path, "");
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentNullException))]
+ public void CheckCtor1 ()
+ {
+ FileSystemWatcher fw = new FileSystemWatcher (null);
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentException))]
+ public void CheckCtor2 ()
+ {
+ FileSystemWatcher fw = new FileSystemWatcher ("");
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentException))]
+ public void CheckCtor3 ()
+ {
+ FileSystemWatcher fw = new FileSystemWatcher ("notexistsblahblah");
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentNullException))]
+ public void CheckCtor4 ()
+ {
+ FileSystemWatcher fw = new FileSystemWatcher (Path.GetTempPath (), null);
+ }
+
+ [Test]
+ // Doesn't throw here :-?
+ // [ExpectedException (typeof (ArgumentException))]
+ public void CheckCtor5 ()
+ {
+ FileSystemWatcher fw = new FileSystemWatcher (Path.GetTempPath (), "invalidpath|");
+ fw = new FileSystemWatcher (Path.GetTempPath (), "*");
+ }
+
+ [Test]
+ // ...But here it does...
+ [ExpectedException (typeof (ArgumentException))]
+ public void CheckInvalidPath ()
+ {
+ FileSystemWatcher fw = new FileSystemWatcher (Path.GetTempPath (), "invalidpath|");
+ fw.Path = "invalidpath|";
+ }
+
+ [Test]
+ // ...and here too
+ [ExpectedException (typeof (ArgumentException))]
+ public void CheckPathWildcard ()
+ {
+ FileSystemWatcher fw = new FileSystemWatcher (Path.GetTempPath (), "*");
+ fw.Path = "*";
+ }
+ }
+}
+
diff --git a/mcs/class/System/Test/System.Net/HttpWebRequestTest.cs b/mcs/class/System/Test/System.Net/HttpWebRequestTest.cs
index 56334b6401c..1e90447c262 100644
--- a/mcs/class/System/Test/System.Net/HttpWebRequestTest.cs
+++ b/mcs/class/System/Test/System.Net/HttpWebRequestTest.cs
@@ -30,7 +30,7 @@ public class HttpWebRequestTest : Assertion
AssertEquals ("req Header 2", "MonoClient v1.0", req.Headers.Get (0));
HttpWebResponse res = (HttpWebResponse) req.GetResponse ();
- AssertEquals ("res:HttpStatusCode: ", "OK", res.StatusCode);
+ AssertEquals ("res:HttpStatusCode: ", "OK", res.StatusCode.ToString ());
AssertEquals ("res:HttpStatusDescription: ", "OK", res.StatusDescription);
AssertEquals ("res Header 1", "text/html", res.Headers.Get ("Content-Type"));
diff --git a/mcs/class/System/Test/System.Text.RegularExpressions/ChangeLog b/mcs/class/System/Test/System.Text.RegularExpressions/ChangeLog
index f22b84fc777..6cbea91b46a 100644
--- a/mcs/class/System/Test/System.Text.RegularExpressions/ChangeLog
+++ b/mcs/class/System/Test/System.Text.RegularExpressions/ChangeLog
@@ -1,3 +1,13 @@
+2004-01-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * RegexBugs.cs: added test from bug #52924.
+
+2004-01-07 Lluis Sanchez Gual <lluis@ximian.com>
+
+ * RegexBugs.cs: Improved test. In Split(), if the last match is at the
+ end of the string, an empty string must be added to the array of
+ results.
+
2003-11-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* RegexBugs.cs: added tests from bug #42529.
diff --git a/mcs/class/System/Test/System.Text.RegularExpressions/RegexBugs.cs b/mcs/class/System/Test/System.Text.RegularExpressions/RegexBugs.cs
index 79c63a02daf..79b5b86936b 100644
--- a/mcs/class/System/Test/System.Text.RegularExpressions/RegexBugs.cs
+++ b/mcs/class/System/Test/System.Text.RegularExpressions/RegexBugs.cs
@@ -40,6 +40,13 @@ namespace MonoTests.System.Text.RegularExpressions
AssertEquals ("#04", length, splitResult.Length);
for (i = 0; i < length; i++)
AssertEquals ("#05 " + i, expected [i], splitResult [i]);
+
+ splitResult = new Regex ("-").Split ("a-bcd-e-fg-");
+ expected = new string [] {"a", "bcd", "e", "fg", ""};
+ length = expected.Length;
+ AssertEquals ("#06", length, splitResult.Length);
+ for (i = 0; i < length; i++)
+ AssertEquals ("#07 " + i, expected [i], splitResult [i]);
}
[Test]
@@ -63,5 +70,14 @@ namespace MonoTests.System.Text.RegularExpressions
AssertEquals ("MEG #12", true, Regex.IsMatch(str, @"(something|dog|)*$"));
}
+
+ [Test]
+ public void Braces () // bug 52924
+ {
+ // Before the fix, the next line throws an exception
+ Regex regVar = new Regex(@"{\w+}");
+ Match m = regVar.Match ("{ }");
+ AssertEquals ("BR #01", false, m.Success);
+ }
}
}
diff --git a/mcs/class/System/Test/System/ChangeLog b/mcs/class/System/Test/System/ChangeLog
index 047a1e78193..9611a73bd4e 100644
--- a/mcs/class/System/Test/System/ChangeLog
+++ b/mcs/class/System/Test/System/ChangeLog
@@ -1,3 +1,24 @@
+2004-01-12 Atsushi Enomoto <atsushi@ximian.com>
+
+ * test-uri-list.txt, test-uri-props.txt : added more tests.
+
+2004-01-06 Atsushi Enomoto <atsushi@ximian.com>
+
+ * UriTest.cs :
+ Derived from Assertion.
+ Added ConstructorsRejectRelativePath ().
+ "file://cygwin" means machine name cygwin, not top directory cygwin.
+ * UriTest2.cs : added relative constructor tests and manually created
+ absolute uri tests (rejected by MS.NET).
+ * uri-test-generator.cs : added relative test generator.
+ * added test-uri-props-manual.txt, test-uri-relative-list.txt,
+ test-uri-relative-props.txt for relative path test and
+ manually added tests.
+
+2004-01-04 Nick Drochak <ndrochak@ieee.com>
+
+ * UriBuilderTest.cs: Make tests pass on .NET 1.1.
+
2003-12-31 Nick Drochak <ndrochak@ieee.com>
* UriTest2.cs: Use proper path to find file.
@@ -7,11 +28,11 @@
* UriTest.cs: Test for UriFormatException
-2003-12-08 Atsushi Enomoto <atsushi@novell.com>
+2003-12-08 Atsushi Enomoto <atsushi@ximian.com>
* UriTest2.cs : eliminating Console.WriteLine().
-2003-12-08 Atsushi Enomoto <atsushi@novell.com>
+2003-12-08 Atsushi Enomoto <atsushi@ximian.com>
* Added uri-test-generator.cs, test-uri-list.txt, test-uri-props.txt
and UriTest2.cs. They are test generator files.
diff --git a/mcs/class/System/Test/System/UriBuilderTest.cs b/mcs/class/System/Test/System/UriBuilderTest.cs
index 921e06e46e3..cd8a837b037 100644
--- a/mcs/class/System/Test/System/UriBuilderTest.cs
+++ b/mcs/class/System/Test/System/UriBuilderTest.cs
@@ -14,50 +14,50 @@ using System;
namespace MonoTests.System
{
[TestFixture]
- public class UriBuilderTest
+ public class UriBuilderTest : Assertion
{
private UriBuilder b, b2, b3;
[SetUp]
public void GetReady()
{
- b = new UriBuilder ("http://", "www.ximian.com", 80, "foo/bar/index.html");
+ b = new UriBuilder ("http", "www.ximian.com", 80, "foo/bar/index.html");
}
[Test]
public void Constructors ()
{
b = new UriBuilder ();
- Assertion.AssertEquals ("#1", "http", b.Scheme);
- Assertion.AssertEquals ("#2", "loopback", b.Host);
- Assertion.AssertEquals ("#3", -1, b.Port);
+ AssertEquals ("#1", "http", b.Scheme);
+ AssertEquals ("#2", "loopback", b.Host);
+ AssertEquals ("#3", -1, b.Port);
try {
- b = new UriBuilder ("http://", "www.ximian.com", 80, "foo/bar/index.html", "extras");
- Assertion.Fail ("#4 should have thrown an ArgumentException because extraValue must start with '?' or '#' character.");
+ b = new UriBuilder ("http", "www.ximian.com", 80, "foo/bar/index.html", "extras");
+ Fail ("#4 should have thrown an ArgumentException because extraValue must start with '?' or '#' character.");
} catch (ArgumentException) {}
- b = new UriBuilder ("http://", "www.ximian.com", 80, "foo/bar/index.html", "#extras");
+ b = new UriBuilder ("http", "www.ximian.com", 80, "foo/bar/index.html", "#extras");
}
[Test]
public void UserInfo ()
{
b = new UriBuilder ("mailto://myname:mypwd@contoso.com?subject=hello");
- Assertion.AssertEquals ("#1", "myname", b.UserName);
- Assertion.AssertEquals ("#2", "mypwd", b.Password);
+ AssertEquals ("#1", "myname", b.UserName);
+ AssertEquals ("#2", "mypwd", b.Password);
- b = new UriBuilder ("mailto:", "contoso.com");
+ b = new UriBuilder ("mailto", "contoso.com");
b.UserName = "myname";
b.Password = "mypwd";
- Assertion.AssertEquals ("#3: known to fail with ms.net.", "myname:mypwd", b.Uri.UserInfo);
+ AssertEquals ("#3", "myname:mypwd", b.Uri.UserInfo);
}
[Test]
public void Path ()
{
b.Path = ((char) 0xa9) + " 2002";
- Assertion.AssertEquals ("#1: known to fail with ms.net, should at least return a slash.", "/%A9%202002", b.Path);
+ AssertEquals ("#1", "%C2%A9%202002", b.Path);
}
[Test]
@@ -78,43 +78,43 @@ namespace MonoTests.System
public void Query ()
{
b.Query = ((char) 0xa9) + " 2002";
- Assertion.AssertEquals ("#1: known to fail with ms.net, should've been escaped.", "?%A9%202002", b.Query);
- Assertion.AssertEquals ("#2", String.Empty, b.Fragment);
+ AssertEquals ("#1", "?© 2002", b.Query);
+ AssertEquals ("#2", String.Empty, b.Fragment);
b.Query = "?test";
- Assertion.AssertEquals ("#3", "??test", b.Query);
+ AssertEquals ("#3", "??test", b.Query);
b.Query = null;
- Assertion.AssertEquals ("#4", String.Empty, b.Query);
+ AssertEquals ("#4", String.Empty, b.Query);
}
[Test]
public void Fragment ()
{
b.Fragment = ((char) 0xa9) + " 2002";
- Assertion.AssertEquals ("#1: known to fail with ms.net, should've been escaped.", "#%A9%202002", b.Fragment);
- Assertion.AssertEquals ("#2", String.Empty, b.Query);
+ AssertEquals ("#1", "#© 2002", b.Fragment);
+ AssertEquals ("#2", String.Empty, b.Query);
b.Fragment = "#test";
- Assertion.AssertEquals ("#3", "##test", b.Fragment);
+ AssertEquals ("#3", "##test", b.Fragment);
b.Fragment = null;
- Assertion.AssertEquals ("#4", String.Empty, b.Fragment);
+ AssertEquals ("#4", String.Empty, b.Fragment);
}
[Test]
public void Scheme ()
{
b.Scheme = "http";
- Assertion.AssertEquals ("#1", b.Scheme, "http");
+ AssertEquals ("#1", b.Scheme, "http");
b.Scheme = "http:";
- Assertion.AssertEquals ("#2", b.Scheme, "http");
+ AssertEquals ("#2", b.Scheme, "http");
b.Scheme = "http://";
- Assertion.AssertEquals ("#3", b.Scheme, "http");
+ AssertEquals ("#3", b.Scheme, "http");
b.Scheme = "http://foo/bar";
- Assertion.AssertEquals ("#4", b.Scheme, "http");
+ AssertEquals ("#4", b.Scheme, "http");
b.Scheme = "mailto:";
- Assertion.AssertEquals ("#5", b.Scheme, "mailto");
+ AssertEquals ("#5", b.Scheme, "mailto");
b.Scheme = "unknown";
- Assertion.AssertEquals ("#6", b.Scheme, "unknown");
+ AssertEquals ("#6", b.Scheme, "unknown");
b.Scheme = "unknown://";
- Assertion.AssertEquals ("#7", b.Scheme, "unknown");
+ AssertEquals ("#7", b.Scheme, "unknown");
}
[Test]
@@ -124,17 +124,18 @@ namespace MonoTests.System
b2 = new UriBuilder ("http", "www.ximian.com", 80, "/foo/bar/index.html", "?item=1");
b3 = new UriBuilder (new Uri ("http://www.ximian.com/foo/bar/index.html?item=1"));
- Assertion.Assert ("#1", b.Equals (b2));
- Assertion.Assert ("#2", b.Uri.Equals (b2.Uri));
- Assertion.Assert ("#3", b.Equals (b3));
- Assertion.Assert ("#4", b2.Equals (b3));
- Assertion.Assert ("#5", b3.Equals (b));
+ Assert ("#1", b.Equals (b2));
+ Assert ("#2", b.Uri.Equals (b2.Uri));
+ Assert ("#3", b.Equals (b3));
+ Assert ("#4", b2.Equals (b3));
+ Assert ("#5", b3.Equals (b));
}
[Test]
public void ToStringTest ()
{
- Assertion.AssertEquals ("#1 known to fail with ms.net, should've been canonicalized.", b.Uri.ToString (), b.ToString ());
+ AssertEquals ("ToString ()", "http://www.ximian.com:80/foo/bar/index.html", b.ToString ());
+ AssertEquals ("Uri.ToString ()", "http://www.ximian.com/foo/bar/index.html", b.Uri.ToString ());
}
}
}
diff --git a/mcs/class/System/Test/System/UriTest.cs b/mcs/class/System/Test/System/UriTest.cs
index 8be2a2044af..e83c7660d80 100644
--- a/mcs/class/System/Test/System/UriTest.cs
+++ b/mcs/class/System/Test/System/UriTest.cs
@@ -17,7 +17,7 @@ using System.IO;
namespace MonoTests.System
{
[TestFixture]
- public class UriTest
+ public class UriTest : Assertion
{
protected bool isWin32 = false;
@@ -67,192 +67,223 @@ namespace MonoTests.System
*/
uri = new Uri ("http://contoso.com?subject=uri");
- Assertion.AssertEquals ("#k1", "/", uri.AbsolutePath);
- Assertion.AssertEquals ("#k2", "http://contoso.com/?subject=uri", uri.AbsoluteUri);
- Assertion.AssertEquals ("#k3", "contoso.com", uri.Authority);
- Assertion.AssertEquals ("#k4", "", uri.Fragment);
- Assertion.AssertEquals ("#k5", "contoso.com", uri.Host);
- Assertion.AssertEquals ("#k6", UriHostNameType.Dns, uri.HostNameType);
- Assertion.AssertEquals ("#k7", true, uri.IsDefaultPort);
- Assertion.AssertEquals ("#k8", false, uri.IsFile);
- Assertion.AssertEquals ("#k9", false, uri.IsLoopback);
- Assertion.AssertEquals ("#k10", false, uri.IsUnc);
- Assertion.AssertEquals ("#k11", "/", uri.LocalPath);
- Assertion.AssertEquals ("#k12", "/?subject=uri", uri.PathAndQuery);
- Assertion.AssertEquals ("#k13", 80, uri.Port);
- Assertion.AssertEquals ("#k14", "?subject=uri", uri.Query);
- Assertion.AssertEquals ("#k15", "http", uri.Scheme);
- Assertion.AssertEquals ("#k16", false, uri.UserEscaped);
- Assertion.AssertEquals ("#k17", "", uri.UserInfo);
+ AssertEquals ("#k1", "/", uri.AbsolutePath);
+ AssertEquals ("#k2", "http://contoso.com/?subject=uri", uri.AbsoluteUri);
+ AssertEquals ("#k3", "contoso.com", uri.Authority);
+ AssertEquals ("#k4", "", uri.Fragment);
+ AssertEquals ("#k5", "contoso.com", uri.Host);
+ AssertEquals ("#k6", UriHostNameType.Dns, uri.HostNameType);
+ AssertEquals ("#k7", true, uri.IsDefaultPort);
+ AssertEquals ("#k8", false, uri.IsFile);
+ AssertEquals ("#k9", false, uri.IsLoopback);
+ AssertEquals ("#k10", false, uri.IsUnc);
+ AssertEquals ("#k11", "/", uri.LocalPath);
+ AssertEquals ("#k12", "/?subject=uri", uri.PathAndQuery);
+ AssertEquals ("#k13", 80, uri.Port);
+ AssertEquals ("#k14", "?subject=uri", uri.Query);
+ AssertEquals ("#k15", "http", uri.Scheme);
+ AssertEquals ("#k16", false, uri.UserEscaped);
+ AssertEquals ("#k17", "", uri.UserInfo);
uri = new Uri ("mailto:user:pwd@contoso.com?subject=uri");
- Assertion.AssertEquals ("#m1", "", uri.AbsolutePath);
- Assertion.AssertEquals ("#m2", "mailto:user:pwd@contoso.com?subject=uri", uri.AbsoluteUri);
- Assertion.AssertEquals ("#m3", "contoso.com", uri.Authority);
- Assertion.AssertEquals ("#m4", "", uri.Fragment);
- Assertion.AssertEquals ("#m5", "contoso.com", uri.Host);
- Assertion.AssertEquals ("#m6", UriHostNameType.Dns, uri.HostNameType);
- Assertion.AssertEquals ("#m7", true, uri.IsDefaultPort);
- Assertion.AssertEquals ("#m8", false, uri.IsFile);
- Assertion.AssertEquals ("#m9", false, uri.IsLoopback);
- Assertion.AssertEquals ("#m10", false, uri.IsUnc);
- Assertion.AssertEquals ("#m11", "", uri.LocalPath);
- Assertion.AssertEquals ("#m12", "?subject=uri", uri.PathAndQuery);
- Assertion.AssertEquals ("#m13", 25, uri.Port);
- Assertion.AssertEquals ("#m14", "?subject=uri", uri.Query);
- Assertion.AssertEquals ("#m15", "mailto", uri.Scheme);
- Assertion.AssertEquals ("#m16", false, uri.UserEscaped);
- Assertion.AssertEquals ("#m17", "user:pwd", uri.UserInfo);
+ AssertEquals ("#m1", "", uri.AbsolutePath);
+ AssertEquals ("#m2", "mailto:user:pwd@contoso.com?subject=uri", uri.AbsoluteUri);
+ AssertEquals ("#m3", "contoso.com", uri.Authority);
+ AssertEquals ("#m4", "", uri.Fragment);
+ AssertEquals ("#m5", "contoso.com", uri.Host);
+ AssertEquals ("#m6", UriHostNameType.Dns, uri.HostNameType);
+ AssertEquals ("#m7", true, uri.IsDefaultPort);
+ AssertEquals ("#m8", false, uri.IsFile);
+ AssertEquals ("#m9", false, uri.IsLoopback);
+ AssertEquals ("#m10", false, uri.IsUnc);
+ AssertEquals ("#m11", "", uri.LocalPath);
+ AssertEquals ("#m12", "?subject=uri", uri.PathAndQuery);
+ AssertEquals ("#m13", 25, uri.Port);
+ AssertEquals ("#m14", "?subject=uri", uri.Query);
+ AssertEquals ("#m15", "mailto", uri.Scheme);
+ AssertEquals ("#m16", false, uri.UserEscaped);
+ AssertEquals ("#m17", "user:pwd", uri.UserInfo);
uri = new Uri (@"\\myserver\mydir\mysubdir\myfile.ext");
- Assertion.AssertEquals ("#n1", "/mydir/mysubdir/myfile.ext", uri.AbsolutePath);
- Assertion.AssertEquals ("#n2", "file://myserver/mydir/mysubdir/myfile.ext", uri.AbsoluteUri);
- Assertion.AssertEquals ("#n3", "myserver", uri.Authority);
- Assertion.AssertEquals ("#n4", "", uri.Fragment);
- Assertion.AssertEquals ("#n5", "myserver", uri.Host);
- Assertion.AssertEquals ("#n6", UriHostNameType.Dns, uri.HostNameType);
- Assertion.AssertEquals ("#n7", true, uri.IsDefaultPort);
- Assertion.AssertEquals ("#n8", true, uri.IsFile);
- Assertion.AssertEquals ("#n9", false, uri.IsLoopback);
- Assertion.AssertEquals ("#n10", true, uri.IsUnc);
+ AssertEquals ("#n1", "/mydir/mysubdir/myfile.ext", uri.AbsolutePath);
+ AssertEquals ("#n2", "file://myserver/mydir/mysubdir/myfile.ext", uri.AbsoluteUri);
+ AssertEquals ("#n3", "myserver", uri.Authority);
+ AssertEquals ("#n4", "", uri.Fragment);
+ AssertEquals ("#n5", "myserver", uri.Host);
+ AssertEquals ("#n6", UriHostNameType.Dns, uri.HostNameType);
+ AssertEquals ("#n7", true, uri.IsDefaultPort);
+ AssertEquals ("#n8", true, uri.IsFile);
+ AssertEquals ("#n9", false, uri.IsLoopback);
+ AssertEquals ("#n10", true, uri.IsUnc);
if (isWin32)
- Assertion.AssertEquals ("#n11", @"\\myserver\mydir\mysubdir\myfile.ext", uri.LocalPath);
+ AssertEquals ("#n11", @"\\myserver\mydir\mysubdir\myfile.ext", uri.LocalPath);
else
- Assertion.AssertEquals ("#n11", "//myserver/mydir/mysubdir/myfile.ext", uri.LocalPath);
-
- Assertion.AssertEquals ("#n12", "/mydir/mysubdir/myfile.ext", uri.PathAndQuery);
- Assertion.AssertEquals ("#n13", -1, uri.Port);
- Assertion.AssertEquals ("#n14", "", uri.Query);
- Assertion.AssertEquals ("#n15", "file", uri.Scheme);
- Assertion.AssertEquals ("#n16", false, uri.UserEscaped);
- Assertion.AssertEquals ("#n17", "", uri.UserInfo);
+ AssertEquals ("#n11", "//myserver/mydir/mysubdir/myfile.ext", uri.LocalPath);
+
+ AssertEquals ("#n12", "/mydir/mysubdir/myfile.ext", uri.PathAndQuery);
+ AssertEquals ("#n13", -1, uri.Port);
+ AssertEquals ("#n14", "", uri.Query);
+ AssertEquals ("#n15", "file", uri.Scheme);
+ AssertEquals ("#n16", false, uri.UserEscaped);
+ AssertEquals ("#n17", "", uri.UserInfo);
uri = new Uri (new Uri("http://www.contoso.com"), "Hello World.htm", true);
- Assertion.AssertEquals ("#rel1a", "http://www.contoso.com/Hello World.htm", uri.AbsoluteUri);
- Assertion.AssertEquals ("#rel1b", true, uri.UserEscaped);
+ AssertEquals ("#rel1a", "http://www.contoso.com/Hello World.htm", uri.AbsoluteUri);
+ AssertEquals ("#rel1b", true, uri.UserEscaped);
uri = new Uri (new Uri("http://www.contoso.com"), "Hello World.htm", false);
- Assertion.AssertEquals ("#rel2a", "http://www.contoso.com/Hello%20World.htm", uri.AbsoluteUri);
- Assertion.AssertEquals ("#rel2b", false, uri.UserEscaped);
+ AssertEquals ("#rel2a", "http://www.contoso.com/Hello%20World.htm", uri.AbsoluteUri);
+ AssertEquals ("#rel2b", false, uri.UserEscaped);
uri = new Uri (new Uri("http://www.contoso.com"), "http://www.xxx.com/Hello World.htm", false);
- Assertion.AssertEquals ("#rel3", "http://www.xxx.com/Hello%20World.htm", uri.AbsoluteUri);
+ AssertEquals ("#rel3", "http://www.xxx.com/Hello%20World.htm", uri.AbsoluteUri);
//uri = new Uri (new Uri("http://www.contoso.com"), "foo:8080/bar/Hello World.htm", false);
- //Assertion.AssertEquals ("#rel4", "foo:8080/bar/Hello%20World.htm", uri.AbsoluteUri);
+ //AssertEquals ("#rel4", "foo:8080/bar/Hello%20World.htm", uri.AbsoluteUri);
uri = new Uri (new Uri("http://www.contoso.com"), "foo/bar/Hello World.htm?x=0:8", false);
- Assertion.AssertEquals ("#rel5", "http://www.contoso.com/foo/bar/Hello%20World.htm?x=0:8", uri.AbsoluteUri);
+ AssertEquals ("#rel5", "http://www.contoso.com/foo/bar/Hello%20World.htm?x=0:8", uri.AbsoluteUri);
uri = new Uri (new Uri("http://www.contoso.com/xxx/yyy/index.htm"), "foo/bar/Hello World.htm?x=0:8", false);
- Assertion.AssertEquals ("#rel6", "http://www.contoso.com/xxx/yyy/foo/bar/Hello%20World.htm?x=0:8", uri.AbsoluteUri);
+ AssertEquals ("#rel6", "http://www.contoso.com/xxx/yyy/foo/bar/Hello%20World.htm?x=0:8", uri.AbsoluteUri);
uri = new Uri (new Uri("http://www.contoso.com/xxx/yyy/index.htm"), "/foo/bar/Hello World.htm?x=0:8", false);
- Assertion.AssertEquals ("#rel7", "http://www.contoso.com/foo/bar/Hello%20World.htm?x=0:8", uri.AbsoluteUri);
+ AssertEquals ("#rel7", "http://www.contoso.com/foo/bar/Hello%20World.htm?x=0:8", uri.AbsoluteUri);
uri = new Uri (new Uri("http://www.contoso.com/xxx/yyy/index.htm"), "../foo/bar/Hello World.htm?x=0:8", false);
- Assertion.AssertEquals ("#rel8", "http://www.contoso.com/xxx/foo/bar/Hello%20World.htm?x=0:8", uri.AbsoluteUri);
+ AssertEquals ("#rel8", "http://www.contoso.com/xxx/foo/bar/Hello%20World.htm?x=0:8", uri.AbsoluteUri);
uri = new Uri (new Uri("http://www.contoso.com/xxx/yyy/index.htm"), "../../../foo/bar/Hello World.htm?x=0:8", false);
- Assertion.AssertEquals ("#rel9", "http://www.contoso.com/../foo/bar/Hello%20World.htm?x=0:8", uri.AbsoluteUri);
+ AssertEquals ("#rel9", "http://www.contoso.com/../foo/bar/Hello%20World.htm?x=0:8", uri.AbsoluteUri);
uri = new Uri (new Uri("http://www.contoso.com/xxx/yyy/index.htm"), "./foo/bar/Hello World.htm?x=0:8", false);
- Assertion.AssertEquals ("#rel10", "http://www.contoso.com/xxx/yyy/foo/bar/Hello%20World.htm?x=0:8", uri.AbsoluteUri);
+ AssertEquals ("#rel10", "http://www.contoso.com/xxx/yyy/foo/bar/Hello%20World.htm?x=0:8", uri.AbsoluteUri);
try {
uri = new Uri (null, "http://www.contoso.com/index.htm", false);
- Assertion.Fail ("#rel20");
+ Fail ("#rel20");
} catch (NullReferenceException) {
}
try {
uri = new Uri (new Uri("http://www.contoso.com"), null, false);
- Assertion.Fail ("#rel21");
+ Fail ("#rel21");
} catch (NullReferenceException) {
}
try {
uri = new Uri (new Uri("http://www.contoso.com/foo/bar/index.html?x=0"), String.Empty, false);
- Assertion.AssertEquals("#22", "http://www.contoso.com/foo/bar/index.html?x=0", uri.ToString ());
+ AssertEquals("#22", "http://www.contoso.com/foo/bar/index.html?x=0", uri.ToString ());
} catch (NullReferenceException) {
}
uri = new Uri (new Uri("http://www.xxx.com"), "?x=0");
- Assertion.AssertEquals ("#rel30", "http://www.xxx.com/?x=0", uri.ToString());
+ AssertEquals ("#rel30", "http://www.xxx.com/?x=0", uri.ToString());
uri = new Uri (new Uri("http://www.xxx.com/index.htm"), "?x=0");
- Assertion.AssertEquals ("#rel31", "http://www.xxx.com/?x=0", uri.ToString());
+ AssertEquals ("#rel31", "http://www.xxx.com/?x=0", uri.ToString());
uri = new Uri (new Uri("http://www.xxx.com/index.htm"), "#here");
- Assertion.AssertEquals ("#rel32", "http://www.xxx.com/index.htm#here", uri.ToString());
+ AssertEquals ("#rel32", "http://www.xxx.com/index.htm#here", uri.ToString());
}
-
+
+ [Test]
+ public void ConstructorsRejectRelativePath ()
+ {
+ string [] reluris = new string [] {
+ "readme.txt",
+ "thisdir/childdir/file"
+ };
+ string [] winRelUris = new string [] {
+ "c:readme.txt"
+ };
+
+ for (int i = 0; i < reluris.Length; i++) {
+ try {
+ new Uri (reluris [i]);
+ Fail ("Should be failed: " + reluris [i]);
+ } catch (UriFormatException) {
+ }
+ }
+
+ if (isWin32) {
+ for (int i = 0; i < winRelUris.Length; i++) {
+ try {
+ new Uri (winRelUris [i]);
+ Fail ("Should be failed: " + winRelUris [i]);
+ } catch (UriFormatException) {
+ }
+ }
+ }
+ }
+
+
[Test]
public void LocalPath ()
{
Uri uri = new Uri ("c:\\tmp\\hello.txt");
- Assertion.AssertEquals ("#1a", "file:///c:/tmp/hello.txt", uri.ToString ());
- Assertion.AssertEquals ("#1b", "c:\\tmp\\hello.txt", uri.LocalPath);
- Assertion.AssertEquals ("#1c", "file", uri.Scheme);
- Assertion.AssertEquals ("#1d", "", uri.Host);
- Assertion.AssertEquals ("#1e", "c:/tmp/hello.txt", uri.AbsolutePath);
+ AssertEquals ("#1a", "file:///c:/tmp/hello.txt", uri.ToString ());
+ AssertEquals ("#1b", "c:\\tmp\\hello.txt", uri.LocalPath);
+ AssertEquals ("#1c", "file", uri.Scheme);
+ AssertEquals ("#1d", "", uri.Host);
+ AssertEquals ("#1e", "c:/tmp/hello.txt", uri.AbsolutePath);
uri = new Uri ("file:////////cygwin/tmp/hello.txt");
- Assertion.AssertEquals ("#3a", "file://cygwin/tmp/hello.txt", uri.ToString ());
+ AssertEquals ("#3a", "file://cygwin/tmp/hello.txt", uri.ToString ());
if (isWin32)
- Assertion.AssertEquals ("#3b win32", "\\\\cygwin\\tmp\\hello.txt", uri.LocalPath);
+ AssertEquals ("#3b win32", "\\\\cygwin\\tmp\\hello.txt", uri.LocalPath);
else
- Assertion.AssertEquals ("#3b *nix", "/cygwin/tmp/hello.txt", uri.LocalPath);
- Assertion.AssertEquals ("#3c", "file", uri.Scheme);
- Assertion.AssertEquals ("#3d", "cygwin", uri.Host);
- Assertion.AssertEquals ("#3e", "/tmp/hello.txt", uri.AbsolutePath);
+ AssertEquals ("#3b *nix", "/cygwin/tmp/hello.txt", uri.LocalPath);
+ AssertEquals ("#3c", "file", uri.Scheme);
+ AssertEquals ("#3d", "cygwin", uri.Host);
+ AssertEquals ("#3e", "/tmp/hello.txt", uri.AbsolutePath);
uri = new Uri ("file://mymachine/cygwin/tmp/hello.txt");
- Assertion.AssertEquals ("#4a", "file://mymachine/cygwin/tmp/hello.txt", uri.ToString ());
+ AssertEquals ("#4a", "file://mymachine/cygwin/tmp/hello.txt", uri.ToString ());
if (isWin32)
- Assertion.AssertEquals ("#4b win32", "\\\\mymachine\\cygwin\\tmp\\hello.txt", uri.LocalPath);
+ AssertEquals ("#4b win32", "\\\\mymachine\\cygwin\\tmp\\hello.txt", uri.LocalPath);
else
- Assertion.AssertEquals ("#4b *nix", "/mymachine/cygwin/tmp/hello.txt", uri.LocalPath);
- Assertion.AssertEquals ("#4c", "file", uri.Scheme);
- Assertion.AssertEquals ("#4d", "mymachine", uri.Host);
- Assertion.AssertEquals ("#4e", "/cygwin/tmp/hello.txt", uri.AbsolutePath);
+ AssertEquals ("#4b *nix", "/mymachine/cygwin/tmp/hello.txt", uri.LocalPath);
+ AssertEquals ("#4c", "file", uri.Scheme);
+ AssertEquals ("#4d", "mymachine", uri.Host);
+ AssertEquals ("#4e", "/cygwin/tmp/hello.txt", uri.AbsolutePath);
uri = new Uri ("file://///c:/cygwin/tmp/hello.txt");
- Assertion.AssertEquals ("#5a", "file:///c:/cygwin/tmp/hello.txt", uri.ToString ());
- Assertion.AssertEquals ("#5b", "c:\\cygwin\\tmp\\hello.txt", uri.LocalPath);
- Assertion.AssertEquals ("#5c", "file", uri.Scheme);
- Assertion.AssertEquals ("#5d", "", uri.Host);
- Assertion.AssertEquals ("#5e", "c:/cygwin/tmp/hello.txt", uri.AbsolutePath);
+ AssertEquals ("#5a", "file:///c:/cygwin/tmp/hello.txt", uri.ToString ());
+ AssertEquals ("#5b", "c:\\cygwin\\tmp\\hello.txt", uri.LocalPath);
+ AssertEquals ("#5c", "file", uri.Scheme);
+ AssertEquals ("#5d", "", uri.Host);
+ AssertEquals ("#5e", "c:/cygwin/tmp/hello.txt", uri.AbsolutePath);
uri = new Uri("file://one_file.txt");
- Assertion.AssertEquals("#6a", "file://one_file.txt", uri.ToString());
+ AssertEquals("#6a", "file://one_file.txt", uri.ToString());
if (isWin32)
- Assertion.AssertEquals("#6b", "\\\\one_file.txt", uri.LocalPath);
+ AssertEquals("#6b", "\\\\one_file.txt", uri.LocalPath);
else
- Assertion.AssertEquals("#6b", "/one_file.txt", uri.LocalPath);
- Assertion.AssertEquals("#6c", "file", uri.Scheme);
- Assertion.AssertEquals("#6d", "one_file.txt", uri.Host);
- Assertion.AssertEquals("#6e", "", uri.AbsolutePath);
+ AssertEquals("#6b", "/one_file.txt", uri.LocalPath);
+ AssertEquals("#6c", "file", uri.Scheme);
+ AssertEquals("#6d", "one_file.txt", uri.Host);
+ AssertEquals("#6e", "", uri.AbsolutePath);
}
[Test]
public void UnixPath () {
if (!isWin32)
- Assertion.AssertEquals ("#6a", "file://cygwin/tmp/hello.txt", new Uri ("/cygwin/tmp/hello.txt").ToString ());
+ AssertEquals ("#6a", "file:///cygwin/tmp/hello.txt", new Uri ("/cygwin/tmp/hello.txt").ToString ());
}
[Test]
public void Unc ()
{
Uri uri = new Uri ("http://www.contoso.com");
- Assertion.Assert ("#1", !uri.IsUnc);
+ Assert ("#1", !uri.IsUnc);
uri = new Uri ("news:123456@contoso.com");
- Assertion.Assert ("#2", !uri.IsUnc);
+ Assert ("#2", !uri.IsUnc);
uri = new Uri ("file://server/filename.ext");
- Assertion.Assert ("#3", uri.IsUnc);
+ Assert ("#3", uri.IsUnc);
uri = new Uri (@"\\server\share\filename.ext");
- Assertion.Assert ("#6", uri.IsUnc);
+ Assert ("#6", uri.IsUnc);
uri = new Uri (@"a:\dir\filename.ext");
- Assertion.Assert ("#8", !uri.IsUnc);
+ Assert ("#8", !uri.IsUnc);
}
[Test, ExpectedException (typeof (UriFormatException))]
public void UncFail ()
{
Uri uri = new Uri ("/home/user/dir/filename.ext");
- Assertion.Assert ("#7", !uri.IsUnc);
+ Assert ("#7", !uri.IsUnc);
}
[Test]
@@ -261,44 +292,44 @@ namespace MonoTests.System
{
try {
Uri uri = new Uri ("file:/filename.ext");
- Assertion.Assert ("#4", uri.IsUnc);
+ Assert ("#4", uri.IsUnc);
} catch (UriFormatException) {
- Assertion.Fail ("#5: known to fail with ms.net");
+ Fail ("#5: known to fail with ms.net");
}
}
[Test]
public void FromHex ()
{
- Assertion.AssertEquals ("#1", 0, Uri.FromHex ('0'));
- Assertion.AssertEquals ("#2", 9, Uri.FromHex ('9'));
- Assertion.AssertEquals ("#3", 10, Uri.FromHex ('a'));
- Assertion.AssertEquals ("#4", 15, Uri.FromHex ('f'));
- Assertion.AssertEquals ("#5", 10, Uri.FromHex ('A'));
- Assertion.AssertEquals ("#6", 15, Uri.FromHex ('F'));
+ AssertEquals ("#1", 0, Uri.FromHex ('0'));
+ AssertEquals ("#2", 9, Uri.FromHex ('9'));
+ AssertEquals ("#3", 10, Uri.FromHex ('a'));
+ AssertEquals ("#4", 15, Uri.FromHex ('f'));
+ AssertEquals ("#5", 10, Uri.FromHex ('A'));
+ AssertEquals ("#6", 15, Uri.FromHex ('F'));
try {
Uri.FromHex ('G');
- Assertion.Fail ("#7");
+ Fail ("#7");
} catch (ArgumentException) {}
try {
Uri.FromHex (' ');
- Assertion.Fail ("#8");
+ Fail ("#8");
} catch (ArgumentException) {}
try {
Uri.FromHex ('%');
- Assertion.Fail ("#8");
+ Fail ("#8");
} catch (ArgumentException) {}
}
[Test]
public void HexEscape ()
{
- Assertion.AssertEquals ("#1","%20", Uri.HexEscape (' '));
- Assertion.AssertEquals ("#2","%A9", Uri.HexEscape ((char) 0xa9));
- Assertion.AssertEquals ("#3","%41", Uri.HexEscape ('A'));
+ AssertEquals ("#1","%20", Uri.HexEscape (' '));
+ AssertEquals ("#2","%A9", Uri.HexEscape ((char) 0xa9));
+ AssertEquals ("#3","%41", Uri.HexEscape ('A'));
try {
Uri.HexEscape ((char) 0x0369);
- Assertion.Fail ("#4");
+ Fail ("#4");
} catch (ArgumentOutOfRangeException) {}
}
@@ -306,79 +337,79 @@ namespace MonoTests.System
public void HexUnescape ()
{
int i = 0;
- Assertion.AssertEquals ("#1", ' ', Uri.HexUnescape ("%20", ref i));
- Assertion.AssertEquals ("#2", 3, i);
+ AssertEquals ("#1", ' ', Uri.HexUnescape ("%20", ref i));
+ AssertEquals ("#2", 3, i);
i = 4;
- Assertion.AssertEquals ("#3", (char) 0xa9, Uri.HexUnescape ("test%a9test", ref i));
- Assertion.AssertEquals ("#4", 7, i);
- Assertion.AssertEquals ("#5", 't', Uri.HexUnescape ("test%a9test", ref i));
- Assertion.AssertEquals ("#6", 8, i);
+ AssertEquals ("#3", (char) 0xa9, Uri.HexUnescape ("test%a9test", ref i));
+ AssertEquals ("#4", 7, i);
+ AssertEquals ("#5", 't', Uri.HexUnescape ("test%a9test", ref i));
+ AssertEquals ("#6", 8, i);
i = 4;
- Assertion.AssertEquals ("#5", '%', Uri.HexUnescape ("test%a", ref i));
- Assertion.AssertEquals ("#6", 5, i);
- Assertion.AssertEquals ("#7", '%', Uri.HexUnescape ("testx%xx", ref i));
- Assertion.AssertEquals ("#8", 6, i);
+ AssertEquals ("#5", '%', Uri.HexUnescape ("test%a", ref i));
+ AssertEquals ("#6", 5, i);
+ AssertEquals ("#7", '%', Uri.HexUnescape ("testx%xx", ref i));
+ AssertEquals ("#8", 6, i);
}
[Test]
public void IsHexDigit ()
{
- Assertion.Assert ("#1", Uri.IsHexDigit ('a'));
- Assertion.Assert ("#2", Uri.IsHexDigit ('f'));
- Assertion.Assert ("#3", !Uri.IsHexDigit ('g'));
- Assertion.Assert ("#4", Uri.IsHexDigit ('0'));
- Assertion.Assert ("#5", Uri.IsHexDigit ('9'));
- Assertion.Assert ("#6", Uri.IsHexDigit ('A'));
- Assertion.Assert ("#7", Uri.IsHexDigit ('F'));
- Assertion.Assert ("#8", !Uri.IsHexDigit ('G'));
+ Assert ("#1", Uri.IsHexDigit ('a'));
+ Assert ("#2", Uri.IsHexDigit ('f'));
+ Assert ("#3", !Uri.IsHexDigit ('g'));
+ Assert ("#4", Uri.IsHexDigit ('0'));
+ Assert ("#5", Uri.IsHexDigit ('9'));
+ Assert ("#6", Uri.IsHexDigit ('A'));
+ Assert ("#7", Uri.IsHexDigit ('F'));
+ Assert ("#8", !Uri.IsHexDigit ('G'));
}
[Test]
public void IsHexEncoding ()
{
- Assertion.Assert ("#1", Uri.IsHexEncoding ("test%a9test", 4));
- Assertion.Assert ("#2", !Uri.IsHexEncoding ("test%a9test", 3));
- Assertion.Assert ("#3", Uri.IsHexEncoding ("test%a9", 4));
- Assertion.Assert ("#4", !Uri.IsHexEncoding ("test%a", 4));
+ Assert ("#1", Uri.IsHexEncoding ("test%a9test", 4));
+ Assert ("#2", !Uri.IsHexEncoding ("test%a9test", 3));
+ Assert ("#3", Uri.IsHexEncoding ("test%a9", 4));
+ Assert ("#4", !Uri.IsHexEncoding ("test%a", 4));
}
[Test]
public void GetLeftPart ()
{
Uri uri = new Uri ("http://www.contoso.com/index.htm#main");
- Assertion.AssertEquals ("#1", "http://", uri.GetLeftPart (UriPartial.Scheme));
- Assertion.AssertEquals ("#2", "http://www.contoso.com", uri.GetLeftPart (UriPartial.Authority));
- Assertion.AssertEquals ("#3", "http://www.contoso.com/index.htm", uri.GetLeftPart (UriPartial.Path));
+ AssertEquals ("#1", "http://", uri.GetLeftPart (UriPartial.Scheme));
+ AssertEquals ("#2", "http://www.contoso.com", uri.GetLeftPart (UriPartial.Authority));
+ AssertEquals ("#3", "http://www.contoso.com/index.htm", uri.GetLeftPart (UriPartial.Path));
uri = new Uri ("mailto:user@contoso.com?subject=uri");
- Assertion.AssertEquals ("#4", "mailto:", uri.GetLeftPart (UriPartial.Scheme));
- Assertion.AssertEquals ("#5", "", uri.GetLeftPart (UriPartial.Authority));
- Assertion.AssertEquals ("#6", "mailto:user@contoso.com", uri.GetLeftPart (UriPartial.Path));
+ AssertEquals ("#4", "mailto:", uri.GetLeftPart (UriPartial.Scheme));
+ AssertEquals ("#5", "", uri.GetLeftPart (UriPartial.Authority));
+ AssertEquals ("#6", "mailto:user@contoso.com", uri.GetLeftPart (UriPartial.Path));
uri = new Uri ("nntp://news.contoso.com/123456@contoso.com");
- Assertion.AssertEquals ("#7", "nntp://", uri.GetLeftPart (UriPartial.Scheme));
- Assertion.AssertEquals ("#8", "nntp://news.contoso.com", uri.GetLeftPart (UriPartial.Authority));
- Assertion.AssertEquals ("#9", "nntp://news.contoso.com/123456@contoso.com", uri.GetLeftPart (UriPartial.Path));
+ AssertEquals ("#7", "nntp://", uri.GetLeftPart (UriPartial.Scheme));
+ AssertEquals ("#8", "nntp://news.contoso.com", uri.GetLeftPart (UriPartial.Authority));
+ AssertEquals ("#9", "nntp://news.contoso.com/123456@contoso.com", uri.GetLeftPart (UriPartial.Path));
uri = new Uri ("news:123456@contoso.com");
- Assertion.AssertEquals ("#10", "news:", uri.GetLeftPart (UriPartial.Scheme));
- Assertion.AssertEquals ("#11", "", uri.GetLeftPart (UriPartial.Authority));
- Assertion.AssertEquals ("#12", "news:123456@contoso.com", uri.GetLeftPart (UriPartial.Path));
+ AssertEquals ("#10", "news:", uri.GetLeftPart (UriPartial.Scheme));
+ AssertEquals ("#11", "", uri.GetLeftPart (UriPartial.Authority));
+ AssertEquals ("#12", "news:123456@contoso.com", uri.GetLeftPart (UriPartial.Path));
uri = new Uri ("file://server/filename.ext");
- Assertion.AssertEquals ("#13", "file://", uri.GetLeftPart (UriPartial.Scheme));
- Assertion.AssertEquals ("#14", "file://server", uri.GetLeftPart (UriPartial.Authority));
- Assertion.AssertEquals ("#15", "file://server/filename.ext", uri.GetLeftPart (UriPartial.Path));
+ AssertEquals ("#13", "file://", uri.GetLeftPart (UriPartial.Scheme));
+ AssertEquals ("#14", "file://server", uri.GetLeftPart (UriPartial.Authority));
+ AssertEquals ("#15", "file://server/filename.ext", uri.GetLeftPart (UriPartial.Path));
uri = new Uri (@"\\server\share\filename.ext");
- Assertion.AssertEquals ("#20", "file://", uri.GetLeftPart (UriPartial.Scheme));
- Assertion.AssertEquals ("#21", "file://server", uri.GetLeftPart (UriPartial.Authority));
- Assertion.AssertEquals ("#22", "file://server/share/filename.ext", uri.GetLeftPart (UriPartial.Path));
+ AssertEquals ("#20", "file://", uri.GetLeftPart (UriPartial.Scheme));
+ AssertEquals ("#21", "file://server", uri.GetLeftPart (UriPartial.Authority));
+ AssertEquals ("#22", "file://server/share/filename.ext", uri.GetLeftPart (UriPartial.Path));
uri = new Uri ("http://www.contoso.com:8080/index.htm#main");
- Assertion.AssertEquals ("#23", "http://", uri.GetLeftPart (UriPartial.Scheme));
- Assertion.AssertEquals ("#24", "http://www.contoso.com:8080", uri.GetLeftPart (UriPartial.Authority));
- Assertion.AssertEquals ("#25", "http://www.contoso.com:8080/index.htm", uri.GetLeftPart (UriPartial.Path));
+ AssertEquals ("#23", "http://", uri.GetLeftPart (UriPartial.Scheme));
+ AssertEquals ("#24", "http://www.contoso.com:8080", uri.GetLeftPart (UriPartial.Authority));
+ AssertEquals ("#25", "http://www.contoso.com:8080/index.htm", uri.GetLeftPart (UriPartial.Path));
}
[Test]
@@ -387,95 +418,95 @@ namespace MonoTests.System
{
try {
Uri uri = new Uri ("file:/filename.ext");
- Assertion.AssertEquals ("#16", "file://", uri.GetLeftPart (UriPartial.Scheme));
- Assertion.AssertEquals ("#17", "", uri.GetLeftPart (UriPartial.Authority));
- Assertion.AssertEquals ("#18", "file:///filename.ext", uri.GetLeftPart (UriPartial.Path));
+ AssertEquals ("#16", "file://", uri.GetLeftPart (UriPartial.Scheme));
+ AssertEquals ("#17", "", uri.GetLeftPart (UriPartial.Authority));
+ AssertEquals ("#18", "file:///filename.ext", uri.GetLeftPart (UriPartial.Path));
} catch (UriFormatException) {
- Assertion.Fail ("#19: known to fail with ms.net (it's their own example!)");
+ Fail ("#19: known to fail with ms.net (it's their own example!)");
}
}
[Test]
public void CheckHostName ()
{
- Assertion.AssertEquals ("#1", UriHostNameType.Unknown, Uri.CheckHostName (null));
- Assertion.AssertEquals ("#2", UriHostNameType.Unknown, Uri.CheckHostName (""));
- Assertion.AssertEquals ("#3", UriHostNameType.Unknown, Uri.CheckHostName ("^&()~`!@"));
- Assertion.AssertEquals ("#4", UriHostNameType.Dns, Uri.CheckHostName ("x"));
- Assertion.AssertEquals ("#5", UriHostNameType.IPv4, Uri.CheckHostName ("1.2.3.4"));
- Assertion.AssertEquals ("#6", UriHostNameType.IPv4, Uri.CheckHostName ("0001.002.03.4"));
- Assertion.AssertEquals ("#7", UriHostNameType.Dns, Uri.CheckHostName ("0001.002.03.256"));
- Assertion.AssertEquals ("#8", UriHostNameType.Dns, Uri.CheckHostName ("9001.002.03.4"));
- Assertion.AssertEquals ("#9", UriHostNameType.Dns, Uri.CheckHostName ("www.contoso.com"));
- Assertion.AssertEquals ("#10", UriHostNameType.Unknown, Uri.CheckHostName (".www.contoso.com"));
- Assertion.AssertEquals ("#11: known to fail with ms.net: this is not a valid domain address", UriHostNameType.Unknown, Uri.CheckHostName ("www.contoso.com."));
- Assertion.AssertEquals ("#12", UriHostNameType.Dns, Uri.CheckHostName ("www.con-toso.com"));
- Assertion.AssertEquals ("#13", UriHostNameType.Dns, Uri.CheckHostName ("www.con_toso.com"));
- Assertion.AssertEquals ("#14", UriHostNameType.Unknown, Uri.CheckHostName ("www.con,toso.com"));
+ AssertEquals ("#1", UriHostNameType.Unknown, Uri.CheckHostName (null));
+ AssertEquals ("#2", UriHostNameType.Unknown, Uri.CheckHostName (""));
+ AssertEquals ("#3", UriHostNameType.Unknown, Uri.CheckHostName ("^&()~`!@"));
+ AssertEquals ("#4", UriHostNameType.Dns, Uri.CheckHostName ("x"));
+ AssertEquals ("#5", UriHostNameType.IPv4, Uri.CheckHostName ("1.2.3.4"));
+ AssertEquals ("#6", UriHostNameType.IPv4, Uri.CheckHostName ("0001.002.03.4"));
+ AssertEquals ("#7", UriHostNameType.Dns, Uri.CheckHostName ("0001.002.03.256"));
+ AssertEquals ("#8", UriHostNameType.Dns, Uri.CheckHostName ("9001.002.03.4"));
+ AssertEquals ("#9", UriHostNameType.Dns, Uri.CheckHostName ("www.contoso.com"));
+ AssertEquals ("#10", UriHostNameType.Unknown, Uri.CheckHostName (".www.contoso.com"));
+ AssertEquals ("#11: known to fail with ms.net: this is not a valid domain address", UriHostNameType.Unknown, Uri.CheckHostName ("www.contoso.com."));
+ AssertEquals ("#12", UriHostNameType.Dns, Uri.CheckHostName ("www.con-toso.com"));
+ AssertEquals ("#13", UriHostNameType.Dns, Uri.CheckHostName ("www.con_toso.com"));
+ AssertEquals ("#14", UriHostNameType.Unknown, Uri.CheckHostName ("www.con,toso.com"));
// test IPv6
- Assertion.AssertEquals ("#15", UriHostNameType.IPv6, Uri.CheckHostName ("11:22:33:44:55:66:77:88"));
- Assertion.AssertEquals ("#16", UriHostNameType.IPv6, Uri.CheckHostName ("11::33:44:55:66:77:88"));
- Assertion.AssertEquals ("#17", UriHostNameType.IPv6, Uri.CheckHostName ("::22:33:44:55:66:77:88"));
- Assertion.AssertEquals ("#18", UriHostNameType.IPv6, Uri.CheckHostName ("11:22:33:44:55:66:77::"));
- Assertion.AssertEquals ("#19", UriHostNameType.IPv6, Uri.CheckHostName ("11::88"));
- Assertion.AssertEquals ("#20", UriHostNameType.IPv6, Uri.CheckHostName ("11::77:88"));
- Assertion.AssertEquals ("#21", UriHostNameType.IPv6, Uri.CheckHostName ("11:22::88"));
- Assertion.AssertEquals ("#22", UriHostNameType.IPv6, Uri.CheckHostName ("11::"));
- Assertion.AssertEquals ("#23", UriHostNameType.IPv6, Uri.CheckHostName ("::88"));
- Assertion.AssertEquals ("#24", UriHostNameType.IPv6, Uri.CheckHostName ("::1"));
- Assertion.AssertEquals ("#25", UriHostNameType.IPv6, Uri.CheckHostName ("::"));
- Assertion.AssertEquals ("#26", UriHostNameType.IPv6, Uri.CheckHostName ("0:0:0:0:0:0:127.0.0.1"));
- Assertion.AssertEquals ("#27", UriHostNameType.IPv6, Uri.CheckHostName ("::127.0.0.1"));
- Assertion.AssertEquals ("#28", UriHostNameType.IPv6, Uri.CheckHostName ("::ffFF:169.32.14.5"));
- Assertion.AssertEquals ("#29", UriHostNameType.IPv6, Uri.CheckHostName ("2001:03A0::/35"));
- Assertion.AssertEquals ("#30", UriHostNameType.IPv6, Uri.CheckHostName ("[2001:03A0::/35]"));
-
- Assertion.AssertEquals ("#31", UriHostNameType.Unknown, Uri.CheckHostName ("2001::03A0::/35"));
- Assertion.AssertEquals ("#32", UriHostNameType.Unknown, Uri.CheckHostName ("2001:03A0::/35a"));
- Assertion.AssertEquals ("#33 known to fail with ms.net: this is not a valid IPv6 address.", UriHostNameType.Unknown, Uri.CheckHostName ("2001::03A0:1.2.3.4"));
- Assertion.AssertEquals ("#34", UriHostNameType.Unknown, Uri.CheckHostName ("::ffff:123.256.155.43"));
- Assertion.AssertEquals ("#35", UriHostNameType.Unknown, Uri.CheckHostName (":127.0.0.1"));
- Assertion.AssertEquals ("#36 known to fail with ms.net: this is not a valid IPv6 address.", UriHostNameType.Unknown, Uri.CheckHostName (":11:22:33:44:55:66:77:88"));
- Assertion.AssertEquals ("#37", UriHostNameType.Unknown, Uri.CheckHostName ("::11:22:33:44:55:66:77:88"));
- Assertion.AssertEquals ("#38", UriHostNameType.Unknown, Uri.CheckHostName ("11:22:33:44:55:66:77:88::"));
- Assertion.AssertEquals ("#39", UriHostNameType.Unknown, Uri.CheckHostName ("11:22:33:44:55:66:77:88:"));
- Assertion.AssertEquals ("#40", UriHostNameType.Unknown, Uri.CheckHostName ("::acbde"));
- Assertion.AssertEquals ("#41", UriHostNameType.Unknown, Uri.CheckHostName ("::abce:"));
- Assertion.AssertEquals ("#42", UriHostNameType.Unknown, Uri.CheckHostName ("::abcg"));
- Assertion.AssertEquals ("#43", UriHostNameType.Unknown, Uri.CheckHostName (":::"));
- Assertion.AssertEquals ("#44", UriHostNameType.Unknown, Uri.CheckHostName (":"));
+ AssertEquals ("#15", UriHostNameType.IPv6, Uri.CheckHostName ("11:22:33:44:55:66:77:88"));
+ AssertEquals ("#16", UriHostNameType.IPv6, Uri.CheckHostName ("11::33:44:55:66:77:88"));
+ AssertEquals ("#17", UriHostNameType.IPv6, Uri.CheckHostName ("::22:33:44:55:66:77:88"));
+ AssertEquals ("#18", UriHostNameType.IPv6, Uri.CheckHostName ("11:22:33:44:55:66:77::"));
+ AssertEquals ("#19", UriHostNameType.IPv6, Uri.CheckHostName ("11::88"));
+ AssertEquals ("#20", UriHostNameType.IPv6, Uri.CheckHostName ("11::77:88"));
+ AssertEquals ("#21", UriHostNameType.IPv6, Uri.CheckHostName ("11:22::88"));
+ AssertEquals ("#22", UriHostNameType.IPv6, Uri.CheckHostName ("11::"));
+ AssertEquals ("#23", UriHostNameType.IPv6, Uri.CheckHostName ("::88"));
+ AssertEquals ("#24", UriHostNameType.IPv6, Uri.CheckHostName ("::1"));
+ AssertEquals ("#25", UriHostNameType.IPv6, Uri.CheckHostName ("::"));
+ AssertEquals ("#26", UriHostNameType.IPv6, Uri.CheckHostName ("0:0:0:0:0:0:127.0.0.1"));
+ AssertEquals ("#27", UriHostNameType.IPv6, Uri.CheckHostName ("::127.0.0.1"));
+ AssertEquals ("#28", UriHostNameType.IPv6, Uri.CheckHostName ("::ffFF:169.32.14.5"));
+ AssertEquals ("#29", UriHostNameType.IPv6, Uri.CheckHostName ("2001:03A0::/35"));
+ AssertEquals ("#30", UriHostNameType.IPv6, Uri.CheckHostName ("[2001:03A0::/35]"));
+
+ AssertEquals ("#31", UriHostNameType.Unknown, Uri.CheckHostName ("2001::03A0::/35"));
+ AssertEquals ("#32", UriHostNameType.Unknown, Uri.CheckHostName ("2001:03A0::/35a"));
+ AssertEquals ("#33 known to fail with ms.net: this is not a valid IPv6 address.", UriHostNameType.Unknown, Uri.CheckHostName ("2001::03A0:1.2.3.4"));
+ AssertEquals ("#34", UriHostNameType.Unknown, Uri.CheckHostName ("::ffff:123.256.155.43"));
+ AssertEquals ("#35", UriHostNameType.Unknown, Uri.CheckHostName (":127.0.0.1"));
+ AssertEquals ("#36 known to fail with ms.net: this is not a valid IPv6 address.", UriHostNameType.Unknown, Uri.CheckHostName (":11:22:33:44:55:66:77:88"));
+ AssertEquals ("#37", UriHostNameType.Unknown, Uri.CheckHostName ("::11:22:33:44:55:66:77:88"));
+ AssertEquals ("#38", UriHostNameType.Unknown, Uri.CheckHostName ("11:22:33:44:55:66:77:88::"));
+ AssertEquals ("#39", UriHostNameType.Unknown, Uri.CheckHostName ("11:22:33:44:55:66:77:88:"));
+ AssertEquals ("#40", UriHostNameType.Unknown, Uri.CheckHostName ("::acbde"));
+ AssertEquals ("#41", UriHostNameType.Unknown, Uri.CheckHostName ("::abce:"));
+ AssertEquals ("#42", UriHostNameType.Unknown, Uri.CheckHostName ("::abcg"));
+ AssertEquals ("#43", UriHostNameType.Unknown, Uri.CheckHostName (":::"));
+ AssertEquals ("#44", UriHostNameType.Unknown, Uri.CheckHostName (":"));
}
[Test]
public void IsLoopback ()
{
Uri uri = new Uri("http://loopback:8080");
- Assertion.AssertEquals ("#1", true, uri.IsLoopback);
+ AssertEquals ("#1", true, uri.IsLoopback);
uri = new Uri("http://localhost:8080");
- Assertion.AssertEquals ("#2", true, uri.IsLoopback);
+ AssertEquals ("#2", true, uri.IsLoopback);
uri = new Uri("http://127.0.0.1:8080");
- Assertion.AssertEquals ("#3", true, uri.IsLoopback);
+ AssertEquals ("#3", true, uri.IsLoopback);
uri = new Uri("http://127.0.0.001:8080");
- Assertion.AssertEquals ("#4", true, uri.IsLoopback);
+ AssertEquals ("#4", true, uri.IsLoopback);
uri = new Uri("http://[::1]");
- Assertion.AssertEquals ("#5", true, uri.IsLoopback);
+ AssertEquals ("#5", true, uri.IsLoopback);
uri = new Uri("http://[::1]:8080");
- Assertion.AssertEquals ("#6", true, uri.IsLoopback);
+ AssertEquals ("#6", true, uri.IsLoopback);
uri = new Uri("http://[::0001]:8080");
- Assertion.AssertEquals ("#7", true, uri.IsLoopback);
+ AssertEquals ("#7", true, uri.IsLoopback);
uri = new Uri("http://[0:0:0:0::1]:8080");
- Assertion.AssertEquals ("#8", true, uri.IsLoopback);
+ AssertEquals ("#8", true, uri.IsLoopback);
uri = new Uri("http://[0:0:0:0::127.0.0.1]:8080");
- Assertion.AssertEquals ("#9", true, uri.IsLoopback);
+ AssertEquals ("#9", true, uri.IsLoopback);
uri = new Uri("http://[0:0:0:0::127.11.22.33]:8080");
- Assertion.AssertEquals ("#10: known to fail with ms.net", true, uri.IsLoopback);
+ AssertEquals ("#10: known to fail with ms.net", true, uri.IsLoopback);
uri = new Uri("http://[::ffff:127.11.22.33]:8080");
- Assertion.AssertEquals ("#11: known to fail with ms.net", true, uri.IsLoopback);
+ AssertEquals ("#11: known to fail with ms.net", true, uri.IsLoopback);
uri = new Uri("http://[::ff00:7f11:2233]:8080");
- Assertion.AssertEquals ("#12", false, uri.IsLoopback);
+ AssertEquals ("#12", false, uri.IsLoopback);
uri = new Uri("http://[1:0:0:0::1]:8080");
- Assertion.AssertEquals ("#13", false, uri.IsLoopback);
+ AssertEquals ("#13", false, uri.IsLoopback);
}
[Test]
@@ -483,11 +514,11 @@ namespace MonoTests.System
{
Uri uri1 = new Uri ("http://www.contoso.com/index.htm#main");
Uri uri2 = new Uri ("http://www.contoso.com/index.htm#fragment");
- Assertion.Assert ("#1", uri1.Equals (uri2));
+ Assert ("#1", uri1.Equals (uri2));
uri2 = new Uri ("http://www.contoso.com/index.htm?x=1");
- Assertion.Assert ("#2 known to fail with ms.net", !uri1.Equals (uri2));
- Assertion.Assert ("#3", !uri2.Equals ("http://www.contoso.com/index.html?x=1"));
- Assertion.Assert ("#4: known to fail with ms.net", !uri1.Equals ("http://www.contoso.com:8080/index.htm?x=1"));
+ Assert ("#2 known to fail with ms.net", !uri1.Equals (uri2));
+ Assert ("#3", !uri2.Equals ("http://www.contoso.com/index.html?x=1"));
+ Assert ("#4: known to fail with ms.net", !uri1.Equals ("http://www.contoso.com:8080/index.htm?x=1"));
}
[Test]
@@ -495,13 +526,13 @@ namespace MonoTests.System
{
Uri uri1 = new Uri ("http://www.contoso.com/index.htm#main");
Uri uri2 = new Uri ("http://www.contoso.com/index.htm#fragment");
- Assertion.AssertEquals ("#1", uri1.GetHashCode (), uri2.GetHashCode ());
+ AssertEquals ("#1", uri1.GetHashCode (), uri2.GetHashCode ());
uri2 = new Uri ("http://www.contoso.com/index.htm?x=1");
- Assertion.Assert ("#2", uri1.GetHashCode () != uri2.GetHashCode ());
+ Assert ("#2", uri1.GetHashCode () != uri2.GetHashCode ());
uri2 = new Uri ("http://www.contoso.com:80/index.htm");
- Assertion.AssertEquals ("#3", uri1.GetHashCode (), uri2.GetHashCode ());
+ AssertEquals ("#3", uri1.GetHashCode (), uri2.GetHashCode ());
uri2 = new Uri ("http://www.contoso.com:8080/index.htm");
- Assertion.Assert ("#4", uri1.GetHashCode () != uri2.GetHashCode ());
+ Assert ("#4", uri1.GetHashCode () != uri2.GetHashCode ());
}
[Test]
@@ -516,59 +547,59 @@ namespace MonoTests.System
Uri uri7 = new Uri ("http://www.contoso2.com/bar/foo/foobar.htm?z=0&y=5");
Uri uri8 = new Uri ("http://www.xxx.com/bar/foo/foobar.htm?z=0&y=5" + (char) 0xa9);
- Assertion.AssertEquals ("#1", "foo/bar/index.htm", uri1.MakeRelative (uri2));
- Assertion.AssertEquals ("#2", "../../index.htm", uri2.MakeRelative (uri1));
+ AssertEquals ("#1", "foo/bar/index.htm", uri1.MakeRelative (uri2));
+ AssertEquals ("#2", "../../index.htm", uri2.MakeRelative (uri1));
- Assertion.AssertEquals ("#3", "../../bar/foo/index.htm", uri2.MakeRelative (uri3));
- Assertion.AssertEquals ("#4", "../../foo/bar/index.htm", uri3.MakeRelative (uri2));
+ AssertEquals ("#3", "../../bar/foo/index.htm", uri2.MakeRelative (uri3));
+ AssertEquals ("#4", "../../foo/bar/index.htm", uri3.MakeRelative (uri2));
- Assertion.AssertEquals ("#5", "../foo2/index.htm", uri3.MakeRelative (uri4));
- Assertion.AssertEquals ("#6", "../foo/index.htm", uri4.MakeRelative (uri3));
+ AssertEquals ("#5", "../foo2/index.htm", uri3.MakeRelative (uri4));
+ AssertEquals ("#6", "../foo/index.htm", uri4.MakeRelative (uri3));
- Assertion.AssertEquals ("#7", "https://www.contoso.com/bar/foo/index.htm?y=1",
+ AssertEquals ("#7", "https://www.contoso.com/bar/foo/index.htm?y=1",
uri4.MakeRelative (uri5));
- Assertion.AssertEquals ("#8", "http://www.contoso2.com/bar/foo/index.htm?x=0",
+ AssertEquals ("#8", "http://www.contoso2.com/bar/foo/index.htm?x=0",
uri4.MakeRelative (uri6));
- Assertion.AssertEquals ("#9", "", uri6.MakeRelative (uri6));
- Assertion.AssertEquals ("#10", "foobar.htm", uri6.MakeRelative (uri7));
+ AssertEquals ("#9", "", uri6.MakeRelative (uri6));
+ AssertEquals ("#10", "foobar.htm", uri6.MakeRelative (uri7));
Uri uri10 = new Uri ("mailto:xxx@xxx.com");
Uri uri11 = new Uri ("mailto:xxx@xxx.com?subject=hola");
- Assertion.AssertEquals ("#11", "", uri10.MakeRelative (uri11));
+ AssertEquals ("#11", "", uri10.MakeRelative (uri11));
Uri uri12 = new Uri ("mailto:xxx@mail.xxx.com?subject=hola");
- Assertion.AssertEquals ("#12", "mailto:xxx@mail.xxx.com?subject=hola", uri10.MakeRelative (uri12));
+ AssertEquals ("#12", "mailto:xxx@mail.xxx.com?subject=hola", uri10.MakeRelative (uri12));
Uri uri13 = new Uri ("mailto:xxx@xxx.com/foo/bar");
- Assertion.AssertEquals ("#13", "/foo/bar", uri10.MakeRelative (uri13));
+ AssertEquals ("#13", "/foo/bar", uri10.MakeRelative (uri13));
- Assertion.AssertEquals ("#14", "http://www.xxx.com/bar/foo/foobar.htm?z=0&y=5" + (char) 0xa9, uri1.MakeRelative (uri8));
+ AssertEquals ("#14", "http://www.xxx.com/bar/foo/foobar.htm?z=0&y=5" + (char) 0xa9, uri1.MakeRelative (uri8));
}
[Test]
public void ToStringTest()
{
Uri uri = new Uri ("dummy://xxx");
- Assertion.AssertEquals ("#1", "dummy://xxx/", uri.ToString ());
+ AssertEquals ("#1", "dummy://xxx/", uri.ToString ());
}
[Test]
public void CheckSchemeName ()
{
- Assertion.AssertEquals ("#01", false, Uri.CheckSchemeName (null));
- Assertion.AssertEquals ("#02", false, Uri.CheckSchemeName (""));
- Assertion.AssertEquals ("#03", true, Uri.CheckSchemeName ("http"));
- Assertion.AssertEquals ("#04", true, Uri.CheckSchemeName ("http-"));
- Assertion.AssertEquals ("#05", false, Uri.CheckSchemeName ("6http-"));
- Assertion.AssertEquals ("#06", true, Uri.CheckSchemeName ("http6-"));
- Assertion.AssertEquals ("#07", false, Uri.CheckSchemeName ("http6,"));
- Assertion.AssertEquals ("#08", true, Uri.CheckSchemeName ("http6."));
- Assertion.AssertEquals ("#09", false, Uri.CheckSchemeName ("+http"));
- Assertion.AssertEquals ("#10", true, Uri.CheckSchemeName ("htt+p6"));
+ AssertEquals ("#01", false, Uri.CheckSchemeName (null));
+ AssertEquals ("#02", false, Uri.CheckSchemeName (""));
+ AssertEquals ("#03", true, Uri.CheckSchemeName ("http"));
+ AssertEquals ("#04", true, Uri.CheckSchemeName ("http-"));
+ AssertEquals ("#05", false, Uri.CheckSchemeName ("6http-"));
+ AssertEquals ("#06", true, Uri.CheckSchemeName ("http6-"));
+ AssertEquals ("#07", false, Uri.CheckSchemeName ("http6,"));
+ AssertEquals ("#08", true, Uri.CheckSchemeName ("http6."));
+ AssertEquals ("#09", false, Uri.CheckSchemeName ("+http"));
+ AssertEquals ("#10", true, Uri.CheckSchemeName ("htt+p6"));
// 0x00E1 -> &atilde;
- Assertion.AssertEquals ("#11", true, Uri.CheckSchemeName ("htt\u00E1+p6"));
+ AssertEquals ("#11", true, Uri.CheckSchemeName ("htt\u00E1+p6"));
}
[Test]
@@ -591,8 +622,8 @@ namespace MonoTests.System
{
Uri uri = new Uri ("http://localhost/");
string [] segments = uri.Segments;
- Assertion.AssertEquals ("#01", 1, segments.Length);
- Assertion.AssertEquals ("#02", "/", segments [0]);
+ AssertEquals ("#01", 1, segments.Length);
+ AssertEquals ("#02", "/", segments [0]);
}
@@ -601,10 +632,10 @@ namespace MonoTests.System
{
Uri uri = new Uri ("http://localhost/dir/dummypage.html");
string [] segments = uri.Segments;
- Assertion.AssertEquals ("#01", 3, segments.Length);
- Assertion.AssertEquals ("#02", "/", segments [0]);
- Assertion.AssertEquals ("#03", "dir/", segments [1]);
- Assertion.AssertEquals ("#04", "dummypage.html", segments [2]);
+ AssertEquals ("#01", 3, segments.Length);
+ AssertEquals ("#02", "/", segments [0]);
+ AssertEquals ("#03", "dir/", segments [1]);
+ AssertEquals ("#04", "dummypage.html", segments [2]);
}
@@ -613,10 +644,10 @@ namespace MonoTests.System
{
Uri uri = new Uri ("http://localhost/dir/dummypage/");
string [] segments = uri.Segments;
- Assertion.AssertEquals ("#01", 3, segments.Length);
- Assertion.AssertEquals ("#02", "/", segments [0]);
- Assertion.AssertEquals ("#03", "dir/", segments [1]);
- Assertion.AssertEquals ("#04", "dummypage/", segments [2]);
+ AssertEquals ("#01", 3, segments.Length);
+ AssertEquals ("#02", "/", segments [0]);
+ AssertEquals ("#03", "dir/", segments [1]);
+ AssertEquals ("#04", "dummypage/", segments [2]);
}
@@ -625,10 +656,10 @@ namespace MonoTests.System
{
Uri uri = new Uri ("file:///c:/hello");
string [] segments = uri.Segments;
- Assertion.AssertEquals ("#01", 3, segments.Length);
- Assertion.AssertEquals ("#02", "c:", segments [0]);
- Assertion.AssertEquals ("#03", "/", segments [1]);
- Assertion.AssertEquals ("#04", "hello", segments [2]);
+ AssertEquals ("#01", 3, segments.Length);
+ AssertEquals ("#02", "c:", segments [0]);
+ AssertEquals ("#03", "/", segments [1]);
+ AssertEquals ("#04", "hello", segments [2]);
}
diff --git a/mcs/class/System/Test/System/UriTest2.cs b/mcs/class/System/Test/System/UriTest2.cs
index e2d21ad8b6e..9d102d9190e 100755
--- a/mcs/class/System/Test/System/UriTest2.cs
+++ b/mcs/class/System/Test/System/UriTest2.cs
@@ -48,20 +48,38 @@ namespace MonoTests.System
}
[Test]
- public void TestFromFile ()
+ public void AbsoluteUriFromFile ()
{
- StreamReader sr = new StreamReader ("Test/System/test-uri-props.txt", Encoding.UTF8);
+ FromFile ("Test/System/test-uri-props.txt", null);
+ }
+
+ [Test]
+ public void AbsoluteUriFromFileManual ()
+ {
+ FromFile ("Test/System/test-uri-props-manual.txt", null);
+ }
+
+ [Test]
+ public void RelativeUriFromFile ()
+ {
+ FromFile ("Test/System/test-uri-relative-props.txt", new Uri ("http://www.go-mono.com"));
+ }
+
+ private void FromFile (string testFile, Uri baseUri)
+ {
+ StreamReader sr = new StreamReader (testFile, Encoding.UTF8);
while (sr.Peek () > 0) {
sr.ReadLine (); // skip
string uriString = sr.ReadLine ();
-//TextWriter sw = Console.Out;
-// sw.WriteLine ("-------------------------");
-// sw.WriteLine (uriString);
-
+/*
+TextWriter sw = Console.Out;
+ sw.WriteLine ("-------------------------");
+ sw.WriteLine (uriString);
+*/
if (uriString == null || uriString.Length == 0)
break;
- Uri uri = new Uri (uriString);
+ Uri uri = baseUri == null ? new Uri (uriString) : new Uri (baseUri, uriString);
/*
sw.WriteLine ("ToString(): " + uri.ToString ());
sw.WriteLine (uri.AbsoluteUri);
@@ -103,48 +121,5 @@ namespace MonoTests.System
}
}
-/*
- public static void Main (string [] args)
- {
- StreamReader sr = new StreamReader ("test-uri-list.txt", Encoding.UTF8);
- StreamWriter sw = new StreamWriter ("test-uri-props.txt", false, Encoding.UTF8);
-
- GenerateResult (sr, sw, null);
- }
-
- public static void GenerateResult (TextReader sr, TextWriter sw, Uri baseUri)
- {
- while (sr.Peek () > 0) {
- string uriString = sr.ReadLine ();
- if (uriString.Length == 0 || uriString [0] == '#')
- continue;
- Uri uri = (baseUri == null) ?
- new Uri (uriString) : new Uri (baseUri, uriString);
-
- sw.WriteLine ("-------------------------");
- sw.WriteLine (uriString);
- sw.WriteLine (uri.ToString ());
- sw.WriteLine (uri.AbsoluteUri);
- sw.WriteLine (uri.Scheme);
- sw.WriteLine (uri.Host);
- sw.WriteLine (uri.LocalPath);
- sw.WriteLine (uri.Query);
- sw.WriteLine (uri.Port);
- sw.WriteLine (uri.IsFile);
- sw.WriteLine (uri.IsUnc);
- sw.WriteLine (uri.IsLoopback);
- sw.WriteLine (uri.UserEscaped);
- sw.WriteLine (uri.HostNameType);
- sw.WriteLine (uri.AbsolutePath);
- sw.WriteLine (uri.PathAndQuery);
- sw.WriteLine (uri.Authority);
- sw.WriteLine (uri.Fragment);
- sw.WriteLine (uri.UserInfo);
- }
- sr.Close ();
- sw.Close ();
- }
-*/
-
}
}
diff --git a/mcs/class/System/Test/System/test-uri-list.txt b/mcs/class/System/Test/System/test-uri-list.txt
index a21ff399d47..25b2e80ac0e 100755
--- a/mcs/class/System/Test/System/test-uri-list.txt
+++ b/mcs/class/System/Test/System/test-uri-list.txt
@@ -72,6 +72,7 @@ file://server/filename.ext
\\server\share\filename.ext
http://1.2.3.4
file://1.2.3.4
+file:///c:/name%20with%20space.txt
# file:
# http:
# makefile
@@ -88,6 +89,7 @@ file://1.2.3.4
http://localhost/c#
http://localhost/c#bookmark
file://localhost/c#
+file://test.domain.com/c#
//localhost/c#
# below should not be allowed ...
file://c:/c#
@@ -114,6 +116,8 @@ http://web.app.com/test.cgi?value=ã‚ã„ã†ãˆãŠ
辭典:cn_to_ja/ファイル
ファイル:
è¾­å…¸:
+# I think it is not totally retional, but ToString() returns unespaced string.
+file:///test.domain.com/name space
#
#
# MS.NET supplies no host info (consoto.com), but I think Mono is better.
diff --git a/mcs/class/System/Test/System/test-uri-props-manual.txt b/mcs/class/System/Test/System/test-uri-props-manual.txt
new file mode 100755
index 00000000000..b496771b4cc
--- /dev/null
+++ b/mcs/class/System/Test/System/test-uri-props-manual.txt
@@ -0,0 +1,38 @@
+-------------------------
+/foo.txt
+file:///foo.txt
+file:///foo.txt
+file
+
+/foo.txt
+
+-1
+True
+False
+False
+False
+Basic
+/foo.txt
+/foo.txt
+
+
+
+-------------------------
+/tmp/hello.txt
+file:///tmp/hello.txt
+file:///tmp/hello.txt
+file
+
+/tmp/hello.txt
+
+-1
+True
+False
+False
+False
+Basic
+/tmp/hello.txt
+/tmp/hello.txt
+
+
+
diff --git a/mcs/class/System/Test/System/test-uri-props.txt b/mcs/class/System/Test/System/test-uri-props.txt
index 6ee54ea7280..2daa5a8ce0f 100755
--- a/mcs/class/System/Test/System/test-uri-props.txt
+++ b/mcs/class/System/Test/System/test-uri-props.txt
@@ -702,6 +702,25 @@ IPv4
-------------------------
+file:///c:/name%20with%20space.txt
+file:///c:/name with space.txt
+file:///c:/name%20with%20space.txt
+file
+
+c:\name with space.txt
+
+-1
+True
+False
+False
+False
+Basic
+c:/name%20with%20space.txt
+c:/name%20with%20space.txt
+
+
+
+-------------------------
http://localhost/c#
http://localhost/c#
http://localhost/c#
@@ -759,6 +778,25 @@ localhost
#
-------------------------
+file://test.domain.com/c#
+file://test.domain.com/c#
+file://test.domain.com/c#
+file
+test.domain.com
+\\test.domain.com\c
+
+-1
+True
+True
+False
+False
+Dns
+/c
+/c
+test.domain.com
+#
+
+-------------------------
//localhost/c#
file://localhost/c%23
file://localhost/c%23
@@ -1043,3 +1081,22 @@ Basic
+-------------------------
+file:///test.domain.com/name space
+file://test.domain.com/name space
+file://test.domain.com/name%20space
+file
+test.domain.com
+\\test.domain.com\name space
+
+-1
+True
+True
+False
+False
+Dns
+/name%20space
+/name%20space
+test.domain.com
+
+
diff --git a/mcs/class/System/Test/System/test-uri-relative-list.txt b/mcs/class/System/Test/System/test-uri-relative-list.txt
new file mode 100755
index 00000000000..fe0611b9c72
--- /dev/null
+++ b/mcs/class/System/Test/System/test-uri-relative-list.txt
@@ -0,0 +1,95 @@
+server
+server/
+server/maybe_file
+server/directory/
+server.com
+server.com/
+server.com/maybe_file
+server.com/directory/
+# http:server ... should not be allowed
+c:/foo.txt
+c:\foo.txt
+c:/foo.txt
+# /usr/local/bin ... doesn't pass. it is critical problem of MS.NET
+\\server
+# ///server ... this became UNC server name in MS.NET
+server
+server/
+server/maybe_file
+server/directory/
+server.com
+## below should be treated as UNC server
+readme.txt
+server.com/
+# file:server.com
+# file:server.com/
+# file:server
+server.com/maybe_file
+server.com/directory/
+## Below are taken from UriTest.cs
+contoso.com?subject=uri
+mailto:user:pwd@contoso.com?subject=uri
+\\myserver\mydir\mysubdir\myfile.ext
+www.contoso.com
+www.contoso.com/foo/bar/index.html?x=0
+c:\tmp\hello.txt
+# //////cygwin/tmp/hello.txt : it became impossible
+mymachine/cygwin/tmp/hello.txt
+# ///c:/cygwin/tmp/hello.txt
+one_file.txt
+cygwin/tmp/hello.txt
+server/filename.ext
+\\server\share\filename.ext
+1.2.3.4
+1.2.3.4
+# file:
+# http:
+# makefile
+# gopher:
+# ftp:
+# file:/
+#
+# / ... however, should be allowed in Unix file path.
+# \
+# c:
+# /c: ... however, should be allowed in Windows file path.
+# news: ... in fact MS passes this.
+# Below should be allowed
+localhost/c#
+localhost/c#bookmark
+localhost/c#
+# this passes... it breaks RFC 2396 rule.
+c#
+mailto:c#
+c#bookmark
+#
+# non-standard scheme
+#
+urn:mono-uri-test
+# This "8080" is not a port specifier. This is "opaque part" (RFC 2396)
+urn:mono-uri-test:8080
+# But here, it is interpreted as a host name.
+urn://mono-uri-test:8080
+# Scheme cannot start with non-alphabetic character, but MS fails to reject
+ファイル:myserver/foo.txt
+ファイル://myserver/foo.txt
+è¾­å…¸://cn_to_ja/
+#
+# still looks TODO (EscapeString)
+#
+web.app.com/test.cgi?value=ã‚ã„ã†ãˆãŠ
+辭典:cn_to_ja/ファイル
+ファイル:
+è¾­å…¸:
+#
+#
+# below should not be allowed but MS passes.
+c:/c#
+#
+#
+# MS.NET supplies no host info (consoto.com), but I think Mono is better.
+# news:123456@contoso.com
+#
+# MS handles it as http, but it is inconsistent with \\server as file.
+# //server
+# //localhost/c#
diff --git a/mcs/class/System/Test/System/test-uri-relative-props.txt b/mcs/class/System/Test/System/test-uri-relative-props.txt
new file mode 100755
index 00000000000..0bf6c10a596
--- /dev/null
+++ b/mcs/class/System/Test/System/test-uri-relative-props.txt
@@ -0,0 +1,969 @@
+-------------------------
+server
+http://www.go-mono.com/server
+http://www.go-mono.com/server
+http
+www.go-mono.com
+/server
+
+80
+False
+False
+False
+False
+Dns
+/server
+/server
+www.go-mono.com
+
+
+-------------------------
+server/
+http://www.go-mono.com/server/
+http://www.go-mono.com/server/
+http
+www.go-mono.com
+/server/
+
+80
+False
+False
+False
+False
+Dns
+/server/
+/server/
+www.go-mono.com
+
+
+-------------------------
+server/maybe_file
+http://www.go-mono.com/server/maybe_file
+http://www.go-mono.com/server/maybe_file
+http
+www.go-mono.com
+/server/maybe_file
+
+80
+False
+False
+False
+False
+Dns
+/server/maybe_file
+/server/maybe_file
+www.go-mono.com
+
+
+-------------------------
+server/directory/
+http://www.go-mono.com/server/directory/
+http://www.go-mono.com/server/directory/
+http
+www.go-mono.com
+/server/directory/
+
+80
+False
+False
+False
+False
+Dns
+/server/directory/
+/server/directory/
+www.go-mono.com
+
+
+-------------------------
+server.com
+http://www.go-mono.com/server.com
+http://www.go-mono.com/server.com
+http
+www.go-mono.com
+/server.com
+
+80
+False
+False
+False
+False
+Dns
+/server.com
+/server.com
+www.go-mono.com
+
+
+-------------------------
+server.com/
+http://www.go-mono.com/server.com/
+http://www.go-mono.com/server.com/
+http
+www.go-mono.com
+/server.com/
+
+80
+False
+False
+False
+False
+Dns
+/server.com/
+/server.com/
+www.go-mono.com
+
+
+-------------------------
+server.com/maybe_file
+http://www.go-mono.com/server.com/maybe_file
+http://www.go-mono.com/server.com/maybe_file
+http
+www.go-mono.com
+/server.com/maybe_file
+
+80
+False
+False
+False
+False
+Dns
+/server.com/maybe_file
+/server.com/maybe_file
+www.go-mono.com
+
+
+-------------------------
+server.com/directory/
+http://www.go-mono.com/server.com/directory/
+http://www.go-mono.com/server.com/directory/
+http
+www.go-mono.com
+/server.com/directory/
+
+80
+False
+False
+False
+False
+Dns
+/server.com/directory/
+/server.com/directory/
+www.go-mono.com
+
+
+-------------------------
+c:/foo.txt
+file:///c:/foo.txt
+file:///c:/foo.txt
+file
+
+c:\foo.txt
+
+-1
+True
+False
+False
+False
+Basic
+c:/foo.txt
+c:/foo.txt
+
+
+
+-------------------------
+c:\foo.txt
+file:///c:/foo.txt
+file:///c:/foo.txt
+file
+
+c:\foo.txt
+
+-1
+True
+False
+False
+False
+Basic
+c:/foo.txt
+c:/foo.txt
+
+
+
+-------------------------
+c:/foo.txt
+file:///c:/foo.txt
+file:///c:/foo.txt
+file
+
+c:\foo.txt
+
+-1
+True
+False
+False
+False
+Basic
+c:/foo.txt
+c:/foo.txt
+
+
+
+-------------------------
+\\server
+file://server
+file://server
+file
+server
+\\server
+
+-1
+True
+True
+False
+False
+Dns
+
+
+server
+
+
+-------------------------
+server
+http://www.go-mono.com/server
+http://www.go-mono.com/server
+http
+www.go-mono.com
+/server
+
+80
+False
+False
+False
+False
+Dns
+/server
+/server
+www.go-mono.com
+
+
+-------------------------
+server/
+http://www.go-mono.com/server/
+http://www.go-mono.com/server/
+http
+www.go-mono.com
+/server/
+
+80
+False
+False
+False
+False
+Dns
+/server/
+/server/
+www.go-mono.com
+
+
+-------------------------
+server/maybe_file
+http://www.go-mono.com/server/maybe_file
+http://www.go-mono.com/server/maybe_file
+http
+www.go-mono.com
+/server/maybe_file
+
+80
+False
+False
+False
+False
+Dns
+/server/maybe_file
+/server/maybe_file
+www.go-mono.com
+
+
+-------------------------
+server/directory/
+http://www.go-mono.com/server/directory/
+http://www.go-mono.com/server/directory/
+http
+www.go-mono.com
+/server/directory/
+
+80
+False
+False
+False
+False
+Dns
+/server/directory/
+/server/directory/
+www.go-mono.com
+
+
+-------------------------
+server.com
+http://www.go-mono.com/server.com
+http://www.go-mono.com/server.com
+http
+www.go-mono.com
+/server.com
+
+80
+False
+False
+False
+False
+Dns
+/server.com
+/server.com
+www.go-mono.com
+
+
+-------------------------
+readme.txt
+http://www.go-mono.com/readme.txt
+http://www.go-mono.com/readme.txt
+http
+www.go-mono.com
+/readme.txt
+
+80
+False
+False
+False
+False
+Dns
+/readme.txt
+/readme.txt
+www.go-mono.com
+
+
+-------------------------
+server.com/
+http://www.go-mono.com/server.com/
+http://www.go-mono.com/server.com/
+http
+www.go-mono.com
+/server.com/
+
+80
+False
+False
+False
+False
+Dns
+/server.com/
+/server.com/
+www.go-mono.com
+
+
+-------------------------
+server.com/maybe_file
+http://www.go-mono.com/server.com/maybe_file
+http://www.go-mono.com/server.com/maybe_file
+http
+www.go-mono.com
+/server.com/maybe_file
+
+80
+False
+False
+False
+False
+Dns
+/server.com/maybe_file
+/server.com/maybe_file
+www.go-mono.com
+
+
+-------------------------
+server.com/directory/
+http://www.go-mono.com/server.com/directory/
+http://www.go-mono.com/server.com/directory/
+http
+www.go-mono.com
+/server.com/directory/
+
+80
+False
+False
+False
+False
+Dns
+/server.com/directory/
+/server.com/directory/
+www.go-mono.com
+
+
+-------------------------
+contoso.com?subject=uri
+http://www.go-mono.com/contoso.com?subject=uri
+http://www.go-mono.com/contoso.com?subject=uri
+http
+www.go-mono.com
+/contoso.com
+?subject=uri
+80
+False
+False
+False
+False
+Dns
+/contoso.com
+/contoso.com?subject=uri
+www.go-mono.com
+
+
+-------------------------
+mailto:user:pwd@contoso.com?subject=uri
+mailto:user:pwd@contoso.com?subject=uri
+mailto:user:pwd@contoso.com?subject=uri
+mailto
+contoso.com
+
+?subject=uri
+25
+False
+False
+False
+False
+Dns
+
+?subject=uri
+contoso.com
+
+user:pwd
+-------------------------
+\\myserver\mydir\mysubdir\myfile.ext
+file://myserver/mydir/mysubdir/myfile.ext
+file://myserver/mydir/mysubdir/myfile.ext
+file
+myserver
+\\myserver\mydir\mysubdir\myfile.ext
+
+-1
+True
+True
+False
+False
+Dns
+/mydir/mysubdir/myfile.ext
+/mydir/mysubdir/myfile.ext
+myserver
+
+
+-------------------------
+www.contoso.com
+http://www.go-mono.com/www.contoso.com
+http://www.go-mono.com/www.contoso.com
+http
+www.go-mono.com
+/www.contoso.com
+
+80
+False
+False
+False
+False
+Dns
+/www.contoso.com
+/www.contoso.com
+www.go-mono.com
+
+
+-------------------------
+www.contoso.com/foo/bar/index.html?x=0
+http://www.go-mono.com/www.contoso.com/foo/bar/index.html?x=0
+http://www.go-mono.com/www.contoso.com/foo/bar/index.html?x=0
+http
+www.go-mono.com
+/www.contoso.com/foo/bar/index.html
+?x=0
+80
+False
+False
+False
+False
+Dns
+/www.contoso.com/foo/bar/index.html
+/www.contoso.com/foo/bar/index.html?x=0
+www.go-mono.com
+
+
+-------------------------
+c:\tmp\hello.txt
+file:///c:/tmp/hello.txt
+file:///c:/tmp/hello.txt
+file
+
+c:\tmp\hello.txt
+
+-1
+True
+False
+False
+False
+Basic
+c:/tmp/hello.txt
+c:/tmp/hello.txt
+
+
+
+-------------------------
+mymachine/cygwin/tmp/hello.txt
+http://www.go-mono.com/mymachine/cygwin/tmp/hello.txt
+http://www.go-mono.com/mymachine/cygwin/tmp/hello.txt
+http
+www.go-mono.com
+/mymachine/cygwin/tmp/hello.txt
+
+80
+False
+False
+False
+False
+Dns
+/mymachine/cygwin/tmp/hello.txt
+/mymachine/cygwin/tmp/hello.txt
+www.go-mono.com
+
+
+-------------------------
+one_file.txt
+http://www.go-mono.com/one_file.txt
+http://www.go-mono.com/one_file.txt
+http
+www.go-mono.com
+/one_file.txt
+
+80
+False
+False
+False
+False
+Dns
+/one_file.txt
+/one_file.txt
+www.go-mono.com
+
+
+-------------------------
+cygwin/tmp/hello.txt
+http://www.go-mono.com/cygwin/tmp/hello.txt
+http://www.go-mono.com/cygwin/tmp/hello.txt
+http
+www.go-mono.com
+/cygwin/tmp/hello.txt
+
+80
+False
+False
+False
+False
+Dns
+/cygwin/tmp/hello.txt
+/cygwin/tmp/hello.txt
+www.go-mono.com
+
+
+-------------------------
+server/filename.ext
+http://www.go-mono.com/server/filename.ext
+http://www.go-mono.com/server/filename.ext
+http
+www.go-mono.com
+/server/filename.ext
+
+80
+False
+False
+False
+False
+Dns
+/server/filename.ext
+/server/filename.ext
+www.go-mono.com
+
+
+-------------------------
+\\server\share\filename.ext
+file://server/share/filename.ext
+file://server/share/filename.ext
+file
+server
+\\server\share\filename.ext
+
+-1
+True
+True
+False
+False
+Dns
+/share/filename.ext
+/share/filename.ext
+server
+
+
+-------------------------
+1.2.3.4
+http://www.go-mono.com/1.2.3.4
+http://www.go-mono.com/1.2.3.4
+http
+www.go-mono.com
+/1.2.3.4
+
+80
+False
+False
+False
+False
+Dns
+/1.2.3.4
+/1.2.3.4
+www.go-mono.com
+
+
+-------------------------
+1.2.3.4
+http://www.go-mono.com/1.2.3.4
+http://www.go-mono.com/1.2.3.4
+http
+www.go-mono.com
+/1.2.3.4
+
+80
+False
+False
+False
+False
+Dns
+/1.2.3.4
+/1.2.3.4
+www.go-mono.com
+
+
+-------------------------
+localhost/c#
+http://www.go-mono.com/localhost/c#
+http://www.go-mono.com/localhost/c#
+http
+www.go-mono.com
+/localhost/c
+
+80
+False
+False
+False
+False
+Dns
+/localhost/c
+/localhost/c
+www.go-mono.com
+#
+
+-------------------------
+localhost/c#bookmark
+http://www.go-mono.com/localhost/c#bookmark
+http://www.go-mono.com/localhost/c#bookmark
+http
+www.go-mono.com
+/localhost/c
+
+80
+False
+False
+False
+False
+Dns
+/localhost/c
+/localhost/c
+www.go-mono.com
+#bookmark
+
+-------------------------
+localhost/c#
+http://www.go-mono.com/localhost/c#
+http://www.go-mono.com/localhost/c#
+http
+www.go-mono.com
+/localhost/c
+
+80
+False
+False
+False
+False
+Dns
+/localhost/c
+/localhost/c
+www.go-mono.com
+#
+
+-------------------------
+c#
+http://www.go-mono.com/c#
+http://www.go-mono.com/c#
+http
+www.go-mono.com
+/c
+
+80
+False
+False
+False
+False
+Dns
+/c
+/c
+www.go-mono.com
+#
+
+-------------------------
+mailto:c#
+mailto:c#
+mailto:c#
+mailto
+c
+
+
+25
+False
+False
+False
+False
+Dns
+
+
+c
+#
+
+-------------------------
+c#bookmark
+http://www.go-mono.com/c#bookmark
+http://www.go-mono.com/c#bookmark
+http
+www.go-mono.com
+/c
+
+80
+False
+False
+False
+False
+Dns
+/c
+/c
+www.go-mono.com
+#bookmark
+
+-------------------------
+urn:mono-uri-test
+urn:mono-uri-test
+urn:mono-uri-test
+urn
+
+mono-uri-test
+
+-1
+False
+False
+False
+False
+Basic
+mono-uri-test
+mono-uri-test
+
+
+
+-------------------------
+urn:mono-uri-test:8080
+urn:mono-uri-test:8080
+urn:mono-uri-test:8080
+urn
+
+mono-uri-test:8080
+
+-1
+False
+False
+False
+False
+Basic
+mono-uri-test:8080
+mono-uri-test:8080
+
+
+
+-------------------------
+urn://mono-uri-test:8080
+urn://mono-uri-test:8080/
+urn://mono-uri-test:8080/
+urn
+mono-uri-test
+/
+
+8080
+False
+False
+False
+False
+Dns
+/
+/
+mono-uri-test:8080
+
+
+-------------------------
+ファイル:myserver/foo.txt
+ファイル:myserver/foo.txt
+ファイル:myserver/foo.txt
+ファイル
+
+myserver/foo.txt
+
+-1
+False
+False
+False
+False
+Basic
+myserver/foo.txt
+myserver/foo.txt
+
+
+
+-------------------------
+ファイル://myserver/foo.txt
+ファイル://myserver/foo.txt
+ファイル://myserver/foo.txt
+ファイル
+myserver
+/foo.txt
+
+-1
+False
+False
+False
+False
+Dns
+/foo.txt
+/foo.txt
+myserver
+
+
+-------------------------
+è¾­å…¸://cn_to_ja/
+è¾­å…¸://cn_to_ja/
+è¾­å…¸://cn_to_ja/
+è¾­å…¸
+cn_to_ja
+/
+
+-1
+False
+False
+False
+False
+Dns
+/
+/
+cn_to_ja
+
+
+-------------------------
+web.app.com/test.cgi?value=ã‚ã„ã†ãˆãŠ
+http://www.go-mono.com/web.app.com/test.cgi?value=ã‚ã„ã†ãˆãŠ
+http://www.go-mono.com/web.app.com/test.cgi?value=%E3%81%82%E3%81%84%E3%81%86%E3%81%88%E3%81%8A
+http
+www.go-mono.com
+/web.app.com/test.cgi
+?value=%E3%81%82%E3%81%84%E3%81%86%E3%81%88%E3%81%8A
+80
+False
+False
+False
+False
+Dns
+/web.app.com/test.cgi
+/web.app.com/test.cgi?value=%E3%81%82%E3%81%84%E3%81%86%E3%81%88%E3%81%8A
+www.go-mono.com
+
+
+-------------------------
+辭典:cn_to_ja/ファイル
+辭典:cn_to_ja/ファイル
+è¾­å…¸:cn_to_ja/%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB
+è¾­å…¸
+
+cn_to_ja/%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB
+
+-1
+False
+False
+False
+False
+Basic
+cn_to_ja/%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB
+cn_to_ja/%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB
+
+
+
+-------------------------
+ファイル:
+ファイル:
+ファイル:
+ファイル
+
+
+
+-1
+False
+False
+False
+False
+Basic
+
+
+
+
+
+-------------------------
+è¾­å…¸:
+è¾­å…¸:
+è¾­å…¸:
+è¾­å…¸
+
+
+
+-1
+False
+False
+False
+False
+Basic
+
+
+
+
+
+-------------------------
+c:/c#
+file:///c:/c%23
+file:///c:/c%23
+file
+
+c:\c#
+
+-1
+True
+False
+False
+False
+Basic
+c:/c%23
+c:/c%23
+
+
+
diff --git a/mcs/class/System/Test/System/uri-test-generator.cs b/mcs/class/System/Test/System/uri-test-generator.cs
index 2de5e74d575..79f26d273ec 100755
--- a/mcs/class/System/Test/System/uri-test-generator.cs
+++ b/mcs/class/System/Test/System/uri-test-generator.cs
@@ -11,11 +11,9 @@
using System;
using System.IO;
using System.Text;
-using NUnit.Framework;
namespace MonoTests.System
{
- [TestFixture]
public class UriTestGenerator
{
public static void Main (string [] args)
@@ -24,6 +22,12 @@ namespace MonoTests.System
StreamWriter sw = new StreamWriter ("test-uri-props.txt", false, Encoding.UTF8);
GenerateResult (sr, sw, null);
+
+ sr = new StreamReader ("test-uri-relative-list.txt", Encoding.UTF8);
+ sw = new StreamWriter ("test-uri-relative-props.txt", false, Encoding.UTF8);
+
+ Uri baseUri = new Uri ("http://www.go-mono.com");
+ GenerateResult (sr, sw, baseUri);
}
public static void GenerateResult (TextReader sr, TextWriter sw, Uri baseUri)
@@ -54,6 +58,7 @@ namespace MonoTests.System
sw.WriteLine (uri.Authority);
sw.WriteLine (uri.Fragment);
sw.WriteLine (uri.UserInfo);
+ sw.Flush ();
}
sr.Close ();
sw.Close ();
diff --git a/mcs/class/corlib/.cvsignore b/mcs/class/corlib/.cvsignore
index 50f66d5855e..09222e4e88b 100644
--- a/mcs/class/corlib/.cvsignore
+++ b/mcs/class/corlib/.cvsignore
@@ -1,6 +1,8 @@
corlib.dll
corlib.pdb
corlib_test.pdb
+corlib_plattest.dll
+corlib_plattest.pdb
.makefrag
.response
library-deps.stamp
diff --git a/mcs/class/corlib/ChangeLog b/mcs/class/corlib/ChangeLog
index ecfb9b7213c..00f84e82a57 100644
--- a/mcs/class/corlib/ChangeLog
+++ b/mcs/class/corlib/ChangeLog
@@ -1,3 +1,40 @@
+2004-01-14 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * corlib_test.dll.sources: Added Url and UrlMembershipCondition unit
+ tests in System.Security.Policy namespace.
+
+2004-01-06 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * corlib_test.dll.sources: Added SecurityException unit tests in
+ System.Security namespace.
+
+2004-01-05 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * corlib_test.dll.sources: Added CodeAccessPermission unit tests in
+ System.Security namespace. Added CodeGroup related and PolicyLevel
+ unit tests to System.Security.Policy.
+
+2004-01-05 Zoltan Varga <vargaz@freemail.hu>
+
+ * corlib.dll.sources: Added System.Resources.Win32Resources.cs.
+
+2004-01-03 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * corlib_test.dll.sources: Added SecurityManager unit tests in
+ in System.Security namespace.
+
+2004-01-03 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * corlib.dll.sources: Added SiteMembershipCondition to
+ System.Security.Policy namespace.
+ * corlib_test.dll.sources: Added Site and SiteMembershipCondition
+ unit tests in System.Security.Policy namespace.
+
+2004-01-02 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * corlib.dll.sources: Added many (long time) missing classes in the
+ System.Security.Policy namespace.
+
2004-01-01 Nick Drochak <ndrochak@gol.com>
* corlib_test.dll.sources: Add PermissionRequestEvidenceTest.cs
diff --git a/mcs/class/corlib/Mono.Security.Cryptography/ChangeLog b/mcs/class/corlib/Mono.Security.Cryptography/ChangeLog
index a2ffbc8c6cd..d9b13eeb31a 100644
--- a/mcs/class/corlib/Mono.Security.Cryptography/ChangeLog
+++ b/mcs/class/corlib/Mono.Security.Cryptography/ChangeLog
@@ -1,3 +1,8 @@
+2004-01-12 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * CryptoConvert.cs: RSA doesn't start with a Q - at least that what
+ a strongname told me. Sorry Ron :(
+
2003-12-15 Sebastien Pouliot <spouliot@videotron.ca>
* MACAlgorithm.cs: Fixed difference between 1.0 and 1.1 framework.
diff --git a/mcs/class/corlib/Mono.Security.Cryptography/CryptoConvert.cs b/mcs/class/corlib/Mono.Security.Cryptography/CryptoConvert.cs
index eda9e982659..958d5232a70 100755
--- a/mcs/class/corlib/Mono.Security.Cryptography/CryptoConvert.cs
+++ b/mcs/class/corlib/Mono.Security.Cryptography/CryptoConvert.cs
@@ -235,7 +235,7 @@ namespace Mono.Security.Cryptography {
blob [1] = 0x02; // Version - Always CUR_BLOB_VERSION (0x02)
// [2], [3] // RESERVED - Always 0
blob [5] = 0x24; // ALGID - Always 00 24 00 00 (for CALG_RSA_SIGN)
- blob [8] = 0x51; // Magic - RSA1 (ASCII in hex)
+ blob [8] = 0x52; // Magic - RSA1 (ASCII in hex)
blob [9] = 0x53;
blob [10] = 0x41;
blob [11] = 0x31;
diff --git a/mcs/class/corlib/System.Collections/ChangeLog b/mcs/class/corlib/System.Collections/ChangeLog
index 27f18d6f7de..74628dd1bf7 100644
--- a/mcs/class/corlib/System.Collections/ChangeLog
+++ b/mcs/class/corlib/System.Collections/ChangeLog
@@ -1,3 +1,13 @@
+2004-01-13 Lluis Sanchez Gual <lluis@ximian.com>
+
+ * Hashtable.cs: Added serialization support to SynchedHashtable. This
+ fixes bug #52741.
+
+2004-01-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Hashtable.cs: fix Clone. Closes bug #52740. Patch by Benjamin Jemlich
+ (pcgod@gmx.net).
+
2003-12-26 Ben Maurer <bmaurer@users.sourceforge.net>
* ArrayList.cs: Add class `SimpleEnumerator' this handles the
@@ -7,9 +17,9 @@
2003-12-23 Lluis Sanchez Gual <lluis@ximian.com>
- * ArrayList.cs: Renamed private fields m_Count, m_Data and m_StateChanges to
- _size, _items and _version, to make it compatible with MS.NET (needed for
- remoting interoperability). This fixes bug #52438.
+ * ArrayList.cs: Renamed private fields m_Count, m_Data and
+ m_StateChanges to _size, _items and _version, to make it compatible with
+ MS.NET (needed for remoting interoperability). This fixes bug #52438.
2003-12-01 Dick Porter <dick@ximian.com>
diff --git a/mcs/class/corlib/System.Collections/Hashtable.cs b/mcs/class/corlib/System.Collections/Hashtable.cs
index f3179c331ca..ac9e47b7cbb 100644
--- a/mcs/class/corlib/System.Collections/Hashtable.cs
+++ b/mcs/class/corlib/System.Collections/Hashtable.cs
@@ -402,9 +402,8 @@ namespace System.Collections {
public virtual object Clone ()
{
Hashtable ht = new Hashtable (Count, hcp, comparer);
- ht.modificationCount = this.modificationCount;
- ht.inUse = this.inUse;
- ht.AdjustThreshold ();
+ ht.inUse = 0;
+ ht.loadFactor = this.loadFactor;
// FIXME: maybe it's faster to simply
// copy the back-end array?
@@ -924,6 +923,16 @@ namespace System.Collections {
this.host = host;
}
+ internal SynchedHashtable (SerializationInfo info, StreamingContext context)
+ {
+ host = (Hashtable) info.GetValue("host", typeof(Hashtable));
+ }
+
+ public override void GetObjectData (SerializationInfo info, StreamingContext context)
+ {
+ info.AddValue ("host", host);
+ }
+
// ICollection
public override int Count {
diff --git a/mcs/class/corlib/System.Globalization/ChangeLog b/mcs/class/corlib/System.Globalization/ChangeLog
index bed300f478e..60874c42134 100644
--- a/mcs/class/corlib/System.Globalization/ChangeLog
+++ b/mcs/class/corlib/System.Globalization/ChangeLog
@@ -1,3 +1,14 @@
+2004-01-27 David Sheldon <dave-mono@earth.li>
+
+ * NumberFormatInfo.cs: InitPatterns: it seems that the patterns in
+ ICU use digitPattern, not zeroPattern for the spaces after the
+ decimal point.
+
+2004-01-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * CultureInfo.cs: Parent returns null when lcid == parent_lcid. Fixes
+ bug #52102.
+
2003-12-20 Ben Maurer <bmaurer@users.sourceforge.net>
* CompareInfo.cs: Replace blah == "" with blah.Length == 0.
diff --git a/mcs/class/corlib/System.Globalization/CultureInfo.cs b/mcs/class/corlib/System.Globalization/CultureInfo.cs
index e3045731192..1e2e54079c3 100644
--- a/mcs/class/corlib/System.Globalization/CultureInfo.cs
+++ b/mcs/class/corlib/System.Globalization/CultureInfo.cs
@@ -1142,7 +1142,11 @@ namespace System.Globalization
public virtual CultureInfo Parent
{
get {
- return(new CultureInfo (CultureMap.lcid_to_parent_lcid (lcid)));
+ int parent_lcid = CultureMap.lcid_to_parent_lcid (lcid);
+ if (parent_lcid == lcid)
+ return null;
+
+ return (new CultureInfo (parent_lcid));
}
}
diff --git a/mcs/class/corlib/System.Globalization/NumberFormatInfo.cs b/mcs/class/corlib/System.Globalization/NumberFormatInfo.cs
index 8b004e2c8d7..c9e8709545f 100644
--- a/mcs/class/corlib/System.Globalization/NumberFormatInfo.cs
+++ b/mcs/class/corlib/System.Globalization/NumberFormatInfo.cs
@@ -135,7 +135,7 @@ namespace System.Globalization {
// decimal digit side
numberDecimalDigits = 0;
for (int i = 0; i < partOne [1].Length; i ++) {
- if (partOne [1][i] == zeroPattern [0]) {
+ if (partOne [1][i] == digitPattern [0]) {
numberDecimalDigits ++;
} else
break;
diff --git a/mcs/class/corlib/System.IO/ChangeLog b/mcs/class/corlib/System.IO/ChangeLog
index 1062e187138..73e304eae05 100644
--- a/mcs/class/corlib/System.IO/ChangeLog
+++ b/mcs/class/corlib/System.IO/ChangeLog
@@ -1,3 +1,47 @@
+
+Tue Jan 20 23:10:22 CET 2004 Paolo Molaro <lupus@ximian.com>
+
+ * StreamWriter.cs, TextWriter.cs: comply with the documented
+ behaviour and use a decode buffer to improve performance.
+
+2004-01-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Path.cs: now Path.GetFullPath ("/") returns "/" instead of "".
+
+2004-01-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Path.cs: add the trailing directory separator only for volumes.
+ Fixes bug #53035.
+
+2004-01-19 Zoltan Varga <vargaz@freemail.hu>
+
+ * IntPtrStream.cs: Fix build bustage.
+
+ * IntPtrStream.cs: Add a 'Closed' event. Also throw exceptions after
+ the stream is closed.
+
+2004-01-18 Ben Maurer <bmaurer@users.sourceforge.net>
+
+ * FileStream.cs: Locking from bug #32344 removed. This is not
+ necessary because the correct fix was actually in the console.
+ This fixes bug #53026. Miguel de Icaza reviewed/approved this
+ patch.
+
+2004-01-14 Zoltan Varga <vargaz@freemail.hu>
+
+ * FileStream.cs (.ctor): Avoid allocating a large buffer when reading
+ from small files.
+
+2004-01-10 Atsushi Enomoto <atsushi@ximian.com>
+
+ * Path.cs : GetDirectoryName ("c:\readme.txt") should return "c:\"
+ instead of "c:" . This fixed bug #52735.
+
+2004-01-04 Nick Drochak <ndrochak@gol.com>
+
+ * Path.cs: Remove defined but unused variable, and also got rid of
+ some unreachable code. Eliminates some build warnings.
+
2003-12-28 Ben Maurer <bmaurer@users.sourceforge.net>
* BinaryWriter.cs: use one encoding buffer for writing
@@ -306,7 +350,7 @@ Fri Jul 18 14:42:42 CEST 2003 Paolo Molaro <lupus@ximian.com>
* BinaryReader.cs (Read): make sure the buffer is big enough (fix
bug # 40702)
-2003-04-24 Pedro Martínez Juliá <yoros@wanadoo.es>
+2003-04-24 Pedro Martinez Julia <yoros@wanadoo.es>
* BufferedStream.cs: Test if it's possible to seek in a Stream
before access to Position. This prevents the exception thrown when
diff --git a/mcs/class/corlib/System.IO/FileStream.cs b/mcs/class/corlib/System.IO/FileStream.cs
index 05ff5d181a3..881da84006d 100644
--- a/mcs/class/corlib/System.IO/FileStream.cs
+++ b/mcs/class/corlib/System.IO/FileStream.cs
@@ -56,7 +56,6 @@ namespace System.IO
this.owner = ownsHandle;
this.async = isAsync;
-
InitBuffer (bufferSize, noBuffering);
/* Can't set append mode */
@@ -104,8 +103,6 @@ namespace System.IO
throw new UnauthorizedAccessException ("Access to the path '" + Path.GetFullPath (name) + "' is denied.");
}
- InitBuffer (bufferSize, false);
-
/* Append streams can't be read (see FileMode
* docs)
*/
@@ -150,6 +147,16 @@ namespace System.IO
} else {
this.append_startpos=0;
}
+
+ if (access == FileAccess.Read && canseek && (bufferSize == DefaultBufferSize)) {
+ /* Avoid allocating a large buffer for small files */
+ long len = Length;
+ if (bufferSize > len) {
+ bufferSize = (int)(len < 1000 ? 1000 : len);
+ }
+ }
+
+ InitBuffer (bufferSize, false);
}
// properties
@@ -211,9 +218,7 @@ namespace System.IO
if(CanSeek == false)
throw new NotSupportedException("The stream does not support seeking");
- lock(this) {
- return(buf_start + buf_offset);
- }
+ return(buf_start + buf_offset);
}
set {
if(CanSeek == false) {
@@ -244,17 +249,14 @@ namespace System.IO
if (!CanRead)
throw new NotSupportedException ("Stream does not support reading");
- lock(this) {
- if (buf_offset >= buf_length) {
- RefillBuffer ();
+ if (buf_offset >= buf_length) {
+ RefillBuffer ();
- if (buf_length == 0) {
- return -1;
- }
- }
-
- return(buf [buf_offset ++]);
+ if (buf_length == 0)
+ return -1;
}
+
+ return buf [buf_offset ++];
}
public override void WriteByte (byte value)
@@ -265,18 +267,14 @@ namespace System.IO
if (!CanWrite)
throw new NotSupportedException ("Stream does not support writing");
- lock(this) {
- if (buf_offset == buf_size) {
- FlushBuffer ();
- }
+ if (buf_offset == buf_size)
+ FlushBuffer ();
- buf [buf_offset ++] = value;
- if (buf_offset > buf_length) {
- buf_length = buf_offset;
- }
+ buf [buf_offset ++] = value;
+ if (buf_offset > buf_length)
+ buf_length = buf_offset;
- buf_dirty = true;
- }
+ buf_dirty = true;
}
public override int Read ([In,Out] byte[] dest, int dest_offset, int count)
@@ -298,43 +296,41 @@ namespace System.IO
int copied = 0;
- lock(this) {
- int n = ReadSegment (dest, dest_offset, count);
- copied += n;
- count -= n;
+ int n = ReadSegment (dest, dest_offset, count);
+ copied += n;
+ count -= n;
- if (count == 0) {
- /* If there was already enough
- * buffered, no need to read
- * more from the file.
- */
- return (copied);
- }
+ if (count == 0) {
+ /* If there was already enough
+ * buffered, no need to read
+ * more from the file.
+ */
+ return (copied);
+ }
- if (count > buf_size) {
- /* Read as much as we can, up
- * to count bytes
- */
- FlushBuffer();
- n = ReadData (handle, dest,
- dest_offset+copied,
- count);
-
- /* Make the next buffer read
- * start from the right place
- */
- buf_start += n;
- } else {
- RefillBuffer ();
- n = ReadSegment (dest,
- dest_offset+copied,
- count);
- }
+ if (count > buf_size) {
+ /* Read as much as we can, up
+ * to count bytes
+ */
+ FlushBuffer();
+ n = ReadData (handle, dest,
+ dest_offset+copied,
+ count);
+
+ /* Make the next buffer read
+ * start from the right place
+ */
+ buf_start += n;
+ } else {
+ RefillBuffer ();
+ n = ReadSegment (dest,
+ dest_offset+copied,
+ count);
+ }
- copied += n;
+ copied += n;
- return(copied);
- }
+ return copied;
}
public override void Write (byte[] src, int src_offset, int count)
@@ -393,52 +389,49 @@ namespace System.IO
throw new NotSupportedException("The stream does not support seeking");
}
- lock(this) {
-
- switch (origin) {
- case SeekOrigin.End:
- pos = Length + offset;
- break;
+ switch (origin) {
+ case SeekOrigin.End:
+ pos = Length + offset;
+ break;
- case SeekOrigin.Current:
- pos = Position + offset;
- break;
+ case SeekOrigin.Current:
+ pos = Position + offset;
+ break;
- case SeekOrigin.Begin: default:
- pos = offset;
- break;
- }
+ case SeekOrigin.Begin: default:
+ pos = offset;
+ break;
+ }
- if (pos < 0) {
- /* LAMESPEC: shouldn't this be
- * ArgumentOutOfRangeException?
- */
- throw new IOException("Attempted to Seek before the beginning of the stream");
- }
+ if (pos < 0) {
+ /* LAMESPEC: shouldn't this be
+ * ArgumentOutOfRangeException?
+ */
+ throw new IOException("Attempted to Seek before the beginning of the stream");
+ }
- if(pos < this.append_startpos) {
- /* More undocumented crap */
- throw new IOException("Can't seek back over pre-existing data in append mode");
- }
+ if(pos < this.append_startpos) {
+ /* More undocumented crap */
+ throw new IOException("Can't seek back over pre-existing data in append mode");
+ }
- if (buf_length > 0) {
- if (pos >= buf_start &&
- pos <= buf_start + buf_length) {
- buf_offset = (int) (pos - buf_start);
- return pos;
- }
+ if (buf_length > 0) {
+ if (pos >= buf_start &&
+ pos <= buf_start + buf_length) {
+ buf_offset = (int) (pos - buf_start);
+ return pos;
}
+ }
- FlushBuffer ();
+ FlushBuffer ();
- MonoIOError error;
+ MonoIOError error;
+
+ buf_start = MonoIO.Seek (handle, pos,
+ SeekOrigin.Begin,
+ out error);
- buf_start = MonoIO.Seek (handle, pos,
- SeekOrigin.Begin,
- out error);
-
- return(buf_start);
- }
+ return(buf_start);
}
public override void SetLength (long length)
@@ -467,9 +460,7 @@ namespace System.IO
if (handle == MonoIO.InvalidHandle)
throw new ObjectDisposedException ("Stream has been closed");
- lock(this) {
- FlushBuffer ();
- }
+ FlushBuffer ();
// The flushing is not actually required, in
//the mono runtime we were mapping flush to
@@ -505,9 +496,7 @@ namespace System.IO
protected virtual void Dispose (bool disposing) {
if (handle != MonoIO.InvalidHandle) {
- lock(this) {
- FlushBuffer ();
- }
+ FlushBuffer ();
if (owner) {
MonoIOError error;
diff --git a/mcs/class/corlib/System.IO/IntPtrStream.cs b/mcs/class/corlib/System.IO/IntPtrStream.cs
index d9eae8bc7fc..8643803ab80 100644
--- a/mcs/class/corlib/System.IO/IntPtrStream.cs
+++ b/mcs/class/corlib/System.IO/IntPtrStream.cs
@@ -21,6 +21,9 @@ namespace System.IO {
unsafe byte *base_address;
int size;
int position;
+ bool closed;
+
+ public event EventHandler Closed;
public IntPtrStream (IntPtr base_address, int size)
{
@@ -82,6 +85,9 @@ namespace System.IO {
throw new ArgumentException ("offset+count",
"The size of the buffer is less than offset + count.");
+ if (closed)
+ throw new ObjectDisposedException ("Stream has been closed");
+
if (position >= size || count == 0)
return 0;
@@ -100,6 +106,9 @@ namespace System.IO {
if (position >= size)
return -1;
+ if (closed)
+ throw new ObjectDisposedException ("Stream has been closed");
+
unsafe {
return base_address [position++];
}
@@ -111,6 +120,9 @@ namespace System.IO {
if (offset > (long) Int32.MaxValue)
throw new ArgumentOutOfRangeException ("Offset out of range. " + offset);
+ if (closed)
+ throw new ObjectDisposedException ("Stream has been closed");
+
int ref_point;
switch (loc) {
case SeekOrigin.Begin:
@@ -161,5 +173,13 @@ namespace System.IO {
public override void Flush ()
{
}
+
+ public override void Close ()
+ {
+ closed = true;
+
+ if (Closed != null)
+ Closed (this, null);
+ }
}
}
diff --git a/mcs/class/corlib/System.IO/Path.cs b/mcs/class/corlib/System.IO/Path.cs
index 3940a6862d7..c8c1542226b 100644
--- a/mcs/class/corlib/System.IO/Path.cs
+++ b/mcs/class/corlib/System.IO/Path.cs
@@ -111,8 +111,15 @@ namespace System.IO
if (nLast == 0)
nLast++;
- if (nLast > 0)
- return path.Substring (0, nLast);
+ if (nLast > 0) {
+ string ret = path.Substring (0, nLast);
+ int l = ret.Length;
+ if (l >= 2 && ret [l - 1] != DirectorySeparatorChar &&
+ ret [l - 2] == VolumeSeparatorChar)
+ return ret + DirectorySeparatorChar;
+ else
+ return ret;
+ }
return String.Empty;
}
@@ -167,8 +174,7 @@ namespace System.IO
if (path.Length >= 2 &&
IsDsc (path [0]) &&
- IsDsc (path [1])
- ) {
+ IsDsc (path [1])) {
if (path.Length == 2 || path.IndexOf (path [0], 2) < 0)
throw new ArgumentException ("UNC pass should be of the form \\\\server\\share.");
else
@@ -178,7 +184,6 @@ namespace System.IO
return path.Replace (AltDirectorySeparatorChar, DirectorySeparatorChar);
}
- bool combineCurrent = false;
if (!IsPathRooted (path))
path = Directory.GetCurrentDirectory () + DirectorySeparatorStr + path;
else if (DirectorySeparatorChar == '\\' &&
@@ -343,7 +348,9 @@ namespace System.IO
// STEP 2: Check to see if this is only a root
string root = GetPathRoot (path);
-// if (root == path) return path; // it will return '\' for path '\', while it should return 'c:\' or so.
+ // it will return '\' for path '\', while it should return 'c:\' or so.
+ // Note: commenting this out makes the ened for the (target == 1...) check in step 5
+ //if (root == path) return path;
// STEP 3: split the directories, this gets rid of consecutative "/"'s
string [] dirs = path.Split (DirectorySeparatorChar, AltDirectorySeparatorChar);
@@ -360,7 +367,7 @@ namespace System.IO
}
// STEP 5: Combine everything.
- if (target == 0)
+ if (target == 0 || (target == 1 && dirs [0] == ""))
return root;
else {
string ret = String.Join (DirectorySeparatorStr, dirs, 0, target);
@@ -387,8 +394,6 @@ namespace System.IO
default: // Unix/Mac
return ret;
}
-
- return ret;
}
}
}
diff --git a/mcs/class/corlib/System.IO/StreamWriter.cs b/mcs/class/corlib/System.IO/StreamWriter.cs
index ef07d479d65..78b1425382a 100644
--- a/mcs/class/corlib/System.IO/StreamWriter.cs
+++ b/mcs/class/corlib/System.IO/StreamWriter.cs
@@ -1,8 +1,9 @@
//
// System.IO.StreamWriter.cs
//
-// Author:
+// Authors:
// Dietmar Maurer (dietmar@ximian.com)
+// Paolo Molaro (lupus@ximian.com)
//
// (C) Ximian, Inc. http://www.ximian.com
//
@@ -24,11 +25,12 @@ namespace System.IO {
private const int DefaultBufferSize = 1024;
private const int DefaultFileBufferSize = 4096;
- private const int MinimumBufferSize = 2;
+ private const int MinimumBufferSize = 256;
- private int pos;
- private int BufferSize;
- private byte[] TheBuffer;
+ private byte[] byte_buf;
+ private int byte_pos;
+ private char[] decode_buf;
+ private int decode_pos;
private bool DisposedAlready = false;
private bool preamble_done = false;
@@ -43,9 +45,10 @@ namespace System.IO {
internal void Initialize(Encoding encoding, int bufferSize) {
internalEncoding = encoding;
- pos = 0;
- BufferSize = Math.Max(bufferSize, MinimumBufferSize);
- TheBuffer = new byte[BufferSize];
+ decode_pos = byte_pos = 0;
+ int BufferSize = Math.Max(bufferSize, MinimumBufferSize);
+ decode_buf = new char [BufferSize];
+ byte_buf = new byte [encoding.GetMaxByteCount (BufferSize)];
}
//[MonoTODO("Nothing is done with bufferSize")]
@@ -136,75 +139,119 @@ namespace System.IO {
}
internalStream = null;
- TheBuffer = null;
+ byte_buf = null;
internalEncoding = null;
+ decode_buf = null;
}
public override void Flush () {
if (DisposedAlready)
throw new ObjectDisposedException("StreamWriter");
- if (pos > 0) {
- internalStream.Write (TheBuffer, 0, pos);
+ Decode ();
+ if (byte_pos > 0) {
+ FlushBytes ();
internalStream.Flush ();
- pos = 0;
}
}
-
- public override void Write (char[] buffer, int index, int count) {
- if (DisposedAlready)
- throw new ObjectDisposedException("StreamWriter");
-
- byte[] res = new byte [internalEncoding.GetByteCount (buffer)];
- int len;
- int BytesToBuffer;
- int resPos = 0;
- len = internalEncoding.GetBytes (buffer, index, count, res, 0);
+ // how the speedup works:
+ // the Write () methods simply copy the characters in a buffer of chars (decode_buf)
+ // Decode () is called when the buffer is full or we need to flash.
+ // Decode () will use the encoding to get the bytes and but them inside
+ // byte_buf. From byte_buf the data is finally outputted to the stream.
+ void FlushBytes () {
// write the encoding preamble only at the start of the stream
- if (!preamble_done && len > 0) {
+ if (!preamble_done && byte_pos > 0) {
byte[] preamble = internalEncoding.GetPreamble ();
if (preamble.Length > 0)
internalStream.Write (preamble, 0, preamble.Length);
preamble_done = true;
}
+ internalStream.Write (byte_buf, 0, byte_pos);
+ byte_pos = 0;
+ }
+
+ void Decode () {
+ if (byte_pos > 0)
+ FlushBytes ();
+ if (decode_pos > 0) {
+ int len = internalEncoding.GetBytes (decode_buf, 0, decode_pos, byte_buf, byte_pos);
+ byte_pos += len;
+ decode_pos = 0;
+ }
+ }
+
+ public override void Write (char[] buffer, int index, int count) {
+ if (DisposedAlready)
+ throw new ObjectDisposedException("StreamWriter");
+
+ if (buffer == null)
+ throw new ArgumentNullException ("buffer");
+ if (index < 0 || index > buffer.Length)
+ throw new ArgumentOutOfRangeException ("index");
+ if (count < 0 || (index + count) > buffer.Length)
+ throw new ArgumentOutOfRangeException ("count");
- // if they want AutoFlush, don't bother buffering
- if (iflush) {
+ LowLevelWrite (buffer, index, count);
+ if (iflush)
Flush();
- internalStream.Write (res, 0, len);
- internalStream.Flush ();
- } else {
- // otherwise use the buffer.
- // NOTE: this logic is not optimized for performance.
- while (resPos < len) {
- // fill the buffer if we've got more bytes than will fit
- BytesToBuffer = Math.Min(BufferSize - pos, len - resPos);
- Array.Copy(res, resPos, TheBuffer, pos, BytesToBuffer);
- resPos += BytesToBuffer;
- pos += BytesToBuffer;
- // if the buffer is full, flush it out.
- if (pos == BufferSize) Flush();
+ }
+
+ void LowLevelWrite (char[] buffer, int index, int count) {
+ while (count > 0) {
+ int todo = decode_buf.Length - decode_pos;
+ if (todo == 0) {
+ Decode ();
+ todo = decode_buf.Length;
}
+ if (todo > count)
+ todo = count;
+ Buffer.BlockCopy (buffer, index * 2, decode_buf, decode_pos * 2, todo * 2);
+ count -= todo;
+ index += todo;
+ decode_pos += todo;
}
}
public override void Write (char value)
{
- Write (new char [] {value}, 0, 1);
+ // the size of decode_buf is always > 0 and
+ // we check for overflow right away
+ if (decode_pos >= decode_buf.Length)
+ Decode ();
+ decode_buf [decode_pos++] = value;
+ if (iflush)
+ Flush ();
}
public override void Write (char [] value)
{
- Write (value, 0, value.Length);
+ LowLevelWrite (value, 0, value.Length);
+ if (iflush)
+ Flush ();
+ }
+
+ public override void Write (string value) {
+ if (DisposedAlready)
+ throw new ObjectDisposedException("StreamWriter");
+
+ if (value != null)
+ LowLevelWrite (value.ToCharArray (), 0, value.Length);
+ if (iflush)
+ Flush ();
}
- public override void Write(string value) {
+ public override void WriteLine (string value) {
if (DisposedAlready)
throw new ObjectDisposedException("StreamWriter");
if (value != null)
- Write (value.ToCharArray (), 0, value.Length);
+ LowLevelWrite (value.ToCharArray (), 0, value.Length);
+ string nl = NewLine;
+ LowLevelWrite (nl.ToCharArray (), 0, nl.Length);
+ if (iflush)
+ Flush ();
}
public override void Close()
diff --git a/mcs/class/corlib/System.IO/TextWriter.cs b/mcs/class/corlib/System.IO/TextWriter.cs
index 8a205d23358..794b43f471e 100644
--- a/mcs/class/corlib/System.IO/TextWriter.cs
+++ b/mcs/class/corlib/System.IO/TextWriter.cs
@@ -4,6 +4,7 @@
// Authors:
// Marcin Szczepanski (marcins@zipworld.com.au)
// Miguel de Icaza (miguel@gnome.org)
+// Paolo Molaro (lupus@ximian.com)
//
using System.Text;
@@ -14,14 +15,14 @@ namespace System.IO {
public abstract class TextWriter : MarshalByRefObject, IDisposable {
protected TextWriter() {
- CoreNewLine = "\n".ToCharArray ();
+ CoreNewLine = System.Environment.NewLine;
}
protected TextWriter( IFormatProvider formatProvider ) {
internalFormatProvider = formatProvider;
}
- protected char[] CoreNewLine;
+ protected string CoreNewLine;
internal IFormatProvider internalFormatProvider;
@@ -37,11 +38,11 @@ namespace System.IO {
public virtual string NewLine {
get {
- return new String(CoreNewLine);
+ return CoreNewLine;
}
set {
- CoreNewLine = value.ToCharArray();
+ CoreNewLine = value;
}
}
@@ -84,8 +85,10 @@ namespace System.IO {
public virtual void Write (char[] value)
{
- if (value != null)
- Write (new String (value));
+ if (value != null) {
+ for (int i = 0; i < value.Length; ++i)
+ Write (value [i]);
+ }
}
public virtual void Write (decimal value)
@@ -121,7 +124,8 @@ namespace System.IO {
public virtual void Write (string value)
{
- // do nothing
+ if (value != null)
+ Write (value.ToCharArray ());
}
[CLSCompliant(false)]
@@ -148,7 +152,15 @@ namespace System.IO {
public virtual void Write (char[] buffer, int index, int count)
{
- Write (new String (buffer, index, count));
+ if (buffer == null)
+ throw new ArgumentNullException ("buffer");
+ if (index < 0 || index > buffer.Length)
+ throw new ArgumentOutOfRangeException ("index");
+ if (count < 0 || (index + count) > buffer.Length)
+ throw new ArgumentOutOfRangeException ("count");
+ for (; count > 0; --count, ++index) {
+ Write (buffer [index]);
+ }
}
public virtual void Write (string format, object arg0, object arg1)
@@ -283,6 +295,12 @@ namespace System.IO {
public override void Write (string s)
{
}
+ public override void Write (char value)
+ {
+ }
+ public override void Write (char[] value, int index, int count)
+ {
+ }
}
}
diff --git a/mcs/class/corlib/System.Reflection.Emit/AssemblyBuilder.cs b/mcs/class/corlib/System.Reflection.Emit/AssemblyBuilder.cs
index fb8f261b0d8..6ef9e7e6b44 100755
--- a/mcs/class/corlib/System.Reflection.Emit/AssemblyBuilder.cs
+++ b/mcs/class/corlib/System.Reflection.Emit/AssemblyBuilder.cs
@@ -43,6 +43,20 @@ namespace System.Reflection.Emit {
public int offset;
}
+ internal struct MonoWin32Resource {
+ public int res_type;
+ public int res_id;
+ public int lang_id;
+ public byte[] data;
+
+ public MonoWin32Resource (int res_type, int res_id, int lang_id, byte[] data) {
+ this.res_type = res_type;
+ this.res_id = res_id;
+ this.lang_id = lang_id;
+ this.data = data;
+ }
+ }
+
public sealed class AssemblyBuilder : Assembly {
#region Sync with reflection.h
private IntPtr dynamic_assembly;
@@ -60,15 +74,19 @@ namespace System.Reflection.Emit {
PEFileKinds pekind = PEFileKinds.Dll;
bool delay_sign;
uint access;
- private Module[] loaded_modules;
+ Module[] loaded_modules;
+ MonoWin32Resource[] win32_resources;
#endregion
internal Type corlib_object_type = typeof (System.Object);
internal Type corlib_value_type = typeof (System.ValueType);
internal Type corlib_enum_type = typeof (System.Enum);
internal Type corlib_void_type = typeof (void);
ArrayList resource_writers = null;
+ Win32VersionResource version_res;
bool created;
bool is_module_only;
+ string keyfile_name;
+ private Mono.Security.StrongName sn;
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private static extern void basic_init (AssemblyBuilder ab);
@@ -290,16 +308,35 @@ namespace System.Reflection.Emit {
return writer;
}
+ private void AddUnmanagedResource (Win32Resource res) {
+ MemoryStream ms = new MemoryStream ();
+ res.WriteTo (ms);
+
+ if (win32_resources != null) {
+ MonoWin32Resource[] new_res = new MonoWin32Resource [win32_resources.Length + 1];
+ System.Array.Copy (win32_resources, new_res, win32_resources.Length);
+ win32_resources = new_res;
+ }
+ else
+ win32_resources = new MonoWin32Resource [1];
+
+ win32_resources [win32_resources.Length - 1] = new MonoWin32Resource (res.Type.Id, res.Name.Id, res.Language, ms.ToArray ());
+ }
+
[MonoTODO]
public void DefineUnmanagedResource (byte[] resource)
{
if (resource == null)
throw new ArgumentNullException ("resource");
+ /*
+ * The format of the argument byte array is not documented
+ * so this method is impossible to implement.
+ */
+
throw new NotImplementedException ();
}
- [MonoTODO]
public void DefineUnmanagedResource (string resourceFileName)
{
if (resourceFileName == null)
@@ -309,20 +346,106 @@ namespace System.Reflection.Emit {
if (!File.Exists (resourceFileName) || Directory.Exists (resourceFileName))
throw new FileNotFoundException ("File '" + resourceFileName + "' does not exists or is a directory.");
- throw new NotImplementedException ();
+ using (FileStream fs = new FileStream (resourceFileName, FileMode.Open)) {
+ Win32ResFileReader reader = new Win32ResFileReader (fs);
+
+ foreach (Win32EncodedResource res in reader.ReadResources ()) {
+ if (res.Name.IsName || res.Type.IsName)
+ throw new InvalidOperationException ("resource files with named resources or non-default resource types are not supported.");
+
+ AddUnmanagedResource (res);
+ }
+ }
}
- [MonoTODO]
public void DefineVersionInfoResource ()
{
- throw new NotImplementedException ();
+ if (version_res != null)
+ throw new ArgumentException ("Native resource has already been defined.");
+
+ version_res = new Win32VersionResource (1, 0);
+
+ if (cattrs != null) {
+ foreach (CustomAttributeBuilder cb in cattrs) {
+ string attrname = cb.Ctor.ReflectedType.FullName;
+
+ if (attrname == "System.Reflection.AssemblyProductAttribute")
+ version_res.ProductName = cb.string_arg ();
+ else if (attrname == "System.Reflection.AssemblyCompanyAttribute")
+ version_res.CompanyName = cb.string_arg ();
+ else if (attrname == "System.Reflection.AssemblyCopyrightAttribute")
+ version_res.LegalCopyright = cb.string_arg ();
+ else if (attrname == "System.Reflection.AssemblyTrademarkAttribute")
+ version_res.LegalTrademarks = cb.string_arg ();
+ else if (attrname == "System.Reflection.AssemblyCultureAttribute")
+ version_res.FileLanguage = new CultureInfo (cb.string_arg ()).LCID;
+ else if (attrname == "System.Reflection.AssemblyFileVersionAttribute")
+ version_res.FileVersion = cb.string_arg ();
+ else if (attrname == "System.Reflection.AssemblyInformationalVersionAttribute")
+ version_res.ProductVersion = cb.string_arg ();
+ else if (attrname == "System.Reflection.AssemblyTitleAttribute")
+ version_res.FileDescription = cb.string_arg ();
+ else if (attrname == "System.Reflection.AssemblyDescriptionAttribute")
+ version_res.Comments = cb.string_arg ();
+ }
+ }
}
- [MonoTODO]
public void DefineVersionInfoResource (string product, string productVersion,
string company, string copyright, string trademark)
{
- throw new NotImplementedException ();
+ if (version_res != null)
+ throw new ArgumentException ("Native resource has already been defined.");
+
+ /*
+ * We can only create the resource later, when the file name and
+ * the binary version is known.
+ */
+
+ version_res = new Win32VersionResource (1, 0);
+ version_res.ProductName = product;
+ version_res.ProductVersion = productVersion;
+ version_res.CompanyName = company;
+ version_res.LegalCopyright = copyright;
+ version_res.LegalTrademarks = trademark;
+ }
+
+ /*
+ * Mono extension to support /win32icon in mcs
+ */
+ internal void DefineIconResource (string iconFileName)
+ {
+ if (iconFileName == null)
+ throw new ArgumentNullException ("iconFileName");
+ if (iconFileName == String.Empty)
+ throw new ArgumentException ("iconFileName");
+ if (!File.Exists (iconFileName) || Directory.Exists (iconFileName))
+ throw new FileNotFoundException ("File '" + iconFileName + "' does not exists or is a directory.");
+
+ using (FileStream fs = new FileStream (iconFileName, FileMode.Open)) {
+ Win32IconFileReader reader = new Win32IconFileReader (fs);
+
+ ICONDIRENTRY[] entries = reader.ReadIcons ();
+
+ Win32IconResource[] icons = new Win32IconResource [entries.Length];
+ for (int i = 0; i < entries.Length; ++i) {
+ icons [i] = new Win32IconResource (i + 1, 0, entries [i]);
+ AddUnmanagedResource (icons [i]);
+ }
+
+ Win32GroupIconResource group = new Win32GroupIconResource (1, 0, icons);
+ AddUnmanagedResource (group);
+ }
+ }
+
+ private void DefineVersionInfoResourceImpl (string fileName) {
+ // Add missing info
+ if (version_res.FileVersion == "0.0.0.0")
+ version_res.FileVersion = version;
+ version_res.InternalName = Path.GetFileNameWithoutExtension (fileName);
+ version_res.OriginalFilename = fileName;
+
+ AddUnmanagedResource (version_res);
}
public ModuleBuilder GetDynamicModule (string name)
@@ -349,6 +472,10 @@ namespace System.Reflection.Emit {
throw not_supported ();
}
+ public override FileStream[] GetFiles() {
+ throw not_supported ();
+ }
+
public override FileStream[] GetFiles(bool getResourceModules) {
throw not_supported ();
}
@@ -405,15 +532,55 @@ namespace System.Reflection.Emit {
// Create a main module if not already created
ModuleBuilder mainModule = null;
- foreach (ModuleBuilder module in modules)
- if (module.FullyQualifiedName == assemblyFileName)
- mainModule = module;
+ if (modules != null) {
+ foreach (ModuleBuilder module in modules)
+ if (module.FullyQualifiedName == assemblyFileName)
+ mainModule = module;
+ }
if (mainModule == null)
mainModule = DefineDynamicModule ("RefEmit_OnDiskManifestModule", assemblyFileName);
if (!is_module_only)
mainModule.IsMain = true;
+ /*
+ * Create a new entry point if the one specified
+ * by the user is in another module.
+ */
+ if ((entry_point != null) && entry_point.DeclaringType.Module != mainModule) {
+ Type[] paramTypes;
+ if (entry_point.GetParameters ().Length == 1)
+ paramTypes = new Type [] { typeof (string) };
+ else
+ paramTypes = new Type [0];
+
+ MethodBuilder mb = mainModule.DefineGlobalMethod ("__EntryPoint$", MethodAttributes.Static|MethodAttributes.PrivateScope, entry_point.ReturnType, paramTypes);
+ ILGenerator ilgen = mb.GetILGenerator ();
+ if (paramTypes.Length == 1)
+ ilgen.Emit (OpCodes.Ldarg_0);
+ ilgen.Emit (OpCodes.Tailcall);
+ ilgen.Emit (OpCodes.Call, entry_point);
+ ilgen.Emit (OpCodes.Ret);
+
+ entry_point = mb;
+ }
+
+ if (version_res != null)
+ DefineVersionInfoResourceImpl (assemblyFileName);
+
+ if ((keyfile_name != null) && (keyfile_name != String.Empty)) {
+ using (FileStream fs = new FileStream (keyfile_name, FileMode.Open)) {
+ byte[] snkeypair = new byte [fs.Length];
+ fs.Read (snkeypair, 0, snkeypair.Length);
+
+ // this will import public or private/public keys
+ RSA rsa = CryptoConvert.FromCapiKeyBlob (snkeypair);
+ // and export only the public part
+ sn = new Mono.Security.StrongName (rsa);
+ public_key = sn.PublicKey;
+ }
+ }
+
foreach (ModuleBuilder module in modules)
if (module != mainModule)
module.Save ();
@@ -422,6 +589,11 @@ namespace System.Reflection.Emit {
// contain the hash of the other modules
mainModule.Save ();
+ // if not delayed then we directly strongname the assembly
+ if ((sn != null) && (!delay_sign)) {
+ sn.Sign (System.IO.Path.Combine (this.AssemblyDir, assemblyFileName));
+ }
+
created = true;
}
@@ -449,36 +621,15 @@ namespace System.Reflection.Emit {
string attrname = customBuilder.Ctor.ReflectedType.FullName;
byte[] data;
int len, pos;
- Mono.Security.StrongName sn;
+
if (attrname == "System.Reflection.AssemblyVersionAttribute") {
- data = customBuilder.Data;
- pos = 2;
- len = CustomAttributeBuilder.decode_len (data, pos, out pos);
- version = create_assembly_version (CustomAttributeBuilder.string_from_bytes (data, pos, len));
+ version = create_assembly_version (customBuilder.string_arg ());
return;
} else if (attrname == "System.Reflection.AssemblyKeyFileAttribute") {
- data = customBuilder.Data;
- pos = 2;
- len = CustomAttributeBuilder.decode_len (data, pos, out pos);
- string keyfile_name = CustomAttributeBuilder.string_from_bytes (data, pos, len);
- if (keyfile_name == String.Empty)
- return;
- using (FileStream fs = new FileStream (keyfile_name, FileMode.Open)) {
- byte[] snkeypair = new byte [fs.Length];
- fs.Read (snkeypair, 0, snkeypair.Length);
-
- // this will import public or private/public keys
- RSA rsa = CryptoConvert.FromCapiKeyBlob (snkeypair);
- // and export only the public part
- sn = new Mono.Security.StrongName (rsa);
- public_key = sn.PublicKey;
- }
+ keyfile_name = customBuilder.string_arg ();
return;
} else if (attrname == "System.Reflection.AssemblyKeyNameAttribute") {
- data = customBuilder.Data;
- pos = 2;
- len = CustomAttributeBuilder.decode_len (data, pos, out pos);
- string key_name = CustomAttributeBuilder.string_from_bytes (data, pos, len);
+ string key_name = customBuilder.string_arg ();
if (key_name == String.Empty)
return;
CspParameters csparam = new CspParameters ();
@@ -488,10 +639,7 @@ namespace System.Reflection.Emit {
public_key = sn.PublicKey;
return;
} else if (attrname == "System.Reflection.AssemblyCultureAttribute") {
- data = customBuilder.Data;
- pos = 2;
- len = CustomAttributeBuilder.decode_len (data, pos, out pos);
- culture = CustomAttributeBuilder.string_from_bytes (data, pos, len);
+ culture = customBuilder.string_arg ();
} else if (attrname == "System.Reflection.AssemblyAlgorithmIdAttribute") {
data = customBuilder.Data;
pos = 2;
diff --git a/mcs/class/corlib/System.Reflection.Emit/ChangeLog b/mcs/class/corlib/System.Reflection.Emit/ChangeLog
index f5c507446f5..fe84550bbb4 100644
--- a/mcs/class/corlib/System.Reflection.Emit/ChangeLog
+++ b/mcs/class/corlib/System.Reflection.Emit/ChangeLog
@@ -1,3 +1,59 @@
+2004-01-27 Zoltan Varga <vargaz@freemail.hu>
+
+ * AssemblyBuilder.cs (SetCustomAttribute): Move the reading of the
+ keyfile to the Save () method.
+
+2004-01-26 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * AssemblyBuilder.cs: Save will now strongname the assembly is (a) a
+ StrongName is present and (b) the signature isn't delayed.
+
+2004-01-24 David Sheldon <dave-mono@earth.li>
+
+ * AssemblyBuilder.cs: Added override for GetFiles() that throws
+ NotSupportedException.
+
+2004-01-15 Zoltan Varga <vargaz@freemail.hu>
+
+ * AssemblyBuilder.cs (Save): Handle entry points with an int return
+ type as well.
+
+ * AssemblyBuilder.cs (Save): If the entry point is in a module, create
+ a new entry point which calls the real one, since the entry point must
+ be in the module which contains the manifest.
+
+ * ModuleBuilder.cs (Save): Create the global type automatically if not
+ already done.
+
+2004-01-13 Zoltan Varga <vargaz@freemail.hu>
+
+ * AssemblyBuilder.cs (DefineVersionInfoResource): Set more
+ version info properties.
+
+2004-01-08 Zoltan Varga <vargaz@freemail.hu>
+
+ * CustomAttributeBuilder.cs (string_arg): New helper method.
+
+ * AssemblyBuilder.cs (DefineVersionInfoResource): Implement.
+
+ * AssemblyBuilder.cs (SetCustomAttribute): Use the new helper method.
+
+ * AssemblyBuilder.cs (DefineUnmanagedResource): Implement.
+
+ * AssemblyBuilder.cs (DefineIconResource): New internal method to
+ support mcs.
+
+ * TypeBuilder.cs (IsDefined): Implement this, since some corlib classes
+ make calls to IsDefined.
+
+2004-01-06 Zoltan Varga <vargaz@freemail.hu>
+
+ * AssemblyBuilder.cs: Fix warning.
+
+2004-01-05 Zoltan Varga <vargaz@freemail.hu>
+
+ * AssemblyBuilder.cs (DefineVersionInfoResource): Implement.
+
2003-12-29 Ben Maurer <bmaurer@users.sourceforge.net>
* MethodBuilder.cs, ConstructorBuilder.cs: Override GetParameterCount.
diff --git a/mcs/class/corlib/System.Reflection.Emit/CustomAttributeBuilder.cs b/mcs/class/corlib/System.Reflection.Emit/CustomAttributeBuilder.cs
index 5f84da3a547..498b7b515dd 100755
--- a/mcs/class/corlib/System.Reflection.Emit/CustomAttributeBuilder.cs
+++ b/mcs/class/corlib/System.Reflection.Emit/CustomAttributeBuilder.cs
@@ -47,6 +47,8 @@ namespace System.Reflection.Emit {
}
public CustomAttributeBuilder( ConstructorInfo con, object[] constructorArgs, PropertyInfo[] namedProperties, object[] propertyValues, FieldInfo[] namedFields, object[] fieldValues) {
ctor = con;
+ if (constructorArgs == null)
+ throw new ArgumentNullException ("constructorArgs");
data = GetBlob (con, constructorArgs, namedProperties, propertyValues, namedFields, fieldValues);
}
@@ -71,6 +73,13 @@ namespace System.Reflection.Emit {
return System.Text.Encoding.UTF8.GetString(data, pos, len);
}
+ internal string string_arg ()
+ {
+ int pos = 2;
+ int len = decode_len (data, pos, out pos);
+ return string_from_bytes (data, pos, len);
+ }
+
internal static UnmanagedMarshal get_umarshal (CustomAttributeBuilder customBuilder, bool is_field) {
byte[] data = customBuilder.Data;
UnmanagedType subtype = UnmanagedType.I4;
diff --git a/mcs/class/corlib/System.Reflection.Emit/ILGenerator.cs b/mcs/class/corlib/System.Reflection.Emit/ILGenerator.cs
index 8896a785fb4..0c469c295e0 100644
--- a/mcs/class/corlib/System.Reflection.Emit/ILGenerator.cs
+++ b/mcs/class/corlib/System.Reflection.Emit/ILGenerator.cs
@@ -722,8 +722,8 @@ namespace System.Reflection.Emit {
Emit (OpCodes.Ldfld, field);
}
Emit (OpCodes.Call,
- typeof (Console).GetMethod ("WriteLine",
- new Type[1] { field.FieldType }));
+ typeof (Console).GetMethod ("WriteLine",
+ new Type[1] { field.FieldType }));
}
public virtual void EmitWriteLine (LocalBuilder lbuilder)
@@ -736,16 +736,16 @@ namespace System.Reflection.Emit {
// should.
Emit (OpCodes.Ldloc, lbuilder);
Emit (OpCodes.Call,
- typeof (Console).GetMethod ("WriteLine",
- new Type[1] { lbuilder.LocalType }));
+ typeof (Console).GetMethod ("WriteLine",
+ new Type[1] { lbuilder.LocalType }));
}
public virtual void EmitWriteLine (string val)
{
Emit (OpCodes.Ldstr, val);
Emit (OpCodes.Call,
- typeof (Console).GetMethod ("WriteLine",
- new Type[1] { typeof(string)}));
+ typeof (Console).GetMethod ("WriteLine",
+ new Type[1] { typeof(string)}));
}
public virtual void EndExceptionBlock ()
diff --git a/mcs/class/corlib/System.Reflection.Emit/ModuleBuilder.cs b/mcs/class/corlib/System.Reflection.Emit/ModuleBuilder.cs
index 3fffd74803a..1378ec88c11 100644
--- a/mcs/class/corlib/System.Reflection.Emit/ModuleBuilder.cs
+++ b/mcs/class/corlib/System.Reflection.Emit/ModuleBuilder.cs
@@ -280,9 +280,9 @@ namespace System.Reflection.Emit {
return GetType (className, false, ignoreCase);
}
- private TypeBuilder search_in_array (TypeBuilder[] arr, string className) {
+ private TypeBuilder search_in_array (TypeBuilder[] arr, int validElementsInArray, string className) {
int i;
- for (i = 0; i < arr.Length; ++i) {
+ for (i = 0; i < validElementsInArray; ++i) {
if (String.Compare (className, arr [i].FullName, true, CultureInfo.InvariantCulture) == 0) {
return arr [i];
}
@@ -290,9 +290,9 @@ namespace System.Reflection.Emit {
return null;
}
- private TypeBuilder search_nested_in_array (TypeBuilder[] arr, string className) {
+ private TypeBuilder search_nested_in_array (TypeBuilder[] arr, int validElementsInArray, string className) {
int i;
- for (i = 0; i < arr.Length; ++i) {
+ for (i = 0; i < validElementsInArray; ++i) {
if (String.Compare (className, arr [i].Name, true, CultureInfo.InvariantCulture) == 0)
return arr [i];
}
@@ -311,13 +311,13 @@ namespace System.Reflection.Emit {
subt = className.IndexOf ('+');
if (subt < 0) {
if (t.subtypes != null)
- return search_nested_in_array (t.subtypes, className);
+ return search_nested_in_array (t.subtypes, t.subtypes.Length, className);
return null;
}
if (t.subtypes != null) {
pname = className.Substring (0, subt);
rname = className.Substring (subt + 1);
- TypeBuilder result = search_nested_in_array (t.subtypes, pname);
+ TypeBuilder result = search_nested_in_array (t.subtypes, t.subtypes.Length, pname);
if (result != null)
return GetMaybeNested (result, rname);
}
@@ -346,12 +346,12 @@ namespace System.Reflection.Emit {
subt = className.IndexOf ('+');
if (subt < 0) {
if (types != null)
- result = search_in_array (types, className);
+ result = search_in_array (types, num_types, className);
} else {
string pname, rname;
pname = className.Substring (0, subt);
rname = className.Substring (subt + 1);
- result = search_in_array (types, pname);
+ result = search_in_array (types, num_types, pname);
if (result != null)
result = GetMaybeNested (result, rname);
}
@@ -594,6 +594,9 @@ namespace System.Reflection.Emit {
if (transient)
return;
+ if ((global_type != null) && (global_type_created == null))
+ global_type_created = global_type.CreateType ();
+
if (resource_writers != null) {
for (int i = 0; i < resource_writers.Count; ++i) {
ResourceWriter writer = (ResourceWriter)resource_writers [i];
diff --git a/mcs/class/corlib/System.Reflection.Emit/TypeBuilder.cs b/mcs/class/corlib/System.Reflection.Emit/TypeBuilder.cs
index b61acef8e0f..73f358a322b 100644
--- a/mcs/class/corlib/System.Reflection.Emit/TypeBuilder.cs
+++ b/mcs/class/corlib/System.Reflection.Emit/TypeBuilder.cs
@@ -249,7 +249,11 @@ namespace System.Reflection.Emit {
public override bool IsDefined( Type attributeType, bool inherit)
{
- throw not_supported ();
+ /*
+ * MS throws NotSupported here, but we can't because some corlib
+ * classes make calls to IsDefined.
+ */
+ return MonoCustomAttrs.IsDefined (this, attributeType, inherit);
}
public override object[] GetCustomAttributes(bool inherit)
diff --git a/mcs/class/corlib/System.Reflection/Assembly.cs b/mcs/class/corlib/System.Reflection/Assembly.cs
index 95838d655b5..59af2926722 100644
--- a/mcs/class/corlib/System.Reflection/Assembly.cs
+++ b/mcs/class/corlib/System.Reflection/Assembly.cs
@@ -156,7 +156,7 @@ namespace System.Reflection {
}
[MethodImplAttribute (MethodImplOptions.InternalCall)]
- private extern IntPtr GetManifestResourceInternal (String name, out int size);
+ private extern IntPtr GetManifestResourceInternal (String name, out int size, out Module module);
public virtual Stream GetManifestResourceStream (String name)
{
@@ -178,11 +178,20 @@ namespace System.Reflection {
}
int size;
- IntPtr data = GetManifestResourceInternal (name, out size);
+ Module module;
+ IntPtr data = GetManifestResourceInternal (name, out size, out module);
if (data == (IntPtr) 0)
return null;
- else
- return new IntPtrStream (data, size);
+ else {
+ IntPtrStream stream = new IntPtrStream (data, size);
+ /*
+ * The returned pointer points inside metadata, so
+ * we have to increase the refcount of the module, and decrease
+ * it when the stream is finalized.
+ */
+ stream.Closed += new EventHandler (new ResourceCloseHandler (module).OnClose);
+ return stream;
+ }
}
public virtual Stream GetManifestResourceStream (Type type, String name)
@@ -376,7 +385,7 @@ namespace System.Reflection {
try {
return AppDomain.CurrentDomain.Load (partialName, securityEvidence);
}
- catch (Exception ex) {
+ catch (Exception) {
// According to MSDN, this should return null instead of
// throwing an exception
return null;
@@ -491,22 +500,34 @@ namespace System.Reflection {
return null;
}
+ private class ResourceCloseHandler {
+
+ Module module;
+
+ public ResourceCloseHandler (Module module) {
+ this.module = module;
+ }
+
+ public void OnClose (object sender, EventArgs e) {
+ // The module dtor will take care of things
+ module = null;
+ }
+ }
+
//
// The following functions are only for the Mono Debugger.
//
- // They should be marked `internal', and extracted with GetMethod from the debugger.
- //
[MethodImplAttribute (MethodImplOptions.InternalCall)]
- public extern MethodBase MonoDebugger_GetMethod (int token);
+ internal static extern MethodBase MonoDebugger_GetMethod (Assembly assembly, int token);
[MethodImplAttribute (MethodImplOptions.InternalCall)]
- public extern int MonoDebugger_GetMethodToken (MethodBase method);
+ internal static extern int MonoDebugger_GetMethodToken (Assembly assembly, MethodBase method);
[MethodImplAttribute (MethodImplOptions.InternalCall)]
- public extern Type MonoDebugger_GetLocalTypeFromSignature (byte[] signature);
+ internal static extern Type MonoDebugger_GetLocalTypeFromSignature (Assembly assembly, byte[] signature);
[MethodImplAttribute (MethodImplOptions.InternalCall)]
- public extern Type MonoDebugger_GetType (int token);
+ internal static extern Type MonoDebugger_GetType (Assembly assembly, int token);
}
}
diff --git a/mcs/class/corlib/System.Reflection/ChangeLog b/mcs/class/corlib/System.Reflection/ChangeLog
index 9c0b5d8602e..95010084722 100644
--- a/mcs/class/corlib/System.Reflection/ChangeLog
+++ b/mcs/class/corlib/System.Reflection/ChangeLog
@@ -1,3 +1,33 @@
+2004-01-25 Martin Baulig <martin@ximian.com>
+
+ * MonoGenericInst.cs: Honor BindingFlags.DeclaredOnly.
+
+2004-01-19 Zoltan Varga <vargaz@freemail.hu>
+
+ * Assembly.cs (GetManifestResourceStream): Make the IntPtrStream keep
+ a reference on the Module object which contains the resource.
+
+ * Module.cs: Decrease the image reference count when the Module is
+ garbage collected.
+
+2004-01-16 Martin Baulig <martin@ximian.com>
+
+ * Assembly.cs: Make the `MonoDebugger_' methods static.
+
+2004-01-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * MonoProperty.cs: changed get_property_info so that it only gets the
+ values needed. Reduces the allocations needed.
+
+2004-01-15 Martin Baulig <martin@ximian.com>
+
+ * Assembly.cs: Make the `MonoDebugger_' methods internal.
+
+2004-01-04 Nick Drochak <ndrochak@gol.com>
+
+ * Assembly.cs: Removed unused variable in catch block.Eliminates a build
+ warning.
+
2003-12-29 Ben Maurer <bmaurer@users.sourceforge.net>
* MethodBase.cs: Internal method to get param count (this
diff --git a/mcs/class/corlib/System.Reflection/Module.cs b/mcs/class/corlib/System.Reflection/Module.cs
index 6bbff1f5e4b..f4afe5f1796 100644
--- a/mcs/class/corlib/System.Reflection/Module.cs
+++ b/mcs/class/corlib/System.Reflection/Module.cs
@@ -29,7 +29,11 @@ namespace System.Reflection {
internal string scopename;
internal bool is_resource;
- internal Module () {}
+ internal Module () { }
+
+ ~Module () {
+ Close ();
+ }
public Assembly Assembly {
get { return assembly; }
@@ -200,5 +204,8 @@ namespace System.Reflection {
[MethodImplAttribute (MethodImplOptions.InternalCall)]
private extern Type GetGlobalType ();
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ private extern void Close ();
}
}
diff --git a/mcs/class/corlib/System.Reflection/MonoGenericInst.cs b/mcs/class/corlib/System.Reflection/MonoGenericInst.cs
index 7eb7345b5bd..39fa613befb 100644
--- a/mcs/class/corlib/System.Reflection/MonoGenericInst.cs
+++ b/mcs/class/corlib/System.Reflection/MonoGenericInst.cs
@@ -25,6 +25,9 @@ namespace System.Reflection
private MethodInfo[] methods;
private ConstructorInfo[] ctors;
private FieldInfo[] fields;
+ private int first_method;
+ private int first_ctor;
+ private int first_field;
[MonoTODO]
internal MonoGenericInst ()
@@ -62,6 +65,10 @@ namespace System.Reflection
}
}
+ first_method = mlist.Count;
+ first_ctor = clist.Count;
+ first_field = flist.Count;
+
foreach (MethodInfo m in generic_type.GetMethods (flags))
mlist.Add (inflate_method (this, reflected, m));
foreach (ConstructorInfo c in generic_type.GetConstructors (flags))
@@ -116,7 +123,15 @@ namespace System.Reflection
bool match;
MethodAttributes mattrs;
- foreach (MethodInfo c in methods) {
+ int start;
+ if ((bindingAttr & BindingFlags.DeclaredOnly) != 0)
+ start = first_method;
+ else
+ start = 0;
+
+ for (int i = start; i < methods.Length; i++) {
+ MethodInfo c = methods [i];
+
match = false;
mattrs = c.Attributes;
if ((mattrs & MethodAttributes.MemberAccessMask) == MethodAttributes.Public) {
@@ -159,7 +174,15 @@ namespace System.Reflection
bool match;
MethodAttributes mattrs;
- foreach (ConstructorInfo c in ctors) {
+ int start;
+ if ((bindingAttr & BindingFlags.DeclaredOnly) != 0)
+ start = first_ctor;
+ else
+ start = 0;
+
+ for (int i = start; i < ctors.Length; i++) {
+ ConstructorInfo c = ctors [i];
+
match = false;
mattrs = c.Attributes;
if ((mattrs & MethodAttributes.MemberAccessMask) == MethodAttributes.Public) {
@@ -202,7 +225,15 @@ namespace System.Reflection
bool match;
FieldAttributes fattrs;
- foreach (FieldInfo c in fields) {
+ int start;
+ if ((bindingAttr & BindingFlags.DeclaredOnly) != 0)
+ start = first_field;
+ else
+ start = 0;
+
+ for (int i = start; i < fields.Length; i++) {
+ FieldInfo c = fields [i];
+
match = false;
fattrs = c.Attributes;
if ((fattrs & FieldAttributes.FieldAccessMask) == FieldAttributes.Public) {
diff --git a/mcs/class/corlib/System.Reflection/MonoProperty.cs b/mcs/class/corlib/System.Reflection/MonoProperty.cs
index 74f21d226de..db5e9c94ffa 100755
--- a/mcs/class/corlib/System.Reflection/MonoProperty.cs
+++ b/mcs/class/corlib/System.Reflection/MonoProperty.cs
@@ -24,9 +24,20 @@ namespace System.Reflection {
public PropertyAttributes attrs;
[MethodImplAttribute(MethodImplOptions.InternalCall)]
- internal static extern void get_property_info (MonoProperty prop, out MonoPropertyInfo info);
+ internal static extern void get_property_info (MonoProperty prop, out MonoPropertyInfo info,
+ PInfo req_info);
}
+ [Flags]
+ internal enum PInfo {
+ Attributes = 1,
+ GetMethod = 1 << 1,
+ SetMethod = 1 << 2,
+ ReflectedType = 1 << 3,
+ DeclaringType = 1 << 4,
+ Name = 1 << 5
+
+ }
internal class MonoProperty : PropertyInfo {
internal IntPtr klass;
internal IntPtr prop;
@@ -34,7 +45,7 @@ namespace System.Reflection {
public override PropertyAttributes Attributes {
get {
MonoPropertyInfo info;
- MonoPropertyInfo.get_property_info (this, out info);
+ MonoPropertyInfo.get_property_info (this, out info, PInfo.Attributes);
return info.attrs;
}
}
@@ -42,7 +53,7 @@ namespace System.Reflection {
public override bool CanRead {
get {
MonoPropertyInfo info;
- MonoPropertyInfo.get_property_info (this, out info);
+ MonoPropertyInfo.get_property_info (this, out info, PInfo.GetMethod);
return (info.get_method != null);
}
}
@@ -50,7 +61,7 @@ namespace System.Reflection {
public override bool CanWrite {
get {
MonoPropertyInfo info;
- MonoPropertyInfo.get_property_info (this, out info);
+ MonoPropertyInfo.get_property_info (this, out info, PInfo.SetMethod);
return (info.set_method != null);
}
}
@@ -58,7 +69,7 @@ namespace System.Reflection {
public override Type PropertyType {
get {
MonoPropertyInfo info;
- MonoPropertyInfo.get_property_info (this, out info);
+ MonoPropertyInfo.get_property_info (this, out info, PInfo.GetMethod | PInfo.SetMethod);
if (info.get_method != null) {
return info.get_method.ReturnType;
@@ -73,7 +84,7 @@ namespace System.Reflection {
public override Type ReflectedType {
get {
MonoPropertyInfo info;
- MonoPropertyInfo.get_property_info (this, out info);
+ MonoPropertyInfo.get_property_info (this, out info, PInfo.ReflectedType);
return info.parent;
}
}
@@ -81,7 +92,7 @@ namespace System.Reflection {
public override Type DeclaringType {
get {
MonoPropertyInfo info;
- MonoPropertyInfo.get_property_info (this, out info);
+ MonoPropertyInfo.get_property_info (this, out info, PInfo.DeclaringType);
return info.parent;
}
}
@@ -89,7 +100,7 @@ namespace System.Reflection {
public override string Name {
get {
MonoPropertyInfo info;
- MonoPropertyInfo.get_property_info (this, out info);
+ MonoPropertyInfo.get_property_info (this, out info, PInfo.Name);
return info.name;
}
}
@@ -100,7 +111,7 @@ namespace System.Reflection {
// FIXME: check nonPublic
MonoPropertyInfo info;
int n = 0;
- MonoPropertyInfo.get_property_info (this, out info);
+ MonoPropertyInfo.get_property_info (this, out info, PInfo.GetMethod | PInfo.SetMethod);
if (info.set_method != null)
n++;
if (info.get_method != null)
@@ -119,14 +130,14 @@ namespace System.Reflection {
{
// FIXME: check nonPublic
MonoPropertyInfo info;
- MonoPropertyInfo.get_property_info (this, out info);
+ MonoPropertyInfo.get_property_info (this, out info, PInfo.GetMethod);
return info.get_method;
}
public override ParameterInfo[] GetIndexParameters()
{
MonoPropertyInfo info;
- MonoPropertyInfo.get_property_info (this, out info);
+ MonoPropertyInfo.get_property_info (this, out info, PInfo.GetMethod);
if (info.get_method != null)
return info.get_method.GetParameters ();
return new ParameterInfo [0];
@@ -136,7 +147,7 @@ namespace System.Reflection {
{
// FIXME: check nonPublic
MonoPropertyInfo info;
- MonoPropertyInfo.get_property_info (this, out info);
+ MonoPropertyInfo.get_property_info (this, out info, PInfo.SetMethod);
return info.set_method;
}
diff --git a/mcs/class/corlib/System.Reflection/common.src b/mcs/class/corlib/System.Reflection/common.src
deleted file mode 100644
index 022b6768fcc..00000000000
--- a/mcs/class/corlib/System.Reflection/common.src
+++ /dev/null
@@ -1,25 +0,0 @@
-Assembly.cs
-AssemblyNameFlags.cs
-BindingFlags.cs
-CallingConventions.cs
-ConstructorInfo.cs
-DefaultMemberAttribute.cs
-EventAttributes.cs
-EventInfo.cs
-FieldAttributes.cs
-FieldInfo.cs
-ICustomAttributeProvider.cs
-MemberFilter.cs
-MemberInfo.cs
-MemberTypes.cs
-MethodAttributes.cs
-MethodBase.cs
-MethodImplAttributes.cs
-MethodInfo.cs
-Module.cs
-ParameterAttributes.cs
-PropertyAttributes.cs
-PropertyInfo.cs
-ResourceAttributes.cs
-ResourceLocation.cs
-TypeAttributes.cs
diff --git a/mcs/class/corlib/System.Resources/ChangeLog b/mcs/class/corlib/System.Resources/ChangeLog
index e03a78996b4..e7ed4f6a6c2 100644
--- a/mcs/class/corlib/System.Resources/ChangeLog
+++ b/mcs/class/corlib/System.Resources/ChangeLog
@@ -1,3 +1,33 @@
+2004-01-13 Zoltan Varga <vargaz@freemail.hu>
+
+ * Win32Resources.cs (Win32VersionInfoResource): Add more properties.
+
+2004-01-09 Zoltan Varga <vargaz@freemail.hu>
+
+ * Win32Resources.cs (Win32VersionInfoResource:WriteTo): Add padding
+ at the end of each string entry.
+
+ * Win32Resources.cs: Fix warnings not detected by mcs.
+
+2004-01-08 Zoltan Varga <vargaz@freemail.hu>
+
+ * Win32Resources.cs: Organize win32 resources into a class hierarchy
+ with the class Win32Resource as the abstract superclass. Add
+ Win32ResFileReader and Win32IconFileReader classes and the
+ corresponding resource types.
+
+ * Win32Resources.cs (Win32VersionInfoResource): Fix version number
+ calculation. Add Language property.
+
+2004-01-05 Zoltan Varga <vargaz@freemail.hu>
+
+ * Win32Resources.cs: New file.
+
+ * Win32Resources.cs: The value of properties can't be empty.
+
+ * Win32Resources.cs: Add Win32ResourceType enumeration. Add accessors
+ for well-known property names. Add missing namespace declaration.
+
2003-12-17 Zoltan Varga <vargaz@freemail.hu>
* ResourceWriter.cs (Stream): New internal property used by Ref.Emit.
diff --git a/mcs/class/corlib/System.Resources/Win32Resources.cs b/mcs/class/corlib/System.Resources/Win32Resources.cs
new file mode 100644
index 00000000000..86ac91517fa
--- /dev/null
+++ b/mcs/class/corlib/System.Resources/Win32Resources.cs
@@ -0,0 +1,705 @@
+//
+// System.Resources/Win32Resources.cs
+//
+// Author:
+// Zoltan Varga (vargaz@freemail.hu)
+//
+// (C) 2003 Ximian, Inc. http://www.ximian.com
+//
+// An incomplete set of classes for manipulating Win32 resources
+//
+
+using System;
+using System.Collections;
+using System.IO;
+using System.Text;
+
+namespace System.Resources {
+
+
+internal enum Win32ResourceType {
+ RT_CURSOR = 1,
+ RT_FONT = 8,
+ RT_BITMAP = 2,
+ RT_ICON = 3,
+ RT_MENU = 4,
+ RT_DIALOG = 5,
+ RT_STRING = 6,
+ RT_FONTDIR = 7,
+ RT_ACCELERATOR = 9,
+ RT_RCDATA = 10,
+ RT_MESSAGETABLE = 11,
+ RT_GROUP_CURSOR = 12,
+ RT_GROUP_ICON = 14,
+ RT_VERSION = 16,
+ RT_DLGINCLUDE = 17,
+ RT_PLUGPLAY = 19,
+ RT_VXD = 20,
+ RT_ANICURSOR = 21,
+ RT_ANIICON = 22,
+ RT_HTML = 23,
+}
+
+internal class NameOrId {
+ string name;
+ int id;
+
+ public NameOrId (string name) {
+ this.name = name;
+ }
+
+ public NameOrId (int id) {
+ this.id = id;
+ }
+
+ public bool IsName {
+ get {
+ return name != null;
+ }
+ }
+
+ public string Name {
+ get {
+ return name;
+ }
+ }
+
+ public int Id {
+ get {
+ return id;
+ }
+ }
+
+ public override string ToString () {
+ if (name != null)
+ return "Name(" + name + ")";
+ else
+ return "Id(" + id + ")";
+ }
+}
+
+internal abstract class Win32Resource {
+
+ NameOrId type;
+ NameOrId name;
+ int language;
+
+ internal Win32Resource (NameOrId type, NameOrId name, int language) {
+ this.type = type;
+ this.name = name;
+ this.language = language;
+ }
+
+ internal Win32Resource (Win32ResourceType type, int name, int language) {
+ this.type = new NameOrId ((int)type);
+ this.name = new NameOrId (name);
+ this.language = language;
+ }
+
+ public Win32ResourceType ResourceType {
+ get {
+ if (type.IsName)
+ return (Win32ResourceType)(-1);
+ else
+ return (Win32ResourceType)type.Id;
+ }
+ }
+
+ public NameOrId Name {
+ get {
+ return name;
+ }
+ }
+
+ public NameOrId Type {
+ get {
+ return type;
+ }
+ }
+
+ public int Language {
+ get {
+ return language;
+ }
+ }
+
+ public abstract void WriteTo (Stream s);
+
+ public override string ToString () {
+ return "Win32Resource (Kind=" + ResourceType + ", Name=" + name + ")";
+ }
+}
+
+//
+// This class represents a Win32 resource in encoded format
+//
+internal class Win32EncodedResource : Win32Resource {
+
+ byte[] data;
+
+ internal Win32EncodedResource (NameOrId type, NameOrId name, int language, byte[] data) : base (type, name, language) {
+ this.data = data;
+ }
+
+ public byte[] Data {
+ get {
+ return data;
+ }
+ }
+
+ public override void WriteTo (Stream s) {
+ s.Write (data, 0, data.Length);
+ }
+}
+
+//
+// This class represents a Win32 ICON resource
+//
+internal class Win32IconResource : Win32Resource {
+
+ ICONDIRENTRY icon;
+
+ public Win32IconResource (int id, int language, ICONDIRENTRY icon) : base (Win32ResourceType.RT_ICON, id, language) {
+ this.icon = icon;
+ }
+
+ public ICONDIRENTRY Icon {
+ get {
+ return icon;
+ }
+ }
+
+ public override void WriteTo (Stream s) {
+ s.Write (icon.image, 0, icon.image.Length);
+ }
+}
+
+internal class Win32GroupIconResource : Win32Resource {
+
+ Win32IconResource[] icons;
+
+ public Win32GroupIconResource (int id, int language, Win32IconResource[] icons) : base (Win32ResourceType.RT_GROUP_ICON, id, language) {
+ this.icons = icons;
+ }
+
+ public override void WriteTo (Stream s) {
+ using (BinaryWriter w = new BinaryWriter (s)) {
+ w.Write ((short)0);
+ w.Write ((short)1);
+ w.Write ((short)icons.Length);
+ for (int i = 0; i < icons.Length; ++i) {
+ Win32IconResource icon = icons [i];
+ ICONDIRENTRY entry = icon.Icon;
+
+ w.Write (entry.bWidth);
+ w.Write (entry.bHeight);
+ w.Write (entry.bColorCount);
+ w.Write ((byte)0);
+ w.Write (entry.wPlanes);
+ w.Write (entry.wBitCount);
+ w.Write ((int)entry.image.Length);
+ w.Write ((short)icon.Name.Id);
+ }
+ }
+ }
+}
+
+//
+// This class represents a Win32 VERSION resource
+//
+internal class Win32VersionResource : Win32Resource {
+
+ public string[] WellKnownProperties = {
+ "Comments",
+ "CompanyName",
+ "FileDescription",
+ "FileVersion",
+ "InternalName",
+ "LegalCopyright",
+ "LegalTrademarks",
+ "OriginalFilename",
+ "ProductName",
+ "ProductVersion"
+ };
+
+ long signature;
+ int struct_version;
+ long file_version;
+ long product_version;
+ int file_flags_mask;
+ int file_flags;
+ int file_os;
+ int file_type;
+ int file_subtype;
+ long file_date;
+
+ int file_lang;
+ int file_codepage;
+
+ Hashtable properties;
+
+ public Win32VersionResource (int id, int language) : base (Win32ResourceType.RT_VERSION, id, language) {
+ // Initialize non-public members to the usual values used in
+ // resources
+ signature = 0xfeef04bd;
+ struct_version = 1 << 16; /* 1.0 */
+ file_flags_mask = 63;
+ file_flags = 0;
+ file_os = 4; /* VOS_WIN32 */
+ file_type = 2;
+ file_subtype = 0;
+ file_date = 0;
+
+ file_lang = 0x7f;
+ file_codepage = 1200;
+
+ properties = new Hashtable ();
+
+ // Well known properties
+ foreach (string s in WellKnownProperties)
+ // The value of properties can't be empty
+ properties [s] = " ";
+ }
+
+ public string FileVersion {
+ get {
+ return
+ "" + (file_version >> 48) +
+ "." + ((file_version >> 32) & 0xffff) +
+ "." + ((file_version >> 16) & 0xffff) +
+ "." + ((file_version >> 0) & 0xffff);
+ }
+
+ set {
+ long[] ver = new long [4] { 0, 0, 0, 0 };
+ if (value != null) {
+ string[] parts = value.Split ('.');
+
+ for (int i = 0; i < parts.Length; ++i) {
+ try {
+ if (i < ver.Length)
+ ver [i] = Int32.Parse (parts [i]);
+ }
+ catch (FormatException) {
+ }
+ }
+ }
+
+ file_version = (ver [0] << 48) | (ver [1] << 32) | (ver [2] << 16) + ver [3];
+ }
+ }
+
+ public virtual string this [string key] {
+ set {
+ properties [key] = value;
+ }
+ }
+
+ // Accessors for well known properties
+
+ public virtual string Comments {
+ get {
+ return (string)properties ["Comments"];
+ }
+ set {
+ properties ["Comments"] = value == String.Empty ? " " : value;
+ }
+ }
+
+ public virtual string CompanyName {
+ get {
+ return (string)properties ["CompanyName"];
+ }
+ set {
+ properties ["CompanyName"] = value == String.Empty ? " " : value;
+ }
+ }
+
+ public virtual string LegalCopyright {
+ get {
+ return (string)properties ["LegalCopyright"];
+ }
+ set {
+ properties ["LegalCopyright"] = value == String.Empty ? " " : value;
+ }
+ }
+
+ public virtual string LegalTrademarks {
+ get {
+ return (string)properties ["LegalTrademarks"];
+ }
+ set {
+ properties ["LegalTrademarks"] = value == String.Empty ? " " : value;
+ }
+ }
+
+ public virtual string OriginalFilename {
+ get {
+ return (string)properties ["OriginalFilename"];
+ }
+ set {
+ properties ["OriginalFilename"] = value == String.Empty ? " " : value;
+ }
+ }
+
+ public virtual string ProductName {
+ get {
+ return (string)properties ["ProductName"];
+ }
+ set {
+ properties ["ProductName"] = value == String.Empty ? " " : value;
+ }
+ }
+
+ public virtual string ProductVersion {
+ get {
+ return (string)properties ["ProductVersion"];
+ }
+ set {
+ properties ["ProductVersion"] = value == String.Empty ? " " : value;
+ }
+ }
+
+ public virtual string InternalName {
+ get {
+ return (string)properties ["InternalName"];
+ }
+ set {
+ properties ["InternalName"] = value == String.Empty ? " " : value;
+ }
+ }
+
+ public virtual string FileDescription {
+ get {
+ return (string)properties ["FileDescription"];
+ }
+ set {
+ properties ["FileDescription"] = value == String.Empty ? " " : value;
+ }
+ }
+
+ public virtual int FileLanguage {
+ get {
+ return file_lang;
+ }
+ set {
+ file_lang = value;
+ }
+ }
+
+ private void emit_padding (BinaryWriter w) {
+ Stream ms = w.BaseStream;
+
+ if ((ms.Position % 4) != 0)
+ w.Write ((short)0);
+ }
+
+ private void patch_length (BinaryWriter w, long len_pos) {
+ Stream ms = w.BaseStream;
+
+ long pos = ms.Position;
+ ms.Position = len_pos;
+ w.Write ((short)(pos - len_pos));
+ ms.Position = pos;
+ }
+
+ public override void WriteTo (Stream ms)
+ {
+ using (BinaryWriter w = new BinaryWriter (ms, Encoding.Unicode)) {
+ //
+ // See the documentation for the VS_VERSIONINFO structure and
+ // its children on MSDN
+ //
+
+ // VS_VERSIONINFO
+ w.Write ((short)0);
+ w.Write ((short)0x34);
+ w.Write ((short)0);
+ w.Write ("VS_VERSION_INFO".ToCharArray ());
+ w.Write ((short)0);
+
+ emit_padding (w);
+
+ // VS_FIXEDFILEINFO
+ w.Write ((uint)signature);
+ w.Write ((int)struct_version);
+ w.Write ((int)(file_version >> 32));
+ w.Write ((int)((file_version & 0xffffffff)));
+
+ w.Write ((int)(product_version >> 32));
+ w.Write ((int)(product_version & 0xffffffff));
+ w.Write ((int)file_flags_mask);
+ w.Write ((int)file_flags);
+ w.Write ((int)file_os);
+ w.Write ((int)file_type);
+ w.Write ((int)file_subtype);
+ w.Write ((int)(file_date >> 32));
+ w.Write ((int)(file_date & 0xffffffff));
+
+ emit_padding (w);
+
+ // VarFileInfo
+ long var_file_info_pos = ms.Position;
+ w.Write ((short)0);
+ w.Write ((short)0);
+ w.Write ((short)1);
+ w.Write ("VarFileInfo".ToCharArray ());
+ w.Write ((short)0);
+
+ if ((ms.Position % 4) != 0)
+ w.Write ((short)0);
+
+ // Var
+ long var_pos = ms.Position;
+ w.Write ((short)0);
+ w.Write ((short)4);
+ w.Write ((short)0);
+ w.Write ("Translation".ToCharArray ());
+ w.Write ((short)0);
+
+ if ((ms.Position % 4) != 0)
+ w.Write ((short)0);
+
+ w.Write ((short)file_lang);
+ w.Write ((short)file_codepage);
+
+ patch_length (w, var_pos);
+
+ patch_length (w, var_file_info_pos);
+
+ // StringFileInfo
+ long string_file_info_pos = ms.Position;
+ w.Write ((short)0);
+ w.Write ((short)0);
+ w.Write ((short)1);
+ w.Write ("StringFileInfo".ToCharArray ());
+
+ emit_padding (w);
+
+ // StringTable
+ long string_table_pos = ms.Position;
+ w.Write ((short)0);
+ w.Write ((short)0);
+ w.Write ((short)1);
+ w.Write (String.Format ("{0:x4}{1:x4}", file_lang, file_codepage).ToCharArray ());
+
+ emit_padding (w);
+
+ // Strings
+ foreach (string key in properties.Keys) {
+ string value = (string)properties [key];
+
+ long string_pos = ms.Position;
+ w.Write ((short)0);
+ w.Write ((short)(value.ToCharArray ().Length + 1));
+ w.Write ((short)1);
+ w.Write (key.ToCharArray ());
+ w.Write ((short)0);
+
+ emit_padding (w);
+
+ w.Write (value.ToCharArray ());
+ w.Write ((short)0);
+
+ emit_padding (w);
+
+ patch_length (w, string_pos);
+ }
+
+ patch_length (w, string_table_pos);
+
+ patch_length (w, string_file_info_pos);
+
+ patch_length (w, 0);
+ }
+ }
+}
+
+internal class Win32ResFileReader {
+
+ Stream res_file;
+
+ public Win32ResFileReader (Stream s) {
+ res_file = s;
+ }
+
+ int read_int16 () {
+ int b1 = res_file.ReadByte ();
+ int b2 = res_file.ReadByte ();
+
+ if ((b1 == -1) || (b2 == -1))
+ return -1;
+ else
+ return b1 | (b2 << 8);
+ }
+
+ int read_int32 () {
+ int w1 = read_int16 ();
+ int w2 = read_int16 ();
+
+ if ((w1 == -1) || (w2 == -1))
+ return -1;
+ return w1 | (w2 << 16);
+ }
+
+ private void read_padding () {
+ while ((res_file.Position % 4) != 0)
+ read_int16 ();
+ }
+
+ NameOrId read_ordinal () {
+ int i = read_int16 ();
+ if ((i & 0xffff) != 0) {
+ int j = read_int16 ();
+ return new NameOrId (j);
+ }
+ else {
+ byte[] chars = new byte [16];
+ int pos = 0;
+
+ while (true) {
+ int j = read_int16 ();
+ if (j == 0)
+ break;
+ if (pos == chars.Length) {
+ byte[] new_chars = new byte [chars.Length * 2];
+ Array.Copy (chars, new_chars, chars.Length);
+ chars = new_chars;
+ }
+ chars [pos] = (byte)(j >> 8);
+ chars [pos + 1] = (byte)(j & 0xff);
+ pos += 2;
+ }
+
+ return new NameOrId (new String (Encoding.Unicode.GetChars (chars, 0, pos)));
+ }
+ }
+
+ public ICollection ReadResources () {
+ ArrayList resources = new ArrayList ();
+
+ /*
+ * We can't use a BinaryReader since we have to keep track of the
+ * stream position for padding.
+ */
+
+ while (true) {
+
+ read_padding ();
+
+ int data_size = read_int32 ();
+
+ if (data_size == -1)
+ /* EOF */
+ break;
+
+ int header_size = read_int32 ();
+ NameOrId type = read_ordinal ();
+ NameOrId name = read_ordinal ();
+
+ read_padding ();
+
+ int data_version = read_int32 ();
+ int memory_flags = read_int16 ();
+ int language_id = read_int16 ();
+ int version = read_int32 ();
+ int characteristics = read_int32 ();
+
+ if (data_size == 0)
+ /* Empty resource entry */
+ continue;
+
+ byte[] data = new byte [data_size];
+ res_file.Read (data, 0, data_size);
+
+ resources.Add (new Win32EncodedResource (type, name, language_id, data));
+ }
+
+ return resources;
+ }
+}
+
+//
+// This class represents one icon image in an .ico file
+//
+internal class ICONDIRENTRY {
+
+ public byte bWidth;
+ public byte bHeight;
+ public byte bColorCount;
+ public byte bReserved;
+ public Int16 wPlanes;
+ public Int16 wBitCount;
+ public Int32 dwBytesInRes;
+ public Int32 dwImageOffset;
+
+ public byte[] image;
+
+ public override string ToString () {
+ return "ICONDIRENTRY (" + bWidth + "x" + bHeight + " " + wBitCount + " bpp)";
+ }
+}
+
+//
+// This class represents a Reader for Win32 .ico files
+//
+internal class Win32IconFileReader {
+
+ Stream iconFile;
+
+ public Win32IconFileReader (Stream s) {
+ iconFile = s;
+ }
+
+ public ICONDIRENTRY[] ReadIcons () {
+ ICONDIRENTRY[] icons = null;
+
+ using (BinaryReader r = new BinaryReader (iconFile)) {
+ int idReserved = r.ReadInt16 ();
+ int idType = r.ReadInt16 ();
+ if ((idReserved != 0) || (idType != 1))
+ throw new Exception ("Invalid .ico file format");
+ long nitems = r.ReadInt16 ();
+
+ icons = new ICONDIRENTRY [nitems];
+
+ for (int i = 0; i < nitems; ++i) {
+ ICONDIRENTRY entry = new ICONDIRENTRY ();
+
+ entry.bWidth = r.ReadByte ();
+ entry.bHeight = r.ReadByte ();
+ entry.bColorCount = r.ReadByte ();
+ entry.bReserved = r.ReadByte ();
+ entry.wPlanes = r.ReadInt16 ();
+ entry.wBitCount = r.ReadInt16 ();
+ int dwBytesInRes = r.ReadInt32 ();
+ int dwImageOffset = r.ReadInt32 ();
+
+ /* Read image */
+ entry.image = new byte [dwBytesInRes];
+
+ long pos = iconFile.Position;
+ iconFile.Position = dwImageOffset;
+ iconFile.Read (entry.image, 0, dwBytesInRes);
+ iconFile.Position = pos;
+
+ /*
+ * The wPlanes and wBitCount members in the ICONDIRENTRY
+ * structure can be 0, so we set them from the BITMAPINFOHEADER
+ * structure that follows
+ */
+
+ if (entry.wPlanes == 0)
+ entry.wPlanes = (short)(entry.image [12] | (entry.image [13] << 8));
+ if (entry.wBitCount == 0)
+ entry.wBitCount = (short)(entry.image [14] | (entry.image [15] << 8));
+
+ icons [i] = entry;
+ }
+
+ return icons;
+ }
+ }
+}
+
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/ChangeLog b/mcs/class/corlib/System.Runtime.InteropServices/ChangeLog
index 6a69ee6dba5..02f9e914744 100644
--- a/mcs/class/corlib/System.Runtime.InteropServices/ChangeLog
+++ b/mcs/class/corlib/System.Runtime.InteropServices/ChangeLog
@@ -1,3 +1,7 @@
+2004-01-30 Zoltan Varga <vargaz@freemail.hu>
+
+ * Marshal.cs: Implement AllocCoTaskMem and FreeCoTaskMem.
+
2003-11-26 Andreas Nahr <ClassDevelopment@A-SoftTech.com>
* DispatchWrapper.cs: Added and implemented
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/Marshal.cs b/mcs/class/corlib/System.Runtime.InteropServices/Marshal.cs
index 7fffb889623..c2c4c7cbb83 100644
--- a/mcs/class/corlib/System.Runtime.InteropServices/Marshal.cs
+++ b/mcs/class/corlib/System.Runtime.InteropServices/Marshal.cs
@@ -27,10 +27,9 @@ namespace System.Runtime.InteropServices
public static int AddRef (IntPtr pUnk) {
throw new NotImplementedException ();
}
- [MonoTODO]
- public static IntPtr AllocCoTaskMem (int cb) {
- throw new NotImplementedException ();
- }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern static IntPtr AllocCoTaskMem (int cb);
[MethodImplAttribute(MethodImplOptions.InternalCall)]
public extern static IntPtr AllocHGlobal (IntPtr cb);
@@ -126,10 +125,8 @@ namespace System.Runtime.InteropServices
throw new NotImplementedException ();
}
- [MonoTODO]
- public static void FreeCoTaskMem (IntPtr ptr) {
- throw new NotImplementedException ();
- }
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern static void FreeCoTaskMem (IntPtr ptr);
[MethodImplAttribute(MethodImplOptions.InternalCall)]
public extern static void FreeHGlobal (IntPtr hglobal);
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Messaging/AsyncResult.cs b/mcs/class/corlib/System.Runtime.Remoting.Messaging/AsyncResult.cs
index 7cc673d76a8..4a6b3ade137 100644
--- a/mcs/class/corlib/System.Runtime.Remoting.Messaging/AsyncResult.cs
+++ b/mcs/class/corlib/System.Runtime.Remoting.Messaging/AsyncResult.cs
@@ -25,6 +25,7 @@ public class AsyncResult : IAsyncResult, IMessageSink {
bool sync_completed;
bool completed;
bool endinvoke_called;
+ object async_callback;
MonoMethodMessage call_message;
IMessageCtrl message_ctrl;
IMessage reply_message;
@@ -118,9 +119,9 @@ public class AsyncResult : IAsyncResult, IMessageSink {
completed = true;
NativeEventCalls.SetEvent_internal (handle.Handle);
- if (async_delegate != null)
+ if (async_callback != null)
{
- AsyncCallback ac = (AsyncCallback) async_delegate;
+ AsyncCallback ac = (AsyncCallback) async_callback;
ac (this);
}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Messaging/ChangeLog b/mcs/class/corlib/System.Runtime.Remoting.Messaging/ChangeLog
index 444bd152ab4..84779e644c7 100644
--- a/mcs/class/corlib/System.Runtime.Remoting.Messaging/ChangeLog
+++ b/mcs/class/corlib/System.Runtime.Remoting.Messaging/ChangeLog
@@ -1,3 +1,11 @@
+2004-01-19 Lluis Sanchez Gual <lluis@ximian.com>
+
+ * AsyncResult.cs: Added async_callback field and fixed the callback call.
+ I thought that async_delegate was the callback, but it is not, it is the
+ delegate upon which the async call was invoked. This fixes bug #53020.
+ * StackBuilderSink.cs: If the target object is a proxy, make the call
+ using the Invoke method of the real proxy.
+
2003-12-23 Lluis Sanchez Gual <lluis@ximian.com>
* ConstructionResponse.cs: Added constructor for exception response.
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Messaging/StackBuilderSink.cs b/mcs/class/corlib/System.Runtime.Remoting.Messaging/StackBuilderSink.cs
index 1c4afda39eb..1c1d2b5e445 100644
--- a/mcs/class/corlib/System.Runtime.Remoting.Messaging/StackBuilderSink.cs
+++ b/mcs/class/corlib/System.Runtime.Remoting.Messaging/StackBuilderSink.cs
@@ -9,6 +9,7 @@
using System;
using System.Threading;
using System.Reflection;
+using System.Runtime.Remoting.Proxies;
namespace System.Runtime.Remoting.Messaging
{
@@ -17,10 +18,13 @@ namespace System.Runtime.Remoting.Messaging
internal class StackBuilderSink: IMessageSink
{
MarshalByRefObject _target;
+ RealProxy _rp;
public StackBuilderSink (MarshalByRefObject obj)
{
_target = obj;
+ if (RemotingServices.IsTransparentProxy (obj))
+ _rp = RemotingServices.GetRealProxy (obj);
}
public IMessage SyncProcessMessage (IMessage msg)
@@ -28,7 +32,8 @@ namespace System.Runtime.Remoting.Messaging
CheckParameters (msg);
// Makes the real call to the object
- return RemotingServices.InternalExecuteMessage (_target, (IMethodCallMessage)msg);
+ if (_rp != null) return _rp.Invoke (msg);
+ else return RemotingServices.InternalExecuteMessage (_target, (IMethodCallMessage)msg);
}
public IMessageCtrl AsyncProcessMessage (IMessage msg, IMessageSink replySink)
@@ -45,7 +50,11 @@ namespace System.Runtime.Remoting.Messaging
IMessageSink replySink = (IMessageSink)parms[1];
CheckParameters (msg);
- IMessage res = RemotingServices.InternalExecuteMessage (_target, msg);
+
+ IMessage res;
+ if (_rp != null) res = _rp.Invoke (msg);
+ else res = RemotingServices.InternalExecuteMessage (_target, (IMethodCallMessage)msg);
+ res = RemotingServices.InternalExecuteMessage (_target, msg);
replySink.SyncProcessMessage (res);
}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Proxies/ChangeLog b/mcs/class/corlib/System.Runtime.Remoting.Proxies/ChangeLog
index 024e3f3dfe3..dcdcd086fc0 100644
--- a/mcs/class/corlib/System.Runtime.Remoting.Proxies/ChangeLog
+++ b/mcs/class/corlib/System.Runtime.Remoting.Proxies/ChangeLog
@@ -1,3 +1,7 @@
+2004-01-19 Lluis Sanchez Gual <lluis@ximian.com>
+
+ * RealProxy.cs: Added setter for ObjectIdentity.
+
2003-11-26 Lluis Sanchez Gual <lluis@ximian.com>
* RealProxy.cs: Signature fix.
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Proxies/RealProxy.cs b/mcs/class/corlib/System.Runtime.Remoting.Proxies/RealProxy.cs
index 23196a3be24..84eb8823ca9 100644
--- a/mcs/class/corlib/System.Runtime.Remoting.Proxies/RealProxy.cs
+++ b/mcs/class/corlib/System.Runtime.Remoting.Proxies/RealProxy.cs
@@ -81,6 +81,7 @@ namespace System.Runtime.Remoting.Proxies
internal Identity ObjectIdentity
{
get { return _objectIdentity; }
+ set { _objectIdentity = value; }
}
[MonoTODO]
diff --git a/mcs/class/corlib/System.Runtime.Remoting/ChangeLog b/mcs/class/corlib/System.Runtime.Remoting/ChangeLog
index 11ef819958d..245348afc63 100755
--- a/mcs/class/corlib/System.Runtime.Remoting/ChangeLog
+++ b/mcs/class/corlib/System.Runtime.Remoting/ChangeLog
@@ -1,3 +1,14 @@
+2004-01-24 Lluis Sanchez Gual <lluis@ximian.com>
+
+ * TypeInfo.cs: The list of interfaces may be null. Added check.
+
+2004-01-19 Lluis Sanchez Gual <lluis@ximian.com>
+
+ * RemotingServices.cs: When marshalling a custom proxy, allow the creation
+ of a new identity. This fixes bug #52921.
+ * ServerIdentity.cs: Allow the creation of server identities that
+ represent a custom proxy instead of a real object.
+
2003-12-10 Lluis Sanchez Gual <lluis@ximian.com>
* SoapServices.cs: Little fix: correctly encode namespaces.
diff --git a/mcs/class/corlib/System.Runtime.Remoting/RemotingServices.cs b/mcs/class/corlib/System.Runtime.Remoting/RemotingServices.cs
index 68b3c441cb1..10ea212fffd 100644
--- a/mcs/class/corlib/System.Runtime.Remoting/RemotingServices.cs
+++ b/mcs/class/corlib/System.Runtime.Remoting/RemotingServices.cs
@@ -146,7 +146,7 @@ namespace System.Runtime.Remoting
public static Type GetServerTypeForUri (string uri)
{
- Identity ident = GetIdentityForUri (uri);
+ ServerIdentity ident = GetIdentityForUri (uri) as ServerIdentity;
if (ident == null) return null;
return ident.ObjectType;
}
@@ -203,7 +203,7 @@ namespace System.Runtime.Remoting
if (identity != null)
{
- if (identity.ObjectType.IsContextful && !identity.IsConnected)
+ if (proxy.GetProxiedType().IsContextful && !identity.IsConnected)
{
// Unregistered local contextbound object. Register now.
ClientActivatedIdentity cboundIdentity = (ClientActivatedIdentity)identity;
@@ -218,8 +218,6 @@ namespace System.Runtime.Remoting
return proxy.ObjectIdentity.CreateObjRef(requested_type);
}
- else
- throw new NotSupportedException (); // TODO
}
if (requested_type == null) requested_type = obj.GetType();
diff --git a/mcs/class/corlib/System.Runtime.Remoting/ServerIdentity.cs b/mcs/class/corlib/System.Runtime.Remoting/ServerIdentity.cs
index 2d0e7c60c8a..a76c3cdb26f 100644
--- a/mcs/class/corlib/System.Runtime.Remoting/ServerIdentity.cs
+++ b/mcs/class/corlib/System.Runtime.Remoting/ServerIdentity.cs
@@ -10,6 +10,7 @@ using System;
using System.Runtime.Remoting.Messaging;
using System.Runtime.Remoting.Contexts;
using System.Runtime.Remoting.Lifetime;
+using System.Runtime.Remoting.Proxies;
namespace System.Runtime.Remoting
{
@@ -71,12 +72,21 @@ namespace System.Runtime.Remoting
public void AttachServerObject (MarshalByRefObject serverObject, Context context)
{
- if (_objectType.IsContextful)
- _envoySink = context.CreateEnvoySink (serverObject);
-
_context = context;
_serverObject = serverObject;
- _serverObject.ObjectIdentity = this;
+
+ if (RemotingServices.IsTransparentProxy (serverObject))
+ {
+ RealProxy rp = RemotingServices.GetRealProxy (serverObject);
+ rp.ObjectIdentity = this;
+ }
+ else
+ {
+ if (_objectType.IsContextful)
+ _envoySink = context.CreateEnvoySink (serverObject);
+
+ _serverObject.ObjectIdentity = this;
+ }
}
public Lease Lease
diff --git a/mcs/class/corlib/System.Runtime.Remoting/TypeInfo.cs b/mcs/class/corlib/System.Runtime.Remoting/TypeInfo.cs
index f859c9d1c24..e9478e9982a 100644
--- a/mcs/class/corlib/System.Runtime.Remoting/TypeInfo.cs
+++ b/mcs/class/corlib/System.Runtime.Remoting/TypeInfo.cs
@@ -82,9 +82,12 @@ namespace System.Runtime.Remoting
foreach (string basec in serverHierarchy)
if ( (basec + ",").StartsWith (fromName)) return true;
- foreach (string basec in interfacesImplemented)
- if ( (basec + ",").StartsWith (fromName)) return true;
-
+ if (interfacesImplemented != null)
+ {
+ foreach (string basec in interfacesImplemented)
+ if ( (basec + ",").StartsWith (fromName)) return true;
+ }
+
return false;
}
}
diff --git a/mcs/class/corlib/System.Security.Cryptography/ChangeLog b/mcs/class/corlib/System.Security.Cryptography/ChangeLog
index 8da7cc030f0..febb4830b6e 100644
--- a/mcs/class/corlib/System.Security.Cryptography/ChangeLog
+++ b/mcs/class/corlib/System.Security.Cryptography/ChangeLog
@@ -1,3 +1,13 @@
+2003-01-31 David Sheldon <dave-mono@earth.li>
+
+ * FromBase64Transform.cs: Removed needless catch and rethrow.
+
+2003-01-31 David Sheldon <dave-mono@earth.li>
+
+ * FromBase64Transform.cs: Fixes to what happens if a character in the
+ input stream is not in the lookup table. IndexOutOfRangeException was
+ wrong.
+
2003-12-15 Sebastien Pouliot <spouliot@videotron.ca>
* CryptoConfig.cs: Now use internal Environment.GetMachineConfigPath()
diff --git a/mcs/class/corlib/System.Security.Cryptography/FromBase64Transform.cs b/mcs/class/corlib/System.Security.Cryptography/FromBase64Transform.cs
index 375c42d5510..289733dba00 100644
--- a/mcs/class/corlib/System.Security.Cryptography/FromBase64Transform.cs
+++ b/mcs/class/corlib/System.Security.Cryptography/FromBase64Transform.cs
@@ -136,6 +136,14 @@ namespace System.Security.Cryptography {
}
+ private byte [] lookupTable;
+ private byte lookup(byte input) {
+ byte ret;
+ if ((input >= lookupTable.Length) || ((ret = lookupTable[input])==-1))
+ throw new System.FormatException("Invalid character in a Base-64 string.");
+ return ret;
+ }
+
private int DoTransform (byte [] inputBuffer,
int inputOffset,
int inputCount,
@@ -154,14 +162,14 @@ namespace System.Security.Cryptography {
if (inputBuffer[inputCount - 2] == (byte)'=') ++rem;
- byte [] lookup = Base64Table.DecodeTable;
+ lookupTable = Base64Table.DecodeTable;
int b0,b1,b2,b3;
for (int i = 0; i < full; i++) {
- b0 = lookup [inputBuffer [inputOffset++]];
- b1 = lookup [inputBuffer [inputOffset++]];
- b2 = lookup [inputBuffer [inputOffset++]];
- b3 = lookup [inputBuffer [inputOffset++]];
+ b0 = lookup (inputBuffer [inputOffset++]);
+ b1 = lookup (inputBuffer [inputOffset++]);
+ b2 = lookup (inputBuffer [inputOffset++]);
+ b3 = lookup (inputBuffer [inputOffset++]);
outputBuffer [outputOffset++] = (byte) ((b0 << 2) | (b1 >> 4));
outputBuffer [outputOffset++] = (byte) ((b1 << 4) | (b2 >> 2));
@@ -174,16 +182,16 @@ namespace System.Security.Cryptography {
case 0:
break;
case 1:
- b0 = lookup [inputBuffer [inputOffset++]];
- b1 = lookup [inputBuffer [inputOffset++]];
- b2 = lookup [inputBuffer [inputOffset++]];
+ b0 = lookup (inputBuffer [inputOffset++]);
+ b1 = lookup (inputBuffer [inputOffset++]);
+ b2 = lookup (inputBuffer [inputOffset++]);
outputBuffer [outputOffset++] = (byte) ((b0 << 2) | (b1 >> 4));
outputBuffer [outputOffset++] = (byte) ((b1 << 4) | (b2 >> 2));
res += 2;
break;
case 2:
- b0 = lookup [inputBuffer [inputOffset++]];
- b1 = lookup [inputBuffer [inputOffset++]];
+ b0 = lookup (inputBuffer [inputOffset++]);
+ b1 = lookup (inputBuffer [inputOffset++]);
outputBuffer [outputOffset++] = (byte) ((b0 << 2) | (b1 >> 4));
++res;
break;
@@ -230,7 +238,7 @@ namespace System.Security.Cryptography {
Array.Copy (src, srcOff, tmpBuff, accPtr, n);
accPtr = count & 3;
Array.Copy (src, srcOff + (n - accPtr), accumulator, 0, accPtr);
- res = DoTransform (tmpBuff, 0, count & (~3), outputBuffer, outputOffset);
+ res = DoTransform (tmpBuff, 0, count & (~3), outputBuffer, outputOffset) ;
}
@@ -267,8 +275,14 @@ namespace System.Security.Cryptography {
Array.Copy (accumulator, 0, tmpBuf, 0, accPtr);
Array.Copy (src, srcOff, tmpBuf, accPtr, n);
-
- int actLen = DoTransform (tmpBuf, 0, dataLen, res, 0);
+
+ int actLen;
+ try {
+ actLen = DoTransform (tmpBuf, 0, dataLen, res, 0);
+ }
+ catch (System.FormatException e) {
+ throw e;
+ }
accPtr = 0;
diff --git a/mcs/class/corlib/System.Security.Permissions/ChangeLog b/mcs/class/corlib/System.Security.Permissions/ChangeLog
index 71a6e43c2cb..b00e3dc31a0 100644
--- a/mcs/class/corlib/System.Security.Permissions/ChangeLog
+++ b/mcs/class/corlib/System.Security.Permissions/ChangeLog
@@ -1,3 +1,12 @@
+2004-01-27 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * FileIOPermission.cs: Added missing ArgumentNullException to
+ constructors.
+
+2004-01-26 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * PermissionSetAttribute.cs: Implemented CreatePermissionSet.
+
2003-12-29 Sebastien Pouliot <spouliot@videotron.ca>
* EnvironmentPermission.cs: Fixed return value to match unit tests.
diff --git a/mcs/class/corlib/System.Security.Permissions/FileIOPermission.cs b/mcs/class/corlib/System.Security.Permissions/FileIOPermission.cs
index 58753783a5d..5deb01a9108 100644
--- a/mcs/class/corlib/System.Security.Permissions/FileIOPermission.cs
+++ b/mcs/class/corlib/System.Security.Permissions/FileIOPermission.cs
@@ -10,13 +10,12 @@
//------------------------------------------------------------------------------
using System.Collections;
-using System.Text;
-using System.Security.Permissions;
using System.IO;
+using System.Text;
namespace System.Security.Permissions {
- [SerializableAttribute()]
+ [Serializable]
public sealed class FileIOPermission
: CodeAccessPermission, IBuiltInPermission, IUnrestrictedPermission {
@@ -37,7 +36,11 @@ namespace System.Security.Permissions {
}
}
- public FileIOPermission(FileIOPermissionAccess access, string path){
+ public FileIOPermission(FileIOPermissionAccess access, string path)
+ {
+ if (path == null)
+ throw new ArgumentNullException ("path");
+
if ((FileIOPermissionAccess.AllAccess & access) != access){
throw new ArgumentException("Illegal enum value: "+access.ToString()+".");
}
@@ -49,7 +52,11 @@ namespace System.Security.Permissions {
AddPathList(access, path);
}
- public FileIOPermission(FileIOPermissionAccess access, string[] pathList){
+ public FileIOPermission(FileIOPermissionAccess access, string[] pathList)
+ {
+ if (pathList == null)
+ throw new ArgumentNullException ("pathList");
+
if ((FileIOPermissionAccess.AllAccess & access) != access){
throw new ArgumentException("Illegal enum value: "+access.ToString()+".");
}
@@ -413,7 +420,5 @@ namespace System.Security.Permissions {
{
return 2;
}
-
-
}
}
diff --git a/mcs/class/corlib/System.Security.Permissions/PermissionSetAttribute.cs b/mcs/class/corlib/System.Security.Permissions/PermissionSetAttribute.cs
index 2d91a1dd10d..42e4d1556d0 100644
--- a/mcs/class/corlib/System.Security.Permissions/PermissionSetAttribute.cs
+++ b/mcs/class/corlib/System.Security.Permissions/PermissionSetAttribute.cs
@@ -1,12 +1,19 @@
//
// System.Security.Permissions.PermissionSetAttribute.cs
//
-// Duncan Mak <duncan@ximian.com>
+// Authors
+// Duncan Mak <duncan@ximian.com>
+// Sebastien Pouliot <spouliot@videotron.ca>
//
// (C) 2002 Ximian, Inc. http://www.ximian.com
//
using System;
+using System.IO;
+using System.Security.Policy;
+using System.Text;
+
+using Mono.Xml;
namespace System.Security.Permissions {
@@ -59,7 +66,31 @@ namespace System.Security.Permissions {
return null; // Not used, used for inheritance from SecurityAttribute
}
- [MonoTODO]
+ private PermissionSet CreateFromXml (string xml)
+ {
+ SecurityParser sp = new SecurityParser ();
+ sp.LoadXml (xml);
+ SecurityElement se = sp.ToXml ();
+
+ string className = se.Attribute ("class");
+ if (className == null)
+ return null;
+
+ PermissionState state = PermissionState.None;
+ if (se.Attribute ("Unrestricted") == "true")
+ state = PermissionState.Unrestricted;
+
+ if (className.EndsWith ("NamedPermissionSet")) {
+ NamedPermissionSet nps = new NamedPermissionSet (se.Attribute ("Name"), state);
+ return (PermissionSet) nps;
+ }
+ else if (className.EndsWith ("PermissionSet")) {
+ PermissionSet ps = new PermissionSet (state);
+ return ps;
+ }
+ return null;
+ }
+
public PermissionSet CreatePermissionSet ()
{
PermissionSet pset = null;
@@ -68,10 +99,16 @@ namespace System.Security.Permissions {
else {
pset = new PermissionSet (PermissionState.None);
if (name != null) {
+ return PolicyLevel.CreateAppDomainLevel ().GetNamedPermissionSet (name);
}
else if (file != null) {
+ Encoding e = ((isUnicodeEncoded) ? System.Text.Encoding.Unicode : System.Text.Encoding.ASCII);
+ using (StreamReader sr = new StreamReader (file, e)) {
+ pset = CreateFromXml (sr.ReadToEnd ());
+ }
}
else if (xml != null) {
+ pset = CreateFromXml (xml);
}
}
return pset;
diff --git a/mcs/class/corlib/System.Security.Policy/AllMembershipCondition.cs b/mcs/class/corlib/System.Security.Policy/AllMembershipCondition.cs
index 4fe9765ec31..5435819e672 100755
--- a/mcs/class/corlib/System.Security.Policy/AllMembershipCondition.cs
+++ b/mcs/class/corlib/System.Security.Policy/AllMembershipCondition.cs
@@ -8,12 +8,8 @@
using System;
using System.Security;
+namespace System.Security.Policy {
-namespace System.Security.Policy
-{
- /// <summary>
- /// Summary description for AllMembershipCondition.
- /// </summary>
[Serializable]
public sealed class AllMembershipCondition
: IMembershipCondition, IConstantMembershipCondition, ISecurityEncodable, ISecurityPolicyEncodable
@@ -35,11 +31,9 @@ namespace System.Security.Policy
return new AllMembershipCondition();
}
- public override bool Equals(object o)
+ public override bool Equals (object o)
{
- if(o is System.Security.Policy.AllMembershipCondition)
- return true;
- return false;
+ return (o is System.Security.Policy.AllMembershipCondition);
}
public void FromXml(SecurityElement e)
@@ -47,7 +41,6 @@ namespace System.Security.Policy
FromXml(e, null);
}
- //Fixme: is there a need for all this????
public void FromXml(SecurityElement e, PolicyLevel level)
{
if(e == null)
@@ -57,7 +50,6 @@ namespace System.Security.Policy
+ AllMembershipCondition.XmlTag);
}
-
public override int GetHashCode()
{
return typeof (AllMembershipCondition).GetHashCode ();
diff --git a/mcs/class/corlib/System.Security.Policy/ApplicationDirectory.cs b/mcs/class/corlib/System.Security.Policy/ApplicationDirectory.cs
index 0062a64ac75..73b1907f70e 100644
--- a/mcs/class/corlib/System.Security.Policy/ApplicationDirectory.cs
+++ b/mcs/class/corlib/System.Security.Policy/ApplicationDirectory.cs
@@ -11,7 +11,7 @@ namespace System.Security.Policy {
[MonoTODO("This class should use a URLString like class instead of just a string")]
[Serializable]
- public sealed class ApplicationDirectory : IBuiltinEvidence {
+ public sealed class ApplicationDirectory : IBuiltInEvidence {
private string directory;
@@ -19,10 +19,10 @@ namespace System.Security.Policy {
// Public Constructors
//
- public ApplicationDirectory(string name)
+ public ApplicationDirectory (string name)
{
if (null == name)
- throw new ArgumentNullException ();
+ throw new ArgumentNullException ("name");
directory = name;
}
@@ -38,17 +38,17 @@ namespace System.Security.Policy {
// Public Methods
//
- public object Copy()
+ public object Copy ()
{
return new ApplicationDirectory (Directory);
}
[MonoTODO("This needs to check for security subsets")]
- public override bool Equals(object other)
+ public override bool Equals (object other)
{
if (null != other && (other is ApplicationDirectory)) {
- ApplicationDirectory compare = (ApplicationDirectory)other;
- return compare.directory.Equals(directory);
+ ApplicationDirectory compare = (ApplicationDirectory) other;
+ return compare.directory.Equals (directory);
}
return false;
}
@@ -56,25 +56,42 @@ namespace System.Security.Policy {
/// <summary>
/// This does not return the exact same results as the MS version
/// </summary>
- public override int GetHashCode()
+ public override int GetHashCode ()
{
return directory.GetHashCode ();
}
- public override string ToString()
+ public override string ToString ()
{
return ToXml ().ToString ();
}
- private SecurityElement ToXml()
+ private SecurityElement ToXml ()
{
SecurityElement element = new SecurityElement (GetType().FullName);
element.AddAttribute ("version", "1");
element.AddAttribute ("Directory", Directory);
-
return element;
}
+ // interface IBuiltInEvidence
+
+ [MonoTODO]
+ int IBuiltInEvidence.GetRequiredSize (bool verbose)
+ {
+ return 0;
+ }
+
+ [MonoTODO]
+ int IBuiltInEvidence.InitFromBuffer (char [] buffer, int position)
+ {
+ return 0;
+ }
+
+ [MonoTODO]
+ int IBuiltInEvidence.OutputToBuffer (char [] buffer, int position, bool verbose)
+ {
+ return 0;
+ }
}
}
-
diff --git a/mcs/class/corlib/System.Security.Policy/ApplicationDirectoryMembershipCondition.cs b/mcs/class/corlib/System.Security.Policy/ApplicationDirectoryMembershipCondition.cs
index 2304317027f..1d243c3fd0a 100644
--- a/mcs/class/corlib/System.Security.Policy/ApplicationDirectoryMembershipCondition.cs
+++ b/mcs/class/corlib/System.Security.Policy/ApplicationDirectoryMembershipCondition.cs
@@ -8,8 +8,7 @@
using System.Security;
-namespace System.Security.Policy
-{
+namespace System.Security.Policy {
[Serializable]
public sealed class ApplicationDirectoryMembershipCondition :
@@ -23,26 +22,41 @@ namespace System.Security.Policy
// Methods
[MonoTODO]
- public bool Check(Evidence evidence) {
- throw new NotImplementedException ();
+ public bool Check (Evidence evidence)
+ {
+ if (evidence == null)
+ return false;
+
+ foreach (object o in evidence) {
+ if (o is ApplicationDirectory) {
+ ApplicationDirectory ad = (o as ApplicationDirectory);
+ // TODO
+ throw new NotImplementedException ();
+ }
+ }
+ return false;
}
- public IMembershipCondition Copy() {
+ public IMembershipCondition Copy ()
+ {
return new ApplicationDirectoryMembershipCondition ();
}
- public override bool Equals(object o) {
+ public override bool Equals (object o)
+ {
return o is ApplicationDirectoryMembershipCondition;
}
- public void FromXml(SecurityElement e) {
+ public void FromXml (SecurityElement e)
+ {
FromXml (e, null);
}
- public void FromXml(SecurityElement e, PolicyLevel level) {
-
+ public void FromXml (SecurityElement e, PolicyLevel level)
+ {
if (null == e)
- throw new ArgumentNullException ();
+ throw new ArgumentNullException ("e");
+
if (XmlTag != e.Tag)
throw new ArgumentException("e","The Tag of SecurityElement must be "
+ ApplicationDirectoryMembershipCondition.XmlTag);
@@ -52,22 +66,22 @@ namespace System.Security.Policy
/// All instances of ApplicationDirectoryMembershipCondition are equal so they should
/// have the same hashcode
/// </summary>
- public override int GetHashCode()
+ public override int GetHashCode ()
{
return typeof (ApplicationDirectoryMembershipCondition).GetHashCode ();
}
- public override string ToString()
+ public override string ToString ()
{
return "ApplicationDirectory";
}
- public SecurityElement ToXml()
+ public SecurityElement ToXml ()
{
return ToXml (null);
}
- public SecurityElement ToXml(PolicyLevel level)
+ public SecurityElement ToXml (PolicyLevel level)
{
SecurityElement element = new SecurityElement (XmlTag);
Type type = GetType ();
diff --git a/mcs/class/corlib/System.Security.Policy/ChangeLog b/mcs/class/corlib/System.Security.Policy/ChangeLog
index 2da2c0f3a2a..eb24bae4102 100644
--- a/mcs/class/corlib/System.Security.Policy/ChangeLog
+++ b/mcs/class/corlib/System.Security.Policy/ChangeLog
@@ -1,3 +1,76 @@
+2004-01-28 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * StrongName.cs: XML now use Type.Name (instead of Type.FullName) to
+ match the XML generated by MS.
+
+2004-01-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * CodeGroup.cs: make it build with mcs. This is a BUG.
+
+2004-01-26 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * AllMembershipCondition.cs: Clean up. Removed FIXME.
+ * ApplicationDirectoryMembershipCondition.cs: Basic (incomplete) Check.
+ * ApplicationDirectory.cs: Added IBuiltInEvidence (to please corcompare).
+ * CodeGroup.cs: Now use Activator for [Named]PermissionSet. Change
+ Equals so it can compile with mcs.
+ * Hash.cs: Added IBuiltInEvidence (to please corcompare).
+ * PolicyLevel.cs: Minor changes to use the new empty constructors in
+ [Named]PermissionSet.
+ * PermissionRequestEvidence.cs: Added IBuiltInEvidence (to please
+ corcompare). Now use SecurityElement in ToString.
+ * Publisher.cs: Added IBuiltInEvidence (to please corcompare).
+ * Site.cs: Added IBuiltInEvidence (to please corcompare).
+ * StrongName.cs: Added IBuiltInEvidence (to please corcompare). Now use
+ SecurityElement in ToString. Removed TODO on CreateIdentityPermission
+ (evidence isn't required in this case).
+
+2004-01-14 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * Url.cs: Added IBuiltInEvidence (corcompare) and new static methods
+ to prepare and compare urls.
+ * UrlMembershipCondition.cs: Added missing [Serializable] attribute
+ and set_Url property. Implemented Check. Fixed Equals and To/FromXml.
+
+2004-01-05 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * CodeGroup.cs: Added internal constructor for PolicyLevel. Complete
+ FromXml. Various small fixes to match the unit tests.
+ * FileCodeGroup.cs: Added internal constructor for PolicyLevel.
+ Implemented GetHashCode (may not be exactly the same as MS).
+ * FirstMatchCodeGroup.cs: Added internal constructor for PolicyLevel.
+ Copy method now returns a deep copy (as documented).
+ * NetCodeGroup.cs: Added internal constructor for PolicyLevel. Fixed
+ "Same site Web" (as documented) to "Same site Web." (as real life).
+ Copy method now returns a deep copy (as documented).
+ * PolicyLevel.cs: Added missing ChangeNamedPermissionSet. Implemented
+ FromXml method. Added internal methods to load from file or string.
+ Added/changed lots of things to match unit tests.
+ * StrongNameMembershipCondition.cs: Added internal constructor for
+ PolicyLevel. Fixed Equals.
+ * UnionCodeGroup.cs: Added internal constructor for PolicyLevel.
+ Copy method now returns a deep copy (as documented).
+
+2004-01-03 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * Site.cs: Completed implementation.
+ * SiteMembershipCondition.cs: New. Implemented.
+
+2004-01-02 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * ApplicationDirectory.cs: Added to build. Commented IBuildInEvidence
+ (not implemented).
+ * Evidence.cs: Synchronised collections (IsSynchronized is always true).
+ Add Locked property and Security exceptions.
+ * Publisher.cs: Now use SecurityElement in ToString. Removed TODO for
+ CreateIdentityPermission (Evidence is useless).
+ * StrongNameMembershipCondition.cs: Added IConstantMembershipCondition
+ interface. Implemented Check method.
+ * Url.cs: Implemented CreateIdentityPermission.
+ * UrlMembershipCondition.cs: Added IConstantMembershipCondition interface.
+ * ZoneMembershipCondition.cs: Added IConstantMembershipCondition
+ interface. Implemented Check method.
+
2004-01-01 Nick Drochak <ndrochak@gol.com>
* PermissionRequestEvidence.cs: New File
diff --git a/mcs/class/corlib/System.Security.Policy/CodeGroup.cs b/mcs/class/corlib/System.Security.Policy/CodeGroup.cs
index 089c4b87966..0652b300598 100644
--- a/mcs/class/corlib/System.Security.Policy/CodeGroup.cs
+++ b/mcs/class/corlib/System.Security.Policy/CodeGroup.cs
@@ -5,16 +5,17 @@
//
// (C) 2001 Nick Drochak, All rights reserved.
+using System.Collections;
+using System.Globalization;
+using System.Reflection;
using System.Security.Policy;
using System.Security.Permissions;
-using System.Collections;
-using System; // for MonoTODO attribute
+//using System; // for MonoTODO attribute
+
+namespace System.Security.Policy {
-namespace System.Security.Policy
-{
[Serializable]
- public abstract class CodeGroup
- {
+ public abstract class CodeGroup {
PolicyStatement m_policy = null;
IMembershipCondition m_membershipCondition = null;
string m_description = null;
@@ -22,8 +23,7 @@ namespace System.Security.Policy
ArrayList m_children = new ArrayList();
PolicyLevel m_level;
- public CodeGroup(IMembershipCondition membershipCondition,
- PolicyStatement policy)
+ public CodeGroup (IMembershipCondition membershipCondition, PolicyStatement policy)
{
if (null == membershipCondition)
throw new ArgumentNullException("Value cannot be null.");
@@ -32,9 +32,17 @@ namespace System.Security.Policy
m_membershipCondition = membershipCondition;
}
+ // for PolicyLevel (to avoid validation duplication)
+ internal CodeGroup (SecurityElement e)
+ {
+ FromXml (e);
+ }
+
+ // abstract
+
public abstract CodeGroup Copy();
public abstract string MergeLogic {get;}
- public abstract PolicyStatement Resolve( Evidence evidence);
+ public abstract PolicyStatement Resolve (Evidence evidence);
public abstract CodeGroup ResolveMatchingCodeGroups(Evidence evidence);
public PolicyStatement PolicyStatement {
@@ -64,50 +72,32 @@ namespace System.Security.Policy
}
}
- public string Name
- {
- get
- {
- return m_name;
- }
- set
- {
- m_name = value;
- }
+ public string Name {
+ get { return m_name; }
+ set { m_name = value; }
}
- public IList Children
- {
- get
- {
- return m_children;
- }
- set
- {
+ public IList Children {
+ get { return m_children; }
+ set {
if (null == value)
- throw new ArgumentException("Value cannot be null");
+ throw new ArgumentNullException ("value");
m_children = new ArrayList(value);
}
}
- public virtual string AttributeString
- {
- get
- {
+ public virtual string AttributeString {
+ get {
if (null != m_policy)
return m_policy.AttributeString;
-
return null;
}
}
- public virtual string PermissionSetName
- {
- get
- {
+ public virtual string PermissionSetName {
+ get {
if (m_policy.PermissionSet is Security.NamedPermissionSet)
return ((NamedPermissionSet)(m_policy.PermissionSet)).Name;
-
return null;
}
}
@@ -135,17 +125,18 @@ namespace System.Security.Policy
if (cg.Description != this.Description)
return false;
- if (cg.MembershipCondition != this.MembershipCondition)
+// FIXME: this compiles with CSC. Didn't succeed at creating a smaller/different test case :(
+// if (!cg.MembershipCondition.Equals (m_membershipCondition))
+ if (((object) cg.MembershipCondition).ToString () !=
+ ((object) m_membershipCondition).ToString ())
return false;
- if (compareChildren)
- {
+ if (compareChildren) {
int childCount = cg.Children.Count;
if (this.Children.Count != childCount)
return false;
- for (int index = 0; index < childCount; index++)
- {
+ for (int index = 0; index < childCount; index++) {
// LAMESPEC: are we supposed to check child equality recursively?
// The docs imply 'no' but it seems natural to do a 'deep' compare.
// Will check the children's children, and so-on unless we find out that
@@ -154,41 +145,63 @@ namespace System.Security.Policy
return false;
}
}
-
return true;
-
}
- public void RemoveChild(CodeGroup group)
+ public void RemoveChild (CodeGroup group)
{
- if (!m_children.Contains(group))
- throw new ArgumentException();
-
- m_children.Remove(group);
+ if (group != null)
+ m_children.Remove (group);
}
- [MonoTODO]
- public override int GetHashCode()
+ public override int GetHashCode ()
{
- return 42;
+ int hashCode = m_membershipCondition.GetHashCode ();
+ if (m_policy != null)
+ hashCode += m_policy.GetHashCode ();
+ return hashCode;
}
public void FromXml (SecurityElement e)
{
- FromXml(e, (PolicyLevel)null);
+ FromXml (e, null);
}
- [MonoTODO]
public void FromXml (SecurityElement e, PolicyLevel level)
{
if (null == e)
throw new ArgumentNullException("e");
- // Not sure what might be serialized in this XML, so just do the strings for now
- // and null's for everything else
- m_children = null;
- m_policy = null;
+ PermissionSet ps = null;
+ SecurityElement pset = e.SearchForChildByTag ("PermissionSet");
+ if (pset != null) {
+ Type classType = Type.GetType (pset.Attribute ("class"));
+ ps = (PermissionSet) Activator.CreateInstance (classType, true);
+ ps.FromXml (pset);
+ }
+ else
+ ps = new NamedPermissionSet ("Nothing", new PermissionSet (PermissionState.None));
+ m_policy = new PolicyStatement (ps);
+
+ m_children.Clear ();
+ if ((e.Children != null) && (e.Children.Count > 0)) {
+ foreach (SecurityElement se in e.Children) {
+ if (se.Tag == "CodeGroup") {
+ this.AddChild (CodeGroup.CreateFromXml (se));
+ }
+ }
+ }
+
m_membershipCondition = null;
+ SecurityElement mc = e.SearchForChildByTag ("IMembershipCondition");
+ if (mc != null) {
+ string className = mc.Attribute ("class");
+ Type classType = Type.GetType (className);
+ if (classType == null)
+ classType = Type.GetType ("System.Security.Policy." + className);
+ m_membershipCondition = (IMembershipCondition) Activator.CreateInstance (classType);
+ m_membershipCondition.FromXml (mc, level);
+ }
m_name = e.Attribute("Name");
m_description = e.Attribute("Description");
@@ -196,7 +209,7 @@ namespace System.Security.Policy
// seems like we might need this to Resolve() in subclasses
m_level = level;
- ParseXml(e, level);
+ ParseXml (e, level);
}
protected virtual void ParseXml(SecurityElement e, PolicyLevel level)
@@ -205,11 +218,10 @@ namespace System.Security.Policy
public SecurityElement ToXml()
{
- return ToXml(null);
+ return ToXml (null);
}
- [MonoTODO("Not sure what to do with PolicyLevel parameter")]
- public SecurityElement ToXml(PolicyLevel level)
+ public SecurityElement ToXml (PolicyLevel level)
{
SecurityElement e = new SecurityElement("CodeGroup");
e.AddAttribute("class", this.GetType().AssemblyQualifiedName);
@@ -224,8 +236,8 @@ namespace System.Security.Policy
if (null != MembershipCondition)
e.AddChild(MembershipCondition.ToXml());
- if (null != PolicyStatement)
- e.AddChild(PolicyStatement.PermissionSet.ToXml());
+ if ((PolicyStatement != null) && (PolicyStatement.PermissionSet != null))
+ e.AddChild (PolicyStatement.PermissionSet.ToXml ());
foreach (CodeGroup child in Children)
e.AddChild(child.ToXml());
@@ -237,6 +249,38 @@ namespace System.Security.Policy
protected virtual void CreateXml(SecurityElement element, PolicyLevel level)
{
}
- } // public abstract class CodeGroup
+ // internal stuff
+
+ internal static CodeGroup CreateFromXml (SecurityElement se)
+ {
+ string fullClassName = se.Attribute ("class");
+ string className = fullClassName;
+ // many possible formats
+ // a. "FirstMatchCodeGroup"
+ // b. "System.Security.Policy.FirstMatchCodeGroup"
+ // c. "System.Security.Policy.FirstMatchCodeGroup, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\"\r\n version=\"1\">\r\n <IMembershipCondition class=\"System.Security.Policy.AllMembershipCondition, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
+ int n = className.IndexOf (",");
+ if (n > 0) {
+ className = className.Substring (0, n);
+ }
+ n = className.LastIndexOf (".");
+ if (n > 0)
+ className = className.Substring (n + 1);
+ // much faster than calling Activator.CreateInstance
+ switch (className) {
+ case "FileCodeGroup":
+ return new FileCodeGroup (se);
+ case "FirstMatchCodeGroup":
+ return new FirstMatchCodeGroup (se);
+ case "NetCodeGroup":
+ return new NetCodeGroup (se);
+ case "UnionCodeGroup":
+ return new UnionCodeGroup (se);
+ default: // unknown
+ Type classType = Type.GetType (fullClassName);
+ return (CodeGroup) Activator.CreateInstance (classType, true);
+ }
+ }
+ } // public abstract class CodeGroup
} // namespace System.Security.Policy
diff --git a/mcs/class/corlib/System.Security.Policy/Evidence.cs b/mcs/class/corlib/System.Security.Policy/Evidence.cs
index 18e817ca234..2ea1a51f5fa 100644
--- a/mcs/class/corlib/System.Security.Policy/Evidence.cs
+++ b/mcs/class/corlib/System.Security.Policy/Evidence.cs
@@ -1,35 +1,42 @@
+//
// System.Security.Policy.Evidence
//
// Authors:
-// Sean MacIsaac (macisaac@ximian.com)
-// Nick Drochak (ndrochak@gol.com)
-// Jackson Harper (Jackson@LatitudeGeo.com)
+// Sean MacIsaac (macisaac@ximian.com)
+// Nick Drochak (ndrochak@gol.com)
+// Jackson Harper (Jackson@LatitudeGeo.com)
+// Sebastien Pouliot (spouliot@motus.com)
//
// (C) 2001 Ximian, Inc.
+// Portions (C) 2003, 2004 Motus Technologies Inc. (http://www.motus.com)
+//
using System;
using System.Collections;
+using System.Security.Permissions;
namespace System.Security.Policy {
- [MonoTODO]
[Serializable]
public sealed class Evidence : ICollection, IEnumerable {
- private ArrayList hostEvidenceList = new ArrayList ();
- private ArrayList assemblyEvidenceList = new ArrayList ();
+ private bool _locked;
+ private ArrayList hostEvidenceList;
+ private ArrayList assemblyEvidenceList;
public Evidence ()
{
+ hostEvidenceList = ArrayList.Synchronized (new ArrayList ());
+ assemblyEvidenceList = ArrayList.Synchronized (new ArrayList ());
}
- public Evidence (Evidence evidence)
+ public Evidence (Evidence evidence) : this ()
{
if (evidence != null)
Merge (evidence);
}
- public Evidence (object[] hostEvidence, object[] assemblyEvidence )
+ public Evidence (object[] hostEvidence, object[] assemblyEvidence) : this ()
{
if (null != hostEvidence)
hostEvidenceList.AddRange (hostEvidence);
@@ -51,17 +58,16 @@ namespace System.Security.Policy {
get{ return false; }
}
+ // LAMESPEC: Always TRUE (not FALSE)
public bool IsSynchronized {
- get { return false; }
+ get { return true; }
}
- [MonoTODO]
public bool Locked {
- get {
- throw new NotImplementedException ();
- }
- set {
- throw new NotImplementedException ();
+ get { return _locked; }
+ set {
+ new SecurityPermission (SecurityPermissionFlag.ControlEvidence).Demand ();
+ _locked = value;
}
}
@@ -78,18 +84,20 @@ namespace System.Security.Policy {
assemblyEvidenceList.Add (id);
}
- [MonoTODO("If Locked is true and the code that calls this method does not have SecurityPermissionFlag.ControlEvidence a SecurityException should be thrown")]
public void AddHost (object id)
{
+ if (_locked) {
+ new SecurityPermission (SecurityPermissionFlag.ControlEvidence).Demand ();
+ }
hostEvidenceList.Add (id);
}
public void CopyTo (Array array, int index)
{
if (hostEvidenceList.Count > 0)
- hostEvidenceList.CopyTo (array,index);
+ hostEvidenceList.CopyTo (array, index);
if (assemblyEvidenceList.Count > 0)
- assemblyEvidenceList.CopyTo (array,index + hostEvidenceList.Count);
+ assemblyEvidenceList.CopyTo (array, index + hostEvidenceList.Count);
}
public IEnumerator GetEnumerator ()
diff --git a/mcs/class/corlib/System.Security.Policy/FileCodeGroup.cs b/mcs/class/corlib/System.Security.Policy/FileCodeGroup.cs
index debd7d3543a..860d52e8a5d 100644
--- a/mcs/class/corlib/System.Security.Policy/FileCodeGroup.cs
+++ b/mcs/class/corlib/System.Security.Policy/FileCodeGroup.cs
@@ -6,49 +6,43 @@
// (C) 2001 Nick Drochak, All rights reserved.
using System.Security.Policy;
-using System.Security.Permissions;
+using System.Security.Permissions;
using System.Collections;
using System; // for MonoTODO attribute
-namespace System.Security.Policy
-{
+namespace System.Security.Policy {
+
[Serializable]
- public sealed class FileCodeGroup : CodeGroup
- {
+ public sealed class FileCodeGroup : CodeGroup {
+
FileIOPermissionAccess m_access;
- [MonoTODO("Check if membershipCondition is valid")]
- public FileCodeGroup(IMembershipCondition membershipCondition,
+ public FileCodeGroup (IMembershipCondition membershipCondition,
FileIOPermissionAccess access)
: base(membershipCondition, null)
{
- if (!Enum.IsDefined(typeof(FileIOPermissionAccess), access))
- throw new ArgumentException("Value not defined for FileIOPermissionAccess","access");
-
+ // note: FileIOPermissionAccess is a [Flag]
m_access = access;
}
- public override CodeGroup Copy()
+ // for PolicyLevel (to avoid validation duplication)
+ internal FileCodeGroup (SecurityElement e) : base (e) {}
+
+ public override CodeGroup Copy ()
{
- FileCodeGroup copy = new FileCodeGroup(MembershipCondition, m_access);
- foreach (CodeGroup child in Children)
- {
- AddChild(child.Copy());
+ FileCodeGroup copy = new FileCodeGroup (MembershipCondition, m_access);
+ foreach (CodeGroup child in Children) {
+ copy.AddChild (child.Copy ()); // deep copy
}
-
return copy;
}
- public override string MergeLogic
- {
- get
- {
- return "Union";
- }
+ public override string MergeLogic {
+ get { return "Union";}
}
[MonoTODO]
- public override PolicyStatement Resolve( Evidence evidence)
+ public override PolicyStatement Resolve (Evidence evidence)
{
if (null == evidence)
throw new ArgumentNullException("evidence");
@@ -88,20 +82,12 @@ namespace System.Security.Policy
return matchRoot;
}
- public override string AttributeString
- {
- get
- {
- return null;
- }
+ public override string AttributeString {
+ get { return null; }
}
- public override string PermissionSetName
- {
- get
- {
- return "Same directory FileIO - " + m_access.ToString();
- }
+ public override string PermissionSetName {
+ get { return "Same directory FileIO - " + m_access.ToString(); }
}
public override bool Equals(object o)
@@ -115,10 +101,9 @@ namespace System.Security.Policy
return Equals((CodeGroup)o, false);
}
- [MonoTODO]
- public override int GetHashCode()
+ public override int GetHashCode ()
{
- throw new NotImplementedException();
+ return m_access.GetHashCode ();
}
protected override void ParseXml(SecurityElement e, PolicyLevel level)
@@ -131,5 +116,4 @@ namespace System.Security.Policy
element.AddAttribute("Access", m_access.ToString());
}
} // public abstract class CodeGroup
-
} // namespace System.Security.Policy \ No newline at end of file
diff --git a/mcs/class/corlib/System.Security.Policy/FirstMatchCodeGroup.cs b/mcs/class/corlib/System.Security.Policy/FirstMatchCodeGroup.cs
index 9b94a6975ef..5bf740c478c 100644
--- a/mcs/class/corlib/System.Security.Policy/FirstMatchCodeGroup.cs
+++ b/mcs/class/corlib/System.Security.Policy/FirstMatchCodeGroup.cs
@@ -12,10 +12,11 @@ namespace System.Security.Policy {
[Serializable]
public sealed class FirstMatchCodeGroup : CodeGroup {
- public FirstMatchCodeGroup(IMembershipCondition membershipCondition, PolicyStatement policy) :
- base (membershipCondition, policy)
- {
- }
+ public FirstMatchCodeGroup (IMembershipCondition membershipCondition, PolicyStatement policy) :
+ base (membershipCondition, policy) {}
+
+ // for PolicyLevel (to avoid validation duplication)
+ internal FirstMatchCodeGroup (SecurityElement e) : base (e) {}
//
// Public Properties
@@ -33,11 +34,9 @@ namespace System.Security.Policy {
public override CodeGroup Copy()
{
FirstMatchCodeGroup copy = CopyNoChildren ();
-
- foreach (CodeGroup group in Children) {
- copy.AddChild ( group );
+ foreach (CodeGroup child in Children) {
+ copy.AddChild (child.Copy ()); // deep copy
}
-
return copy;
}
diff --git a/mcs/class/corlib/System.Security.Policy/Hash.cs b/mcs/class/corlib/System.Security.Policy/Hash.cs
index 75e7a703908..5eafbafcb00 100644
--- a/mcs/class/corlib/System.Security.Policy/Hash.cs
+++ b/mcs/class/corlib/System.Security.Policy/Hash.cs
@@ -19,7 +19,7 @@ using System.Security.Cryptography;
namespace System.Security.Policy {
[Serializable]
-public sealed class Hash : ISerializable {
+public sealed class Hash : ISerializable, IBuiltInEvidence {
private Assembly assembly;
private byte[] data = null;
@@ -104,6 +104,26 @@ public sealed class Hash : ISerializable {
return data;
}
+
+ // interface IBuiltInEvidence
+
+ [MonoTODO]
+ int IBuiltInEvidence.GetRequiredSize (bool verbose)
+ {
+ return 0;
+ }
+
+ [MonoTODO]
+ int IBuiltInEvidence.InitFromBuffer (char [] buffer, int position)
+ {
+ return 0;
+ }
+
+ [MonoTODO]
+ int IBuiltInEvidence.OutputToBuffer (char [] buffer, int position, bool verbose)
+ {
+ return 0;
+ }
}
}
diff --git a/mcs/class/corlib/System.Security.Policy/NetCodeGroup.cs b/mcs/class/corlib/System.Security.Policy/NetCodeGroup.cs
index 231c64e59cf..27d4984ac07 100644
--- a/mcs/class/corlib/System.Security.Policy/NetCodeGroup.cs
+++ b/mcs/class/corlib/System.Security.Policy/NetCodeGroup.cs
@@ -15,9 +15,10 @@ namespace System.Security.Policy {
public sealed class NetCodeGroup : CodeGroup {
public NetCodeGroup (IMembershipCondition condition)
- : base (condition,null)
- {
- }
+ : base (condition, null) {}
+
+ // for PolicyLevel (to avoid validation duplication)
+ internal NetCodeGroup (SecurityElement e) : base (e) {}
//
// Public Properties
@@ -32,10 +33,9 @@ namespace System.Security.Policy {
}
public override string PermissionSetName {
- get { return "Same site Web"; }
+ get { return "Same site Web."; }
}
-
//
// Public Methods
//
@@ -43,16 +43,14 @@ namespace System.Security.Policy {
public override CodeGroup Copy ()
{
NetCodeGroup copy = new NetCodeGroup (MembershipCondition);
-
copy.Name = Name;
copy.Description = Description;
copy.PolicyStatement = PolicyStatement;
foreach (CodeGroup child in Children) {
- copy.AddChild (child);
+ copy.AddChild (child.Copy ()); // deep copy
}
-
- return copy;
+ return copy;
}
[MonoTODO]
diff --git a/mcs/class/corlib/System.Security.Policy/PermissionRequestEvidence.cs b/mcs/class/corlib/System.Security.Policy/PermissionRequestEvidence.cs
index d216fc720c0..399ab3c8ce7 100755
--- a/mcs/class/corlib/System.Security.Policy/PermissionRequestEvidence.cs
+++ b/mcs/class/corlib/System.Security.Policy/PermissionRequestEvidence.cs
@@ -7,12 +7,13 @@
// (C) 2003 Nick Drochak
//
+using System.Security;
using System.Text;
namespace System.Security.Policy
{
[Serializable]
- public sealed class PermissionRequestEvidence {
+ public sealed class PermissionRequestEvidence : IBuiltInEvidence {
PermissionSet requested, optional, denied;
public PermissionRequestEvidence(PermissionSet requested,
@@ -34,40 +35,53 @@ namespace System.Security.Policy
get {return requested;}
}
- public PermissionRequestEvidence Copy() {
+ public PermissionRequestEvidence Copy ()
+ {
return new PermissionRequestEvidence (requested, optional, denied);
}
- public override string ToString() {
- // Cannot use XML classes in corlib, so do it by hand
- StringBuilder sb = new StringBuilder ();
+ public override string ToString ()
+ {
+ SecurityElement se = new SecurityElement ("System.Security.Policy.PermissionRequestEvidence");
+ se.AddAttribute ("version", "1");
- sb.Append ("<System.Security.Policy.PermissionRequestEvidence version=\"1\">");
- sb.Append ("<Request>");
- sb.Append ("<PermissionSet class=\"System.Security.PermissionSet\" version=\"1\"");
- if (requested.IsUnrestricted ())
- sb.Append (" Unrestricted=\"true\"");
- sb.Append (@"/>");
- sb.Append (@"</Request>");
+ if (requested != null) {
+ SecurityElement requestElement = new SecurityElement ("Request");
+ requestElement.AddChild (requested.ToXml ());
+ se.AddChild (requestElement);
+ }
+ if (optional != null) {
+ SecurityElement optionalElement = new SecurityElement ("Optional");
+ optionalElement.AddChild (optional.ToXml ());
+ se.AddChild (optionalElement);
+ }
+ if (denied != null) {
+ SecurityElement deniedElement = new SecurityElement ("Denied");
+ deniedElement.AddChild (denied.ToXml ());
+ se.AddChild (deniedElement);
+ }
+ return se.ToString ();
+ }
- sb.Append ("<Optional>");
- sb.Append ("<PermissionSet class=\"System.Security.PermissionSet\" version=\"1\"");
- if (optional.IsUnrestricted ())
- sb.Append (" Unrestricted=\"true\"");
- sb.Append (@"/>");
- sb.Append (@"</Optional>");
+ // interface IBuiltInEvidence
- sb.Append ("<Denied>");
- sb.Append ("<PermissionSet class=\"System.Security.PermissionSet\" version=\"1\"");
- if (denied.IsUnrestricted ())
- sb.Append (" Unrestricted=\"true\"");
- sb.Append (@"/>");
- sb.Append (@"</Denied>");
+ [MonoTODO]
+ int IBuiltInEvidence.GetRequiredSize (bool verbose)
+ {
+ return 0;
+ }
- sb.Append ("</System.Security.Policy.PermissionRequestEvidence>");
+ [MonoTODO]
+ int IBuiltInEvidence.InitFromBuffer (char [] buffer, int position)
+ {
+ return 0;
+ }
- return sb.ToString ();
+ [MonoTODO]
+ int IBuiltInEvidence.OutputToBuffer (char [] buffer, int position, bool verbose)
+ {
+ return 0;
}
}
-} \ No newline at end of file
+}
diff --git a/mcs/class/corlib/System.Security.Policy/PolicyLevel.cs b/mcs/class/corlib/System.Security.Policy/PolicyLevel.cs
index 1ac9575c9e7..e6bfa63737c 100644
--- a/mcs/class/corlib/System.Security.Policy/PolicyLevel.cs
+++ b/mcs/class/corlib/System.Security.Policy/PolicyLevel.cs
@@ -4,74 +4,111 @@
// Authors:
// Nick Drochak (ndrochak@gol.com)
// Duncan Mak (duncan@ximian.com)
+// Sebastien Pouliot (spouliot@motus.com)
//
// (C) 2001 Nick Drochak
// (C) 2003 Duncan Mak, Ximian Inc.
+// Portions (C) 2004 Motus Technologies Inc. (http://www.motus.com)
//
using System.Collections; // for IList
using System.Globalization;
-using System.Security.Policy;
+using System.IO;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+
+using Mono.Xml;
+
+namespace System.Security.Policy {
+
+ [Serializable]
+ public sealed class PolicyLevel {
-namespace System.Security.Policy
-{
- [MonoTODO][Serializable]
- public sealed class PolicyLevel
- {
string label;
- StrongNameMembershipCondition [] full_trust_assemblies;
CodeGroup root_code_group;
- NamedPermissionSet [] named_permission_sets;
+ private ArrayList full_trust_assemblies;
+ private ArrayList named_permission_sets;
+ private string _location;
internal PolicyLevel (string label)
{
this.label = label;
-
- // What's a good default size?
- full_trust_assemblies = new StrongNameMembershipCondition [10];
- named_permission_sets = new NamedPermissionSet [10];
+ full_trust_assemblies = new ArrayList ();
+ named_permission_sets = new ArrayList ();
}
- [MonoTODO]
- public IList FullTrustAssemblies
+ internal void LoadFromFile (string filename)
{
- get {
- if (full_trust_assemblies != null)
- return (IList) full_trust_assemblies;
-
- return (IList) null;
+ if (!File.Exists (filename))
+ throw new ArgumentException (Locale.GetText ("file do not exist"));
+
+ // throw a SecurityException if we don't have Read, Write and PathDiscovery permissions
+ FileIOPermissionAccess access = FileIOPermissionAccess.Read | FileIOPermissionAccess.Write | FileIOPermissionAccess.PathDiscovery;
+ new FileIOPermission (access, filename).Demand ();
+
+ using (StreamReader sr = File.OpenText (filename)) {
+ string xml = sr.ReadToEnd ();
+ LoadFromString (xml);
}
+ _location = filename;
}
- public string Label {
+ internal void LoadFromString (string xml)
+ {
+ SecurityParser parser = new SecurityParser ();
+ parser.LoadXml (xml);
+ // configuration / mscorlib / security / policy / PolicyLevel
+ SecurityElement configuration = parser.ToXml ();
+ if (configuration.Tag != "configuration")
+ throw new ArgumentException (Locale.GetText ("missing <configuration> root element"));
+ SecurityElement mscorlib = (SecurityElement) configuration.Children [0];
+ if (mscorlib.Tag != "mscorlib")
+ throw new ArgumentException (Locale.GetText ("missing <mscorlib> tag"));
+ SecurityElement security = (SecurityElement) mscorlib.Children [0];
+ if (security.Tag != "security")
+ throw new ArgumentException (Locale.GetText ("missing <security> tag"));
+ SecurityElement policy = (SecurityElement) security.Children [0];
+ if (policy.Tag != "policy")
+ throw new ArgumentException (Locale.GetText ("missing <policy> tag"));
+ SecurityElement policyLevel = (SecurityElement) policy.Children [0];
+ FromXml (policyLevel);
+ }
+
+ // properties
+ public IList FullTrustAssemblies
+ {
+ get { return full_trust_assemblies; }
+ }
+
+ public string Label {
get { return label; }
}
public IList NamedPermissionSets {
-
- get {
- return (IList) named_permission_sets;
- }
+ get { return named_permission_sets; }
}
public CodeGroup RootCodeGroup {
-
get { return root_code_group; }
-
- set { root_code_group = value; }
+ set {
+ if (value == null)
+ throw new ArgumentNullException ("value");
+ root_code_group = value;
+ }
}
- [MonoTODO]
public string StoreLocation {
- get {
- throw new NotImplementedException ();
- }
+ get { return _location; }
}
public void AddFullTrustAssembly (StrongName sn)
{
- StrongNameMembershipCondition snMC = new StrongNameMembershipCondition(
+ if (sn == null)
+ throw new ArgumentNullException ("sn");
+
+ StrongNameMembershipCondition snMC = new StrongNameMembershipCondition(
sn.PublicKey, sn.Name, sn.Version);
AddFullTrustAssembly (snMC);
@@ -80,51 +117,112 @@ namespace System.Security.Policy
public void AddFullTrustAssembly (StrongNameMembershipCondition snMC)
{
if (snMC == null)
- throw new ArgumentNullException (
- Locale.GetText ("The argument is null."));
+ throw new ArgumentNullException ("snMC");
- if (((IList) full_trust_assemblies).Contains (snMC))
- throw new ArgumentException (
- Locale.GetText ("sn already has full trust."));
-
- ((IList) full_trust_assemblies).Add (snMC);
+ foreach (StrongNameMembershipCondition sn in full_trust_assemblies) {
+ if (sn.Equals (snMC)) {
+ throw new ArgumentException (Locale.GetText ("sn already has full trust."));
+ }
+ }
+ full_trust_assemblies.Add (snMC);
}
public void AddNamedPermissionSet (NamedPermissionSet permSet)
{
if (permSet == null)
- throw new ArgumentNullException (
- Locale.GetText ("The argument is null."));
-
- foreach (NamedPermissionSet n in named_permission_sets)
- if (permSet.Name == n.Name)
- throw new ArgumentException (
- Locale.GetText ("This NamedPermissionSet is the same an existing NamedPermissionSet."));
+ throw new ArgumentNullException ("permSet");
- ((IList) named_permission_sets).Add (permSet);
+ foreach (NamedPermissionSet n in named_permission_sets) {
+ if (permSet.Name == n.Name) {
+ throw new ArgumentException (
+ Locale.GetText ("This NamedPermissionSet is the same an existing NamedPermissionSet."));
+ }
+ }
+ named_permission_sets.Add (permSet);
}
- [MonoTODO ("Set NamedPermissionSet to the one from default policy and grant a FullTrust RootCodeGroup")]
+ public NamedPermissionSet ChangeNamedPermissionSet (string name, PermissionSet pSet)
+ {
+ if (name == null)
+ throw new ArgumentNullException ("name");
+ if (pSet == null)
+ throw new ArgumentNullException ("pSet");
+ if (IsReserved (name))
+ throw new ArgumentException (Locale.GetText ("Reserved name"));
+
+ foreach (NamedPermissionSet n in named_permission_sets) {
+ if (name == n.Name) {
+ named_permission_sets.Remove (n);
+ AddNamedPermissionSet (new NamedPermissionSet (name, pSet));
+ return n;
+ }
+ }
+ throw new ArgumentException (Locale.GetText ("PermissionSet not found"));
+ }
+
public static PolicyLevel CreateAppDomainLevel ()
{
- PolicyLevel p = new PolicyLevel ("AppDomain");
-
- return p;
+ NamedPermissionSet fullTrust = new NamedPermissionSet ("FullTrust", PermissionState.Unrestricted);
+ UnionCodeGroup cg = new UnionCodeGroup (new AllMembershipCondition (), new PolicyStatement (fullTrust));
+ cg.Name = "All_Code";
+ PolicyLevel pl = new PolicyLevel ("AppDomain");
+ pl.RootCodeGroup = cg;
+ return pl;
}
- [MonoTODO ("Check for the element's validity")]
public void FromXml (SecurityElement e)
{
if (e == null)
- throw new ArgumentNullException (
- Locale.GetText ("The Argument is null."));
- }
+ throw new ArgumentNullException ("e");
+// MS doesn't throw an exception for this case
+// if (e.Tag != "PolicyLevel")
+// throw new ArgumentException (Locale.GetText ("Invalid XML"));
+
+ Hashtable fullNames = null;
+ SecurityElement sc = e.SearchForChildByTag ("SecurityClasses");
+ if ((sc != null) && (sc.Children != null) && (sc.Children.Count > 0)) {
+ fullNames = new Hashtable (sc.Children.Count);
+ foreach (SecurityElement se in sc.Children) {
+ fullNames.Add (se.Attributes ["Name"], se.Attributes ["Description"]);
+ }
+ }
+
+ SecurityElement nps = e.SearchForChildByTag ("NamedPermissionSets");
+ if ((nps != null) && (nps.Children != null) && (nps.Children.Count > 0)) {
+ named_permission_sets.Clear ();
+ foreach (SecurityElement se in nps.Children) {
+ NamedPermissionSet n = new NamedPermissionSet ();
+ n.FromXml (se);
+ named_permission_sets.Add (n);
+ }
+ }
+
+ SecurityElement cg = e.SearchForChildByTag ("CodeGroup");
+ if ((cg != null) && (cg.Children != null) && (cg.Children.Count > 0)) {
+ root_code_group = CodeGroup.CreateFromXml (cg);
+ }
+ else
+ throw new ArgumentException (Locale.GetText ("Missing Root CodeGroup"));
+
+ SecurityElement fta = e.SearchForChildByTag ("FullTrustAssemblies");
+ if ((fta != null) && (fta.Children != null) && (fta.Children.Count > 0)) {
+ full_trust_assemblies.Clear ();
+ foreach (SecurityElement se in fta.Children) {
+ if (se.Tag != "IMembershipCondition")
+ throw new ArgumentException (Locale.GetText ("Invalid XML"));
+ string className = (string) se.Attributes ["class"];
+ if (className.IndexOf ("StrongNameMembershipCondition") < 0)
+ throw new ArgumentException (Locale.GetText ("Invalid XML - must be StrongNameMembershipCondition"));
+ // we directly use StrongNameMembershipCondition
+ full_trust_assemblies.Add (new StrongNameMembershipCondition (se));
+ }
+ }
+ }
public NamedPermissionSet GetNamedPermissionSet (string name)
{
if (name == null)
- throw new ArgumentNullException (
- Locale.GetText ("The Argument is null."));
+ throw new ArgumentNullException ("name");
foreach (NamedPermissionSet n in named_permission_sets)
if (n.Name == name)
@@ -141,16 +239,17 @@ namespace System.Security.Policy
public void RemoveFullTrustAssembly (StrongName sn)
{
- StrongNameMembershipCondition s = new StrongNameMembershipCondition (sn.PublicKey, sn.Name, sn.Version);
+ if (sn == null)
+ throw new ArgumentNullException ("sn");
+ StrongNameMembershipCondition s = new StrongNameMembershipCondition (sn.PublicKey, sn.Name, sn.Version);
RemoveFullTrustAssembly (s);
}
public void RemoveFullTrustAssembly (StrongNameMembershipCondition snMC)
{
if (snMC == null)
- throw new ArgumentNullException (
- Locale.GetText ("The Argument is null."));
+ throw new ArgumentNullException ("snMC");
if (((IList) full_trust_assemblies).Contains (snMC))
((IList) full_trust_assemblies).Remove (snMC);
@@ -179,12 +278,11 @@ namespace System.Security.Policy
public NamedPermissionSet RemoveNamedPermissionSet (string name)
{
if (name == null)
- throw new ArgumentNullException (
- Locale.GetText ("The Argument is null."));
+ throw new ArgumentNullException ("name");
int idx = -1;
- for (int i = 0; i < named_permission_sets.Length; i++) {
- NamedPermissionSet current = named_permission_sets [i];
+ for (int i = 0; i < named_permission_sets.Count; i++) {
+ NamedPermissionSet current = (NamedPermissionSet) named_permission_sets [i];
if (current.Name == name)
idx = i;
@@ -195,8 +293,8 @@ namespace System.Security.Policy
throw new ArgumentException (
Locale.GetText ("Name cannot be found."));
- NamedPermissionSet retval = named_permission_sets [idx];
- ((IList) named_permission_sets).RemoveAt (idx);
+ NamedPermissionSet retval = (NamedPermissionSet) named_permission_sets [idx];
+ named_permission_sets.RemoveAt (idx);
return retval;
}
@@ -211,8 +309,7 @@ namespace System.Security.Policy
public PolicyStatement Resolve (Evidence evidence)
{
if (evidence == null)
- throw new ArgumentNullException (
- Locale.GetText ("The Argument is null."));
+ throw new ArgumentNullException ("evidence");
throw new NotImplementedException ();
}
@@ -221,38 +318,75 @@ namespace System.Security.Policy
public CodeGroup ResolveMatchingCodeGroups (Evidence evidence)
{
if (evidence == null)
- throw new ArgumentNullException (
- Locale.GetText ("The Argument is null."));
+ throw new ArgumentNullException ("evidence");
throw new NotImplementedException ();
}
- [MonoTODO ("Populate security_classes")]
public SecurityElement ToXml ()
{
- SecurityElement element = new SecurityElement (
- typeof (System.Security.Policy.PolicyLevel).Name);
-
- element.AddAttribute ("version", "1");
-
- SecurityElement security_classes = new SecurityElement ("SecurityClasses");
- element.AddChild (security_classes);
+ Hashtable fullNames = new Hashtable ();
+ // only StrongNameMembershipCondition so no need to loop
+ if (full_trust_assemblies.Count > 0) {
+ if (!fullNames.Contains ("StrongNameMembershipCondition")) {
+ fullNames.Add ("StrongNameMembershipCondition", typeof (StrongNameMembershipCondition).FullName);
+ }
+ }
SecurityElement namedPSs = new SecurityElement ("NamedPermissionSets");
- element.AddChild (namedPSs);
+ foreach (NamedPermissionSet nps in named_permission_sets) {
+ SecurityElement se = nps.ToXml ();
+ object objectClass = se.Attributes ["class"];
+ if (!fullNames.Contains (objectClass)) {
+ fullNames.Add (objectClass, nps.GetType ().FullName);
+ }
+ namedPSs.AddChild (se);
+ }
- foreach (NamedPermissionSet nps in named_permission_sets)
- namedPSs.AddChild (nps.ToXml ());
+ SecurityElement fta = new SecurityElement ("FullTrustAssemblies");
+ foreach (StrongNameMembershipCondition snmc in full_trust_assemblies) {
+ fta.AddChild (snmc.ToXml (this));
+ }
- element.AddChild (root_code_group.ToXml ());
+ SecurityElement security_classes = new SecurityElement ("SecurityClasses");
+ if (fullNames.Count > 0) {
+ foreach (DictionaryEntry de in fullNames) {
+ SecurityElement sc = new SecurityElement ("SecurityClass");
+ sc.AddAttribute ("Name", (string)de.Key);
+ sc.AddAttribute ("Description", (string)de.Value);
+ security_classes.AddChild (sc);
+ }
+ }
+
+ SecurityElement element = new SecurityElement (typeof (System.Security.Policy.PolicyLevel).Name);
+ element.AddAttribute ("version", "1");
+ element.AddChild (security_classes);
+ element.AddChild (namedPSs);
+ if (root_code_group != null) {
+ element.AddChild (root_code_group.ToXml (this));
+ }
+ element.AddChild (fta);
- SecurityElement fta = new SecurityElement ("FullTrustAssemblies");
- element.AddChild (fta);
-
- foreach (StrongNameMembershipCondition s in full_trust_assemblies)
- element.AddChild (s.ToXml (this));
-
return element;
}
+
+ // internal stuff
+
+ internal bool IsReserved (string name)
+ {
+ switch (name) {
+ case "FullTrust":
+ case "LocalIntranet":
+ case "Internet":
+ case "SkipVerification":
+ case "Execution":
+ case "Nothing":
+ case "Everything":
+ // FIXME: Are there others ?
+ return true;
+ default:
+ return false;
+ }
+ }
}
}
diff --git a/mcs/class/corlib/System.Security.Policy/Publisher.cs b/mcs/class/corlib/System.Security.Policy/Publisher.cs
index 19838d88883..1d6e7a9ba36 100644
--- a/mcs/class/corlib/System.Security.Policy/Publisher.cs
+++ b/mcs/class/corlib/System.Security.Policy/Publisher.cs
@@ -4,10 +4,11 @@
// Author:
// Sebastien Pouliot (spouliot@motus.com)
//
-// (C) 2002 Motus Technologies Inc. (http://www.motus.com)
+// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
//
using System;
+using System.Security;
using System.Security.Cryptography.X509Certificates;
using System.Security.Permissions;
using System.Text;
@@ -15,7 +16,7 @@ using System.Text;
namespace System.Security.Policy {
[Serializable]
-public sealed class Publisher : IIdentityPermissionFactory {
+public sealed class Publisher : IIdentityPermissionFactory, IBuiltInEvidence {
private X509Certificate x509;
@@ -36,7 +37,7 @@ public sealed class Publisher : IIdentityPermissionFactory {
public X509Certificate Certificate {
get {
// needed to match MS implementation
- if (x509.GetRawCertData() == null)
+ if (x509.GetRawCertData () == null)
throw new NullReferenceException ("x509");
return x509;
}
@@ -47,7 +48,6 @@ public sealed class Publisher : IIdentityPermissionFactory {
return (object) new Publisher (x509);
}
- [MonoTODO("What should we do with the evidence ? nothing?")]
public IPermission CreateIdentityPermission (Evidence evidence)
{
return new PublisherIdentityPermission (x509);
@@ -67,18 +67,34 @@ public sealed class Publisher : IIdentityPermissionFactory {
public override string ToString ()
{
- StringBuilder sb = new StringBuilder ();
- sb.Append ("<System.Security.Policy.Publisher version=\"1\">\r\n <X509v3Certificate");
- string cert = x509.GetRawCertDataString ();
- if (cert == null)
- sb.Append ("/>\r\n");
- else {
- sb.Append (">");
- sb.Append (cert);
- sb.Append ("</X509v3Certificate>\r\n");
- }
- sb.Append ("</System.Security.Policy.Publisher>\r\n");
- return sb.ToString ();
+ SecurityElement se = new SecurityElement ("System.Security.Policy.Publisher");
+ se.AddAttribute ("version", "1");
+ SecurityElement cert = new SecurityElement ("X509v3Certificate");
+ string data = x509.GetRawCertDataString ();
+ if (data != null)
+ cert.Text = data;
+ se.AddChild (cert);
+ return se.ToString ();
+ }
+
+ // interface IBuiltInEvidence
+
+ [MonoTODO]
+ int IBuiltInEvidence.GetRequiredSize (bool verbose)
+ {
+ return 0;
+ }
+
+ [MonoTODO]
+ int IBuiltInEvidence.InitFromBuffer (char [] buffer, int position)
+ {
+ return 0;
+ }
+
+ [MonoTODO]
+ int IBuiltInEvidence.OutputToBuffer (char [] buffer, int position, bool verbose)
+ {
+ return 0;
}
}
diff --git a/mcs/class/corlib/System.Security.Policy/Site.cs b/mcs/class/corlib/System.Security.Policy/Site.cs
index ceb1d54e475..58dced6136b 100644
--- a/mcs/class/corlib/System.Security.Policy/Site.cs
+++ b/mcs/class/corlib/System.Security.Policy/Site.cs
@@ -1,10 +1,12 @@
//
// System.Security.Policy.Site.cs
//
-// Author
+// Authors
// Duncan Mak (duncan@ximian.com)
+// Sebastien Pouliot (spouliot@motus.com)
//
// (C) 2003 Ximian, Inc (http://www.ximian.com)
+// Portions (C) 2004 Motus Technologies Inc. (http://www.motus.com)
//
using System;
@@ -15,32 +17,20 @@ using System.Security.Policy;
namespace System.Security.Policy {
[Serializable]
- public sealed class Site: IIdentityPermissionFactory
- {
- string origin_site;
- SecurityElement element;
-
- public Site (string name)
- {
- if (name == null)
- throw new ArgumentNullException (Locale.GetText ("name is null"));
-
- if (IsValidSite (name) == false)
- throw new ArgumentException (Locale.GetText ("name is not valid"));
-
- origin_site = name;
- element = new SecurityElement (
- typeof (System.Security.Policy.Site).FullName);
-
- element.AddAttribute ("version", "1");
- element.AddChild (new SecurityElement ("Name", name));
+ public sealed class Site: IIdentityPermissionFactory, IBuiltInEvidence {
+
+ internal string origin_site;
+
+ public Site (string name)
+ {
+ if (name == null)
+ throw new ArgumentNullException (Locale.GetText ("name is null"));
+ if (!IsValid (name))
+ throw new ArgumentException (Locale.GetText ("name is not valid"));
+
+ origin_site = name;
}
- private Site (string name, SecurityElement security_element)
- {
- origin_site = name;
- element = security_element;
- }
public static Site CreateFromUrl (string url)
{
return new Site (url);
@@ -48,18 +38,20 @@ namespace System.Security.Policy {
public object Copy ()
{
- return new Site (origin_site, element);
+ return new Site (origin_site);
}
- [MonoTODO]
public IPermission CreateIdentityPermission (Evidence evidence)
{
- throw new NotImplementedException ();
+ return new SiteIdentityPermission (origin_site);
}
public override bool Equals (object o)
{
- return (o is System.Security.Policy.Site && ((Site) o).Name == Name);
+ if (o is System.Security.Policy.Site) {
+ return (String.Compare (((Site) o).Name, origin_site, true, CultureInfo.InvariantCulture) == 0);
+ }
+ return false;
}
public override int GetHashCode ()
@@ -69,43 +61,63 @@ namespace System.Security.Policy {
public override string ToString ()
{
- return element.ToString ();
+ SecurityElement element = new SecurityElement (typeof (System.Security.Policy.Site).FullName);
+ element.AddAttribute ("version", "1");
+ element.AddChild (new SecurityElement ("Name", origin_site));
+ return element.ToString ();
}
+ // properties
+
public string Name {
- get {
- return origin_site;
- }
+ get { return origin_site; }
}
- [MonoTODO ("Improve check")]
- bool IsValidSite (string site)
- {
- if (site.StartsWith ("file"))
- return false;
+ // interface IBuiltInEvidence
- string [] parts = site.Split ('.');
+ [MonoTODO]
+ int IBuiltInEvidence.GetRequiredSize (bool verbose)
+ {
+ return 0;
+ }
- foreach (string part in parts)
- if (!IsValidPart (part))
- return false;
-
- return true;
- }
+ [MonoTODO]
+ int IBuiltInEvidence.InitFromBuffer (char [] buffer, int position)
+ {
+ return 0;
+ }
- bool IsValidPart (string part)
- {
- foreach (char c in part) {
- if (Char.IsLetterOrDigit (c))
- continue;
-
- if (c == '/' || c == '*')
- continue;
+ [MonoTODO]
+ int IBuiltInEvidence.OutputToBuffer (char [] buffer, int position, bool verbose)
+ {
+ return 0;
+ }
- else
- return false;
- }
+ // internals
+ internal static bool IsValid (string name)
+ {
+ if (name == String.Empty)
+ return false;
+ if ((name.Length == 1) && (name == ".")) // split would remove .
+ return false;
+
+ string [] parts = name.Split ('.');
+ for (int i=0; i < parts.Length; i++) {
+ string part = parts [i];
+ if ((i == 0) && (part == "*")) // * (only in first part)
+ continue;
+ foreach (char c in part) {
+ int x = Convert.ToInt32 (c);
+ bool result = ((x == 45) // -
+ || (x >= 47 && x <= 57) // /,0-9
+ || (x >= 64 && x <= 90) // @,A-Z
+ || (x == 95) // _
+ || (x >= 97 && x <= 122)); // a-z
+ if (!result)
+ return false;
+ }
+ }
return true;
}
}
diff --git a/mcs/class/corlib/System.Security.Policy/SiteMembershipCondition.cs b/mcs/class/corlib/System.Security.Policy/SiteMembershipCondition.cs
new file mode 100755
index 00000000000..64369883f42
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Policy/SiteMembershipCondition.cs
@@ -0,0 +1,127 @@
+//
+// SiteMembershipCondition.cs: Site MembershipCondition
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2004 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using System;
+using System.Collections;
+using System.Globalization;
+using System.Security;
+
+namespace System.Security.Policy {
+
+ [Serializable]
+ public sealed class SiteMembershipCondition : IMembershipCondition, IConstantMembershipCondition {
+
+ private string _site;
+
+ // constructors
+
+ public SiteMembershipCondition (string site)
+ {
+ Site = site;
+ }
+
+ // properties
+
+ public string Site {
+ get { return _site; }
+ set {
+ if (value == null)
+ throw new ArgumentNullException ("site");
+ if (!System.Security.Policy.Site.IsValid (value))
+ throw new ArgumentException ("invalid site");
+ _site = value;
+ }
+ }
+
+ // methods
+
+ public bool Check (Evidence evidence)
+ {
+ if (evidence == null)
+ return false;
+
+ IEnumerator e = evidence.GetHostEnumerator ();
+ while (e.MoveNext ()) {
+ if (e.Current is Site) {
+ string[] s1 = _site.Split ('.');
+ string[] s2 = (e.Current as Site).origin_site.Split ('.');
+ for (int i = s1.Length - 1, j = s2.Length - 1; i>=0; i--, j--) {
+ if (i == 0) {
+ // special * case
+ return (String.Compare (s1 [0], "*", true, CultureInfo.InvariantCulture) == 0);
+ }
+ if (String.Compare (s1 [i], s2 [j], true, CultureInfo.InvariantCulture) != 0)
+ return false;
+ }
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public IMembershipCondition Copy ()
+ {
+ return new SiteMembershipCondition (_site);
+ }
+
+ public override bool Equals (object o)
+ {
+ if (o == null)
+ return false;
+ if (o is SiteMembershipCondition) {
+ Site s = new Site ((o as SiteMembershipCondition)._site);
+ return s.Equals (new Site (_site));
+ }
+ return false;
+ }
+
+ public void FromXml (SecurityElement e)
+ {
+ FromXml (e, null);
+ }
+
+ public void FromXml (SecurityElement e, PolicyLevel level)
+ {
+ if (e == null)
+ throw new ArgumentNullException ("e");
+ if (e.Tag != "IMembershipCondition")
+ throw new ArgumentException (Locale.GetText ("Invalid XML - not a IMembershipCondition tag."));
+ if (e.Attribute ("class") != GetType ().AssemblyQualifiedName)
+ throw new ArgumentException (Locale.GetText ("Invalid class."));
+ if (e.Attribute ("version") != "1")
+ throw new ArgumentException (Locale.GetText ("Invalid version."));
+
+ _site = e.Attribute ("Site");
+ }
+
+ public override int GetHashCode ()
+ {
+ return _site.GetHashCode ();
+ }
+
+ public override string ToString ()
+ {
+ return "Site - " + _site;
+ }
+
+ public SecurityElement ToXml ()
+ {
+ return ToXml (null);
+ }
+
+ public SecurityElement ToXml (PolicyLevel level)
+ {
+ SecurityElement element = new SecurityElement ("IMembershipCondition");
+ element.AddAttribute ("class", this.GetType ().AssemblyQualifiedName);
+ element.AddAttribute ("version", "1");
+ element.AddAttribute ("Site", _site);
+ return element;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Security.Policy/StrongName.cs b/mcs/class/corlib/System.Security.Policy/StrongName.cs
index d0316a8625b..5450c52082b 100644
--- a/mcs/class/corlib/System.Security.Policy/StrongName.cs
+++ b/mcs/class/corlib/System.Security.Policy/StrongName.cs
@@ -14,7 +14,7 @@ using System.Text;
namespace System.Security.Policy {
[Serializable]
-public sealed class StrongName : IIdentityPermissionFactory {
+public sealed class StrongName : IIdentityPermissionFactory, IBuiltInEvidence {
private StrongNamePublicKeyBlob publickey;
private string name;
@@ -51,7 +51,6 @@ public sealed class StrongName : IIdentityPermissionFactory {
return (object) new StrongName (publickey, name, version);
}
- [MonoTODO("What should we do with the evidence ? nothing?")]
public IPermission CreateIdentityPermission (Evidence evidence)
{
return new StrongNameIdentityPermission (publickey, name, version);
@@ -76,15 +75,32 @@ public sealed class StrongName : IIdentityPermissionFactory {
public override string ToString ()
{
- StringBuilder sb = new StringBuilder ();
- sb.Append ("<StrongName version=\"1\"\r\n Key=\"");
- sb.Append (publickey.ToString ());
- sb.Append ("\"\r\n Name=\"");
- sb.Append (name);
- sb.Append ("\"\r\n Version=\"");
- sb.Append (version.ToString ());
- sb.Append ("\"/>\r\n");
- return sb.ToString ();
+ SecurityElement element = new SecurityElement (typeof (System.Security.Policy.StrongName).Name);
+ element.AddAttribute ("version", "1");
+ element.AddAttribute ("Key", publickey.ToString ());
+ element.AddAttribute ("Name", name);
+ element.AddAttribute ("Version", version.ToString ());
+ return element.ToString ();
+ }
+
+ // interface IBuiltInEvidence
+
+ [MonoTODO]
+ int IBuiltInEvidence.GetRequiredSize (bool verbose)
+ {
+ return 0;
+ }
+
+ [MonoTODO]
+ int IBuiltInEvidence.InitFromBuffer (char [] buffer, int position)
+ {
+ return 0;
+ }
+
+ [MonoTODO]
+ int IBuiltInEvidence.OutputToBuffer (char [] buffer, int position, bool verbose)
+ {
+ return 0;
}
}
diff --git a/mcs/class/corlib/System.Security.Policy/StrongNameMembershipCondition.cs b/mcs/class/corlib/System.Security.Policy/StrongNameMembershipCondition.cs
index eafda17ae50..dc6fce4440d 100644
--- a/mcs/class/corlib/System.Security.Policy/StrongNameMembershipCondition.cs
+++ b/mcs/class/corlib/System.Security.Policy/StrongNameMembershipCondition.cs
@@ -7,7 +7,6 @@
// (C) 2003 Duncan Mak, Ximian Inc.
//
-
using System;
using System.Globalization;
using System.Security.Permissions;
@@ -15,26 +14,30 @@ using System.Security.Permissions;
namespace System.Security.Policy {
public sealed class StrongNameMembershipCondition
- : IMembershipCondition, ISecurityEncodable, ISecurityPolicyEncodable
+ : IMembershipCondition, ISecurityEncodable, ISecurityPolicyEncodable, IConstantMembershipCondition
{
-
StrongNamePublicKeyBlob blob;
string name;
Version version;
- public StrongNameMembershipCondition (
- StrongNamePublicKeyBlob blob, string name, Version version)
+ public StrongNameMembershipCondition (StrongNamePublicKeyBlob blob, string name, Version version)
{
-
if (blob == null)
- throw new ArgumentNullException (
- Locale.GetText ("The argument is null."));
+ throw new ArgumentNullException ("blob");
this.blob = blob;
this.name = name;
this.version = version;
}
+ // for PolicyLevel (to avoid validation duplication)
+ internal StrongNameMembershipCondition (SecurityElement e)
+ {
+ FromXml (e);
+ }
+
+ // properties
+
public string Name {
get { return name; }
@@ -62,9 +65,18 @@ namespace System.Security.Policy {
}
}
- [MonoTODO ("How do you check for StrongName from an Evidence?")]
public bool Check (Evidence evidence)
{
+ if (evidence == null)
+ return false;
+
+ foreach (object o in evidence) {
+ if (o is StrongName) {
+ StrongName sn = (o as StrongName);
+ if (sn.PublicKey.Equals (blob) && (sn.Name == name) && (sn.Version.Equals (version)))
+ return true;
+ }
+ }
return false;
}
@@ -75,12 +87,11 @@ namespace System.Security.Policy {
public override bool Equals (object o)
{
- if (o is StrongName == false)
+ if (o is StrongNameMembershipCondition == false)
return false;
-
else {
- StrongName sn = (StrongName) o;
- return (sn.Name == Name && sn.Version == Version && sn.PublicKey == PublicKey);
+ StrongNameMembershipCondition snmc = (StrongNameMembershipCondition) o;
+ return (snmc.Name == Name && snmc.Version == Version && snmc.PublicKey == PublicKey);
}
}
@@ -97,20 +108,21 @@ namespace System.Security.Policy {
public void FromXml (SecurityElement e, PolicyLevel level)
{
if (e == null)
- throw new ArgumentNullException (
- Locale.GetText ("The argument is null."));
+ throw new ArgumentNullException ("e");
- if (e.Attribute ("class") != GetType ().AssemblyQualifiedName)
- throw new ArgumentException (
- Locale.GetText ("The argument is invalid."));
+ if (e.Attribute ("class").IndexOf (GetType ().Name) < 0)
+ throw new ArgumentException (Locale.GetText ("Invalid class"));
if (e.Attribute ("version") != "1")
- throw new ArgumentException (
- Locale.GetText ("The argument is invalid."));
+ throw new ArgumentException (Locale.GetText ("Invalid version"));
blob = StrongNamePublicKeyBlob.FromString (e.Attribute ("PublicKeyBlob"));
name = e.Attribute ("Name");
- version = new Version (e.Attribute ("AssemblyVersion"));
+ string v = (string) e.Attribute ("AssemblyVersion");
+ if (v == null)
+ version = new Version ();
+ else
+ version = new Version (v);
}
public override string ToString ()
@@ -132,9 +144,11 @@ namespace System.Security.Policy {
element.AddAttribute ("PublicKeyBlob", blob.ToString ());
element.AddAttribute ("Name", name);
- element.AddAttribute ("AssemblyVersion", version.ToString ());
+ string v = version.ToString ();
+ if (v != "0.0")
+ element.AddAttribute ("AssemblyVersion", version.ToString ());
- return element;
+ return element;
}
}
}
diff --git a/mcs/class/corlib/System.Security.Policy/UnionCodeGroup.cs b/mcs/class/corlib/System.Security.Policy/UnionCodeGroup.cs
index 80e24e2179c..18ade715436 100644
--- a/mcs/class/corlib/System.Security.Policy/UnionCodeGroup.cs
+++ b/mcs/class/corlib/System.Security.Policy/UnionCodeGroup.cs
@@ -15,8 +15,8 @@ using System.Security.Policy;
namespace System.Security.Policy {
[Serializable]
- public sealed class UnionCodeGroup : CodeGroup
- {
+ public sealed class UnionCodeGroup : CodeGroup {
+
public UnionCodeGroup (
IMembershipCondition membershipCondition,
PolicyStatement policyStatement)
@@ -24,16 +24,23 @@ namespace System.Security.Policy {
{
}
+ // for PolicyLevel (to avoid validation duplication)
+ internal UnionCodeGroup (SecurityElement e) : base (e) {}
+
public override CodeGroup Copy ()
{
- return new UnionCodeGroup (MembershipCondition, PolicyStatement);
+ UnionCodeGroup copy = new UnionCodeGroup (MembershipCondition, PolicyStatement);
+ foreach (CodeGroup child in Children) {
+ copy.AddChild (child.Copy ()); // deep copy
+ }
+ return copy;
}
[MonoTODO]
public override PolicyStatement Resolve (Evidence evidence)
{
if (evidence == null)
- throw new ArgumentNullException (Locale.GetText ("Evidence is null"));
+ throw new ArgumentNullException ("evidence");
throw new NotImplementedException ();
}
@@ -42,7 +49,7 @@ namespace System.Security.Policy {
public override CodeGroup ResolveMatchingCodeGroups (Evidence evidence)
{
if (evidence == null)
- throw new ArgumentNullException (Locale.GetText ("Evidence is null"));
+ throw new ArgumentNullException ("evidence");
throw new NotImplementedException ();
}
diff --git a/mcs/class/corlib/System.Security.Policy/Url.cs b/mcs/class/corlib/System.Security.Policy/Url.cs
index 543c481cbca..c86d524b41d 100644
--- a/mcs/class/corlib/System.Security.Policy/Url.cs
+++ b/mcs/class/corlib/System.Security.Policy/Url.cs
@@ -3,8 +3,10 @@
//
// Author
// Duncan Mak (duncan@ximian.com)
+// Sebastien Pouliot (spouliot@motus.com)
//
// (C) 2003 Ximian, Inc (http://www.ximian.com)
+// (C) 2004 Motus Technologies Inc. (http://www.motus.com)
//
using System;
@@ -15,44 +17,30 @@ using System.Security.Policy;
namespace System.Security.Policy {
[Serializable]
- public sealed class Url: IIdentityPermissionFactory
- {
+ public sealed class Url: IIdentityPermissionFactory, IBuiltInEvidence {
+
string origin_url;
- SecurityElement element;
public Url (string name)
{
- if (name == null)
- throw new ArgumentNullException (Locale.GetText ("name is null"));
-
- origin_url = name;
- element = new SecurityElement (
- typeof (System.Security.Policy.Url).FullName);
-
- element.AddAttribute ("version", "1");
- element.AddChild (new SecurityElement ("Url", name));
- }
-
- private Url (string name, SecurityElement security_element)
- {
- origin_url = name;
- element = security_element;
+ origin_url = Prepare (name);
}
public object Copy ()
{
- return new Url (origin_url, element);
+ return new Url (origin_url);
}
- [MonoTODO]
public IPermission CreateIdentityPermission (Evidence evidence)
{
- return null;
+ return new UrlIdentityPermission (origin_url);
}
public override bool Equals (object o)
{
- return (o is System.Security.Policy.Url && ((Url) o).Value == Value);
+ if (o is System.Security.Policy.Url)
+ return (String.Compare (((Url) o).Value, Value, true, CultureInfo.InvariantCulture) == 0);
+ return false;
}
public override int GetHashCode ()
@@ -62,13 +50,72 @@ namespace System.Security.Policy {
public override string ToString ()
{
- return element.ToString ();
+ SecurityElement element = new SecurityElement (typeof (System.Security.Policy.Url).FullName);
+ element.AddAttribute ("version", "1");
+ element.AddChild (new SecurityElement ("Url", origin_url));
+ return element.ToString ();
}
public string Value {
- get {
- return origin_url;
- }
+ get { return origin_url; }
}
+
+ // interface IBuiltInEvidence
+
+ [MonoTODO]
+ int IBuiltInEvidence.GetRequiredSize (bool verbose)
+ {
+ return 0;
+ }
+
+ [MonoTODO]
+ int IBuiltInEvidence.InitFromBuffer (char [] buffer, int position)
+ {
+ return 0;
+ }
+
+ [MonoTODO]
+ int IBuiltInEvidence.OutputToBuffer (char [] buffer, int position, bool verbose)
+ {
+ return 0;
+ }
+
+ // internal
+
+ [MonoTODO ("missing site validation")]
+ internal static string Prepare (string url)
+ {
+ if (url == null)
+ throw new ArgumentNullException ("Url");
+ if (url == String.Empty)
+ throw new FormatException (Locale.GetText ("Invalid (empty) Url"));
+
+ // is a protocol specified
+ int protocolPos = url.IndexOf ("://");
+ if (protocolPos == -1)
+ return "file://" + url.ToUpper ();
+
+ if (url.StartsWith ("file://"))
+ return "file://" + url.Substring (7).ToUpper ();
+
+ // add a trailing slash if none (lonely one) is present
+ if (url.LastIndexOf ("/") == protocolPos + 2)
+ return url + "/";
+ else
+ return url;
+ }
+
+ internal static bool Compare (string mask, string url)
+ {
+ int wildcard = mask.LastIndexOf ("*");
+ if (wildcard > 0) {
+ // partial match with a wildcard at the end
+ return (String.Compare (mask, 0, url, 0, wildcard, true, CultureInfo.InvariantCulture) == 0);
+ }
+ else {
+ // exact match
+ return (String.Compare (mask, url, true, CultureInfo.InvariantCulture) == 0);
+ }
+ }
}
}
diff --git a/mcs/class/corlib/System.Security.Policy/UrlMembershipCondition.cs b/mcs/class/corlib/System.Security.Policy/UrlMembershipCondition.cs
index f74e43c73f6..4a78acb318f 100644
--- a/mcs/class/corlib/System.Security.Policy/UrlMembershipCondition.cs
+++ b/mcs/class/corlib/System.Security.Policy/UrlMembershipCondition.cs
@@ -1,10 +1,12 @@
//
// System.Security.Policy.UrlMembershipCondition.cs
//
-// Author:
-// Duncan Mak (duncan@ximian.com)
+// Authors:
+// Duncan Mak (duncan@ximian.com)
+// Sebastien Pouliot (spouliot@motus.com)
//
// (C) 2003, Ximian Inc.
+// (C) 2004 Motus Technologies Inc. (http://www.motus.com)
//
using System;
@@ -12,27 +14,35 @@ using System.Globalization;
namespace System.Security.Policy {
+ [Serializable]
public sealed class UrlMembershipCondition
- : IMembershipCondition, ISecurityEncodable, ISecurityPolicyEncodable
+ : IMembershipCondition, ISecurityEncodable, ISecurityPolicyEncodable, IConstantMembershipCondition
{
string url;
public UrlMembershipCondition (string url)
{
- if (url == null)
- throw new ArgumentNullException (
- Locale.GetText ("The argument is null."));
-
- this.url = url;
+ this.url = System.Security.Policy.Url.Prepare (url);
}
public string Url {
get { return url; }
+ set { url = System.Security.Policy.Url.Prepare (value); }
}
- [MonoTODO]
public bool Check (Evidence evidence)
{
+ if (evidence == null)
+ return false;
+
+ foreach (object o in evidence) {
+ Url u = (o as Url);
+ if (u != null) {
+ // note: there shouldn't be more than one Url evidence
+ if (System.Security.Policy.Url.Compare (url, u.Value))
+ return true;
+ }
+ }
return false;
}
@@ -43,11 +53,10 @@ namespace System.Security.Policy {
public override bool Equals (Object o)
{
- if (o is UrlMembershipCondition == false)
- return false;
-
- else
- return ((UrlMembershipCondition) o).Url == url;
+ if (o is UrlMembershipCondition) {
+ return System.Security.Policy.Url.Compare (url, ((UrlMembershipCondition) o).Url);
+ }
+ return false;
}
public void FromXml (SecurityElement element)
@@ -58,16 +67,19 @@ namespace System.Security.Policy {
public void FromXml (SecurityElement element, PolicyLevel level)
{
if (element == null)
- throw new ArgumentNullException (
- Locale.GetText ("The argument is null."));
+ throw new ArgumentNullException ("element");
+
+ if (element.Tag != "IMembershipCondition")
+ throw new ArgumentException (
+ Locale.GetText ("Invalid tag - expected IMembershipCondition"));
if (element.Attribute ("class") != GetType ().AssemblyQualifiedName)
throw new ArgumentException (
- Locale.GetText ("The argument is invalid."));
+ Locale.GetText ("Invalid class attribute"));
if (element.Attribute ("version") != "1")
throw new ArgumentException (
- Locale.GetText ("The argument is invalid."));
+ Locale.GetText ("Invalid version"));
url = element.Attribute ("Url");
}
@@ -90,10 +102,9 @@ namespace System.Security.Policy {
public SecurityElement ToXml (PolicyLevel level)
{
SecurityElement element = new SecurityElement ("IMembershipCondition");
- element.AddAttribute ("version", "1");
-
+ element.AddAttribute ("class", this.GetType ().AssemblyQualifiedName);
+ element.AddAttribute ("version", "1");
element.AddAttribute ("Url", url);
-
return element;
}
}
diff --git a/mcs/class/corlib/System.Security.Policy/ZoneMembershipCondition.cs b/mcs/class/corlib/System.Security.Policy/ZoneMembershipCondition.cs
index 5d9624ac801..84e883f8a83 100644
--- a/mcs/class/corlib/System.Security.Policy/ZoneMembershipCondition.cs
+++ b/mcs/class/corlib/System.Security.Policy/ZoneMembershipCondition.cs
@@ -13,7 +13,7 @@ using System.Globalization;
namespace System.Security.Policy {
public sealed class ZoneMembershipCondition
- : IMembershipCondition, ISecurityEncodable, ISecurityPolicyEncodable
+ : IMembershipCondition, ISecurityEncodable, ISecurityPolicyEncodable, IConstantMembershipCondition
{
SecurityZone zone;
@@ -27,9 +27,18 @@ namespace System.Security.Policy {
get { return zone; }
}
- [MonoTODO]
public bool Check (Evidence evidence)
{
+ if (evidence == null)
+ return false;
+
+ foreach (object o in evidence) {
+ if (o is Zone) {
+ Zone z = (o as Zone);
+ if (z.SecurityZone == zone)
+ return true;
+ }
+ }
return false;
}
@@ -42,7 +51,6 @@ namespace System.Security.Policy {
{
if (o is ZoneMembershipCondition == false)
return false;
-
else
return ((ZoneMembershipCondition) o).SecurityZone == zone;
}
diff --git a/mcs/class/corlib/System.Security/AllowPartiallyTrustedCallersAttribute.cs b/mcs/class/corlib/System.Security/AllowPartiallyTrustedCallersAttribute.cs
index 820b596ff68..edf12e93e5b 100644
--- a/mcs/class/corlib/System.Security/AllowPartiallyTrustedCallersAttribute.cs
+++ b/mcs/class/corlib/System.Security/AllowPartiallyTrustedCallersAttribute.cs
@@ -4,7 +4,7 @@
// Author:
// Sebastien Pouliot (spouliot@motus.com)
//
-// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
+// (C) 2003, 2004 Motus Technologies Inc. (http://www.motus.com)
//
using System;
@@ -12,7 +12,7 @@ using System;
namespace System.Security {
// LAMESPEC: Undocument in original help file, but present, in framework 1.0
- [AttributeUsage (AttributeTargets.Assembly)]
+ [AttributeUsage (AttributeTargets.Assembly, AllowMultiple=false, Inherited=false)]
public sealed class AllowPartiallyTrustedCallersAttribute : Attribute {
public AllowPartiallyTrustedCallersAttribute () : base () {}
diff --git a/mcs/class/corlib/System.Security/ChangeLog b/mcs/class/corlib/System.Security/ChangeLog
index 237ae1a13cf..42a06020115 100755
--- a/mcs/class/corlib/System.Security/ChangeLog
+++ b/mcs/class/corlib/System.Security/ChangeLog
@@ -1,3 +1,67 @@
+2004-01-27 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * SecurityElement.cs: Attributes are now kept in an ArrayList (but
+ still returned in an Hashtable) so the attributes order can be
+ kept like MS implementation (but Hashtable cannot guarantee this).
+
+2004-01-26 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * NamedPermissionSet.cs: Changed internal constructor
+ NamedPermissionSet (SecurityElement e) to NamedPermissionSet ().
+ * PermissionSet.cs: Changed internal constructor
+ PermissionSet (SecurityElement e) to PermissionSet ().
+
+2004-01-24 David Sheldon <dave-mono@earth.li>
+
+ * SecurityElement.cs: Changed indentation in ToString, it seems
+ MS indent by 3 spaces, not 4. Also added NewLine to childless
+ elements.
+
+2004-01-24 David Sheldon <dave-mono@earth.li>
+
+ * SecurityElement.cs: Changed newline distribution in ToString.
+ Matches MS better.
+
+2004-01-06 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * CodeAccessPermission.cs: Fixed Demand for custom permissions
+ (permissions that do not implement, the internal, IBuiltInPermission).
+ Ref. http://bugzilla.ximian.com/show_bug.cgi?id=52626
+ * SecurityException.cs: Fixed ToString() which could, when no
+ PermissionType where specified, throws a NullReferenceException.
+ Ref. http://bugzilla.ximian.com/show_bug.cgi?id=52626
+
+2004-01-05 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * CodeAccessPermission.cs: Fixed Union to match 1.1/1.2 documentation.
+ Simplified ToString to match MS implementation. Added LAMESPEC to
+ Assert, Demand, Deny and PermitOnly as they aren't virtual.
+ * NamedPermissionSet.cs: Added internal constructor for PolicyLevel.
+ * PermissionSet.cs: Added internal constructor for PolicyLevel.
+ * SecurityManager.cs: Moved some stuff to PolicyLevel class (e.g. Load).
+
+2004-01-03 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * SecurityManager.cs: Added some basic stuff to make some security unit
+ tests works (mostly when using PolicyHierarchy).
+
+2004-01-02 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * AllowPartiallyTrustedCallersAttribute.cs: Fixed AttributeUsage using
+ 1.2 documentation (AllowMultiple=false, Inherited=false)
+ * NamedPermissionSet.cs: Changes to match unit tests.
+ * PermissionSet.cs: Implemented Copy, Intersect, IsSubsetOf and Union
+ methods. Corrected FromXml.
+ * PolicyLevelType.cs: Added missing [Serializable].
+ * SecurityElement.cs: Fixed constructor to match unit tests.
+ * SecurityException.cs: Added support for GrantedSet and RefusedSet
+ properties (since 1.1). Set HResult to 0x8013150A.
+ * SecurityZone.cs: Added missing [Serializable].
+ * SuppressUnmanagedCodeSecurityAttribute.cs: Fixed AttributeUsage using
+ 1.2 documentation (AllowMultiple=true, Inherited=false)
+ * UnverifiableCodeAttribute.cs: Fixed AttributeUsage using 1.2
+ documentation (AllowMultiple=true, Inherited=false)
+
2003-06-29 Sebastien Pouliot <spouliot@videotron.ca>
* PermissionSet.cs: Added missing "virtual" to Count, IsSynchronized
diff --git a/mcs/class/corlib/System.Security/CodeAccessPermission.cs b/mcs/class/corlib/System.Security/CodeAccessPermission.cs
index 148c2a231ba..ce56ae22165 100755
--- a/mcs/class/corlib/System.Security/CodeAccessPermission.cs
+++ b/mcs/class/corlib/System.Security/CodeAccessPermission.cs
@@ -4,11 +4,15 @@
// Authors:
// Miguel de Icaza (miguel@ximian.com)
// Nick Drochak, ndrochak@gol.com
+// Sebastien Pouliot (spouliot@motus.com)
//
// (C) Ximian, Inc. http://www.ximian.com
// Copyright (C) 2001 Nick Drochak, All Rights Reserved
+// Portions (C) 2004 Motus Technologies Inc. (http://www.motus.com)
//
+using System.Globalization;
+using System.Security.Permissions;
using System.Text;
namespace System.Security {
@@ -18,16 +22,81 @@ namespace System.Security {
protected CodeAccessPermission () {}
- [MonoTODO()]
- public void Assert () {}
+ // LAMESPEC: Documented as virtual
+ [MonoTODO("SecurityStackFrame not ready")]
+ public void Assert ()
+ {
+ // throw a SecurityException if Assertion is denied
+ new SecurityPermission (SecurityPermissionFlag.Assertion).Demand ();
+// SecurityStackFrame.Current.Assert = this;
+ }
public abstract IPermission Copy ();
- [MonoTODO()]
- public void Demand () {}
+ // LAMESPEC: Documented as virtual
+ [MonoTODO("MS contralize demands, but I think we should branch back into indivual permission classes.")]
+ public void Demand ()
+ {
+ IBuiltInPermission perm = (this as IBuiltInPermission);
+ if (perm == null)
+ return; // not sure about this :(
+
+ // TODO : Loop the stack
+ switch (perm.GetTokenIndex ()) {
+ case 0: // EnvironmentPermission
+ // TODO
+ break;
+ case 1: // FileDialogPermission
+ // TODO
+ break;
+ case 2: // FileIOPermission
+ // TODO
+ break;
+ case 3: // IsolatedStorageFilePermission
+ // TODO
+ break;
+ case 4: // ReflectionPermission
+ // TODO
+ break;
+ case 5: // RegistryPermission
+ // TODO
+ break;
+ case 6: // SecurityPermission
+ // TODO
+ break;
+ case 7: // UIPermission
+ // TODO
+ break;
+ case 8: // PrincipalPermission
+ // TODO
+ break;
+ case 9: // PublisherIdentityPermission
+ // TODO
+ break;
+ case 10: // SiteIdentityPermission
+ // TODO
+ break;
+ case 11: // StrongNameIdentityPermission
+ // TODO
+ break;
+ case 12: // UrlIdentityPermission
+ // TODO
+ break;
+ case 13: // ZoneIdentityPermission
+ // TODO
+ break;
+ default:
+ string message = String.Format (Locale.GetText ("Unknown IBuiltInPermission #{0}"), perm.GetTokenIndex ());
+ throw new SecurityException (message);
+ }
+ }
- [MonoTODO()]
- public void Deny () {}
+ // LAMESPEC: Documented as virtual
+ [MonoTODO("SecurityStackFrame not ready")]
+ public void Deny ()
+ {
+// SecurityStackFrame.Current.Deny = this;
+ }
public abstract void FromXml (SecurityElement elem);
@@ -35,38 +104,51 @@ namespace System.Security {
public abstract bool IsSubsetOf (IPermission target);
- public override string ToString()
+ public override string ToString ()
{
SecurityElement elem = ToXml ();
- return elem == null ? null : elem.ToString ();
+ return elem.ToString ();
}
public abstract SecurityElement ToXml ();
- [MonoTODO("Incomplete")]
public virtual IPermission Union (IPermission other)
{
- if (!(other is System.Security.CodeAccessPermission))
- throw new System.ArgumentException(); // other is not of type System.Security.CodeAccessPermission.
if (null != other)
- throw new System.NotSupportedException(); // other is not null.
+ throw new System.NotSupportedException (); // other is not null.
return null;
}
- [MonoTODO()]
- public void PermitOnly () {}
+ // LAMESPEC: Documented as virtual
+ [MonoTODO("SecurityStackFrame not ready")]
+ public void PermitOnly ()
+ {
+// SecurityStackFrame.Current.PermitOnly = this;
+ }
- [MonoTODO()]
- public static void RevertAll () {}
+ [MonoTODO("SecurityStackFrame not ready")]
+ public static void RevertAll ()
+ {
+// SecurityStackFrame.Current.RevertAll ();
+ }
- [MonoTODO()]
- public static void RevertAssert () {}
+ [MonoTODO("SecurityStackFrame not ready")]
+ public static void RevertAssert ()
+ {
+// SecurityStackFrame.Current.RevertAssert ();
+ }
- [MonoTODO()]
- public static void RevertDeny () {}
+ [MonoTODO("SecurityStackFrame not ready")]
+ public static void RevertDeny ()
+ {
+// SecurityStackFrame.Current.RevertDeny ();
+ }
- [MonoTODO()]
- public static void RevertPermitOnly () {}
+ [MonoTODO("SecurityStackFrame not ready")]
+ public static void RevertPermitOnly ()
+ {
+// SecurityStackFrame.Current.RevertPermitOnly ();
+ }
// snippet moved from FileIOPermission (nickd) to be reused in all derived classes
internal SecurityElement Element (object o, int version)
diff --git a/mcs/class/corlib/System.Security/NamedPermissionSet.cs b/mcs/class/corlib/System.Security/NamedPermissionSet.cs
index c766134d6b0..5dc90cb257d 100644
--- a/mcs/class/corlib/System.Security/NamedPermissionSet.cs
+++ b/mcs/class/corlib/System.Security/NamedPermissionSet.cs
@@ -6,7 +6,7 @@
// Sebastien Pouliot (spouliot@motus.com)
//
// (C) 2002
-// Portions (C) 2003 Motus Technologies Inc. (http://www.motus.com)
+// Portions (C) 2003, 2004 Motus Technologies Inc. (http://www.motus.com)
//
using System;
@@ -17,6 +17,9 @@ namespace System.Security {
[Serializable]
public sealed class NamedPermissionSet : PermissionSet {
+ // for PolicyLevel (to avoid validation duplication)
+ internal NamedPermissionSet () : base () {}
+
public NamedPermissionSet (string name, PermissionSet set) : base (set)
{
Name = name;
@@ -31,6 +34,8 @@ namespace System.Security {
public NamedPermissionSet (string name) : this (name, PermissionState.None) {}
+ // properties
+
public string Description {
get { return description; }
set { description = value; }
@@ -59,9 +64,11 @@ namespace System.Security {
public override void FromXml (SecurityElement e)
{
- FromXml (e, "System.Security.NamedPermissionSet");
+ FromXml (e, "NamedPermissionSet");
Name = (e.Attributes ["Name"] as string);
- Description = (e.Attributes ["Description"] as string);
+ description = (e.Attributes ["Description"] as string);
+ if (description == null)
+ description = String.Empty;
}
public override SecurityElement ToXml ()
diff --git a/mcs/class/corlib/System.Security/PermissionSet.cs b/mcs/class/corlib/System.Security/PermissionSet.cs
index 4956e262648..c9cad75a9e1 100644
--- a/mcs/class/corlib/System.Security/PermissionSet.cs
+++ b/mcs/class/corlib/System.Security/PermissionSet.cs
@@ -6,7 +6,7 @@
// Sebastien Pouliot (spouliot@motus.com)
//
// (C) Nick Drochak
-// Portions (C) 2003 Motus Technologies Inc. (http://www.motus.com)
+// Portions (C) 2003, 2004 Motus Technologies Inc. (http://www.motus.com)
//
using System;
@@ -23,6 +23,14 @@ namespace System.Security {
private PermissionState state;
private ArrayList list;
+ // constructors
+
+ // for PolicyLevel (to avoid validation duplication)
+ internal PermissionSet ()
+ {
+ list = new ArrayList ();
+ }
+
public PermissionSet (PermissionState state)
{
if (!Enum.IsDefined(typeof(System.Security.Permissions.PermissionState), state))
@@ -31,17 +39,21 @@ namespace System.Security {
list = new ArrayList ();
}
- public PermissionSet (PermissionSet permSet) : this (PermissionState.Unrestricted)
+ public PermissionSet (PermissionSet permSet) : this (PermissionState.None)
{
// LAMESPEC: This would be handled by the compiler. No way permSet is not a PermissionSet.
//if (!(permSet is PermissionSet))
// throw new System.ArgumentException(); // permSet is not an instance of System.Security.PermissionSet.
- if (permSet != null) {
+ if (permSet == null)
+ state = PermissionState.Unrestricted;
+ else {
foreach (IPermission p in permSet.list)
list.Add (p);
}
}
+ // methods
+
public virtual IPermission AddPermission (IPermission perm)
{
if (perm == null)
@@ -60,10 +72,9 @@ namespace System.Security {
{
}
- [MonoTODO()]
public virtual PermissionSet Copy ()
{
- return null;
+ return new PermissionSet (this);
}
public virtual void CopyTo (Array array, int index)
@@ -94,10 +105,11 @@ namespace System.Security {
throw new ArgumentNullException ("et");
if (et.Tag != "PermissionSet")
throw new ArgumentException ("not PermissionSet");
- if (!(et.Attributes ["class"] as string).StartsWith (className))
+ if (!(et.Attributes ["class"] as string).EndsWith (className))
throw new ArgumentException ("not " + className);
- if ((et.Attributes ["version"] as string) != "1")
- throw new ArgumentException ("wrong version");
+// version isn't checked
+// if ((et.Attributes ["version"] as string) != "1")
+// throw new ArgumentException ("wrong version");
if ((et.Attributes ["Unrestricted"] as string) == "true")
state = PermissionState.Unrestricted;
@@ -107,13 +119,17 @@ namespace System.Security {
public virtual void FromXml (SecurityElement et)
{
- FromXml (et, "System.Security.PermissionSet");
- foreach (SecurityElement se in et.Children) {
- string className = (se.Attributes ["class"] as string);
- Type classType = Type.GetType (className);
- IPermission p = (IPermission) Activator.CreateInstance (classType);
- p.FromXml (se);
- list.Add (p);
+ list.Clear ();
+ FromXml (et, "PermissionSet");
+ if (et.Children != null) {
+ foreach (SecurityElement se in et.Children) {
+ string className = (se.Attributes ["class"] as string);
+ Type classType = Type.GetType (className);
+ object [] psNone = new object [1] { PermissionState.None };
+ IPermission p = (IPermission) Activator.CreateInstance (classType, psNone);
+ p.FromXml (se);
+ list.Add (p);
+ }
}
}
@@ -122,10 +138,25 @@ namespace System.Security {
return list.GetEnumerator ();
}
- [MonoTODO()]
public virtual bool IsSubsetOf (PermissionSet target)
{
- return false;
+ // if target is empty we must be empty too
+ if ((target == null) || (target.IsEmpty ()))
+ return this.IsEmpty ();
+ // if we're unrestricted then target must also be unrestricted
+ if (this.IsUnrestricted () && target.IsUnrestricted ())
+ return true;
+
+ // if each of our permission is (a) present and (b) a subset of target
+ foreach (IPermission p in list) {
+ // for every type in both list
+ IPermission i = target.GetPermission (p.GetType ());
+ if (i == null)
+ return false; // not present (condition a)
+ if (!p.IsSubsetOf (i))
+ return false; // not a subset (condition b)
+ }
+ return true;
}
[MonoTODO()]
@@ -158,10 +189,28 @@ namespace System.Security {
return null;
}
- [MonoTODO()]
public virtual PermissionSet Intersect (PermissionSet other)
{
- return null;
+ // no intersection possible
+ if ((other == null) || (other.IsEmpty ()) || (this.IsEmpty ()))
+ return new PermissionSet (PermissionState.None);
+ // intersections with unrestricted
+ if (this.IsUnrestricted ())
+ return other.Copy ();
+ if (other.IsUnrestricted ())
+ return this.Copy ();
+
+ PermissionSet interSet = new PermissionSet (PermissionState.None);
+ foreach (IPermission p in other.list) {
+ // for every type in both list
+ IPermission i = interSet.GetPermission (p.GetType ());
+ if (i != null) {
+ // add intersection for this type
+ interSet.AddPermission (p.Intersect (i));
+ }
+ // or reject!
+ }
+ return interSet;
}
public virtual bool IsEmpty ()
@@ -214,10 +263,18 @@ namespace System.Security {
return se;
}
- [MonoTODO()]
public virtual PermissionSet Union (PermissionSet other)
{
- return null;
+ if (other == null)
+ return this.Copy ();
+ if (this.IsUnrestricted () || other.IsUnrestricted ())
+ return new PermissionSet (PermissionState.Unrestricted);
+
+ PermissionSet copy = this.Copy ();
+ foreach (IPermission p in other.list) {
+ copy.AddPermission (p);
+ }
+ return copy;
}
public virtual int Count {
diff --git a/mcs/class/corlib/System.Security/PolicyLevelType.cs b/mcs/class/corlib/System.Security/PolicyLevelType.cs
index a7414010104..1e099ea92d7 100644
--- a/mcs/class/corlib/System.Security/PolicyLevelType.cs
+++ b/mcs/class/corlib/System.Security/PolicyLevelType.cs
@@ -1,18 +1,19 @@
-//
-// System.Security.PolicyLevelType.cs
-//
-// Author:
-// Nick Drochak(ndrochak@gol.com)
-//
-// (C) Nick Drochak
-//
-
-namespace System.Security {
-
- public enum PolicyLevelType {
- User = 0x0,
- Machine,
- Enterprise,
- AppDomain,
- }
-}
+//
+// System.Security.PolicyLevelType.cs
+//
+// Author:
+// Nick Drochak(ndrochak@gol.com)
+//
+// (C) Nick Drochak
+//
+
+namespace System.Security {
+
+ [Serializable]
+ public enum PolicyLevelType {
+ User = 0x0,
+ Machine,
+ Enterprise,
+ AppDomain,
+ }
+}
diff --git a/mcs/class/corlib/System.Security/SecurityElement.cs b/mcs/class/corlib/System.Security/SecurityElement.cs
index 4aeb033328b..3add4dad515 100755
--- a/mcs/class/corlib/System.Security/SecurityElement.cs
+++ b/mcs/class/corlib/System.Security/SecurityElement.cs
@@ -1,9 +1,10 @@
//
// System.Security.SecurityElement.cs
//
-// Author:
+// Authors:
// Miguel de Icaza (miguel@ximian.com)
// Lawrence Pit (loz@cable.a2000.nl)
+// Sebastien Pouliot <spouliot@videotron.ca>
//
// (C) Ximian, Inc. http://www.ximian.com
@@ -16,9 +17,35 @@ namespace System.Security
[Serializable]
public sealed class SecurityElement
{
+ internal class SecurityAttribute {
+
+ private string _name;
+ private string _value;
+
+ public SecurityAttribute (string name, string value)
+ {
+ if (!IsValidAttributeName (name))
+ throw new ArgumentException (Locale.GetText ("Invalid XML attribute name") + ": " + name);
+
+ if (!IsValidAttributeValue (value))
+ throw new ArgumentException (Locale.GetText ("Invalid XML attribute value") + ": " + value);
+
+ _name = name;
+ _value = value;
+ }
+
+ public string Name {
+ get { return _name; }
+ }
+
+ public string Value {
+ get { return _value; }
+ }
+ }
+
string text;
string tag;
- Hashtable attributes;
+ ArrayList attributes;
ArrayList children;
// these values are determined by a simple test program against the MS.Net implementation:
@@ -42,7 +69,7 @@ namespace System.Security
public SecurityElement (string tag, string text)
{
this.Tag = tag;
- this.Text = (text == null) ? String.Empty : text;
+ this.Text = text;
}
public Hashtable Attributes {
@@ -50,33 +77,27 @@ namespace System.Security
if (attributes == null)
return null;
- Hashtable result = new Hashtable ();
- IDictionaryEnumerator e = attributes.GetEnumerator ();
- while (e.MoveNext ())
- result.Add (e.Key, e.Value);
+ Hashtable result = new Hashtable (attributes.Count);
+ foreach (SecurityAttribute sa in attributes) {
+ result.Add (sa.Name, sa.Value);
+ }
return result;
}
set {
if (value == null || value.Count == 0) {
- attributes = null;
+ attributes.Clear ();
return;
}
- Hashtable result = new Hashtable ();
+ if (attributes == null)
+ attributes = new ArrayList ();
+ else
+ attributes.Clear ();
IDictionaryEnumerator e = value.GetEnumerator ();
while (e.MoveNext ()) {
- string key = (string) e.Key;
- string val = (string) e.Value;
- if (!IsValidAttributeName (key))
- throw new ArgumentException (Locale.GetText ("Invalid XML string") + ": " + key);
-
- if (!IsValidAttributeValue (val))
- throw new ArgumentException (Locale.GetText ("Invalid XML string") + ": " + key);
-
- result.Add (key, val);
+ attributes.Add (new SecurityAttribute ((string) e.Key, (string) e.Value));
}
- attributes = result;
}
}
@@ -125,29 +146,22 @@ namespace System.Security
public void AddAttribute (string name, string value)
{
- if (name == null || value == null)
- throw new ArgumentNullException ();
+ if (name == null)
+ throw new ArgumentNullException ("name");
+ if (value == null)
+ throw new ArgumentNullException ("value");
+ if (GetAttribute (name) != null)
+ throw new ArgumentException (Locale.GetText ("Duplicate attribute : " + name));
if (attributes == null)
- attributes = new Hashtable ();
-
- //
- // The hashtable will throw ArgumentException if name is already there
- //
-
- if (!IsValidAttributeName (name))
- throw new ArgumentException (Locale.GetText ("Invalid XML string") + ": " + name);
-
- if (!IsValidAttributeValue (value))
- throw new ArgumentException (Locale.GetText ("Invalid XML string") + ": " + value);
-
- attributes.Add (name, value);
+ attributes = new ArrayList ();
+ attributes.Add (new SecurityAttribute (name, value));
}
public void AddChild (SecurityElement child)
{
if (child == null)
- throw new ArgumentNullException ();
+ throw new ArgumentNullException ("child");
if (children == null)
children = new ArrayList ();
@@ -158,12 +172,10 @@ namespace System.Security
public string Attribute (string name)
{
if (name == null)
- throw new ArgumentNullException ();
+ throw new ArgumentNullException ("name");
- if (attributes != null)
- return (string) attributes [name];
- else
- return null;
+ SecurityAttribute sa = GetAttribute (name);
+ return ((sa == null) ? null : sa.Value);
}
public bool Equal (SecurityElement other)
@@ -189,10 +201,11 @@ namespace System.Security
if (this.attributes != null && other.attributes != null) {
if (this.attributes.Count != other.attributes.Count)
return false;
- IDictionaryEnumerator e = attributes.GetEnumerator ();
- while (e.MoveNext ())
- if (other.attributes [e.Key] != e.Value)
+ foreach (SecurityAttribute sa1 in attributes) {
+ SecurityAttribute sa2 = other.GetAttribute (sa1.Name);
+ if ((sa2 == null) || (sa1.Value != sa2.Value))
return false;
+ }
}
if (this.children == null && other.children != null && other.children.Count != 0)
@@ -255,7 +268,9 @@ namespace System.Security
public static bool IsValidText (string value)
{
- return value != null && value.IndexOfAny (invalid_text_chars) == -1;
+ if (value == null)
+ return true;
+ return value.IndexOfAny (invalid_text_chars) == -1;
}
public SecurityElement SearchForChildByTag (string tag)
@@ -301,40 +316,56 @@ namespace System.Security
return s.ToString ();
}
- private void ToXml(ref StringBuilder s, int level)
+ private void ToXml (ref StringBuilder s, int level)
{
- s.Append (' ', level << 2);
+ s.Append (' ', level * 3);
s.Append ("<");
s.Append (tag);
if (attributes != null) {
- IDictionaryEnumerator e = attributes.GetEnumerator ();
- while (e.MoveNext ()) {
- s.Append (" ")
- .Append (e.Key)
+ for (int i=0; i < attributes.Count; i++) {
+ SecurityAttribute sa = (SecurityAttribute) attributes [i];
+ s.Append (" ");
+ // all other attributes must align with the first one
+ if (i != 0)
+ s.Append (' ', (level * 3) + tag.Length + 1);
+ s.Append (sa.Name)
.Append ("=\"")
- .Append (e.Value)
+ .Append (sa.Value)
.Append ("\"");
+ if (i != attributes.Count - 1)
+ s.Append (Environment.NewLine);
}
}
if ((text == null || text == String.Empty) &&
(children == null || children.Count == 0))
- s.Append ("/>");
+ s.Append ("/>").Append (Environment.NewLine);
else {
s.Append (">").Append (text);
if (children != null) {
+ s.Append (Environment.NewLine);
foreach (SecurityElement child in children) {
- s.Append (Environment.NewLine);
child.ToXml (ref s, level + 1);
}
+ s.Append (' ', level * 3);
}
- s.Append (Environment.NewLine)
- .Append (' ', level << 2)
- .Append ("</")
+ s.Append ("</")
.Append (tag)
- .Append (">");
+ .Append (">")
+ .Append (Environment.NewLine);
+ }
+ }
+
+ internal SecurityAttribute GetAttribute (string name)
+ {
+ if (attributes != null) {
+ foreach (SecurityAttribute sa in attributes) {
+ if (sa.Name == name)
+ return sa;
+ }
}
+ return null;
}
}
}
diff --git a/mcs/class/corlib/System.Security/SecurityException.cs b/mcs/class/corlib/System.Security/SecurityException.cs
index aaa0086bbe2..9dcc9c35bdf 100644
--- a/mcs/class/corlib/System.Security/SecurityException.cs
+++ b/mcs/class/corlib/System.Security/SecurityException.cs
@@ -1,79 +1,130 @@
-//
-// System.Security.SecurityException.cs
-//
-// Author:
-// Nick Drochak(ndrochak@gol.com)
-//
-// (C) Nick Drochak
-//
-
-using System.Runtime.Serialization;
-using System.Globalization;
-
-namespace System.Security {
- [Serializable]
- public class SecurityException : SystemException {
-
- // Fields
- string permissionState;
- Type permissionType;
-
- // Properties
- public string PermissionState
- {
- get { return permissionState; }
- }
-
- public Type PermissionType
- {
- get { return permissionType; }
- }
-
- // Constructors
- public SecurityException ()
- : base (Locale.GetText ("A security error has been detected."))
- {
- }
-
- public SecurityException (string message)
- : base (message)
- {
- }
-
- protected SecurityException (SerializationInfo info, StreamingContext context)
- : base (info, context)
- {
- permissionState = info.GetString ("permissionState");
- }
-
- public SecurityException (string message, Exception inner)
- : base (message, inner)
- {
- }
-
- public SecurityException (string message, Type type)
- : base (message)
- {
- permissionType = type;
- }
-
- public SecurityException (string message, Type type, string state)
- : base (message)
- {
- permissionType = type;
- permissionState = state;
- }
-
- // Methods
- public override void GetObjectData (SerializationInfo info, StreamingContext context)
- {
- base.GetObjectData (info, context);
- info.AddValue ("PermissionState", permissionState);
- }
-
- public override string ToString ()
- {
- return permissionType.FullName + ": " + permissionState;
- }
- }
-}
+//
+// System.Security.SecurityException.cs
+//
+// Authors:
+// Nick Drochak(ndrochak@gol.com)
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) Nick Drochak
+// (C) 2004 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using System.Runtime.Serialization;
+using System.Globalization;
+using System.Text;
+
+namespace System.Security {
+
+ [Serializable]
+ public class SecurityException : SystemException {
+
+ // Fields
+ string permissionState;
+ Type permissionType;
+ private string _granted;
+ private string _refused;
+
+ // Properties
+ public string PermissionState
+ {
+ get { return permissionState; }
+ }
+
+ public Type PermissionType
+ {
+ get { return permissionType; }
+ }
+#if ! NET_1_0
+ public string GrantedSet {
+ get { return _granted; }
+ }
+
+ public string RefusedSet {
+ get { return _refused; }
+ }
+#endif
+ // Constructors
+ public SecurityException ()
+ : base (Locale.GetText ("A security error has been detected."))
+ {
+ base.HResult = unchecked ((int)0x8013150A);
+ }
+
+ public SecurityException (string message)
+ : base (message)
+ {
+ base.HResult = unchecked ((int)0x8013150A);
+ }
+
+ protected SecurityException (SerializationInfo info, StreamingContext context)
+ : base (info, context)
+ {
+ base.HResult = unchecked ((int)0x8013150A);
+ permissionState = info.GetString ("permissionState");
+ }
+
+ public SecurityException (string message, Exception inner)
+ : base (message, inner)
+ {
+ base.HResult = unchecked ((int)0x8013150A);
+ }
+
+ public SecurityException (string message, Type type)
+ : base (message)
+ {
+ base.HResult = unchecked ((int)0x8013150A);
+ permissionType = type;
+ }
+
+ public SecurityException (string message, Type type, string state)
+ : base (message)
+ {
+ base.HResult = unchecked ((int)0x8013150A);
+ permissionType = type;
+ permissionState = state;
+ }
+
+ internal SecurityException (string message, PermissionSet granted, PermissionSet refused)
+ : base (message)
+ {
+ base.HResult = unchecked ((int)0x8013150A);
+ _granted = granted.ToString ();
+ _refused = refused.ToString ();
+ }
+
+ // Methods
+ public override void GetObjectData (SerializationInfo info, StreamingContext context)
+ {
+ base.GetObjectData (info, context);
+ info.AddValue ("PermissionState", permissionState);
+ }
+
+ public override string ToString ()
+ {
+ StringBuilder sb = new StringBuilder (base.ToString ());
+ if (permissionState != null) {
+ sb.Append (Environment.NewLine);
+ sb.Append ("State: ");
+ sb.Append (permissionState);
+ }
+ if (permissionType != null) {
+ sb.Append (Environment.NewLine);
+ sb.Append ("Type: ");
+ sb.Append (permissionType.ToString ());
+ }
+#if ! NET_1_0
+ if (_granted != null) {
+ sb.Append (Environment.NewLine);
+ sb.Append ("Granted: ");
+ sb.Append (_granted.ToString ());
+ }
+ if (_refused != null) {
+ sb.Append (Environment.NewLine);
+ sb.Append ("Refused: ");
+ sb.Append (_refused.ToString ());
+ }
+#endif
+ return sb.ToString ();
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Security/SecurityManager.cs b/mcs/class/corlib/System.Security/SecurityManager.cs
index c07ab91a446..c0238669582 100644
--- a/mcs/class/corlib/System.Security/SecurityManager.cs
+++ b/mcs/class/corlib/System.Security/SecurityManager.cs
@@ -1,62 +1,120 @@
//
// System.Security.SecurityManager.cs
//
-// Author:
+// Authors:
// Nick Drochak(ndrochak@gol.com)
+// Sebastien Pouliot (spouliot@motus.com)
//
// (C) Nick Drochak
+// Portions (C) 2004 Motus Technologies Inc. (http://www.motus.com)
//
-using System.Security.Policy;
using System.Collections;
+using System.Globalization;
+using System.IO;
+using System.Security.Permissions;
+using System.Security.Policy;
+
+using Mono.Xml;
namespace System.Security {
+ // Note: Using [SecurityPermissionAttribute] would be cool but triggers an error
+ // as you can't reference a custom security attribute from it's own assembly (CS0647)
+
public sealed class SecurityManager {
private static bool checkExecutionRights;
private static bool securityEnabled;
+ private static object _lockObject;
+ private static ArrayList _hierarchy;
+
+ static SecurityManager ()
+ {
+ // lock(this) is bad
+ // http://msdn.microsoft.com/library/en-us/dnaskdr/html/askgui06032003.asp?frame=true
+ _lockObject = new object ();
+ }
private SecurityManager () {}
+ // properties
+
public static bool CheckExecutionRights {
get { return checkExecutionRights; }
- set { checkExecutionRights = value; }
+ set {
+ // throw a SecurityException if we don't have ControlPolicy permission
+ new SecurityPermission (SecurityPermissionFlag.ControlPolicy).Demand ();
+ checkExecutionRights = value;
+ }
}
public static bool SecurityEnabled {
get { return securityEnabled; }
- set { securityEnabled = value; }
+ set {
+ // throw a SecurityException if we don't have ControlPolicy permission
+ new SecurityPermission (SecurityPermissionFlag.ControlPolicy).Demand ();
+ securityEnabled = value;
+ }
}
+ // methods
+
[MonoTODO("Incomplete")]
public static bool IsGranted (IPermission perm)
{
if (perm == null)
- return false;
+ return true;
if (!securityEnabled)
return true;
return false;
}
- [MonoTODO()]
public static PolicyLevel LoadPolicyLevelFromFile (string path, PolicyLevelType type)
{
- return null;
+ // throw a SecurityException if we don't have ControlPolicy permission
+ new SecurityPermission (SecurityPermissionFlag.ControlPolicy).Demand ();
+
+ if (path == null)
+ throw new ArgumentNullException ("path");
+
+ PolicyLevel pl = null;
+ try {
+ pl = new PolicyLevel (type.ToString ());
+ pl.LoadFromFile (path);
+ }
+ catch (Exception e) {
+ throw new ArgumentException (Locale.GetText ("Invalid policy XML"), e);
+ }
+ return pl;
}
- [MonoTODO()]
public static PolicyLevel LoadPolicyLevelFromString (string str, PolicyLevelType type)
{
+ // throw a SecurityException if we don't have ControlPolicy permission
+ new SecurityPermission (SecurityPermissionFlag.ControlPolicy).Demand ();
+
if (null == str)
- throw new ArgumentNullException("str");
- return null;
+ throw new ArgumentNullException ("str");
+
+ PolicyLevel pl = null;
+ try {
+ pl = new PolicyLevel (type.ToString ());
+ pl.LoadFromString (str);
+ }
+ catch (Exception e) {
+ throw new ArgumentException (Locale.GetText ("Invalid policy XML"), e);
+ }
+ return pl;
}
- [MonoTODO()]
+ [MonoTODO("InitializePolicyHierarchy isn't complete")]
public static IEnumerator PolicyHierarchy ()
{
- return null;
+ // throw a SecurityException if we don't have ControlPolicy permission
+ new SecurityPermission (SecurityPermissionFlag.ControlPolicy).Demand ();
+
+ return Hierarchy;
}
[MonoTODO()]
@@ -78,10 +136,56 @@ namespace System.Security {
return null;
}
- [MonoTODO()]
- public static void SavePolicy () {}
+ [MonoTODO ("InternalSavePolicyLevel isn't complete")]
+ public static void SavePolicy ()
+ {
+ // throw a SecurityException if we don't have ControlPolicy permission
+ new SecurityPermission (SecurityPermissionFlag.ControlPolicy).Demand ();
+
+ IEnumerator e = Hierarchy;
+ while (e.MoveNext ()) {
+ PolicyLevel level = (e.Current as PolicyLevel);
+ InternalSavePolicyLevel (level);
+ }
+ }
- [MonoTODO()]
- public static void SavePolicyLevel (PolicyLevel level) {}
+ [MonoTODO ("InternalSavePolicyLevel isn't complete")]
+ public static void SavePolicyLevel (PolicyLevel level)
+ {
+ // throw a SecurityException if we don't have ControlPolicy permission
+ new SecurityPermission (SecurityPermissionFlag.ControlPolicy).Demand ();
+
+ InternalSavePolicyLevel (level);
+ }
+
+ // internal stuff
+
+ internal static IEnumerator Hierarchy {
+ get {
+ if (_hierarchy == null) {
+ lock (_lockObject) {
+ InitializePolicyHierarchy ();
+ }
+ }
+ return _hierarchy.GetEnumerator ();
+ }
+ }
+
+ internal static void InternalSavePolicyLevel (PolicyLevel level)
+ {
+ // without the security checks (to avoid checks in loops)
+ }
+
+ [MonoTODO ("Incomplete")]
+ internal static void InitializePolicyHierarchy ()
+ {
+ ArrayList al = new ArrayList ();
+ // minimum: Machine, Enterprise and User
+ // FIXME: Incomplete
+ al.Add (new PolicyLevel ("Enterprise"));
+ al.Add (new PolicyLevel ("Machine"));
+ al.Add (new PolicyLevel ("User"));
+ _hierarchy = ArrayList.Synchronized (al);
+ }
}
}
diff --git a/mcs/class/corlib/System.Security/SecurityZone.cs b/mcs/class/corlib/System.Security/SecurityZone.cs
index 68a7014d5d4..c1853db90db 100644
--- a/mcs/class/corlib/System.Security/SecurityZone.cs
+++ b/mcs/class/corlib/System.Security/SecurityZone.cs
@@ -1,20 +1,21 @@
-//
-// System.Security.SecurityZone.cs
-//
-// Author:
-// Nick Drochak(ndrochak@gol.com)
-//
-// (C) Nick Drochak
-//
-
-namespace System.Security {
-
- public enum SecurityZone {
- MyComputer = 0x0,
- Intranet,
- Trusted,
- Internet,
- Untrusted,
- NoZone = -1,
- }
-}
+//
+// System.Security.SecurityZone.cs
+//
+// Author:
+// Nick Drochak(ndrochak@gol.com)
+//
+// (C) Nick Drochak
+//
+
+namespace System.Security {
+
+ [Serializable]
+ public enum SecurityZone {
+ MyComputer = 0x0,
+ Intranet,
+ Trusted,
+ Internet,
+ Untrusted,
+ NoZone = -1,
+ }
+}
diff --git a/mcs/class/corlib/System.Security/SuppressUnmanagedCodeSecurityAttribute.cs b/mcs/class/corlib/System.Security/SuppressUnmanagedCodeSecurityAttribute.cs
index 58ac28dcec5..8c45aafa5aa 100644
--- a/mcs/class/corlib/System.Security/SuppressUnmanagedCodeSecurityAttribute.cs
+++ b/mcs/class/corlib/System.Security/SuppressUnmanagedCodeSecurityAttribute.cs
@@ -1,15 +1,15 @@
-//
-// System.Security.SuppressUnmanagedCodeSecurityAttribute.cs
-//
-// Author:
-// Nick Drochak(ndrochak@gol.com)
-//
-// (C) Nick Drochak
-//
-
-namespace System.Security {
-
- [AttributeUsage (AttributeTargets.Class | AttributeTargets.Method |
- AttributeTargets.Interface)]
- public sealed class SuppressUnmanagedCodeSecurityAttribute : Attribute {}
-}
+//
+// System.Security.SuppressUnmanagedCodeSecurityAttribute.cs
+//
+// Author:
+// Nick Drochak(ndrochak@gol.com)
+//
+// (C) Nick Drochak
+//
+
+namespace System.Security {
+
+ [AttributeUsage (AttributeTargets.Class | AttributeTargets.Method |
+ AttributeTargets.Interface, AllowMultiple=true, Inherited=false)]
+ public sealed class SuppressUnmanagedCodeSecurityAttribute : Attribute {}
+}
diff --git a/mcs/class/corlib/System.Security/UnverifiableCodeAttribute.cs b/mcs/class/corlib/System.Security/UnverifiableCodeAttribute.cs
index 6cfb5bda372..3923cbc01e4 100644
--- a/mcs/class/corlib/System.Security/UnverifiableCodeAttribute.cs
+++ b/mcs/class/corlib/System.Security/UnverifiableCodeAttribute.cs
@@ -1,14 +1,14 @@
-//
-// System.Security.UnverifiableCodeAttribute.cs
-//
-// Author:
-// Nick Drochak(ndrochak@gol.com)
-//
-// (C) Nick Drochak
-//
-
-namespace System.Security {
-
- [AttributeUsage (AttributeTargets.Module)]
- public sealed class UnverifiableCodeAttribute : Attribute {}
-}
+//
+// System.Security.UnverifiableCodeAttribute.cs
+//
+// Author:
+// Nick Drochak(ndrochak@gol.com)
+//
+// (C) Nick Drochak
+//
+
+namespace System.Security {
+
+ [AttributeUsage (AttributeTargets.Module, AllowMultiple=true, Inherited=false)]
+ public sealed class UnverifiableCodeAttribute : Attribute {}
+}
diff --git a/mcs/class/corlib/System.Text/ChangeLog b/mcs/class/corlib/System.Text/ChangeLog
index a2892cd1550..28e7c9c2578 100755
--- a/mcs/class/corlib/System.Text/ChangeLog
+++ b/mcs/class/corlib/System.Text/ChangeLog
@@ -1,3 +1,22 @@
+2004-01-23 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * StringBuilder.cs:
+ (Remove): fixed offsets when copying and set the new size. Fixes bug
+ #53240.
+
+2004-01-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * StringBuilder.cs: added checks for null in a few Append methods.
+
+Tue Jan 13 22:23:25 CET 2004 Paolo Molaro <lupus@ximian.com>
+
+ * StringBuilder.cs: fixed start offset in Append(char).
+
+2004-01-12 Patrik Torstensson
+
+ * StringBuilder.cs: new implementation that uses
+ string as a buffer instead of a array of chars.
+
2003-12-07 Ben Maurer <bmaurer@users.sourceforge.net>
* UTF8Encoding.cs (GetBytes string): Do not call base
diff --git a/mcs/class/corlib/System.Text/StringBuilder.cs b/mcs/class/corlib/System.Text/StringBuilder.cs
index 8ce8960d624..ec336e58485 100644
--- a/mcs/class/corlib/System.Text/StringBuilder.cs
+++ b/mcs/class/corlib/System.Text/StringBuilder.cs
@@ -1,669 +1,634 @@
-// -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
-//
-// System.Text.StringBuilder
-//
-// Authors:
-// Marcin Szczepanski (marcins@zipworld.com.au)
-// Paolo Molaro (lupus@ximian.com)
-//
-// TODO: Make sure the coding complies to the ECMA draft, there's some
-// variable names that probably don't (like sString)
-//
-// NOTE: the string returned by ToString() is cached in the 'thestring'
-// member: if you change/add a method that modifies the stringbuilder, make
-// sure thestring is set to null (to invalidate the cache).
-using System.Runtime.CompilerServices;
-
-namespace System.Text {
-
- [Serializable]
- public sealed class StringBuilder {
-
- private const int defaultCapacity = 16;
-
- private int sCapacity;
- private int sLength;
- private char[] sString;
- private int sMaxCapacity = Int32.MaxValue;
- string thestring;
-
- public StringBuilder(string value, int startIndex, int length, int capacity) {
- // first, check the parameters and throw appropriate exceptions if needed
- if(null==value)
- value = "";
-
- // make sure startIndex is zero or positive
- if(startIndex < 0) {
- throw new System.ArgumentOutOfRangeException("startIndex", startIndex, "StartIndex cannot be less than zero.");
- }
-
- // make sure length is zero or positive
- if(length < 0) {
- throw new System.ArgumentOutOfRangeException("length", length, "Length cannot be less than zero.");
- }
-
- if (capacity < 0)
- throw new System.ArgumentOutOfRangeException ("capacity", capacity, "capacity must be greater than zero.");
-
- // make sure startIndex and length give a valid substring of value
- if(startIndex + (length -1) > (value.Length - 1) ) {
- throw new System.ArgumentOutOfRangeException("startIndex", startIndex, "StartIndex and length must refer to a location within the string.");
- }
-
- if (capacity == 0)
- sCapacity = defaultCapacity;
- else
- sCapacity = capacity;
-
- // LAMESPEC: what to do if capacity is too small to hold the substring?
- // Like the MS implementation, double the capacity until it is large enough
- while (sCapacity < length) {
- // However, take care not to double if that would make the number
- // larger than what an int can hold
- if (sCapacity <= Int32.MaxValue / 2) {
- sCapacity *= 2;
- }
- else{
- sCapacity = Int32.MaxValue;
- }
- }
-
- sString = new char[sCapacity];
- sLength = length;
-
- // if the length is not zero, then we have to copy some characters
- if (sLength > 0) {
- // Copy the correct number of characters into the internal array
- value.CopyTo (startIndex, sString, 0, sLength);
- }
- }
-
- public StringBuilder () : this(String.Empty, 0, 0, 0) {}
-
- public StringBuilder( int capacity ) : this(String.Empty, 0, 0, capacity) {}
-
- public StringBuilder( int capacity, int maxCapacity ) : this(String.Empty, 0, 0, capacity) {
- if(capacity > maxCapacity) {
- throw new System.ArgumentOutOfRangeException("capacity", "Capacity exceeds maximum capacity.");
- }
- sMaxCapacity = maxCapacity;
- }
-
- public StringBuilder( string value ) : this(value, 0, value == null ? 0 : value.Length, value == null? 0 : value.Length) {
- }
-
- public StringBuilder( string value, int capacity) : this(value, 0, value.Length, capacity) {}
-
- public int MaxCapacity {
- get {
- // MS runtime always returns Int32.MaxValue.
- return sMaxCapacity;
- }
- }
-
- public int Capacity {
- get {
- return sCapacity;
- }
-
- set {
- if( value < sLength ) {
- throw new ArgumentException( "Capacity must be > length" );
- } else {
- char[] tString = new char[value];
- Array.Copy( sString, tString, sLength );
- sString = tString;
- sCapacity = sString.Length;
- }
- }
- }
-
-
- public int Length {
- get {
- return sLength;
- }
-
- set {
- if( value < 0 || value > MaxCapacity) {
- throw new ArgumentOutOfRangeException();
- } else {
-
- if( value < sLength ) {
- // Truncate current string at value
-
- // LAMESPEC: The spec is unclear as to what to do
- // with the capacity when truncating the string.
- //
- // Don't change the capacity, as this is what
- // the MS implementation does.
-
- sLength = value;
- thestring = null;
- } else {
- // Expand the capacity to the new length and
- // pad the string with spaces.
-
- // LAMESPEC: The spec says to put the spaces on the
- // left of the string however the MS implementation
- // puts them on the right. We'll do that for
- // compatibility (!)
-
- char[] tString = new char[ value ];
- int padLength = value - sLength;
-
- string padding = new String( ' ', padLength );
- Array.Copy( sString, tString, sLength );
- padding.CopyTo (0, tString, sLength, padLength);
- sString = tString;
- sLength = sString.Length;
- sCapacity = value;
- }
- }
- }
- }
-
- [IndexerName("Chars")]
- public char this[ int index ] {
- get {
-
- if( index >= sLength || index < 0 ) {
- throw new IndexOutOfRangeException();
- }
- return sString[ index ];
- }
-
- set {
- if( index >= sLength || index < 0 ) {
- throw new IndexOutOfRangeException();
- }
- sString[ index ] = value;
- thestring = null;
- }
- }
-
- public override string ToString() {
- if (thestring != null)
- return thestring;
- return (thestring = ToString(0, sLength));
- }
-
- public string ToString( int startIndex, int length ) {
- if( startIndex < 0 || length < 0 || startIndex + length > sLength ) {
- throw new ArgumentOutOfRangeException();
- }
-
- return new String( sString, startIndex, length );
- }
-
- public int EnsureCapacity( int capacity ) {
- if( capacity < 0 ) {
- throw new ArgumentOutOfRangeException(
- "Capacity must be greater than 0." );
- }
-
- if( capacity <= sCapacity ) {
- return sCapacity;
- } else {
- Capacity = capacity;
- return sCapacity;
- }
- }
-
- public bool Equals( StringBuilder sb ) {
- if(sLength == sb.Length && this.ToString() == sb.ToString() ) {
- return true;
- } else {
- return false;
- }
- }
-
- public StringBuilder Remove (int startIndex, int length)
- {
- if( startIndex < 0 || length < 0 || startIndex + length > sLength )
- throw new ArgumentOutOfRangeException();
-
- // Copy everything after the 'removed' part to the start
- // of the removed part and truncate the sLength
-
- Array.Copy (sString, startIndex + length, sString, startIndex,
- sLength - (startIndex + length));
-
- sLength -= length;
- thestring = null;
- return this;
- }
-
- public StringBuilder Replace( char oldChar, char newChar ) {
-
- return Replace( oldChar, newChar, 0, sLength);
- }
-
- public StringBuilder Replace( char oldChar, char newChar, int startIndex, int count ) {
- if( startIndex + count > sLength || startIndex < 0 || count < 0 ) {
- throw new ArgumentOutOfRangeException();
- }
-
- for( int replaceIterate = startIndex; replaceIterate < startIndex + count; replaceIterate++ ) {
- if( this[replaceIterate] == oldChar ) {
- this[replaceIterate] = newChar;
- }
- }
-
- thestring = null;
- return this;
- }
-
- public StringBuilder Replace( string oldValue, string newValue ) {
- return Replace( oldValue, newValue, 0, sLength );
- }
-
- public StringBuilder Replace( string oldValue, string newValue, int startIndex, int count ) {
- string startString = this.ToString();
- StringBuilder newStringB = new StringBuilder();
-
- if( oldValue == null ) {
- throw new ArgumentNullException(
- "The old value cannot be null.");
- }
-
- if( startIndex < 0 || count < 0 || startIndex + count > sLength ) {
- throw new ArgumentOutOfRangeException();
- }
-
- if( oldValue.Length == 0 ) {
- throw new ArgumentException(
- "The old value cannot be zero length.");
- }
-
- int nextIndex = startIndex; // Where to start the next search
- int lastIndex = startIndex; // Where the last search finished
-
- while( nextIndex != -1 ) {
- nextIndex = startString.IndexOf( oldValue, lastIndex);
- if( nextIndex != -1 ) {
- // The MS implementation won't replace a substring
- // if that substring goes over the "count"
- // boundary, so we'll make sure the behaviour
- // here is the same.
-
- if( nextIndex + oldValue.Length <= startIndex + count ) {
-
- // Add everything to the left of the old
- // string
- if (lastIndex == startIndex) // don't lose the beginning
- lastIndex = 0;
-
- newStringB.Append( startString.Substring( lastIndex, nextIndex - lastIndex ) );
-
- // Add the replacement string
- newStringB.Append( newValue );
-
- // Set the next start point to the
- // end of the last match
- lastIndex = nextIndex + oldValue.Length;
- } else {
- // We're past the "count" we're supposed to replace within
- nextIndex = -1;
- newStringB.Append(
- startString.Substring( lastIndex ) );
- }
-
- } else {
- // Append everything left over
- newStringB.Append( startString.Substring( lastIndex ) );
- }
- }
-
- sCapacity = newStringB.sCapacity;
- sString = newStringB.sString;
- sLength = newStringB.sLength;
- thestring = null;
- return this;
- }
-
-
- /* The Append Methods */
-
- public StringBuilder Append( char[] value ) {
- if( sLength + value.Length > sCapacity ) {
- // Need more capacity, double the capacity StringBuilder
- // and make sure we have at least enough for the value
- // if that's going to go over double.
-
- Capacity = value.Length + ( sCapacity + sCapacity);
- }
-
- Array.Copy( value, 0, sString, sLength, value.Length );
- sLength += value.Length;
-
- thestring = null;
- return this;
- }
-
- public StringBuilder Append( string value ) {
- if( value != null ) {
- int new_size = sLength + value.Length;
- if (new_size > sCapacity)
- Capacity = value.Length + sCapacity * 2;
-
- value.CopyTo (0, sString, sLength, value.Length);
- sLength = new_size;
- thestring = null;
- return this;
- } else {
- return null;
- }
- }
-
- public StringBuilder Append( bool value ) {
- return Append (value.ToString());
- }
-
- public StringBuilder Append( byte value ) {
- return Append (value.ToString());
- }
-
- public StringBuilder Append( decimal value ) {
- return Append (value.ToString());
- }
-
- public StringBuilder Append( double value ) {
- return Append (value.ToString());
- }
-
- public StringBuilder Append( short value ) {
- return Append (value.ToString());
- }
-
- public StringBuilder Append( int value ) {
- return Append (value.ToString());
- }
-
- public StringBuilder Append( long value ) {
- return Append (value.ToString());
- }
-
- public StringBuilder Append( object value ) {
- return Append (value.ToString());
- }
-
- [CLSCompliant(false)]
- public StringBuilder Append( sbyte value ) {
- return Append (value.ToString());
- }
-
- public StringBuilder Append( float value ) {
- return Append (value.ToString());
- }
-
- [CLSCompliant(false)]
- public StringBuilder Append( ushort value ) {
- return Append (value.ToString());
- }
-
- [CLSCompliant(false)]
- public StringBuilder Append( uint value ) {
- return Append (value.ToString());
- }
-
- [CLSCompliant(false)]
- public StringBuilder Append( ulong value ) {
- return Append (value.ToString());
- }
-
- public StringBuilder Append( char value ) {
- if( sLength + 1 > sCapacity ) {
- // Need more capacity, double the capacity StringBuilder
- // and make sure we have at least enough for the value
- // if that's going to go over double.
-
- Capacity = 1 + ( sCapacity + sCapacity);
- }
- sString [sLength] = value;
- sLength++;
- thestring = null;
-
- return this;
- }
-
- public StringBuilder Append( char value, int repeatCount ) {
- if( repeatCount < 0 ) {
- throw new ArgumentOutOfRangeException();
+// -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+//
+// System.Text.StringBuilder
+//
+// Authors:
+// Marcin Szczepanski (marcins@zipworld.com.au)
+// Paolo Molaro (lupus@ximian.com)
+// Patrik Torstensson
+//
+// NOTE: In the case the buffer is only filled by 50% a new string
+// will be returned by ToString() is cached in the '_cached_str'
+// cache_string will also control if a string has been handed out
+// to via ToString(). If you are chaning the code make sure that
+// if you modify the string data set the cache_string to null.
+//
+using System.Runtime.CompilerServices;
+
+namespace System.Text {
+
+ [Serializable]
+ public sealed class StringBuilder
+ {
+ private int _length;
+ private string _str = null;
+ private string _cached_str = null;
+
+ private int _maxCapacity = Int32.MaxValue;
+ private const int constDefaultCapacity = 16;
+
+ public StringBuilder(string value, int startIndex, int length, int capacity)
+ {
+ // first, check the parameters and throw appropriate exceptions if needed
+ if (null == value)
+ value = "";
+
+ // make sure startIndex is zero or positive
+ if (startIndex < 0)
+ throw new System.ArgumentOutOfRangeException ("startIndex", startIndex, "StartIndex cannot be less than zero.");
+
+ // make sure length is zero or positive
+ if(length < 0)
+ throw new System.ArgumentOutOfRangeException ("length", length, "Length cannot be less than zero.");
+
+ if (capacity < 0)
+ throw new System.ArgumentOutOfRangeException ("capacity", capacity, "capacity must be greater than zero.");
+
+ // make sure startIndex and length give a valid substring of value
+ if (startIndex + (length -1) > (value.Length - 1) )
+ throw new System.ArgumentOutOfRangeException ("startIndex", startIndex, "StartIndex and length must refer to a location within the string.");
+
+ if (capacity == 0)
+ capacity = constDefaultCapacity;
+
+ _str = String.InternalAllocateStr ((length > capacity) ? length : capacity);
+ if (length > 0)
+ String.InternalStrcpy(_str, 0, value, startIndex, length);
+
+ _length = length;
+ }
+
+ public StringBuilder () : this (String.Empty, 0, 0, 0) {}
+
+ public StringBuilder(int capacity) : this (String.Empty, 0, 0, capacity) {}
+
+ public StringBuilder(int capacity, int maxCapacity) : this (String.Empty, 0, 0, capacity) {
+ if (capacity > maxCapacity)
+ throw new System.ArgumentOutOfRangeException ("capacity", "Capacity exceeds maximum capacity.");
+
+ _maxCapacity = maxCapacity;
+ }
+
+ public StringBuilder( string value ) : this(value, 0, value == null ? 0 : value.Length, value == null? 0 : value.Length) {
+ }
+
+ public StringBuilder( string value, int capacity) : this(value, 0, value.Length, capacity) {}
+
+ public int MaxCapacity {
+ get {
+ // MS runtime always returns Int32.MaxValue.
+ return _maxCapacity;
+ }
+ }
+
+ public int Capacity {
+ get {
+ return _str.Length;
+ }
+
+ set {
+ if (value < _length)
+ throw new ArgumentException( "Capacity must be larger than length" );
+
+ InternalEnsureCapacity(value);
}
-
- if( sLength + repeatCount > sCapacity ) {
- // Need more capacity, double the capacity StringBuilder
- // and make sure we have at least enough for the value
- // if that's going to go over double.
-
- Capacity = repeatCount + ( sCapacity + sCapacity);
+ }
+
+ public int Length {
+ get {
+ return _length;
+ }
+
+ set {
+ if( value < 0 || value > _maxCapacity)
+ throw new ArgumentOutOfRangeException();
+
+ if (value == _length)
+ return;
+
+ if( value < _length )
+ {
+ // LAMESPEC: The spec is unclear as to what to do
+ // with the capacity when truncating the string.
+
+ // Do as MS, keep the capacity
+ _length = value;
+ } else
+ {
+ // Expand the capacity to the new length and
+ // pad the string with spaces.
+
+ // LAMESPEC: The spec says to put the spaces on the
+ // left of the string however the MS implementation
+ // puts them on the right. We'll do that for
+ // compatibility (!)
+ Append(' ', value - _length);
+ }
}
+ }
+
+ [IndexerName("Chars")]
+ public char this [int index] {
+ get {
+ if (index >= _length || index < 0)
+ throw new IndexOutOfRangeException();
+
+ return _str [index];
+ }
+
+ set {
+ if (index >= _length || index < 0)
+ throw new IndexOutOfRangeException();
+
+ if (null != _cached_str)
+ InternalEnsureCapacity (_length);
+
+ _str.InternalSetChar (index, value);
+ }
+ }
+
+ public override string ToString ()
+ {
+ if (_length == 0)
+ return String.Empty;
+
+ if (null != _cached_str)
+ return _cached_str;
+
+ // If we only have a half-full buffer we return a new string.
+ if (_length < (_str.Length >> 1))
+ {
+ _cached_str = _str.Substring(0, _length);
+ return _cached_str;
+ }
+
+ _cached_str = _str;
+ _str.InternalSetLength(_length);
+
+ return _str;
+ }
+
+ public string ToString (int startIndex, int length)
+ {
+ if( startIndex < 0 || length < 0 || startIndex + length > _length )
+ throw new ArgumentOutOfRangeException();
+
+ return _str.Substring (startIndex, length);
+ }
+
+ public int EnsureCapacity (int capacity)
+ {
+ if (capacity < 0)
+ throw new ArgumentOutOfRangeException ("Capacity must be greater than 0." );
+
+ if( capacity <= _str.Length )
+ return _str.Length;
+
+ InternalEnsureCapacity (capacity);
+
+ return _str.Length;
+ }
+
+ public bool Equals (StringBuilder sb)
+ {
+ if (_length == sb.Length && _str == sb._str )
+ return true;
+
+ return false;
+ }
+
+ public StringBuilder Remove (int startIndex, int length)
+ {
+ if( startIndex < 0 || length < 0 || startIndex + length > _length )
+ throw new ArgumentOutOfRangeException();
+
+ // Copy everything after the 'removed' part to the start
+ // of the removed part and truncate the sLength
+ if (_length - (startIndex + length) > 0)
+ String.InternalStrcpy (_str, startIndex, _str, startIndex + length, _length - (startIndex + length));
+
+ _length -= length;
+ if (null != _cached_str)
+ InternalEnsureCapacity (_length);
+
+ return this;
+ }
+
+ public StringBuilder Replace (char oldChar, char newChar)
+ {
+ return Replace( oldChar, newChar, 0, _length);
+ }
+
+ public StringBuilder Replace (char oldChar, char newChar, int startIndex, int count)
+ {
+ if( startIndex + count > _length || startIndex < 0 || count < 0 )
+ throw new ArgumentOutOfRangeException();
+
+ if (null != _cached_str)
+ InternalEnsureCapacity (_str.Length);
+
+ for (int replaceIterate = startIndex; replaceIterate < startIndex + count; replaceIterate++ ) {
+ if( _str [replaceIterate] == oldChar )
+ _str.InternalSetChar (replaceIterate, newChar);
+ }
+
+ return this;
+ }
+
+ public StringBuilder Replace( string oldValue, string newValue ) {
+ return Replace (oldValue, newValue, 0, _length);
+ }
+
+ public StringBuilder Replace( string oldValue, string newValue, int startIndex, int count )
+ {
+ if (oldValue == null)
+ throw new ArgumentNullException ("The old value cannot be null.");
+
+ if (startIndex < 0 || count < 0 || startIndex + count > _length)
+ throw new ArgumentOutOfRangeException ();
+
+ if (oldValue.Length == 0)
+ throw new ArgumentException ("The old value cannot be zero length.");
+
+ // TODO: OPTIMIZE!
+ string replace = _str.Substring(startIndex, count).Replace(oldValue, newValue);
+
+ InternalEnsureCapacity (replace.Length + (_length - count));
+
+ String.InternalStrcpy (_str, startIndex, replace);
+
+ _length = replace.Length + (_length - count);
+
+ return this;
+ }
+
+
+ /* The Append Methods */
+ public StringBuilder Append (char[] value)
+ {
+ if (value == null)
+ return this;
+
+ int needed_cap = _length + value.Length;
+ if (null != _cached_str || _str.Length < needed_cap)
+ InternalEnsureCapacity (needed_cap);
+
+ for (int i = 0; i != value.Length; i++)
+ _str.InternalSetChar (i + _length, value[i]);
+
+ _length += value.Length;
+
+ return this;
+ }
+
+ public StringBuilder Append (string value)
+ {
+ if (value == null)
+ return this;
+
+ int needed_cap = _length + value.Length;
+ if (null != _cached_str || _str.Length < needed_cap)
+ InternalEnsureCapacity (needed_cap);
+
+ if (value != null)
+ {
+ String.InternalStrcpy (_str, _length, value);
+ _length += value.Length;
+ }
+
+ return this;
+ }
+
+ public StringBuilder Append (bool value) {
+ return Append (value.ToString());
+ }
+
+ public StringBuilder Append (byte value) {
+ return Append (value.ToString());
+ }
+
+ public StringBuilder Append (decimal value) {
+ return Append (value.ToString());
+ }
+
+ public StringBuilder Append (double value) {
+ return Append (value.ToString());
+ }
+
+ public StringBuilder Append (short value) {
+ return Append (value.ToString());
+ }
+
+ public StringBuilder Append (int value) {
+ return Append (value.ToString());
+ }
+
+ public StringBuilder Append (long value) {
+ return Append (value.ToString());
+ }
+
+ public StringBuilder Append (object value) {
+ if (value == null)
+ return this;
+
+ return Append (value.ToString());
+ }
+
+ [CLSCompliant(false)]
+ public StringBuilder Append (sbyte value) {
+ return Append (value.ToString());
+ }
+
+ public StringBuilder Append (float value) {
+ return Append (value.ToString());
+ }
+
+ [CLSCompliant(false)]
+ public StringBuilder Append (ushort value) {
+ return Append (value.ToString());
+ }
+
+ [CLSCompliant(false)]
+ public StringBuilder Append (uint value) {
+ return Append (value.ToString());
+ }
+
+ [CLSCompliant(false)]
+ public StringBuilder Append (ulong value) {
+ return Append (value.ToString());
+ }
+
+ public StringBuilder Append (char value)
+ {
+ int needed_cap = _length + 1;
+ if (null != _cached_str || _str.Length < needed_cap)
+ InternalEnsureCapacity (needed_cap);
+
+ _str.InternalSetChar(_length, value);
+ _length++;
+
+ return this;
+ }
+
+ public StringBuilder Append (char value, int repeatCount)
+ {
+ if( repeatCount < 0 )
+ throw new ArgumentOutOfRangeException();
+
+ InternalEnsureCapacity (_length + repeatCount);
for (int i = 0; i < repeatCount; i++)
- sString [sLength++] = value;
+ _str.InternalSetChar (_length++, value);
+
+ return this;
+ }
+
+ public StringBuilder Append( char[] value, int startIndex, int charCount )
+ {
+ if (value == null) {
+ if (!(startIndex == 0 && charCount == 0))
+ throw new ArgumentNullException ("value");
+
+ return this;
+ }
+
+ if ((charCount < 0 || startIndex < 0) || (charCount + startIndex > value.Length))
+ throw new ArgumentOutOfRangeException();
- thestring = null;
- return this;
- }
-
- public StringBuilder Append( char[] value, int startIndex, int charCount ) {
-
- if( (charCount < 0 || startIndex < 0) ||
- ( charCount + startIndex > value.Length ) ) {
- throw new ArgumentOutOfRangeException();
- }
-
- if( value == null ) {
- if( !(startIndex == 0 && charCount == 0) ) {
- throw new ArgumentNullException();
- } else {
- return this;
- }
- } else {
- char[] appendChars = new char[ charCount ];
-
- Array.Copy( value, startIndex, appendChars, 0, charCount );
- return Append( appendChars );
- }
- }
-
- public StringBuilder Append( string value, int startIndex, int count ) {
- if( (count < 0 || startIndex < 0) ||
- ( startIndex + count > value.Length ) ) {
- throw new ArgumentOutOfRangeException();
+
+ InternalEnsureCapacity (_length + charCount);
+
+ int endPos = charCount + startIndex;
+ for (int i = startIndex; i != endPos; i++)
+ _str.InternalSetChar (_length++, value[i]);
+
+ return this;
+ }
+
+ public StringBuilder Append (string value, int startIndex, int count)
+ {
+ if (value == null) {
+ if (startIndex != 0 && count != 0)
+ throw new ArgumentNullException ("value");
+
+ return this;
}
+
+ if ((count < 0 || startIndex < 0) || (startIndex + count > value.Length))
+ throw new ArgumentOutOfRangeException();
- int new_size = sLength + count;
- if (new_size > sCapacity)
- Capacity = count + sCapacity * 2;
-
- value.CopyTo (startIndex, sString, sLength, count);
- sLength = new_size;
- thestring = null;
- return this;
- }
-
- public StringBuilder AppendFormat (string format, object arg0 )
- {
- return AppendFormat (null, format, new object [] { arg0 });
- }
-
- public StringBuilder AppendFormat (string format, params object[] args )
- {
- return AppendFormat (null, format, args);
- }
-
- public StringBuilder AppendFormat (IFormatProvider provider,
- string format,
- params object[] args)
- {
+ int needed_cap = _length + count;
+ if (null != _cached_str || _str.Length < needed_cap)
+ InternalEnsureCapacity (needed_cap);
+
+ String.InternalStrcpy (_str, _length, value, startIndex, count);
+
+ _length += count;
+
+ return this;
+ }
+
+ public StringBuilder AppendFormat (string format, object arg0)
+ {
+ return AppendFormat (null, format, new object [] { arg0 });
+ }
+
+ public StringBuilder AppendFormat (string format, params object[] args)
+ {
+ return AppendFormat (null, format, args);
+ }
+
+ public StringBuilder AppendFormat (IFormatProvider provider,
+ string format,
+ params object[] args)
+ {
String.FormatHelper (this, provider, format, args);
- return this;
- }
-
- public StringBuilder AppendFormat (string format, object arg0, object arg1 )
- {
- return AppendFormat (null, format, new object [] { arg0, arg1 });
- }
-
- public StringBuilder AppendFormat (string format, object arg0, object arg1, object arg2 )
- {
- return AppendFormat (null, format, new object [] { arg0, arg1, arg2 });
- }
-
- /* The Insert Functions */
-
- public StringBuilder Insert( int index, char[] value ) {
- if( index > sLength || index < 0) {
- throw new ArgumentOutOfRangeException();
- }
-
- if( value == null || value.Length == 0 ) {
- return this;
- } else {
- // Check we have the capacity to insert this array
- if( sCapacity < sLength + value.Length ) {
- Capacity = value.Length + ( sCapacity + sCapacity );
- }
-
- // Move everything to the right of the insert point across
- Array.Copy( sString, index, sString, index + value.Length, sLength - index);
-
- // Copy in stuff from the insert buffer
- Array.Copy( value, 0, sString, index, value.Length );
-
- sLength += value.Length;
- thestring = null;
- return this;
- }
- }
-
- public StringBuilder Insert( int index, string value ) {
- if (index > sLength || index < 0)
- throw new ArgumentOutOfRangeException ("index");
-
- if (value == null || value.Length == 0)
- return this;
-
- int len = value.Length;
- // Check we have the capacity to insert this array
- if (sCapacity < sLength + len)
- Capacity = len + ( sCapacity + sCapacity );
-
- // Move everything to the right of the insert point across
- Array.Copy (sString, index, sString, index + len, sLength - index);
-
- value.CopyTo (0, sString, index, len);
-
- sLength += len;
- thestring = null;
- return this;
- }
-
- public StringBuilder Insert( int index, bool value ) {
- return Insert( index, value.ToString());
- }
-
- public StringBuilder Insert( int index, byte value ) {
- return Insert( index, value.ToString());
- }
-
- public StringBuilder Insert( int index, char value) {
- if (index > sLength || index < 0)
+ return this;
+ }
+
+ public StringBuilder AppendFormat (string format, object arg0, object arg1)
+ {
+ return AppendFormat (null, format, new object [] { arg0, arg1 });
+ }
+
+ public StringBuilder AppendFormat (string format, object arg0, object arg1, object arg2)
+ {
+ return AppendFormat (null, format, new object [] { arg0, arg1, arg2 });
+ }
+
+ /* The Insert Functions */
+
+ public StringBuilder Insert (int index, char[] value)
+ {
+ if( index > _length || index < 0)
+ throw new ArgumentOutOfRangeException();
+
+ if (value == null || value.Length == 0)
+ return this;
+
+ InternalEnsureCapacity (_length + value.Length);
+
+ // Move everything to the right of the insert point across
+ String.InternalStrcpy (_str, index + value.Length, _str, index, _length - index);
+
+ // Copy in stuff from the insert buffer
+ String.InternalStrcpy (_str, index, value.ToString());
+
+ _length += value.Length;
+
+ return this;
+ }
+
+ public StringBuilder Insert (int index, string value)
+ {
+ if( index > _length || index < 0)
+ throw new ArgumentOutOfRangeException();
+
+ if (value == null || value.Length == 0)
+ return this;
+
+ InternalEnsureCapacity (_length + value.Length);
+
+ // Move everything to the right of the insert point across
+ String.InternalStrcpy (_str, index + value.Length, _str, index, _length - index);
+
+ // Copy in stuff from the insert buffer
+ String.InternalStrcpy (_str, index, value);
+
+ _length += value.Length;
+
+ return this;
+ }
+
+ public StringBuilder Insert( int index, bool value ) {
+ return Insert (index, value.ToString());
+ }
+
+ public StringBuilder Insert( int index, byte value ) {
+ return Insert (index, value.ToString());
+ }
+
+ public StringBuilder Insert( int index, char value)
+ {
+ if (index > _length || index < 0)
throw new ArgumentOutOfRangeException ("index");
- // Check we have the capacity to insert this array
- if( sCapacity < sLength + 1) {
- Capacity = 1 + ( sCapacity + sCapacity );
- }
+
+ InternalEnsureCapacity (_length + 1);
// Move everything to the right of the insert point across
- Array.Copy( sString, index, sString, index + 1, sLength - index);
+ String.InternalStrcpy (_str, index + 1, _str, index, _length - index);
- sString [index] = value;
- sLength += 1;
- thestring = null;
- return this;
- }
-
- public StringBuilder Insert( int index, decimal value ) {
- return Insert( index, value.ToString() );
- }
-
- public StringBuilder Insert( int index, double value ) {
- return Insert( index, value.ToString() );
- }
-
- public StringBuilder Insert( int index, short value ) {
- return Insert( index, value.ToString() );
- }
-
- public StringBuilder Insert( int index, int value ) {
- return Insert( index, value.ToString() );
- }
-
- public StringBuilder Insert( int index, long value ) {
- return Insert( index, value.ToString() );
- }
-
- public StringBuilder Insert( int index, object value ) {
- return Insert( index, value.ToString() );
- }
-
- [CLSCompliant(false)]
- public StringBuilder Insert( int index, sbyte value ) {
- return Insert( index, value.ToString() );
- }
-
- public StringBuilder Insert( int index, float value ) {
- return Insert( index, value.ToString() );
- }
-
- [CLSCompliant(false)]
- public StringBuilder Insert( int index, ushort value ) {
- return Insert( index, value.ToString() );
- }
-
- [CLSCompliant(false)]
- public StringBuilder Insert( int index, uint value ) {
- return Insert( index, value.ToString() );
- }
-
- [CLSCompliant(false)]
- public StringBuilder Insert( int index, ulong value ) {
- return Insert( index, value.ToString() );
- }
-
- public StringBuilder Insert( int index, string value, int count ) {
- if ( count < 0 ) {
- throw new ArgumentOutOfRangeException();
- }
-
- if( value != null ) {
- if( value != "" ) {
- for( int insertCount = 0; insertCount < count;
- insertCount++ ) {
- Insert( index, value );
- }
- }
- }
- return this;
- }
-
- public StringBuilder Insert( int index, char[] value, int startIndex,
- int charCount ) {
-
- if( value != null ) {
- if( charCount < 0 || startIndex < 0 || startIndex + charCount > value.Length ) {
- throw new ArgumentOutOfRangeException();
- }
-
- char[] insertChars = new char[ charCount ];
- Array.Copy( value, startIndex, insertChars, 0, charCount );
- return Insert( index, insertChars );
- } else {
- return this;
- }
- }
- }
-}
+ _str.InternalSetChar (index, value);
+ _length++;
+
+ return this;
+ }
+
+ public StringBuilder Insert( int index, decimal value ) {
+ return Insert (index, value.ToString());
+ }
+
+ public StringBuilder Insert( int index, double value ) {
+ return Insert (index, value.ToString());
+ }
+
+ public StringBuilder Insert( int index, short value ) {
+ return Insert (index, value.ToString());
+ }
+
+ public StringBuilder Insert( int index, int value ) {
+ return Insert (index, value.ToString());
+ }
+
+ public StringBuilder Insert( int index, long value ) {
+ return Insert (index, value.ToString());
+ }
+
+ public StringBuilder Insert( int index, object value ) {
+ return Insert (index, value.ToString());
+ }
+
+ [CLSCompliant(false)]
+ public StringBuilder Insert( int index, sbyte value ) {
+ return Insert (index, value.ToString() );
+ }
+
+ public StringBuilder Insert (int index, float value) {
+ return Insert (index, value.ToString() );
+ }
+
+ [CLSCompliant(false)]
+ public StringBuilder Insert (int index, ushort value) {
+ return Insert (index, value.ToString() );
+ }
+
+ [CLSCompliant(false)]
+ public StringBuilder Insert (int index, uint value) {
+ return Insert ( index, value.ToString() );
+ }
+
+ [CLSCompliant(false)]
+ public StringBuilder Insert (int index, ulong value) {
+ return Insert ( index, value.ToString() );
+ }
+
+ public StringBuilder Insert (int index, string value, int count)
+ {
+ if ( count < 0 )
+ throw new ArgumentOutOfRangeException();
+
+ if( value != null ) {
+ if( value != String.Empty ) {
+ for( int insertCount = 0; insertCount < count;
+ insertCount++ ) {
+ Insert( index, value );
+ }
+ }
+ }
+
+ return this;
+ }
+
+ public StringBuilder Insert( int index, char[] value, int startIndex, int charCount ) {
+ if (value != null)
+ {
+ if( charCount < 0 || startIndex < 0 || startIndex + charCount > value.Length )
+ throw new ArgumentOutOfRangeException();
+
+ char[] insertChars = new char[ charCount ];
+ Array.Copy( value, startIndex, insertChars, 0, charCount );
+
+ return Insert( index, insertChars );
+ }
+
+ return this;
+ }
+
+ private void InternalEnsureCapacity (int size)
+ {
+ if (size > _str.Length || _cached_str == _str)
+ {
+ int capacity = _str.Length;
+
+ // Try double buffer, if that doesn't work, set the length as capacity
+ if (size > capacity)
+ {
+ capacity = capacity << 1;
+ if (size > capacity)
+ capacity = size;
+
+ if (capacity >= Int32.MaxValue || capacity < 0)
+ capacity = Int32.MaxValue;
+ }
+
+ string tmp = String.InternalAllocateStr (capacity);
+ if (_length > 0)
+ String.InternalStrcpy (tmp, 0, _str, 0, _length);
+
+ _str = tmp;
+ }
+
+ _cached_str = null;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Threading/ChangeLog b/mcs/class/corlib/System.Threading/ChangeLog
index f9ae7d5108f..0cde572ba00 100644
--- a/mcs/class/corlib/System.Threading/ChangeLog
+++ b/mcs/class/corlib/System.Threading/ChangeLog
@@ -1,3 +1,9 @@
+2004-01-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Thread.cs: delayed thread creation until Start is called. If we
+ don't do that and Start() is not called, the thread is leaked. First
+ step towards fixing bug #53078.
+
2003-12-02 Dick Porter <dick@ximian.com>
* Thread.cs: Throw InvalidOperationException if Thread.Name is
diff --git a/mcs/class/corlib/System.Threading/Thread.cs b/mcs/class/corlib/System.Threading/Thread.cs
index 59ae3ba9871..5a68f4c9079 100755
--- a/mcs/class/corlib/System.Threading/Thread.cs
+++ b/mcs/class/corlib/System.Threading/Thread.cs
@@ -241,17 +241,6 @@ namespace System.Threading
throw new ArgumentNullException("Null ThreadStart");
}
threadstart=start;
-
- // This is a two-stage thread launch. Thread_internal
- // creates the new thread, but blocks it until
- // Start() is called later.
- system_thread_handle=Thread_internal(start);
-
- // Should throw an exception here if
- // Thread_internal returns NULL
- if(system_thread_handle==(IntPtr)0) {
- throw new SystemException("Thread creation failed");
- }
}
[MonoTODO]
@@ -506,6 +495,15 @@ namespace System.Threading
throw new ThreadStateException("Thread has already been started");
}
+
+ // Thread_internal creates the new thread, but
+ // blocks it until Start() is called later.
+ system_thread_handle=Thread_internal(threadstart);
+
+ if (system_thread_handle == (IntPtr) 0) {
+ throw new SystemException ("Thread creation failed");
+ }
+
// Launch this thread
Start_internal(system_thread_handle);
diff --git a/mcs/class/corlib/System/AppDomain.cs b/mcs/class/corlib/System/AppDomain.cs
index 03f1e95ad34..eead24e7b30 100755
--- a/mcs/class/corlib/System/AppDomain.cs
+++ b/mcs/class/corlib/System/AppDomain.cs
@@ -37,6 +37,12 @@ namespace System {
IntPtr _mono_app_domain;
static string _process_guid;
+ [ThreadStatic]
+ Hashtable type_resolve_in_progress;
+
+ [ThreadStatic]
+ Hashtable assembly_resolve_in_progress;
+
// Evidence evidence;
AppDomain () {}
@@ -411,7 +417,6 @@ namespace System {
return ab;
}
-
public void DoCallBack (CrossAppDomainDelegate theDelegate)
{
if (theDelegate != null)
@@ -448,7 +453,7 @@ namespace System {
}
[MethodImplAttribute (MethodImplOptions.InternalCall)]
- private extern Assembly LoadAssembly (AssemblyName assemblyRef, Evidence securityEvidence);
+ private extern Assembly LoadAssembly (string assemblyRef, Evidence securityEvidence);
public Assembly Load (AssemblyName assemblyRef)
{
@@ -460,7 +465,7 @@ namespace System {
if (assemblyRef == null)
throw new ArgumentNullException ("assemblyRef");
- return LoadAssembly (assemblyRef, assemblySecurity);
+ return LoadAssembly (assemblyRef.FullName, assemblySecurity);
}
public Assembly Load (string assemblyString)
@@ -468,10 +473,7 @@ namespace System {
if (assemblyString == null)
throw new ArgumentNullException ("assemblyString");
- AssemblyName an = new AssemblyName ();
- an.Name = assemblyString;
-
- return Load (an, new Evidence ());
+ return LoadAssembly (assemblyString, new Evidence ());
}
public Assembly Load (string assemblyString, Evidence assemblySecurity)
@@ -479,10 +481,7 @@ namespace System {
if (assemblyString == null)
throw new ArgumentNullException ("assemblyString");
- AssemblyName an = new AssemblyName ();
- an.Name = assemblyString;
-
- return Load (an, assemblySecurity);
+ return LoadAssembly (assemblyString, assemblySecurity);
}
public Assembly Load (byte[] rawAssembly)
@@ -720,14 +719,31 @@ namespace System {
if (AssemblyResolve == null)
return null;
- foreach (Delegate eh in AssemblyResolve.GetInvocationList ()) {
- ResolveEventHandler handler = (ResolveEventHandler) eh;
- Assembly assembly = handler (this, new ResolveEventArgs (name));
- if (assembly != null)
- return assembly;
+ /* Prevent infinite recursion */
+ Hashtable ht = assembly_resolve_in_progress;
+ if (ht == null) {
+ ht = new Hashtable ();
+ assembly_resolve_in_progress = ht;
}
- return null;
+ if (ht.Contains (name))
+ return null;
+ else
+ ht [name] = name;
+
+ try {
+ foreach (Delegate eh in AssemblyResolve.GetInvocationList ()) {
+ ResolveEventHandler handler = (ResolveEventHandler) eh;
+ Assembly assembly = handler (this, new ResolveEventArgs (name));
+ if (assembly != null)
+ return assembly;
+ }
+
+ return null;
+ }
+ finally {
+ ht.Remove (name);
+ }
}
internal Assembly DoTypeResolve (Object name_or_tb)
@@ -742,14 +758,31 @@ namespace System {
else
name = (string)name_or_tb;
- foreach (Delegate d in TypeResolve.GetInvocationList ()) {
- ResolveEventHandler eh = (ResolveEventHandler)d;
- Assembly assembly = eh (this, new ResolveEventArgs (name));
- if (assembly != null)
- return assembly;
+ /* Prevent infinite recursion */
+ Hashtable ht = type_resolve_in_progress;
+ if (ht == null) {
+ ht = new Hashtable ();
+ type_resolve_in_progress = ht;
}
- return null;
+ if (ht.Contains (name))
+ return null;
+ else
+ ht [name] = name;
+
+ try {
+ foreach (Delegate d in TypeResolve.GetInvocationList ()) {
+ ResolveEventHandler eh = (ResolveEventHandler)d;
+ Assembly assembly = eh (this, new ResolveEventArgs (name));
+ if (assembly != null)
+ return assembly;
+ }
+
+ return null;
+ }
+ finally {
+ ht.Remove (name);
+ }
}
private void DoDomainUnload () {
diff --git a/mcs/class/corlib/System/Array.cs b/mcs/class/corlib/System/Array.cs
index 9b69d509b02..766f1a11d98 100644
--- a/mcs/class/corlib/System/Array.cs
+++ b/mcs/class/corlib/System/Array.cs
@@ -473,16 +473,22 @@ namespace System
[ComVisible (false)]
public object GetValue (long [] indices)
{
- if (indices == null)
- throw new ArgumentNullException ("indices");
+ if (indices == null) {
+ // LAMESPEC: Docs say we should throw a ArgumentNull, but .NET
+ // 1.1 actually throws a NullReference.
+ throw new NullReferenceException ("'indices' cannot be null");
+ }
return GetValue (GetIntArray (indices));
}
[ComVisible (false)]
public void SetValue (object value, long [] indices)
{
- if (indices == null)
- throw new ArgumentNullException ("indices");
+ if (indices == null) {
+ // LAMESPEC: Docs say we should throw a ArgumentNull, but .NET
+ // 1.1 actually throws a NullReference.
+ throw new NullReferenceException ("'indices' cannot be null");
+ }
SetValue (value, GetIntArray (indices));
}
#endif
diff --git a/mcs/class/corlib/System/ChangeLog b/mcs/class/corlib/System/ChangeLog
index 27f776bbe93..325beb47b4e 100644
--- a/mcs/class/corlib/System/ChangeLog
+++ b/mcs/class/corlib/System/ChangeLog
@@ -1,3 +1,102 @@
+2004-01-27 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * Exception.cs: Changed ToString to remove the \n when no stack trace
+ is present (which fixed a unit test for SecurityException). Changed
+ all \n to Environment.NewLine.
+
+2004-01-27 Lluis Sanchez Gual <lluis@ximian.com>
+
+ * ContextBoundObject.cs: Removed TODO.
+
+2004-01-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * TimeSpan.cs: fixed bug #52075. Days (int) don't rely on TotalDays
+ (double), which might round up.
+
+2004-01-19 Jackson Harper <jackson@ximian.com>
+
+ * FloatingPointFormatter.cs: Use the default decimal digits count
+ if they are not specified. This fixes bug #52927.
+
+2004-01-19 Zoltan Varga <vargaz@freemail.hu>
+
+ * Environment.cs: Bump version number.
+
+2004-01-19 Lluis Sanchez Gual <lluis@ximian.com>
+
+ * Type.cs: Added internal call for IsInstanceOfType. The old implementation
+ uses IsAssignableFrom(o.GetType()), which is not always valid for
+ transparent proxies (because GetType will not return the type of the remote
+ object if its assembly is not present).
+
+2004-01-18 David Sheldon <dave-mono@earth.li>
+
+ * FloatingPointFormatter.cs: Skip the decimal point if we have an
+ integer mantassa. So: 1E+15, rather than 1.E+15.
+
+2004-01-18 David Sheldon <dave-mono@earth.li>
+
+ * Array.cs (GetValue/SetValue): Throw NullRef exception like .NET 1.1,
+ even though docs say it should be an ArgumentNull. Two test cases now
+ pass. See also nickd's commit of 2003-12-24.
+
+2004-01-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Environment.cs: increased corlib version.
+
+2004-01-14 Lluis Sanchez Gual <lluis@ximian.com>
+
+ * MonoCustomAttrs.cs: Removed attribute cache. Attribute instances can't
+ be reused because they could be modified. This fixes bug #52655.
+
+2004-01-12 Patrik Torstensson
+
+ * Environment.cs: Bump corlib version number due to new StringBuilder
+
+ * String.cs: New internal method to support the new StringBuilder that
+ uses the string as a buffer (until ToString is called)
+
+2004-01-12 Zoltan Varga <vargaz@freemail.hu>
+
+ * Environment.cs: Bump corlib version number for real this time.
+
+ * AppDomain.cs (LoadAssembly): Pass the assembly name as a string to
+ the runtime, so it can take into account the Culture etc.
+
+ * Environment.cs: Bump corlib version number.
+
+2004-01-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * MonoType.cs: GetMethods renamed to GetMethodsByName. It takes a
+ new parameter with the method name and a boolean for ignoring case.
+ Removed some string comparisons no longer needed.
+
+2004-01-11 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * MonoType.cs: GetProperties renamed to GetPropetiesByName. It takes a
+ new parameter with the property name and a boolean for ignoring case.
+ Fixes bug #52753.
+
+2004-01-11 David Sheldon <dave-mono@earth.li>
+
+ * DateTime.cs: Correct processing of formats with multiple '-'s, fixing
+ bug 52274.
+
+2004-01-10 Zoltan Varga <vargaz@freemail.hu>
+
+ * AppDomain.cs: Keep track of type resolve and assembly resolve
+ events in progress to prevent infinite recursion.
+
+2004-01-06 Miguel de Icaza <miguel@ximian.com>
+
+ * Console.cs: Test for UTF-8 being present anywhere on the
+ string, also do ToUpper instead of ToLower, which will work even
+ around the ICU bug with different locales (#52065), and addresses #52101
+
+2004-01-05 Zoltan Varga <vargaz@freemail.hu>
+
+ * Environment.cs: Bump version.
+
2003-12-24 Ben Maurer <bmaurer@users.sourceforge.net>
* Type.cs (IsNotPublic): One would normally assume that
diff --git a/mcs/class/corlib/System/Console.cs b/mcs/class/corlib/System/Console.cs
index c2959b750fd..311d2168f08 100644
--- a/mcs/class/corlib/System/Console.cs
+++ b/mcs/class/corlib/System/Console.cs
@@ -22,11 +22,22 @@ namespace System {
{
string codepage = Encoding.InternalCodePage ();
Encoding encoding;
-
- if (codepage.ToLower ().Replace ('-', '_') == "utf_8")
- encoding = Encoding.UTF8Unmarked;
- else
+
+ if (((int) Environment.Platform) == 128){
+ //
+ // On Unix systems (128), do not output the
+ // UTF-8 ZWNBSP (zero-width non-breaking space).
+ //
+ if (codepage.ToUpper ().Replace ('-', '_').IndexOf ("UTF_8") != -1)
+ encoding = Encoding.UTF8Unmarked;
+ else
+ encoding = Encoding.Default;
+ } else {
+ //
+ // On Windows, follow the Windows tradition
+ //
encoding = Encoding.Default;
+ }
stderr = new StreamWriter (OpenStandardError (), encoding);
((StreamWriter)stderr).AutoFlush = true;
@@ -326,7 +337,7 @@ namespace System {
}
[CLSCompliant(false)]
- public static void WriteLine (string format, object arg0, object arg1, object arg2, object arg3)
+ static void WriteLine (string format, object arg0, object arg1, object arg2, object arg3)
{
stdout.WriteLine (String.Format (format, arg0, arg1, arg2, arg3));
}
diff --git a/mcs/class/corlib/System/ContextBoundObject.cs b/mcs/class/corlib/System/ContextBoundObject.cs
index 92e95e454aa..7db6a82708f 100644
--- a/mcs/class/corlib/System/ContextBoundObject.cs
+++ b/mcs/class/corlib/System/ContextBoundObject.cs
@@ -14,7 +14,6 @@ namespace System {
/// <summary>
/// Base class for all the context-bound classes
/// </summary>
- [MonoTODO]
[Serializable]
public abstract class ContextBoundObject : MarshalByRefObject {
diff --git a/mcs/class/corlib/System/DateTime.cs b/mcs/class/corlib/System/DateTime.cs
index 969e6f0d3f9..b7f8e5a69c0 100644
--- a/mcs/class/corlib/System/DateTime.cs
+++ b/mcs/class/corlib/System/DateTime.cs
@@ -888,7 +888,7 @@ namespace System
return false;
break;
case '-':
- if (!_ParseString (s, 0, "-", out num_parsed)) {
+ if (!_ParseString (s, 0, new String('-', num + 1), out num_parsed)) {
return false;
}
break;
diff --git a/mcs/class/corlib/System/Environment.cs b/mcs/class/corlib/System/Environment.cs
index 29939c04d8a..64958b7addf 100644
--- a/mcs/class/corlib/System/Environment.cs
+++ b/mcs/class/corlib/System/Environment.cs
@@ -29,7 +29,7 @@ namespace System
* increment this variable. Also increment the
* pair of this variable in the runtime in metadata/appdomain.c.
*/
- private const int mono_corlib_version = 5;
+ private const int mono_corlib_version = 10;
private Environment () {}
@@ -145,7 +145,7 @@ namespace System
//
static OperatingSystem os;
- static extern PlatformID Platform {
+ internal static extern PlatformID Platform {
[MethodImplAttribute (MethodImplOptions.InternalCall)]
get;
}
diff --git a/mcs/class/corlib/System/Exception.cs b/mcs/class/corlib/System/Exception.cs
index dfa2ed61d89..34ab7f2c700 100644
--- a/mcs/class/corlib/System/Exception.cs
+++ b/mcs/class/corlib/System/Exception.cs
@@ -204,27 +204,22 @@ namespace System {
if (inner_exception != null)
{
result += " ---> " + inner_exception.ToString ();
- result += "--- End of inner exception stack trace ---\n";
+ result += "--- End of inner exception stack trace ---";
+ result += Environment.NewLine;
}
- return result + "\n" + stack_trace;
+ if (stack_trace != null)
+ result += Environment.NewLine + stack_trace;
+ return result;
}
internal Exception FixRemotingException()
{
- String tmp = null;
-
- if (0 == remote_stack_index)
- {
- tmp = "\n\nServer stack trace: \n"
- + StackTrace
- + "\n\nException rethrown at [" + remote_stack_index + "]: \n";
- }
- else
- {
- tmp = StackTrace
- + "\n\nException rethrown at [" + remote_stack_index + "]: \n";
- }
+ string message = (0 == remote_stack_index) ?
+ "{0}{0}Server stack trace: {0}{1}{0}{0}Exception rethrown at [{2}]: {0}" :
+ "{1}{0}{0}Exception rethrown at [{2}]: {0}";
+ string tmp = String.Format (message, Environment.NewLine,
+ StackTrace, remote_stack_index);
remote_stack_trace = tmp;
remote_stack_index++;
diff --git a/mcs/class/corlib/System/FloatingPointFormatter.cs b/mcs/class/corlib/System/FloatingPointFormatter.cs
index 9e0b89660aa..1df6ac72395 100644
--- a/mcs/class/corlib/System/FloatingPointFormatter.cs
+++ b/mcs/class/corlib/System/FloatingPointFormatter.cs
@@ -32,6 +32,8 @@ namespace System {
int dec_len2;
int dec_len_min2;
+ bool no_precision_specified;
+
public FloatingPointFormatter
(double p, double p10, int dec_len, int dec_len_min,
double p2, double p102, int dec_len2, int dec_len_min2) {
@@ -47,6 +49,7 @@ namespace System {
public string GetStringFrom
(string format, NumberFormatInfo nfi, double value) {
+ no_precision_specified = false;
if (format == null || format == "") {
format = "G";
}
@@ -122,6 +125,7 @@ namespace System {
switch (format.Length) {
case 1:
specifier = Char.ToUpper(format[0]);
+ no_precision_specified = true;
return true;
case 2:
if (Char.IsLetter(format[0]) && Char.IsDigit(format[1])) {
@@ -178,8 +182,8 @@ namespace System {
private string FormatCurrency (double value,
NumberFormatInfo nfi, int precision) {
StringBuilder sb = new StringBuilder();
- precision = (precision >= 0) ?
- precision : nfi.CurrencyDecimalDigits;
+ precision = (no_precision_specified ?
+ nfi.CurrencyDecimalDigits : precision);
int decimals = precision;
long mantissa;
int exponent;
@@ -470,8 +474,11 @@ namespace System {
mantissa /= 10;
exponent++;
}
- sb.Insert(0, (char)('0' + (mantissa % 10)) +
- nfi.NumberDecimalSeparator);
+ if (sb.Length != 0)
+ sb.Insert(0, nfi.NumberDecimalSeparator);
+
+ sb.Insert(0, (char)('0' + (mantissa % 10)) );
+
if (exponent > 0) {
sb.Append("E" + nfi.PositiveSign);
}
diff --git a/mcs/class/corlib/System/MonoCustomAttrs.cs b/mcs/class/corlib/System/MonoCustomAttrs.cs
index bd841ee3812..ad7628707c1 100755
--- a/mcs/class/corlib/System/MonoCustomAttrs.cs
+++ b/mcs/class/corlib/System/MonoCustomAttrs.cs
@@ -16,23 +16,9 @@ using System.Runtime.CompilerServices;
namespace System {
internal class MonoCustomAttrs {
- static Hashtable handle_to_attrs = new Hashtable ();
-
[MethodImplAttribute(MethodImplOptions.InternalCall)]
internal static extern object[] GetCustomAttributes (ICustomAttributeProvider obj);
- private static object[] from_cache (ICustomAttributeProvider obj)
- {
- lock (handle_to_attrs) {
- object[] res = (object []) handle_to_attrs [obj];
- if (res != null)
- return res;
- res = GetCustomAttributes (obj);
- handle_to_attrs.Add (obj, res);
- return res;
- }
- }
-
internal static Attribute GetCustomAttribute (ICustomAttributeProvider obj,
Type attributeType,
bool inherit)
@@ -40,7 +26,7 @@ namespace System {
if (obj == null)
throw new ArgumentNullException ("attribute_type"); // argument name in the caller
- object[] res = from_cache (obj);
+ object[] res = GetCustomAttributes (obj);
ICustomAttributeProvider btype = obj;
Attribute result = null;
@@ -58,7 +44,7 @@ namespace System {
}
if (inherit && (btype = GetBase (btype)) != null)
- res = from_cache (btype);
+ res = GetCustomAttributes (btype);
// Stop when encounters the first one for a given provider.
} while (inherit && result == null && btype != null);
@@ -72,7 +58,7 @@ namespace System {
return (object []) Array.CreateInstance (attributeType, 0);
object[] r;
- object[] res = from_cache (obj);
+ object[] res = GetCustomAttributes (obj);
// shortcut
if (!inherit && res.Length == 1) {
if (attributeType.IsAssignableFrom (res[0].GetType ())) {
@@ -92,7 +78,7 @@ namespace System {
a.Add (attr);
if ((btype = GetBase (btype)) != null)
- res = from_cache (btype);
+ res = GetCustomAttributes (btype);
} while (inherit && btype != null);
return (object []) a.ToArray (attributeType);
@@ -104,20 +90,20 @@ namespace System {
return new object [0]; //FIXME: Should i throw an exception here?
if (!inherit)
- return (object []) from_cache (obj).Clone ();
+ return (object []) GetCustomAttributes (obj).Clone ();
ArrayList a = new ArrayList ();
ICustomAttributeProvider btype = obj;
- a.AddRange (from_cache (btype));
+ a.AddRange (GetCustomAttributes (btype));
while ((btype = GetBase (btype)) != null)
- a.AddRange (from_cache (btype));
+ a.AddRange (GetCustomAttributes (btype));
return (object []) a.ToArray (typeof (Attribute));
}
internal static bool IsDefined (ICustomAttributeProvider obj, Type attributeType, bool inherit)
{
- object[] res = from_cache (obj);
+ object[] res = GetCustomAttributes (obj);
foreach (object attr in res) {
if (attributeType.Equals (attr.GetType ()))
return true;
diff --git a/mcs/class/corlib/System/MonoType.cs b/mcs/class/corlib/System/MonoType.cs
index 1e77ce5eace..da2d1490c76 100644
--- a/mcs/class/corlib/System/MonoType.cs
+++ b/mcs/class/corlib/System/MonoType.cs
@@ -131,23 +131,26 @@ namespace System
}
[MethodImplAttribute(MethodImplOptions.InternalCall)]
- public extern override MethodInfo[] GetMethods (BindingFlags bindingAttr);
+ internal extern MethodInfo [] GetMethodsByName (string name, BindingFlags bindingAttr, bool ignoreCase);
+
+ public override MethodInfo [] GetMethods (BindingFlags bindingAttr)
+ {
+ return GetMethodsByName (null, bindingAttr, false);
+ }
protected override MethodInfo GetMethodImpl (string name, BindingFlags bindingAttr,
Binder binder,
CallingConventions callConvention,
Type[] types, ParameterModifier[] modifiers)
{
- MethodInfo[] methods = GetMethods (bindingAttr);
bool ignoreCase = ((bindingAttr & BindingFlags.IgnoreCase) != 0);
+ MethodInfo[] methods = GetMethodsByName (name, bindingAttr, ignoreCase);
MethodInfo found = null;
MethodBase[] match;
int typesLen = (types != null) ? types.Length : 0;
int count = 0;
foreach (MethodInfo m in methods) {
- if (String.Compare (m.Name, name, ignoreCase, CultureInfo.InvariantCulture) != 0)
- continue;
// Under MS.NET, Standard|HasThis matches Standard...
if (callConvention != CallingConventions.Any && ((m.CallingConvention & callConvention) != callConvention))
continue;
@@ -167,8 +170,6 @@ namespace System
else {
count = 0;
foreach (MethodInfo m in methods) {
- if (String.Compare (m.Name, name, ignoreCase, CultureInfo.InvariantCulture) != 0)
- continue;
if (callConvention != CallingConventions.Any && ((m.CallingConvention & callConvention) != callConvention))
continue;
match [count++] = m;
@@ -191,7 +192,12 @@ namespace System
public extern override Type[] GetNestedTypes (BindingFlags bindingAttr);
[MethodImplAttribute(MethodImplOptions.InternalCall)]
- public extern override PropertyInfo[] GetProperties( BindingFlags bindingAttr);
+ internal extern PropertyInfo[] GetPropertiesByName (string name, BindingFlags bindingAttr, bool icase);
+
+ public override PropertyInfo [] GetProperties (BindingFlags bindingAttr)
+ {
+ return GetPropertiesByName (null, bindingAttr, false);
+ }
[MonoTODO]
protected override PropertyInfo GetPropertyImpl (string name, BindingFlags bindingAttr,
@@ -204,39 +210,36 @@ namespace System
throw new ArgumentNullException ();
PropertyInfo ret = null;
- PropertyInfo [] props = GetProperties(bindingAttr);
bool ignoreCase = ((bindingAttr & BindingFlags.IgnoreCase) != 0);
+ PropertyInfo [] props = GetPropertiesByName (name, bindingAttr, ignoreCase);
foreach (PropertyInfo info in props) {
- if (String.Compare (info.Name, name, ignoreCase, CultureInfo.InvariantCulture) != 0)
+ if (returnType != null && info.PropertyType != returnType)
continue;
- if (returnType != null && info.PropertyType != returnType)
- continue;
+ if (types.Length > 0) {
+ ParameterInfo[] parameterInfo = info.GetIndexParameters ();
- if (types.Length > 0) {
- ParameterInfo[] parameterInfo = info.GetIndexParameters ();
-
- if (parameterInfo.Length != types.Length)
- continue;
+ if (parameterInfo.Length != types.Length)
+ continue;
- int i;
- bool match = true;
+ int i;
+ bool match = true;
- for (i = 0; i < types.Length; i ++)
- if (parameterInfo [i].ParameterType != types [i]) {
- match = false;
- break;
- }
+ for (i = 0; i < types.Length; i ++)
+ if (parameterInfo [i].ParameterType != types [i]) {
+ match = false;
+ break;
+ }
- if (!match)
- continue;
- }
+ if (!match)
+ continue;
+ }
- if (null != ret)
- throw new AmbiguousMatchException();
+ if (null != ret)
+ throw new AmbiguousMatchException();
- ret = info;
+ ret = info;
}
return ret;
@@ -323,20 +326,9 @@ namespace System
}
bool ignoreCase = (invokeAttr & BindingFlags.IgnoreCase) != 0;
if ((invokeAttr & BindingFlags.InvokeMethod) != 0) {
- MethodInfo[] methods = GetMethods (invokeAttr);
+ MethodInfo[] methods = GetMethodsByName (name, invokeAttr, ignoreCase);
object state = null;
- int i, count = 0;
- for (i = 0; i < methods.Length; ++i) {
- if (String.Compare (methods [i].Name, name, ignoreCase, CultureInfo.InvariantCulture) == 0)
- count++;
- }
- MethodBase[] smethods = new MethodBase [count];
- count = 0;
- for (i = 0; i < methods.Length; ++i) {
- if (String.Compare (methods [i].Name, name, ignoreCase, CultureInfo.InvariantCulture) == 0)
- smethods [count++] = methods [i];
- }
- MethodBase m = binder.BindToMethod (invokeAttr, smethods, ref args, modifiers, culture, namedParameters, out state);
+ MethodBase m = binder.BindToMethod (invokeAttr, methods, ref args, modifiers, culture, namedParameters, out state);
if (m == null)
throw new MissingMethodException ();
object result = m.Invoke (target, invokeAttr, binder, args, culture);
@@ -362,18 +354,18 @@ namespace System
/* try SetProperty */
}
if ((invokeAttr & BindingFlags.GetProperty) != 0) {
- PropertyInfo[] properties = GetProperties (invokeAttr);
+ PropertyInfo[] properties = GetPropertiesByName (name, invokeAttr, ignoreCase);
object state = null;
int i, count = 0;
for (i = 0; i < properties.Length; ++i) {
- if (String.Compare (properties [i].Name, name, ignoreCase, CultureInfo.InvariantCulture) == 0 && (properties [i].GetGetMethod () != null))
+ if ((properties [i].GetGetMethod () != null))
count++;
}
MethodBase[] smethods = new MethodBase [count];
count = 0;
for (i = 0; i < properties.Length; ++i) {
MethodBase mb = properties [i].GetGetMethod ();
- if (String.Compare (properties [i].Name, name, ignoreCase, CultureInfo.InvariantCulture) == 0 && (mb != null))
+ if (mb != null)
smethods [count++] = mb;
}
MethodBase m = binder.BindToMethod (invokeAttr, smethods, ref args, modifiers, culture, namedParameters, out state);
@@ -383,18 +375,18 @@ namespace System
binder.ReorderArgumentArray (ref args, state);
return result;
} else if ((invokeAttr & BindingFlags.SetProperty) != 0) {
- PropertyInfo[] properties = GetProperties (invokeAttr);
+ PropertyInfo[] properties = GetPropertiesByName (name, invokeAttr, ignoreCase);
object state = null;
int i, count = 0;
for (i = 0; i < properties.Length; ++i) {
- if (String.Compare (properties [i].Name, name, ignoreCase, CultureInfo.InvariantCulture) == 0 && (properties [i].GetSetMethod () != null))
+ if (properties [i].GetSetMethod () != null)
count++;
}
MethodBase[] smethods = new MethodBase [count];
count = 0;
for (i = 0; i < properties.Length; ++i) {
MethodBase mb = properties [i].GetSetMethod ();
- if (String.Compare (properties [i].Name, name, ignoreCase, CultureInfo.InvariantCulture) == 0 && (mb != null))
+ if (mb != null)
smethods [count++] = mb;
}
MethodBase m = binder.BindToMethod (invokeAttr, smethods, ref args, modifiers, culture, namedParameters, out state);
diff --git a/mcs/class/corlib/System/String.cs b/mcs/class/corlib/System/String.cs
index 7e96e7b778b..4c96877612d 100644
--- a/mcs/class/corlib/System/String.cs
+++ b/mcs/class/corlib/System/String.cs
@@ -2,7 +2,7 @@
// System.String.cs
//
// Authors:
-// Patrik Torstensson (patrik.torstensson@labs2.com)
+// Patrik Torstensson
// Jeffrey Stedfast (fejj@ximian.com)
// Dan Lewis (dihlewis@yahoo.co.uk)
//
@@ -18,8 +18,8 @@ using System.Runtime.CompilerServices;
namespace System {
[Serializable]
public sealed class String : IConvertible, IComparable, ICloneable, IEnumerable {
- [NonSerialized]
- private int length;
+ [NonSerialized] private int length;
+ [NonSerialized] private char start_char;
private const int COMPARE_CASE = 0;
private const int COMPARE_INCASE = 1;
@@ -913,7 +913,8 @@ namespace System {
s3 = String.Empty;
}
}
-
+
+ //return InternalConcat (s1, s2, s3);
String tmp = InternalAllocateStr(s1.length + s2.length + s3.length);
InternalStrcpy(tmp, 0, s1);
@@ -1209,7 +1210,31 @@ namespace System {
ptr = p;
return n;
}
-
+
+ internal unsafe void InternalSetChar(int idx, char val)
+ {
+ if ((uint) idx >= (uint) Length)
+ throw new ArgumentOutOfRangeException("idx");
+
+ fixed (char * pStr = &start_char)
+ {
+ pStr [idx] = val;
+ }
+ }
+
+ internal unsafe void InternalSetLength(int newLength)
+ {
+ if (newLength > length)
+ throw new ArgumentOutOfRangeException("newLength > length");
+
+ length = newLength;
+
+ // zero terminate, we can pass string objects directly via pinvoke
+ fixed (char * pStr = &start_char) {
+ pStr [length] = '\0';
+ }
+ }
+
[CLSCompliant(false), MethodImplAttribute(MethodImplOptions.InternalCall)]
unsafe public extern String(char *value);
@@ -1277,13 +1302,13 @@ namespace System {
private extern String InternalToUpper(CultureInfo culture);
[MethodImplAttribute(MethodImplOptions.InternalCall)]
- private extern static String InternalAllocateStr(int length);
+ internal extern static String InternalAllocateStr(int length);
[MethodImplAttribute(MethodImplOptions.InternalCall)]
- private extern static void InternalStrcpy(String dest, int destPos, String src);
+ internal extern static void InternalStrcpy(String dest, int destPos, String src);
[MethodImplAttribute(MethodImplOptions.InternalCall)]
- private extern static void InternalStrcpy(String dest, int destPos, String src, int startPos, int count);
+ internal extern static void InternalStrcpy(String dest, int destPos, String src, int startPos, int count);
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private extern static string InternalIntern(string str);
diff --git a/mcs/class/corlib/System/TimeSpan.cs b/mcs/class/corlib/System/TimeSpan.cs
index 565308ba918..2d0fac88e2d 100644
--- a/mcs/class/corlib/System/TimeSpan.cs
+++ b/mcs/class/corlib/System/TimeSpan.cs
@@ -51,7 +51,7 @@ public struct TimeSpan : IComparable {
public int Days
{
get {
- return (int) TotalDays;
+ return (int) (_ticks / TicksPerDay);
}
}
diff --git a/mcs/class/corlib/System/Type.cs b/mcs/class/corlib/System/Type.cs
index ffc65c65269..66892a39163 100644
--- a/mcs/class/corlib/System/Type.cs
+++ b/mcs/class/corlib/System/Type.cs
@@ -479,6 +479,9 @@ namespace System {
[MethodImplAttribute(MethodImplOptions.InternalCall)]
internal static extern bool type_is_assignable_from (Type a, Type b);
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ internal static extern bool type_is_instance (Type a, object b);
+
public virtual bool IsSubclassOf (Type c)
{
if (c == null)
@@ -538,12 +541,8 @@ namespace System {
return type_is_assignable_from (this, c);
}
- public virtual bool IsInstanceOfType (object o) {
- if (o != null)
- return IsAssignableFrom (o.GetType ());
-
- return false;
- }
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern virtual bool IsInstanceOfType (object o);
public virtual int GetArrayRank ()
{
diff --git a/mcs/class/corlib/Test/System.Collections/HashtableTest.cs b/mcs/class/corlib/Test/System.Collections/HashtableTest.cs
index 54b50420fe6..ca9cf29fb91 100644
--- a/mcs/class/corlib/Test/System.Collections/HashtableTest.cs
+++ b/mcs/class/corlib/Test/System.Collections/HashtableTest.cs
@@ -35,7 +35,7 @@ public class HashtableTest : Assertion {
{
bool errorThrown = false;
try {
- Hashtable h = new Hashtable(null);
+ Hashtable h = new Hashtable((IDictionary) null);
} catch (ArgumentNullException) {
errorThrown = true;
}
diff --git a/mcs/class/corlib/Test/System.IO/ChangeLog b/mcs/class/corlib/Test/System.IO/ChangeLog
index 8d98ea7e5ba..8ad56a0f71c 100644
--- a/mcs/class/corlib/Test/System.IO/ChangeLog
+++ b/mcs/class/corlib/Test/System.IO/ChangeLog
@@ -1,3 +1,39 @@
+2004-01-31 David Sheldon <dave-mono@earth.li>
+
+ * FileSystemInfoTest.cs: Added code to skip CreationTime tests
+ on Unix, as it doesn't support them.
+
+2004-01-31 David Sheldon <dave-mono@earth.li>
+
+ * FileSystemInfoTest.cs: Change tests for default times to
+ be TimeZone agnostic by conversion to universal time before
+ testing.
+
+2004-01-22 David Sheldon <dave-mono@earth.li>
+
+ * FileStreamTest.cs: CtorArgumentOutOfRangeException4, we were
+ testing for this ecveption, but the other parameters were also
+ invalid. Made them correct. We don't care that MS throw
+ exceptions in a different order do we?
+
+2004-01-22 David Sheldon <dave-mono@earth.li>
+
+ * DirectoryTest.cs: Added Ignore to the CreationTime tests,
+ as Unix filesystems don't support them. Should we only ignore
+ them on Unix?
+
+2004-01-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * PathTest.cs: added some unix-only tests for GetFullPath.
+
+2004-01-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * PathTest.cs: a couple of tests for bugs.
+
+2003-01-06 Atsushi Enomoto <atsushi@ximian.com>
+
+ * DirectoryTest.cs : remoed incorrect args.
+
2003-12-25 Atsushi Enomoto <atsushi@ximian.com>
* PathTest.cs : On Unix, "Z:" can be valid local file.
diff --git a/mcs/class/corlib/Test/System.IO/DirectoryTest.cs b/mcs/class/corlib/Test/System.IO/DirectoryTest.cs
index 854e6cc2a10..0f5e8541075 100755
--- a/mcs/class/corlib/Test/System.IO/DirectoryTest.cs
+++ b/mcs/class/corlib/Test/System.IO/DirectoryTest.cs
@@ -577,6 +577,7 @@ public class DirectoryTest : Assertion {
}
[Test]
+ [Ignore("Unix doesnt support CreationTime")]
public void CreationTime ()
{
string path = TempFolder + "/DirectoryTest.CreationTime.1";
@@ -1148,21 +1149,21 @@ public class DirectoryTest : Assertion {
[Test]
[ExpectedException (typeof (ArgumentNullException))]
- public void SetCurrentDirectoryNull (string path)
+ public void SetCurrentDirectoryNull ()
{
Directory.SetCurrentDirectory (null);
}
[Test]
[ExpectedException (typeof (ArgumentException))]
- public void SetCurrentDirectoryEmpty (string path)
+ public void SetCurrentDirectoryEmpty ()
{
Directory.SetCurrentDirectory (String.Empty);
}
[Test]
[ExpectedException (typeof (ArgumentException))]
- public void SetCurrentDirectoryWhitespace (string path)
+ public void SetCurrentDirectoryWhitespace ()
{
Directory.SetCurrentDirectory (" ");
}
diff --git a/mcs/class/corlib/Test/System.IO/FileStreamTest.cs b/mcs/class/corlib/Test/System.IO/FileStreamTest.cs
index 3c8a9d0f213..f172955fc0d 100644
--- a/mcs/class/corlib/Test/System.IO/FileStreamTest.cs
+++ b/mcs/class/corlib/Test/System.IO/FileStreamTest.cs
@@ -204,7 +204,7 @@ namespace MonoTests.System.IO
FileStream stream = null;
try {
- stream = new FileStream (path, FileMode.Truncate, FileAccess.Read, FileShare.ReadWrite, -1);
+ stream = new FileStream (path, FileMode.OpenOrCreate, FileAccess.Read, FileShare.ReadWrite, -1);
} finally {
if (stream != null)
stream.Close ();
diff --git a/mcs/class/corlib/Test/System.IO/FileSystemInfoTest.cs b/mcs/class/corlib/Test/System.IO/FileSystemInfoTest.cs
index 74d47935d63..4cbf15d1f4b 100644
--- a/mcs/class/corlib/Test/System.IO/FileSystemInfoTest.cs
+++ b/mcs/class/corlib/Test/System.IO/FileSystemInfoTest.cs
@@ -33,6 +33,27 @@ namespace MonoTests.System.IO
if (Directory.Exists (TempFolder))
Directory.Delete (TempFolder, true);
}
+
+ bool Windows
+ {
+ get {
+ return Path.DirectorySeparatorChar == '\\';
+ }
+ }
+
+ bool Unix
+ {
+ get {
+ return Path.DirectorySeparatorChar == '/';
+ }
+ }
+
+ bool Mac
+ {
+ get {
+ return Path.DirectorySeparatorChar == ':';
+ }
+ }
private void DeleteFile (string path)
{
@@ -51,7 +72,9 @@ namespace MonoTests.System.IO
{
string path = TempFolder + "/FSIT.CreationTime.Test";
DeleteFile (path);
-
+ if (Unix) { // Unix doesn't support CreationTimes
+ return;
+ }
try {
File.Create (path).Close ();
FileSystemInfo info = new FileInfo (path);
@@ -101,6 +124,9 @@ namespace MonoTests.System.IO
{
string path = TempFolder + "/FSIT.CreationTimeDirectory.Test";
DeleteDir (path);
+ if (Unix) { // Unix doesn't support CreationTimes
+ return;
+ }
try {
FileSystemInfo info = Directory.CreateDirectory (path);
@@ -144,22 +170,22 @@ namespace MonoTests.System.IO
try {
FileSystemInfo info = new FileInfo (path);
- DateTime time = info.CreationTime;
+ DateTime time = TimeZone.CurrentTimeZone.ToUniversalTime(info.CreationTime);
AssertEquals ("test#01", 1601, time.Year);
AssertEquals ("test#02", 1, time.Month);
AssertEquals ("test#03", 1, time.Day);
- AssertEquals ("test#04", 9, time.Hour);
+ AssertEquals ("test#04", 0, time.Hour);
AssertEquals ("test#05", 0, time.Minute);
AssertEquals ("test#06", 0, time.Second);
AssertEquals ("test#07", 0, time.Millisecond);
info = new DirectoryInfo (path);
- time = info.CreationTime;
+ time = TimeZone.CurrentTimeZone.ToUniversalTime(info.CreationTime);
AssertEquals ("test#08", 1601, time.Year);
AssertEquals ("test#09", 1, time.Month);
AssertEquals ("test#10", 1, time.Day);
- AssertEquals ("test#11", 9, time.Hour);
+ AssertEquals ("test#11", 0, time.Hour);
AssertEquals ("test#12", 0, time.Minute);
AssertEquals ("test#13", 0, time.Second);
AssertEquals ("test#14", 0, time.Millisecond);
@@ -192,12 +218,12 @@ namespace MonoTests.System.IO
try {
FileSystemInfo info = new FileInfo (path);
- DateTime time = info.LastAccessTime;
+ DateTime time = TimeZone.CurrentTimeZone.ToUniversalTime(info.LastAccessTime);
AssertEquals ("test#01", 1601, time.Year);
AssertEquals ("test#02", 1, time.Month);
AssertEquals ("test#03", 1, time.Day);
- AssertEquals ("test#04", 9, time.Hour);
+ AssertEquals ("test#04", 0, time.Hour);
AssertEquals ("test#05", 0, time.Minute);
AssertEquals ("test#06", 0, time.Second);
AssertEquals ("test#07", 0, time.Millisecond);
@@ -258,12 +284,12 @@ namespace MonoTests.System.IO
try {
FileSystemInfo info = new DirectoryInfo (path);
- DateTime time = info.LastAccessTime;
+ DateTime time = TimeZone.CurrentTimeZone.ToUniversalTime(info.LastWriteTime);
AssertEquals ("test#01", 1601, time.Year);
AssertEquals ("test#02", 1, time.Month);
AssertEquals ("test#03", 1, time.Day);
- AssertEquals ("test#04", 9, time.Hour);
+ AssertEquals ("test#04", 0, time.Hour);
AssertEquals ("test#05", 0, time.Minute);
AssertEquals ("test#06", 0, time.Second);
AssertEquals ("test#07", 0, time.Millisecond);
diff --git a/mcs/class/corlib/Test/System.IO/PathTest.cs b/mcs/class/corlib/Test/System.IO/PathTest.cs
index 19822fe3ec7..1fdb57b3e86 100644
--- a/mcs/class/corlib/Test/System.IO/PathTest.cs
+++ b/mcs/class/corlib/Test/System.IO/PathTest.cs
@@ -14,14 +14,7 @@
// (c) 2003 Gilles Freart
//
-#define NUNIT // Comment out this one if you wanna play with the test without using NUnit
-
-#if NUNIT
using NUnit.Framework;
-#else
-using System.Reflection;
-#endif
-
using System.IO;
using System;
using System.Text;
@@ -35,28 +28,18 @@ namespace MonoTests.System.IO
Mac
}
-#if NUNIT
[TestFixture]
public class PathTest : Assertion
{
-#else
- public class PathTest
- {
-#endif
static string path1;
static string path2;
static string path3;
static OsType OS;
static char DSC = Path.DirectorySeparatorChar;
-#if NUNIT
[SetUp]
public void SetUp ()
{
-#else
- static PathTest ()
- {
-#endif
if ('/' == DSC) {
OS = OsType.Unix;
path1 = "/foo/test.txt";
@@ -541,15 +524,18 @@ namespace MonoTests.System.IO
Assert ("IsPathRooted #08", Path.IsPathRooted ("//"));
Assert ("IsPathRooted #09", Path.IsPathRooted ("\\\\"));
Assert ("IsPathRooted #10", !Path.IsPathRooted (":"));
- if (OS == OsType.Windows)
+ if (Windows)
Assert ("IsPathRooted #11", Path.IsPathRooted ("z:"));
else
Assert ("IsPathRooted #11", !Path.IsPathRooted ("z:"));
- Assert ("IsPathRooted #12", Path.IsPathRooted ("z:\\"));
- Assert ("IsPathRooted #13", Path.IsPathRooted ("z:\\topdir"));
- // This looks MS BUG. It is treated as absolute path
- Assert ("IsPathRooted #14", Path.IsPathRooted ("z:curdir"));
- Assert ("IsPathRooted #15", Path.IsPathRooted ("\\abc\\def"));
+
+ if (Windows) {
+ Assert ("IsPathRooted #12", Path.IsPathRooted ("z:\\"));
+ Assert ("IsPathRooted #13", Path.IsPathRooted ("z:\\topdir"));
+ // This looks MS BUG. It is treated as absolute path
+ Assert ("IsPathRooted #14", Path.IsPathRooted ("z:curdir"));
+ Assert ("IsPathRooted #15", Path.IsPathRooted ("\\abc\\def"));
+ }
}
public void TestCanonicalizeDots ()
@@ -559,41 +545,27 @@ namespace MonoTests.System.IO
string parent = Path.GetFullPath ("..");
Assert ("TestCanonicalizeDotst #02", !current.EndsWith (".."));
}
-#if !NUNIT
- void Assert (string msg, bool result)
- {
- if (!result)
- Console.WriteLine (msg);
- }
- void AssertEquals (string msg, object expected, object real)
+ public void TestDirectoryNameBugs ()
{
- if (expected == null && real == null)
- return;
-
- if (expected != null && expected.Equals (real))
- return;
-
- Console.WriteLine ("{0}: expected: '{1}', got: '{2}'", msg, expected, real);
+ if (Windows) {
+ AssertEquals ("Win #01", "C:\\foo", Path.GetDirectoryName ("C:\\foo\\foo.txt"));
+ } else {
+ AssertEquals ("No win #01", "/etc", Path.GetDirectoryName ("/etc/hostname"));
+ }
}
- void Fail (string msg)
+ public void TestGetFullPathUnix ()
{
- Console.WriteLine ("Failed: {0}", msg);
- }
+ if (Windows)
+ return;
- static void Main ()
- {
- PathTest p = new PathTest ();
- Type t = p.GetType ();
- MethodInfo [] methods = t.GetMethods ();
- foreach (MethodInfo m in methods) {
- if (m.Name.Substring (0, 4) == "Test") {
- m.Invoke (p, null);
- }
- }
+ AssertEquals ("#01", "/", Path.GetFullPath ("/"));
+ AssertEquals ("#02", "/hey", Path.GetFullPath ("/hey"));
+ AssertEquals ("#03", Environment.CurrentDirectory, Path.GetFullPath ("."));
+ AssertEquals ("#04", Path.Combine (Environment.CurrentDirectory, "hey"),
+ Path.GetFullPath ("hey"));
}
-#endif
}
}
diff --git a/mcs/class/corlib/Test/System.Reflection.Emit/AssemblyBuilderTest.cs b/mcs/class/corlib/Test/System.Reflection.Emit/AssemblyBuilderTest.cs
index 985a5a9f10c..7bca34047f1 100644
--- a/mcs/class/corlib/Test/System.Reflection.Emit/AssemblyBuilderTest.cs
+++ b/mcs/class/corlib/Test/System.Reflection.Emit/AssemblyBuilderTest.cs
@@ -397,8 +397,6 @@ public class AssemblyBuilderTest : Assertion
ab.SetCustomAttribute (new CustomAttributeBuilder (typeof (AssemblyVersionAttribute).GetConstructor (new Type [] { typeof (string) }), new object [] { "1.2.3.4"}));
- ab.SetCustomAttribute (new CustomAttributeBuilder (typeof (AssemblyKeyFileAttribute).GetConstructor (new Type [] { typeof (string) }), new object [] { "foo"}));
-
ab.SetCustomAttribute (new CustomAttributeBuilder (typeof (AssemblyCultureAttribute).GetConstructor (new Type [] { typeof (string) }), new object [] { "bar"}));
ab.SetCustomAttribute (new CustomAttributeBuilder (typeof (AssemblyAlgorithmIdAttribute).GetConstructor (new Type [] { typeof (AssemblyHashAlgorithm) }), new object [] { AssemblyHashAlgorithm.MD5 }));
diff --git a/mcs/class/corlib/Test/System.Reflection.Emit/ChangeLog b/mcs/class/corlib/Test/System.Reflection.Emit/ChangeLog
index 0c0beb7265a..c6276290721 100644
--- a/mcs/class/corlib/Test/System.Reflection.Emit/ChangeLog
+++ b/mcs/class/corlib/Test/System.Reflection.Emit/ChangeLog
@@ -1,3 +1,20 @@
+2004-01-27 Zoltan Varga <vargaz@freemail.hu>
+
+ * AssemblyBuilderTest.cs (TestCustomAttributes): Remove
+ KeyFileAttribute from the test, since it must point to a valid keyfile.
+
+2004-01-09 Nick Drochak <ndrochak@ieee.org>
+
+ * TypeBuilderTest.cs (TestEnums): Fix build with csc.
+
+2004-01-07 Zoltan Varga <vargaz@freemail.hu>
+
+ * TypeBuilderTest.cs (IsDefined): Comment out this test, since
+ IsDefined works under mono.
+
+ * TypeBuilderTest.cs (TestEnums): New test for using runtime generated
+ enums.
+
2003-12-17 Nick Drochak <ndrochak@gol.com>
* ModuleBuilderTest.cs: Shorten the path, there's a 260-or-so character
diff --git a/mcs/class/corlib/Test/System.Reflection.Emit/TypeBuilderTest.cs b/mcs/class/corlib/Test/System.Reflection.Emit/TypeBuilderTest.cs
index 9df9cbf199e..38aa03a802a 100644
--- a/mcs/class/corlib/Test/System.Reflection.Emit/TypeBuilderTest.cs
+++ b/mcs/class/corlib/Test/System.Reflection.Emit/TypeBuilderTest.cs
@@ -909,6 +909,8 @@ public class TypeBuilderTest : Assertion
}
}
+ /* IsDefined actually works under mono */
+ /*
public void TestIsDefined () {
TypeBuilder tb = module.DefineType (genTypeName ());
@@ -919,6 +921,7 @@ public class TypeBuilderTest : Assertion
catch (NotSupportedException) {
}
}
+ */
/* FIXME: This does not work under mono
public void TestGetEvents () {
@@ -983,6 +986,37 @@ public class TypeBuilderTest : Assertion
catch (NotSupportedException) {
}
}
+
+ /* Test for dynamically generated enums */
+ public void TestEnums () {
+ TypeAttributes typeAttrs = TypeAttributes.Class | TypeAttributes.Public | TypeAttributes.Sealed;
+ TypeBuilder enumToCreate = module.DefineType(genTypeName (), typeAttrs,
+ typeof(Enum));
+ enumToCreate.SetCustomAttribute (new CustomAttributeBuilder (typeof (FlagsAttribute).GetConstructors ()[0], new Type [0]));
+ // add value__ field, see DefineEnum method of ModuleBuilder
+ enumToCreate.DefineField("value__", typeof(Int32),
+ FieldAttributes.Public | FieldAttributes.SpecialName | FieldAttributes.RTSpecialName);
+
+ // add enum entries
+ FieldBuilder fb = enumToCreate.DefineField("A", enumToCreate,
+ FieldAttributes.Public | FieldAttributes.Static | FieldAttributes.Literal);
+ fb.SetConstant((Int32) 0);
+
+ fb = enumToCreate.DefineField("B", enumToCreate,
+ FieldAttributes.Public | FieldAttributes.Static | FieldAttributes.Literal);
+ fb.SetConstant((Int32) 1);
+
+ fb = enumToCreate.DefineField("C", enumToCreate,
+ FieldAttributes.Public | FieldAttributes.Static | FieldAttributes.Literal);
+ fb.SetConstant((Int32) 2);
+
+ Type enumType = enumToCreate.CreateType();
+
+ object enumVal = Enum.ToObject(enumType, (Int32) 3);
+
+ AssertEquals ("B, C", enumVal.ToString ());
+ AssertEquals (3, (Int32)enumVal);
+ }
}
}
diff --git a/mcs/class/corlib/Test/System.Runtime.Remoting/ChangeLog b/mcs/class/corlib/Test/System.Runtime.Remoting/ChangeLog
index 3847c91aacb..ee510d8bd97 100644
--- a/mcs/class/corlib/Test/System.Runtime.Remoting/ChangeLog
+++ b/mcs/class/corlib/Test/System.Runtime.Remoting/ChangeLog
@@ -1,3 +1,7 @@
+2004-01-08 Lluis Sanchez Gual <lluis@ximian.com>
+
+ * SynchronizationAttributeTest.cs: Improved test.
+
2003-11-26 Lluis Sanchez Gual <lluis@ximian.com>
* SoapServicesTest.cs: New test added.
diff --git a/mcs/class/corlib/Test/System.Runtime.Remoting/SynchronizationAttributeTest.cs b/mcs/class/corlib/Test/System.Runtime.Remoting/SynchronizationAttributeTest.cs
index 99c1bac582d..b7f0075fce7 100755
--- a/mcs/class/corlib/Test/System.Runtime.Remoting/SynchronizationAttributeTest.cs
+++ b/mcs/class/corlib/Test/System.Runtime.Remoting/SynchronizationAttributeTest.cs
@@ -126,6 +126,7 @@ namespace MonoTests.System.Runtime.Remoting
SincroNotSupported notsup = new SincroNotSupported ();
SincroRequiresNewReentrant reentrant = new SincroRequiresNewReentrant ();
SincroRequiresNew notreentrant = new SincroRequiresNew ();
+ bool otResult;
[Test]
public void TestSynchronization ()
@@ -134,12 +135,14 @@ namespace MonoTests.System.Runtime.Remoting
tr.Start ();
Thread.Sleep (200);
SecondSyncThread ();
+
+ tr.Join ();
+ Assert ("Concurrency detected in FirstSyncThread", !otResult);
}
void FirstSyncThread ()
{
- bool concurrent = sincob.CheckConcurrency ();
- Assert ("Concurrency detected", !concurrent);
+ otResult = sincob.CheckConcurrency ();
}
void SecondSyncThread ()
@@ -204,6 +207,9 @@ namespace MonoTests.System.Runtime.Remoting
tr.Start ();
Thread.Sleep (200);
SecondSyncThread ();
+
+ tr.Join ();
+ Assert ("Concurrency detected in FirstSyncThread", !otResult);
}
[Test]
@@ -213,12 +219,14 @@ namespace MonoTests.System.Runtime.Remoting
tr.Start ();
Thread.Sleep (200);
SecondNotSyncThread ();
+
+ tr.Join ();
+ Assert ("Concurrency not detected in FirstReentryThread", otResult);
}
void FirstNotSyncThread ()
{
- bool concurrent = sincob.CheckUnlockedConcurrency ();
- Assert ("Concurrency not detected", concurrent);
+ otResult = sincob.CheckUnlockedConcurrency ();
}
void SecondNotSyncThread ()
@@ -253,12 +261,14 @@ namespace MonoTests.System.Runtime.Remoting
tr.Start ();
Thread.Sleep (200);
SecondReentryThread ();
+
+ tr.Join ();
+ Assert ("Concurrency not detected in FirstReentryThread", otResult);
}
void FirstReentryThread ()
{
- bool concurrent = reentrant.CheckCalloutConcurrency (notsup);
- Assert ("Concurrency not detected", concurrent);
+ otResult = reentrant.CheckCalloutConcurrency (notsup);
}
void SecondReentryThread ()
@@ -274,12 +284,14 @@ namespace MonoTests.System.Runtime.Remoting
tr.Start ();
Thread.Sleep (200);
SecondNoReentryThread ();
+
+ tr.Join ();
+ Assert ("Concurrency detected in FirstNoReentryThread", !otResult);
}
void FirstNoReentryThread ()
{
- bool concurrent = notreentrant.CheckCalloutConcurrency (notsup);
- Assert ("Concurrency detected", !concurrent);
+ otResult = notreentrant.CheckCalloutConcurrency (notsup);
}
void SecondNoReentryThread ()
@@ -297,12 +309,14 @@ namespace MonoTests.System.Runtime.Remoting
bool concurrent = notreentrant.CheckConcurrency ();
Assert ("Concurrency detected", !concurrent);
notreentrant.CheckContext (Thread.CurrentContext);
+
+ tr.Join ();
+ Assert ("Concurrency detected in CallbackThread", !otResult);
}
void CallbackThread ()
{
- bool concurrent = notreentrant.TestCallback ();
- Assert ("Concurrency detected", !concurrent);
+ otResult = notreentrant.TestCallback ();
}
}
}
diff --git a/mcs/class/corlib/Test/System.Security.Permissions/ChangeLog b/mcs/class/corlib/Test/System.Security.Permissions/ChangeLog
index 70920511089..de6b61fb19a 100644
--- a/mcs/class/corlib/Test/System.Security.Permissions/ChangeLog
+++ b/mcs/class/corlib/Test/System.Security.Permissions/ChangeLog
@@ -1,3 +1,11 @@
+2004-01-27 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * FileIOPermissionTest.cs: Converted to NUnit2. Added a test to show a
+ strange behaviour (short/long path) - ignored for now.
+ * FileIOPermissionAttributeTest.cs: Removed GetTempPath from the tests
+ as the introduced failures weren't related to the class (test moved to
+ FileIOPermissionTest.cs).
+
2003-12-29 Sebastien Pouliot <spouliot@videotron.ca>
* EnvironmentPermissionAttributeTest.cs: Updated to test default
diff --git a/mcs/class/corlib/Test/System.Security.Permissions/FileIOPermissionAttributeTest.cs b/mcs/class/corlib/Test/System.Security.Permissions/FileIOPermissionAttributeTest.cs
index 4ca71e51a2b..87ae7f8eee0 100644
--- a/mcs/class/corlib/Test/System.Security.Permissions/FileIOPermissionAttributeTest.cs
+++ b/mcs/class/corlib/Test/System.Security.Permissions/FileIOPermissionAttributeTest.cs
@@ -10,49 +10,16 @@
using NUnit.Framework;
using System;
using System.IO;
+using System.Reflection;
using System.Security;
using System.Security.Permissions;
using System.Text;
-using System.Runtime.InteropServices;
-
namespace MonoTests.System.Security.Permissions {
- public class FilePathUtil
- {
- [DllImport("kernel32.dll")]
- private static extern uint GetLongPathName (string shortPath,
- StringBuilder buffer, uint bufLength);
-
- static public string GetLongPathName (string somePath)
- {
- StringBuilder buffer = new StringBuilder(260);
- if (0 != GetLongPathName (somePath, buffer, (uint) buffer.Capacity))
- return buffer.ToString ();
- else
- return null;
- }
- }
-
[TestFixture]
public class FileIOPermissionAttributeTest : Assertion {
- private static string filename;
-
- [SetUp]
- public void SetUp ()
- {
- Environment.CurrentDirectory = Path.GetTempPath();
- filename = Path.GetTempFileName ();
- }
-
- [TearDown]
- public void TearDown ()
- {
- if (File.Exists (filename))
- File.Delete (filename);
- }
-
[Test]
public void Default ()
{
@@ -95,17 +62,18 @@ namespace MonoTests.System.Security.Permissions {
[Test]
public void All ()
{
+ string filename = Assembly.GetCallingAssembly ().Location;
FileIOPermissionAttribute attr = new FileIOPermissionAttribute (SecurityAction.Assert);
- attr.All = Path.GetFullPath(filename);
+ attr.All = filename;
AssertEquals ("All=Append", filename, attr.Append);
AssertEquals ("All=PathDiscovery", filename, attr.PathDiscovery);
AssertEquals ("All=Read", filename, attr.Read);
AssertEquals ("All=Write", filename, attr.Write);
FileIOPermission p = (FileIOPermission) attr.CreatePermission ();
- AssertEquals ("All=FileIOPermissionAttribute-Append", FilePathUtil.GetLongPathName (filename), Path.GetFullPath(p.GetPathList (FileIOPermissionAccess.Append)[0]));
- AssertEquals ("All=FileIOPermissionAttribute-PathDiscovery", FilePathUtil.GetLongPathName (filename), p.GetPathList (FileIOPermissionAccess.PathDiscovery)[0]);
- AssertEquals ("All=FileIOPermissionAttribute-Read", FilePathUtil.GetLongPathName (filename), p.GetPathList (FileIOPermissionAccess.Read)[0]);
- AssertEquals ("All=FileIOPermissionAttribute-Write", FilePathUtil.GetLongPathName (filename), p.GetPathList (FileIOPermissionAccess.Write)[0]);
+ AssertEquals ("All=FileIOPermissionAttribute-Append", filename, p.GetPathList (FileIOPermissionAccess.Append)[0]);
+ AssertEquals ("All=FileIOPermissionAttribute-PathDiscovery", filename, p.GetPathList (FileIOPermissionAccess.PathDiscovery)[0]);
+ AssertEquals ("All=FileIOPermissionAttribute-Read", filename, p.GetPathList (FileIOPermissionAccess.Read)[0]);
+ AssertEquals ("All=FileIOPermissionAttribute-Write", filename, p.GetPathList (FileIOPermissionAccess.Write)[0]);
}
#if !NET_1_0
[Test]
@@ -119,14 +87,15 @@ namespace MonoTests.System.Security.Permissions {
[Test]
public void Append ()
{
+ string filename = Assembly.GetCallingAssembly ().Location;
FileIOPermissionAttribute attr = new FileIOPermissionAttribute (SecurityAction.Assert);
- attr.Append = Path.GetFullPath(filename);
+ attr.Append = filename;
AssertEquals ("Append=Append", filename, attr.Append);
AssertNull ("PathDiscovery=null", attr.PathDiscovery);
AssertNull ("Read=null", attr.Read);
AssertNull ("Write=null", attr.Write);
FileIOPermission p = (FileIOPermission) attr.CreatePermission ();
- AssertEquals ("Append=FileIOPermissionAttribute-Append", FilePathUtil.GetLongPathName (filename), p.GetPathList (FileIOPermissionAccess.Append)[0]);
+ AssertEquals ("Append=FileIOPermissionAttribute-Append", filename, p.GetPathList (FileIOPermissionAccess.Append)[0]);
AssertNull ("Append=FileIOPermissionAttribute-PathDiscovery", p.GetPathList (FileIOPermissionAccess.PathDiscovery));
AssertNull ("Append=FileIOPermissionAttribute-Read", p.GetPathList (FileIOPermissionAccess.Read));
AssertNull ("Append=FileIOPermissionAttribute-Write", p.GetPathList (FileIOPermissionAccess.Write));
@@ -135,15 +104,16 @@ namespace MonoTests.System.Security.Permissions {
[Test]
public void PathDiscovery ()
{
+ string filename = Assembly.GetCallingAssembly ().Location;
FileIOPermissionAttribute attr = new FileIOPermissionAttribute (SecurityAction.Assert);
- attr.PathDiscovery = Path.GetFullPath(filename);
+ attr.PathDiscovery = filename;
AssertNull ("Append=null", attr.Append);
AssertEquals ("PathDiscovery=PathDiscovery", filename, attr.PathDiscovery);
AssertNull ("Read=null", attr.Read);
AssertNull ("Write=null", attr.Write);
FileIOPermission p = (FileIOPermission) attr.CreatePermission ();
AssertNull ("PathDiscovery=FileIOPermissionAttribute-Append", p.GetPathList (FileIOPermissionAccess.Append));
- AssertEquals ("PathDiscovery=FileIOPermissionAttribute-PathDiscovery", FilePathUtil.GetLongPathName (filename), p.GetPathList (FileIOPermissionAccess.PathDiscovery)[0]);
+ AssertEquals ("PathDiscovery=FileIOPermissionAttribute-PathDiscovery", filename, p.GetPathList (FileIOPermissionAccess.PathDiscovery)[0]);
AssertNull ("PathDiscovery=FileIOPermissionAttribute-Read", p.GetPathList (FileIOPermissionAccess.Read));
AssertNull ("PathDiscovery=FileIOPermissionAttribute-Write", p.GetPathList (FileIOPermissionAccess.Write));
}
@@ -151,8 +121,9 @@ namespace MonoTests.System.Security.Permissions {
[Test]
public void Read ()
{
+ string filename = Assembly.GetCallingAssembly ().Location;
FileIOPermissionAttribute attr = new FileIOPermissionAttribute (SecurityAction.Assert);
- attr.Read = Path.GetFullPath(filename);
+ attr.Read = filename;
AssertNull ("Append=null", attr.Append);
AssertNull ("PathDiscovery=null", attr.PathDiscovery);
AssertEquals ("Read=Read", filename, attr.Read);
@@ -160,15 +131,16 @@ namespace MonoTests.System.Security.Permissions {
FileIOPermission p = (FileIOPermission) attr.CreatePermission ();
AssertNull ("PathDiscovery=FileIOPermissionAttribute-Append", p.GetPathList (FileIOPermissionAccess.Append));
AssertNull ("PathDiscovery=FileIOPermissionAttribute-PathDiscovery", p.GetPathList (FileIOPermissionAccess.PathDiscovery));
- AssertEquals ("PathDiscovery=FileIOPermissionAttribute-Read", FilePathUtil.GetLongPathName (filename), p.GetPathList (FileIOPermissionAccess.Read)[0]);
+ AssertEquals ("PathDiscovery=FileIOPermissionAttribute-Read", filename, p.GetPathList (FileIOPermissionAccess.Read)[0]);
AssertNull ("PathDiscovery=FileIOPermissionAttribute-Write", p.GetPathList (FileIOPermissionAccess.Write));
}
[Test]
public void Write ()
{
+ string filename = Assembly.GetCallingAssembly ().Location;
FileIOPermissionAttribute attr = new FileIOPermissionAttribute (SecurityAction.Assert);
- attr.Write = Path.GetFullPath(filename);
+ attr.Write = filename;
AssertNull ("Append=null", attr.Append);
AssertNull ("PathDiscovery=null", attr.PathDiscovery);
AssertNull ("Read=null", attr.Read);
@@ -177,7 +149,7 @@ namespace MonoTests.System.Security.Permissions {
AssertNull ("PathDiscovery=FileIOPermissionAttribute-Append", p.GetPathList (FileIOPermissionAccess.Append));
AssertNull ("PathDiscovery=FileIOPermissionAttribute-PathDiscovery", p.GetPathList (FileIOPermissionAccess.PathDiscovery));
AssertNull ("PathDiscovery=FileIOPermissionAttribute-Read", p.GetPathList (FileIOPermissionAccess.Read));
- AssertEquals ("PathDiscovery=FileIOPermissionAttribute-Write", FilePathUtil.GetLongPathName (filename), p.GetPathList (FileIOPermissionAccess.Write)[0]);
+ AssertEquals ("PathDiscovery=FileIOPermissionAttribute-Write", filename, p.GetPathList (FileIOPermissionAccess.Write)[0]);
}
[Test]
diff --git a/mcs/class/corlib/Test/System.Security.Permissions/FileIOPermissionTest.cs b/mcs/class/corlib/Test/System.Security.Permissions/FileIOPermissionTest.cs
index 89033aa8535..60a25c08b3a 100644
--- a/mcs/class/corlib/Test/System.Security.Permissions/FileIOPermissionTest.cs
+++ b/mcs/class/corlib/Test/System.Security.Permissions/FileIOPermissionTest.cs
@@ -10,15 +10,33 @@
// search for the "FIXME" notes below and adjust accordingly.
using System;
+using System.IO;
+using System.Runtime.InteropServices;
using System.Security;
using System.Security.Permissions;
-using System.IO;
+using System.Text;
using NUnit.Framework;
namespace MonoTests.System.Security.Permissions {
- public class FileIOPermissionTest : TestCase {
+ public class FilePathUtil {
+ [DllImport("kernel32.dll")]
+ private static extern uint GetLongPathName (string shortPath,
+ StringBuilder buffer, uint bufLength);
+
+ static public string GetLongPathName (string somePath)
+ {
+ StringBuilder buffer = new StringBuilder(260);
+ if (0 != GetLongPathName (somePath, buffer, (uint) buffer.Capacity))
+ return buffer.ToString ();
+ else
+ return null;
+ }
+ }
+
+ [TestFixture]
+ public class FileIOPermissionTest : Assertion {
string[] pathArrayGood;
string[] pathArrayBad;
@@ -28,7 +46,14 @@ namespace MonoTests.System.Security.Permissions {
string[] pathArrayGood2;
FileIOPermission unrestricted;
- protected override void SetUp() {
+ private string filename;
+
+ [SetUp]
+ public void SetUp ()
+ {
+ Environment.CurrentDirectory = Path.GetTempPath();
+ filename = Path.GetTempFileName ();
+
p = null;
pathsInPermission = null;
pathArrayGood = new string[2];
@@ -55,10 +80,16 @@ namespace MonoTests.System.Security.Permissions {
}
}
- private void SetDefaultData() {
+ [TearDown]
+ public void TearDown ()
+ {
+ if (File.Exists (filename))
+ File.Delete (filename);
}
-
- public void TestConstructorPermissionState() {
+
+ [Test]
+ public void ConstructorPermissionState ()
+ {
p = new FileIOPermission(PermissionState.None);
AssertEquals("Should be Restricted", false, p.IsUnrestricted());
p = new FileIOPermission(PermissionState.Unrestricted);
@@ -72,31 +103,44 @@ namespace MonoTests.System.Security.Permissions {
}
}
- public void TestConstructorString() {
- try{
- p = new FileIOPermission(FileIOPermissionAccess.Append, "this path is not rooted");
- Fail("Should have thrown an exception on path not rooted");
- }
- catch{}
+ [Test]
+ [ExpectedException (typeof (ArgumentNullException))]
+ public void ConstructorString_Null ()
+ {
+ p = new FileIOPermission(FileIOPermissionAccess.Append, (string)null);
+ }
- try{
- p = new FileIOPermission(FileIOPermissionAccess.Append, "<this is not a valid path>");
- Fail("Should have thrown an exception on invalid characters in path");
- }
- catch{}
-
- try{
- p = new FileIOPermission(FileIOPermissionAccess.Append, "\\\\mycomputer\\test*");
- Fail("Should have thrown an exception on wildcards not allowed in path");
- }
- catch{}
+ [Test]
+ [ExpectedException (typeof (ArgumentException))]
+ public void ConstructorString_NotRooted ()
+ {
+ p = new FileIOPermission(FileIOPermissionAccess.Append, "this path is not rooted");
+ }
- try{
- p = new FileIOPermission((FileIOPermissionAccess)77, "c:\\temp");
- Fail("Should have thrown an exception on invalid access value");
- }
- catch{}
+ [Test]
+ [ExpectedException (typeof (ArgumentException))]
+ public void ConstructorString_InvalidPath ()
+ {
+ p = new FileIOPermission(FileIOPermissionAccess.Append, "<this is not a valid path>");
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentException))]
+ public void ConstructorString_Wildcard ()
+ {
+ p = new FileIOPermission(FileIOPermissionAccess.Append, "\\\\mycomputer\\test*");
+ }
+ [Test]
+ [ExpectedException (typeof (ArgumentException))]
+ public void ConstructorString_InvalidAccess ()
+ {
+ p = new FileIOPermission((FileIOPermissionAccess)77, "c:\\temp");
+ }
+
+ [Test]
+ public void ConstructorString ()
+ {
string pathToAdd;
// FIXME: Adjust to run on Mac OS's
if (Path.VolumeSeparatorChar == ':')
@@ -110,29 +154,41 @@ namespace MonoTests.System.Security.Permissions {
Assert("Does not contain expected path from constructor: "+pathToAdd, pathsInPermission[0] == pathToAdd);
}
- public void TestConstructorStringArray() {
- try{
- p = new FileIOPermission(FileIOPermissionAccess.Append, pathArrayBad);
- Fail("Should have thrown an exception on wildcards not allowed in path");
- }
- catch{}
+ [Test]
+ [ExpectedException (typeof (ArgumentNullException))]
+ public void ConstructorStringArray_Null ()
+ {
+ p = new FileIOPermission(FileIOPermissionAccess.Append, (string[])null);
+ }
- try{
- p = new FileIOPermission((FileIOPermissionAccess)77, pathArrayGood);
- Fail("Should have thrown an exception on invalid access value");
- }
- catch{}
+ [Test]
+ [ExpectedException (typeof (ArgumentException))]
+ public void ConstructorStringArray_Wildcard ()
+ {
+ p = new FileIOPermission(FileIOPermissionAccess.Append, pathArrayBad);
+ }
+ [Test]
+ [ExpectedException (typeof (ArgumentException))]
+ public void ConstructorStringArray_InvalidAccess ()
+ {
+ p = new FileIOPermission((FileIOPermissionAccess)77, pathArrayGood);
+ }
+
+ [Test]
+ public void ConstructorStringArray ()
+ {
p = new FileIOPermission(FileIOPermissionAccess.Read, pathArrayGood);
pathsInPermission = p.GetPathList(FileIOPermissionAccess.Read);
Assert("Does not contain correct number of paths. Expected 2 but got: "+pathsInPermission.Length, pathsInPermission.Length == 2);
foreach (string s in pathsInPermission){
Assert("Unexpected path in the Permission: " + s, Array.IndexOf(pathsInPermission, s) >=0);
}
-
}
- public void TestAddPathListStringArray() {
+ [Test]
+ public void AddPathListStringArray ()
+ {
p = new FileIOPermission(FileIOPermissionAccess.Read, pathArrayGood);
pathsInPermission = p.GetPathList(FileIOPermissionAccess.Read);
Assert("Does not contain correct number of paths. Expected 2 but got: "+pathsInPermission.Length, pathsInPermission.Length == 2);
@@ -153,16 +209,16 @@ namespace MonoTests.System.Security.Permissions {
}
}
- public void TestIntersect() {
- FileIOPermission intersection;
-
+ [Test]
+ public void Intersect ()
+ {
p = new FileIOPermission(FileIOPermissionAccess.Read, pathArrayGood);
p.AllFiles = FileIOPermissionAccess.Append;
p.AllLocalFiles = FileIOPermissionAccess.Write;
unrestricted = new FileIOPermission(PermissionState.Unrestricted);
- intersection = (FileIOPermission)p.Intersect(unrestricted);
+ FileIOPermission intersection = (FileIOPermission)p.Intersect(unrestricted);
pathsInPermission = intersection.GetPathList(FileIOPermissionAccess.Read);
Assert("Should contain correct number of Read paths. Expected 2 but got: "+pathsInPermission.Length, pathsInPermission.Length == 2);
Assert("Should have Append bit in AllFiles.", (intersection.AllFiles & FileIOPermissionAccess.Append) != 0);
@@ -191,7 +247,9 @@ namespace MonoTests.System.Security.Permissions {
Assert("Should have only Write bit in AllLocalFiles.", intersection.AllLocalFiles == FileIOPermissionAccess.Write);
}
- public void TestIsSubsetOf() {
+ [Test]
+ public void IsSubsetOf ()
+ {
unrestricted = new FileIOPermission(PermissionState.Unrestricted);
Assert("IsSubsetOf reflective test failed", unrestricted.IsSubsetOf(unrestricted));
@@ -210,12 +268,13 @@ namespace MonoTests.System.Security.Permissions {
Assert("#2 IsSubsetOf false test failed", !p2.IsSubsetOf(p));
}
- public void TestUnion() {
- FileIOPermission union;
-
+ [Test]
+ public void Union ()
+ {
unrestricted = new FileIOPermission(PermissionState.Unrestricted);
p = new FileIOPermission(FileIOPermissionAccess.Read, pathArrayGood);
- union = (FileIOPermission)unrestricted.Union(p);
+
+ FileIOPermission union = (FileIOPermission)unrestricted.Union(p);
pathsInPermission = union.GetPathList(FileIOPermissionAccess.Read);
Assert("Should get an unrestricted permission", union.IsUnrestricted());
Assert("Path list should be empty", pathsInPermission == null);
@@ -240,11 +299,11 @@ namespace MonoTests.System.Security.Permissions {
Assert("Path list should have 3 for Append", pathsInPermission.Length == pathArrayGood2.Length);
}
- public void TestFromXML() {
+ [Test]
+ public void FromXML ()
+ {
p = new FileIOPermission(PermissionState.None);
- SecurityElement esd;
-
- esd = new SecurityElement("IPermission");
+ SecurityElement esd = new SecurityElement("IPermission");
esd.AddAttribute("class", "FileIOPermission");
esd.AddAttribute("version", "1");
esd.AddAttribute("Unrestricted", "true");
@@ -271,17 +330,31 @@ namespace MonoTests.System.Security.Permissions {
Assert("Path list should have 2 for Write", pathsInPermission.Length == 3);
}
- public void TestToXML() {
- SecurityElement esd;
- string read;
+ [Test]
+ public void ToXML ()
+ {
p = new FileIOPermission(FileIOPermissionAccess.Read, pathArrayGood);
- esd = p.ToXml();
+ SecurityElement esd = p.ToXml();
Assert("Esd tag incorrect", esd.Tag == "IPermission");
Assert("Esd version incorrect", (String)esd.Attributes["version"] == "1");
- read = (String)esd.Attributes["Read"];
+ string read = (String)esd.Attributes["Read"];
pathsInPermission = read.Split(';');
Assert("Path list should have 2 for Read", pathsInPermission.Length == 2);
}
+
+ [Test]
+ [Ignore("should compatibility go that far ?")]
+ public void ShortToLong ()
+ {
+ // on windows this returns a "short" (8.3) path and filename
+ string filename = Path.GetTempFileName ();
+ p = new FileIOPermission(FileIOPermissionAccess.Read, filename);
+ string[] files = p.GetPathList (FileIOPermissionAccess.Read);
+ AssertEquals ("GetPathList.Count", 1, files.Length);
+ // FIXME: here GetTempFileName != GetPathList[0] for MS but == for Mono
+ AssertEquals ("Path.GetFileName(GetTempFileName)==Path.GetFileName(GetPathList[0])", Path.GetFileName (filename), Path.GetFileName (files [0]));
+ // note: this will fail on Linux as kernel32.dll isn't available
+ AssertEquals ("GetLongPathName(GetTempFileName)==GetPathList[0]", FilePathUtil.GetLongPathName (filename), files [0]);
+ }
}
}
-
diff --git a/mcs/class/corlib/Test/System.Security.Policy/ChangeLog b/mcs/class/corlib/Test/System.Security.Policy/ChangeLog
index 65b78a59e59..c5148c8b33b 100644
--- a/mcs/class/corlib/Test/System.Security.Policy/ChangeLog
+++ b/mcs/class/corlib/Test/System.Security.Policy/ChangeLog
@@ -1,3 +1,56 @@
+2004-01-28 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * PermissionRequestEvidenceTest.cs: Added ToString () assertions
+ to existing tests.
+ * PublisherMembershipConditionTest.cs: Replaced "\r\n" with
+ Environment.NewLine.
+ * StrongNameTest.cs: Replaced "\r\n" with Environment.NewLine.
+
+2004-01-26 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * CodeGroupTest.cs: Replaced "\r\n" with Environment.NewLine.
+
+2004-01-25 David Sheldon <dave-mono@earth.li>
+
+ * UrlTest.cs: Changed "\r\n" in strings to use
+ Environment.NewLine.
+
+2004-01-25 David Sheldon <dave-mono@earth.li>
+
+ * PublisherTest.cs, SiteTest.cs: Changed "\r\n" in strings to use
+ Environment.NewLine.
+
+2004-01-14 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * UrlTest.cs: New. Unit tests for Url. Site test still fails.
+ * UrlMembershipConditionTest.cs: New. Unit tests for
+ UrlMembershipCondition. Site test still fails.
+
+2004-01-05 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * CodeGroupTest.cs: Updated to NUnit2. Added new tests for exceptions
+ and for ToXml/FromXml methods.
+ * FileCodeGroupTest.cs: New. Unit tests for FileCodeGroup. Missing
+ Resolve unit tests.
+ * FirstMatchCodeGroupTest.cs: New. Unit tests for FirstMatchCodeGroup.
+ Missing Resolve unit tests.
+ * NetCodeGroupTest.cs: New. Unit tests for NetCodeGroup. Missing
+ Resolve unit tests.
+ * UnionCodeGroupTest.cs: New. Unit tests for NetCodeGroup. Missing
+ Resolve unit tests.
+ * PolicyLevelTest.cs: New. Unit tests for PolicyLevel. Missing Resolve
+ unit tests.
+
+2004-01-03 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * SiteTest.cs: New. Unit tests for Site.
+ * SiteMembershipConditionTest.cs: New. Implemented.
+
+2004-01-02 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * EvidenceTest.cs: Upgraded tests to NUnit2. Added new tests.
+ * StrongNameTest.cs: Class now inherits from Assertion.
+
2004-01-01 Nick Drochak <ndrochak@gol.com>
* PermissionRequestEvidenceTest.cs: New File
diff --git a/mcs/class/corlib/Test/System.Security.Policy/CodeGroupTest.cs b/mcs/class/corlib/Test/System.Security.Policy/CodeGroupTest.cs
index a9b108bf18e..d61c9304c05 100644
--- a/mcs/class/corlib/Test/System.Security.Policy/CodeGroupTest.cs
+++ b/mcs/class/corlib/Test/System.Security.Policy/CodeGroupTest.cs
@@ -1,232 +1,359 @@
-//
-// MonoTests.System.Security.Policy.CodeGroupTest
-//
-// Author(s):
-// Nick Drochak (ndrochak@gol.com)
-//
+//
+// MonoTests.System.Security.Policy.CodeGroupTest
+//
+// Authors:
+// Nick Drochak (ndrochak@gol.com)
+// Sebastien Pouliot (spouliot@motus.com)
+//
// (C) 2001 Nick Drochak, All rights reserved.
-
-using NUnit.Framework;
-using System;
-using System.Security;
-using System.Security.Policy;
-using System.Security.Permissions;
-
-namespace MonoTests.System.Security.Policy
-{
-
- public class CodeGroupTest : TestCase
- {
-
- protected override void SetUp()
- {
- }
-
- public class MyCodeGroup : CodeGroup
- {
- public MyCodeGroup(IMembershipCondition membershipCondition,
- PolicyStatement policy) :base(membershipCondition, policy)
- {
- }
+// Portions (C) 2004 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using NUnit.Framework;
+using System;
+using System.Collections;
+using System.Security;
+using System.Security.Policy;
+using System.Security.Permissions;
+
+namespace MonoTests.System.Security.Policy {
+
+ public class MyCodeGroup : CodeGroup {
+
+ public MyCodeGroup (IMembershipCondition membershipCondition, PolicyStatement policy)
+ : base (membershipCondition, policy) {}
+
+ public override CodeGroup Copy ()
+ {
+ return this;
+ }
+
+ public override string MergeLogic {
+ get { return ""; }
+ }
+
+ public override PolicyStatement Resolve (Evidence evidence)
+ {
+ return null;
+ }
+
+ public override CodeGroup ResolveMatchingCodeGroups (Evidence evidence)
+ {
+ return this;
+ }
+ }
+
+ // this version has a constructor with no parameters
+ public class MySecondCodeGroup : CodeGroup {
+
+ // must be public (else the ToFromXmlRoundtrip_WithChildren_Second will fail)
+ public MySecondCodeGroup () : base (new AllMembershipCondition (), null) {}
+
+ public MySecondCodeGroup (IMembershipCondition membershipCondition, PolicyStatement policy)
+ : base (membershipCondition, policy) {}
+
+ public override CodeGroup Copy () {
+ return this;
+ }
+
+ public override string MergeLogic {
+ get { return ""; }
+ }
+
+ public override PolicyStatement Resolve (Evidence evidence) {
+ return null;
+ }
+
+ public override CodeGroup ResolveMatchingCodeGroups (Evidence evidence) {
+ return this;
+ }
+ }
+
+ [TestFixture]
+ public class CodeGroupTest : Assertion {
+
+ private const string ps_Name = "TestName";
+
+ [Test]
+ [ExpectedException (typeof (ArgumentNullException))]
+ public void Constructor_MembershipConditionNullPolicyStatement ()
+ {
+ MyCodeGroup cg = new MyCodeGroup (null, new PolicyStatement(new PermissionSet(PermissionState.None)));
+ }
+
+ [Test]
+ public void Constructor_MembershipConditionPolicyStatementNull ()
+ {
+ // legal
+ MyCodeGroup cg = new MyCodeGroup (new AllMembershipCondition(), null);
+ AssertNull ("PolicyStatement", cg.PolicyStatement);
+ }
+
+ [Test]
+ public void Constructor ()
+ {
+ MyCodeGroup cg = new MyCodeGroup (new AllMembershipCondition(), new PolicyStatement(new PermissionSet(PermissionState.None)));
+ AssertNotNull ("PolicyStatement property not set correctly by constructor.", cg.PolicyStatement);
+ AssertNotNull ("MembershipCondition property not set correctly by constructor.", cg.MembershipCondition);
+ }
+
+ [Test]
+ public void Description ()
+ {
+ const string description = "Test Description";
+ MyCodeGroup cg = new MyCodeGroup (new AllMembershipCondition(), new PolicyStatement(new PermissionSet(PermissionState.None)));
+ cg.Description = description;
+ AssertEquals ("Description not the expected value", description, cg.Description);
+ }
+
+ [Test]
+ public void Name ()
+ {
+ const string name = "Test Name";
+ MyCodeGroup cg = new MyCodeGroup (new AllMembershipCondition(), new PolicyStatement(new PermissionSet(PermissionState.None)));
+ cg.Name = name;
+ AssertEquals ("Description not the expected value", name, cg.Name);
+ }
+
+ [Test]
+ public void AddChild ()
+ {
+ MyCodeGroup cg = new MyCodeGroup(new AllMembershipCondition (), new PolicyStatement(new PermissionSet (PermissionState.None)));
+ AssertEquals ("Unexpected number of children (before add)", 0, cg.Children.Count);
+ cg.AddChild (new MyCodeGroup (new AllMembershipCondition (), new PolicyStatement(new PermissionSet (PermissionState.Unrestricted))));
+ AssertEquals ("Unexpected number of children (after add)", 1, cg.Children.Count);
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentNullException))]
+ public void AddChild_Null ()
+ {
+ MyCodeGroup cg = new MyCodeGroup (new AllMembershipCondition (), new PolicyStatement(new PermissionSet (PermissionState.None)));
+ cg.AddChild (null);
+ }
+
+ [Test]
+ public void AttributeString ()
+ {
+ PolicyStatementAttribute psa = PolicyStatementAttribute.LevelFinal;
+ PolicyStatement ps = new PolicyStatement (new PermissionSet (PermissionState.None));
+ ps.Attributes = psa;
+ MyCodeGroup cg = new MyCodeGroup(new AllMembershipCondition (), ps);
+ AssertEquals ("AttributeString", psa.ToString(), cg.AttributeString);
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentNullException))]
+ public void Children_Null ()
+ {
+ MyCodeGroup cg = new MyCodeGroup (new AllMembershipCondition (), new PolicyStatement(new PermissionSet (PermissionState.None)));
+ cg.Children = null;
+ }
+
+ [Test]
+ public void PermissionSetName ()
+ {
+ PolicyStatement ps = new PolicyStatement(new NamedPermissionSet (ps_Name));
+ MyCodeGroup cg = new MyCodeGroup (new AllMembershipCondition (), ps);
+ AssertEquals ("PermissionSetName", ps_Name, cg.PermissionSetName);
+ }
+
+ [Test]
+ public void Equals ()
+ {
+ PolicyStatement ps = new PolicyStatement (new NamedPermissionSet (ps_Name));
+ MyCodeGroup cg = new MyCodeGroup (new AllMembershipCondition (), ps);
+ cg.Name = "SomeName";
+ cg.Description = "Some Description";
+ Assert ("Equals (itself)", cg.Equals (cg));
+ Assert ("Equals (string)", !cg.Equals ("Not Equal to this"));
+
+ MyCodeGroup cg2 = new MyCodeGroup(new AllMembershipCondition(), ps);
+ cg2.Name = "SomeOtherName";
+ cg2.Description = "Some Other Description";
+ Assert ("Equals (another)", !cg.Equals (cg2));
- public override CodeGroup Copy()
- {
- return this;
- }
-
- public override string MergeLogic
- {
- get
- {
- return "";
- }
- }
-
- public override PolicyStatement Resolve( Evidence evidence)
- {
- return (PolicyStatement)null;
- }
-
- public override CodeGroup ResolveMatchingCodeGroups(Evidence evidence)
- {
- return this;
- }
- }
-
- public void TestConstructorExceptions()
- {
- MyCodeGroup cg;
- try
- {
- cg = new MyCodeGroup(null, null);
- Fail("Constructor should throw exception on null paramters");
- }
- catch(Exception e)
- {
- Assert("Should have caught an ArgumentNull Exception", e is ArgumentNullException);
- }
- }
-
- public void TestConstructor()
- {
- MyCodeGroup cg = null;
- try
- {
- cg = new MyCodeGroup(new AllMembershipCondition(), new PolicyStatement(new PermissionSet(PermissionState.None)));
- Assert("PolicyStatement property not set correctly by constructor.", cg.PolicyStatement != null);
- Assert("MembershipCondition property not set correctly by constructor.", cg.MembershipCondition != null);
- }
- catch(Exception e)
- {
- Fail("Constructor failed. Exception caught was: " + e.ToString());
- }
- }
-
- public void TestDescriptionProperty()
- {
- MyCodeGroup cg = null;
- const string description = "Test Description";
- cg = new MyCodeGroup(new AllMembershipCondition(), new PolicyStatement(new PermissionSet(PermissionState.None)));
- cg.Description = description;
- Assert("Description not the expected value", cg.Description == description);
- }
-
- public void TestNameProperty()
- {
- MyCodeGroup cg = null;
- const string name = "Test Name";
- cg = new MyCodeGroup(new AllMembershipCondition(), new PolicyStatement(new PermissionSet(PermissionState.None)));
- cg.Name = name;
- Assert("Description not the expected value", cg.Name == name);
- }
-
- public void TestChildren()
- {
- MyCodeGroup cg = null;
- cg = new MyCodeGroup(new AllMembershipCondition(), new PolicyStatement(new PermissionSet(PermissionState.None)));
- cg.AddChild(new MyCodeGroup(new AllMembershipCondition(), new PolicyStatement(new PermissionSet(PermissionState.Unrestricted))));
- Assert("Unexpected number of children", cg.Children.Count == 1);
- }
-
- public void TestAttributeStringProperty()
- {
- MyCodeGroup cg = null;
- PolicyStatementAttribute psa = PolicyStatementAttribute.LevelFinal;
- PolicyStatement ps = new PolicyStatement(new PermissionSet(PermissionState.None));
- ps.Attributes = psa;
- cg = new MyCodeGroup(new AllMembershipCondition(), ps);
- AssertEquals("AttributeString", psa.ToString(), cg.AttributeString);
- }
-
- public void TestPermissionSetNameProperty()
- {
- MyCodeGroup cg = null;
- const string ps_Name = "TestName";
- PolicyStatement ps = new PolicyStatement(new NamedPermissionSet(ps_Name));
- cg = new MyCodeGroup(new AllMembershipCondition(), ps);
- AssertEquals("AttributeString", ps_Name, cg.PermissionSetName);
- }
-
- public void TestEquals()
- {
- MyCodeGroup cg = null;
- MyCodeGroup cg2 = null;
- const string ps_Name = "TestName";
- PolicyStatement ps = new PolicyStatement(new NamedPermissionSet(ps_Name));
- cg = new MyCodeGroup(new AllMembershipCondition(), ps);
- cg.Name = "SomeName";
- cg.Description = "Some Description";
- bool isEquals;
- isEquals = cg.Equals(cg);
-
- isEquals = cg.Equals("Not Equal to this");
- Assert("CodeGroup should not be equal to a non-CodeGroup type", !isEquals);
-
- cg2 = new MyCodeGroup(new AllMembershipCondition(), ps);
- cg2.Name = "SomeOtherName";
- cg2.Description = "Some Other Description";
-
- isEquals = cg.Equals(cg2);
- Assert("CodeGroup should not be equal when Name or Description is different", !isEquals);
-
- cg2 = new MyCodeGroup(new ApplicationDirectoryMembershipCondition(), ps);
- cg2.Name = cg.Name;
- cg2.Description = cg.Description;
- isEquals = cg.Equals(cg2);
- Assert("CodeGroup should not be equal when Membership Condition is different", !isEquals);
- }
-
- public void TestEqualsWithChildren()
- {
- MyCodeGroup cg = null;
- MyCodeGroup cg2 = null;
- MyCodeGroup cgChild = null;
- const string ps_Name = "TestName";
- bool isEquals;
-
- PolicyStatement ps = new PolicyStatement(new NamedPermissionSet(ps_Name));
- cg = new MyCodeGroup(new AllMembershipCondition(), ps);
- cg.Name = "SomeName";
- cg.Description = "Some Description";
-
- cgChild = new MyCodeGroup(new ApplicationDirectoryMembershipCondition(), ps);
- cgChild.Name = "ChildName";
- cgChild.Description = "Child Descripiton";
-
- cg.AddChild(cgChild);
-
- cg2 = new MyCodeGroup(cg.MembershipCondition, cg.PolicyStatement);
- cg2.Name = cg.Name;
- cg2.Description = cg.Description;
-
- isEquals = cg.Equals(cg2);
- Assert("Should be equal when Children are ignored", isEquals);
-
- isEquals = cg.Equals(cg2, true);
- Assert("Should not be equal when Child count is different", !isEquals);
-
- cg2.AddChild(cgChild);
- isEquals = cg2.Equals(cg, true);
- Assert("Should be equal when children are equal", isEquals);
- }
-
-
- public void TestRemoveChild()
- {
- MyCodeGroup cg = null;
- MyCodeGroup cgChild = null;
- MyCodeGroup cgChild2 = null;
- const string ps_Name = "TestName";
-
- PolicyStatement ps = new PolicyStatement(new NamedPermissionSet(ps_Name));
- cg = new MyCodeGroup(new AllMembershipCondition(), ps);
- cg.Name = "SomeName";
- cg.Description = "Some Description";
-
- cgChild = new MyCodeGroup(new ApplicationDirectoryMembershipCondition(), ps);
- cgChild.Name = "ChildName";
- cgChild.Description = "Child Descripiton";
-
- cg.AddChild(cgChild);
-
- cgChild2 = new MyCodeGroup(new ApplicationDirectoryMembershipCondition(), ps);
- cgChild2.Name = "ChildName2";
- cgChild2.Description = "Child Descripiton 2";
-
- cg.AddChild(cgChild2);
-
- AssertEquals("Should be two children before the call to Remove()", 2, cg.Children.Count);
-
- cg.RemoveChild(cgChild);
-
- AssertEquals("Remaing child does not have correct name", "ChildName2", ((CodeGroup)cg.Children[0]).Name);
- try
- {
- cg.RemoveChild(cgChild);
- Fail("Should have throw error on trying to remove non-existant child");
- }
- catch{}
- }
- } // public class CodeGroupTest
-
+ cg2 = new MyCodeGroup (new ApplicationDirectoryMembershipCondition(), ps);
+ cg2.Name = cg.Name;
+ cg2.Description = cg.Description;
+ Assert ("Equals (different Membership Condition)", !cg.Equals (cg2));
+ }
+
+ [Test]
+ public void EqualsWithChildren ()
+ {
+ PolicyStatement ps = new PolicyStatement (new NamedPermissionSet (ps_Name));
+
+ MyCodeGroup cgChild = new MyCodeGroup(new ApplicationDirectoryMembershipCondition(), ps);
+ cgChild.Name = "ChildName";
+ cgChild.Description = "Child Descripiton";
+
+ MyCodeGroup cg = new MyCodeGroup (new AllMembershipCondition (), ps);
+ cg.Name = "SomeName";
+ cg.Description = "Some Description";
+ cg.AddChild (cgChild);
+
+ MyCodeGroup cg2 = new MyCodeGroup (cg.MembershipCondition, cg.PolicyStatement);
+ cg2.Name = cg.Name;
+ cg2.Description = cg.Description;
+
+ Assert ("Should be equal when Children are ignored", cg.Equals (cg2));
+ Assert ("Should not be equal when Child count is different", !cg.Equals(cg2, true));
+
+ cg2.AddChild(cgChild);
+ Assert ("Should be equal when children are equal", cg2.Equals(cg, true));
+ }
+
+ [Test]
+ public void RemoveChild ()
+ {
+ PolicyStatement ps = new PolicyStatement (new NamedPermissionSet (ps_Name));
+ MyCodeGroup cg = new MyCodeGroup (new AllMembershipCondition (), ps);
+ cg.Name = "SomeName";
+ cg.Description = "Some Description";
+
+ MyCodeGroup cgChild = new MyCodeGroup (new ApplicationDirectoryMembershipCondition (), ps);
+ cgChild.Name = "ChildName";
+ cgChild.Description = "Child Descripiton";
+ cg.AddChild (cgChild);
+
+ MyCodeGroup cgChild2 = new MyCodeGroup (new ApplicationDirectoryMembershipCondition (), ps);
+ cgChild2.Name = "ChildName2";
+ cgChild2.Description = "Child Descripiton 2";
+ cg.AddChild (cgChild2);
+
+ AssertEquals ("Should be two children before the call to Remove()", 2, cg.Children.Count);
+ cg.RemoveChild(cgChild);
+ AssertEquals ("Should be one children after the call to Remove()", 1, cg.Children.Count);
+ AssertEquals("Remaining child does not have correct name", "ChildName2", ((CodeGroup)cg.Children[0]).Name);
+ }
+
+ [Test]
+ public void RemoveChild_NonExistant ()
+ {
+ PolicyStatement ps = new PolicyStatement (new NamedPermissionSet (ps_Name));
+
+ MyCodeGroup cgChild = new MyCodeGroup (new ApplicationDirectoryMembershipCondition (), ps);
+ cgChild.Name = "ChildName";
+ cgChild.Description = "Child Descripiton";
+
+ MyCodeGroup cg = new MyCodeGroup (new AllMembershipCondition (), ps);
+ cg.AddChild (cgChild);
+ cg.RemoveChild (cgChild);
+ cg.RemoveChild (cgChild);
+ // no exception
+ }
+
+ [Test]
+ public void RemoveChild_Null ()
+ {
+ MyCodeGroup cg = new MyCodeGroup (new AllMembershipCondition (), new PolicyStatement(new PermissionSet (PermissionState.None)));
+ cg.RemoveChild (null);
+ // no exception
+ }
+
+ [Test]
+ public void ToXml ()
+ {
+ MyCodeGroup cg = new MyCodeGroup (new AllMembershipCondition (), new PolicyStatement(new PermissionSet (PermissionState.None)));
+ SecurityElement se = cg.ToXml ();
+ string s = se.ToString ();
+ Assert ("ToXml-Starts", s.StartsWith ("<CodeGroup class=\"MonoTests.System.Security.Policy.MyCodeGroup,"));
+ Assert ("ToXml-Ends", s.EndsWith ("version=\"1\"/>" + Environment.NewLine + "</CodeGroup>" + Environment.NewLine));
+
+ cg.AddChild (new MyCodeGroup (new AllMembershipCondition (), new PolicyStatement(new PermissionSet (PermissionState.Unrestricted))));
+ se = cg.ToXml ();
+ s = se.ToString ();
+ Assert ("ToXml-Child", s.IndexOf ("<CodeGroup class=\"MonoTests.System.Security.Policy.MyCodeGroup,", 1) > 0);
+ }
+
+ [Test]
+ public void ToFromXmlRoundtrip ()
+ {
+ PolicyStatement ps = new PolicyStatement (new NamedPermissionSet (ps_Name));
+ MyCodeGroup cg = new MyCodeGroup (new AllMembershipCondition (), ps);
+ cg.Name = "SomeName";
+ cg.Description = "Some Description";
+ Assert ("Equals (itself)", cg.Equals (cg));
+ SecurityElement se = cg.ToXml ();
+
+ MyCodeGroup cg2 = new MyCodeGroup (new AllMembershipCondition(), ps);
+ cg2.Name = "SomeOtherName";
+ cg2.Description = "Some Other Description";
+ Assert ("Equals (another)", !cg.Equals (cg2));
+
+ cg2.FromXml (se);
+ Assert ("Equals (FromXml)", cg.Equals (cg2));
+ }
+
+ [Test]
+ [ExpectedException (typeof (MissingMethodException))]
+ public void ToFromXmlRoundtrip_WithChildren ()
+ {
+ PolicyStatement ps = new PolicyStatement (new NamedPermissionSet (ps_Name));
+
+ MyCodeGroup cgChild = new MyCodeGroup (new ApplicationDirectoryMembershipCondition (), ps);
+ cgChild.Name = "ChildName";
+ cgChild.Description = "Child Descripiton";
+
+ MyCodeGroup cg = new MyCodeGroup (new AllMembershipCondition (), ps);
+ cg.Name = "SomeName";
+ cg.Description = "Some Description";
+ cg.AddChild (cgChild);
+ cg.AddChild (cgChild);
+ Assert ("Equals (itself)", cg.Equals (cg));
+ SecurityElement se = cg.ToXml ();
+
+ MyCodeGroup cg2 = (MyCodeGroup) cg.Copy ();
+ cg2.FromXml (se);
+ // MissingMethodException down here (stangely not up here ?!? delayed ?)
+ Assert ("Equals (FromXml)", cg.Equals (cg2, true));
+ }
+
+ [Test]
+ public void ToFromXmlRoundtrip_WithChildren_Second ()
+ {
+ PolicyStatement ps = new PolicyStatement (new NamedPermissionSet (ps_Name));
+
+ // only the child is MySecondCodeGroup
+ MySecondCodeGroup cgChild = new MySecondCodeGroup (new ApplicationDirectoryMembershipCondition (), ps);
+ cgChild.Name = "ChildName";
+ cgChild.Description = "Child Descripiton";
+
+ MyCodeGroup cg = new MyCodeGroup (new AllMembershipCondition (), ps);
+ cg.Name = "SomeName";
+ cg.Description = "Some Description";
+ cg.AddChild (cgChild);
+ Assert ("Equals (itself)", cg.Equals (cg));
+ SecurityElement se = cg.ToXml ();
+
+ MyCodeGroup cg2 = (MyCodeGroup) cg.Copy ();
+ cg2.FromXml (se);
+ Assert ("Equals (FromXml)", cg.Equals (cg2, true));
+ }
+
+ [Test]
+ public void FromXml_Bad ()
+ {
+ MyCodeGroup cg = new MyCodeGroup (new AllMembershipCondition (), new PolicyStatement(new PermissionSet (PermissionState.None)));
+ SecurityElement se = cg.ToXml ();
+ se.Tag = "Mono";
+ // strangely this works :(
+ cg.FromXml (se);
+ // let's get weirder :)
+ foreach (SecurityElement child in se.Children) {
+ child.Tag = "Mono";
+ }
+ cg.FromXml (se);
+ // it's not enough :(( - very relax parsing
+ se.Attributes = new Hashtable ();
+ cg.FromXml (se);
+ // arghh - I will prevail!
+ foreach (SecurityElement child in se.Children) {
+ child.Attributes = new Hashtable ();
+ }
+ cg.FromXml (se);
+ // huh ? well maybe not (but this is both cruel and injust)
+ }
+ } // public class CodeGroupTest
} // namespace MonoTests.System.Security.Policy \ No newline at end of file
diff --git a/mcs/class/corlib/Test/System.Security.Policy/EvidenceTest.cs b/mcs/class/corlib/Test/System.Security.Policy/EvidenceTest.cs
index 23cfffaf110..7b4f7a56f7e 100644
--- a/mcs/class/corlib/Test/System.Security.Policy/EvidenceTest.cs
+++ b/mcs/class/corlib/Test/System.Security.Policy/EvidenceTest.cs
@@ -1,29 +1,26 @@
//
// MonoTests.System.Security.Policy.EvidenceTest
//
-// Author(s):
-// Jackson Harper (Jackson@LatitudeGeo.com)
+// Authors:
+// Jackson Harper (Jackson@LatitudeGeo.com)
+// Sebastien Pouliot (spouliot@motus.com)
//
// (C) 2001 Jackson Harper, All rights reserved.
-
+// Portions (C) 2003, 2004 Motus Technologies Inc. (http://www.motus.com)
+//
using System;
using System.Collections;
using System.Security.Policy;
using NUnit.Framework;
+namespace MonoTests.System.Security.Policy {
-namespace MonoTests.System.Security.Policy
-{
-
- public class EvidenceTest : TestCase
- {
+ [TestFixture]
+ public class EvidenceTest : Assertion {
- protected override void SetUp()
- {
- }
-
- public void TestDefaultConstructor()
+ [Test]
+ public void DefaultConstructor ()
{
Evidence evidence = new Evidence ();
@@ -36,34 +33,33 @@ namespace MonoTests.System.Security.Policy
evidence.GetEnumerator().MoveNext(), false);
}
- public void TestMultipleConstructor() {
- Evidence evidence;
+ [Test]
+ public void MultipleConstructor ()
+ {
object[] hostarray = new object[10];
object[] assemarray = new object[10];
-
- evidence = new Evidence ( hostarray, assemarray );
+ Evidence evidence = new Evidence ( hostarray, assemarray );
AssertEquals ( "Count of multiple arg constructor should equal 20", evidence.Count, 20 );
}
- public void TestCopyConstructor()
+ [Test]
+ public void CopyConstructor ()
{
- Evidence evidence1, evidence2;
object[] hostlist = { "host-1", "host-2", "host-3", "host-4" };
object[] asmblist = { "asmb-1", "asmb-2", "asmb-3", "asmb-4" };
-
- evidence1 = new Evidence (hostlist, asmblist);
- evidence2 = new Evidence (evidence1);
+ Evidence evidence1 = new Evidence (hostlist, asmblist);
+ Evidence evidence2 = new Evidence (evidence1);
AssertEquals("Copy constructor counts do not match", evidence1.Count, evidence2.Count);
}
- public void TestAddAssembly()
+ [Test]
+ public void AddAssembly ()
{
Evidence evidence = new Evidence ();
object[] comparray = new object[100];
string obj;
- int index;
for (int i=0; i<100; i++) {
obj = String.Format ("asmb-{0}", i+1);
@@ -72,19 +68,19 @@ namespace MonoTests.System.Security.Policy
AssertEquals (evidence.Count, i+1);
}
- index = 0;
+ int index = 0;
foreach (object compobj in evidence) {
AssertEquals ("Comparison object does not equal evidence assembly object",
comparray[index++], compobj);
}
}
- public void TestAddHost()
+ [Test]
+ public void AddHost ()
{
Evidence evidence = new Evidence ();
object[] comparray = new object[100];
string obj;
- int index;
for (int i=0; i<100; i++) {
obj = String.Format ("asmb-{0}", i+1);
@@ -93,44 +89,42 @@ namespace MonoTests.System.Security.Policy
AssertEquals (evidence.Count, i+1);
}
- index = 0;
+ int index = 0;
foreach (object compobj in evidence) {
AssertEquals ("Comparison object does not equal evidence host object",
comparray[index++], compobj);
}
}
- public void TestMultiArgConstructorForEach()
+ [Test]
+ public void MultiArgConstructorForEach ()
{
object[] hostarray = { "host-1", "host-2", "host-3", "host-4" };
object[] asmbarray = { "asmb-1", "asmb-2", "asmb-3", "asmb-4" };
ArrayList compare = new ArrayList ();
Evidence evidence = new Evidence (hostarray, asmbarray);
- int i;
compare.AddRange (hostarray);
compare.AddRange (asmbarray);
- i = 0;
+ int i = 0;
foreach (object obj in evidence) {
AssertEquals (obj, compare[i++]);
}
}
- public void TestEnumeratorReset()
+ [Test]
+ public void EnumeratorReset ()
{
object[] hostarray = { "host-1", "host-2", "host-3", "host-4" };
object[] asmbarray = { "asmb-1", "asmb-2", "asmb-3", "asmb-4" };
ArrayList compare = new ArrayList ();
Evidence evidence = new Evidence (hostarray, asmbarray);
- IEnumerator enumerator;
- int i;
-
compare.AddRange (hostarray);
compare.AddRange (asmbarray);
- i = 0;
- enumerator = evidence.GetEnumerator ();
+ int i = 0;
+ IEnumerator enumerator = evidence.GetEnumerator ();
while (enumerator.MoveNext ()) {
AssertEquals (enumerator.Current, compare[i++]);
}
@@ -142,25 +136,21 @@ namespace MonoTests.System.Security.Policy
}
}
- public void TestGetHostEnumerator()
+ [Test]
+ public void GetHostEnumerator ()
{
object[] hostarray = { "host-1", "host-2", "host-3", "host-4" };
object[] asmbarray = { "asmb-1", "asmb-2" };
- Evidence evidence;
- IEnumerator enumerator;
- int i;
-
- evidence = new Evidence (hostarray, asmbarray);
- enumerator = evidence.GetHostEnumerator ();
-
- i = 0;
+ Evidence evidence = new Evidence (hostarray, asmbarray);
+ IEnumerator enumerator = evidence.GetHostEnumerator ();
+ int i = 0;
while (enumerator.MoveNext ()) {
AssertEquals (enumerator.Current, hostarray[i++]);
}
}
-
- public void TestGetHostAssemblyEnumerator()
+ [Test]
+ public void GetHostAssemblyEnumerator ()
{
object[] hostarray = { "host-1", "host-2", "host-3", "host-4" };
object[] asmbarray = { "asmb-1", "asmb-2", "asmb-3", "asmb-4" };
@@ -175,16 +165,14 @@ namespace MonoTests.System.Security.Policy
while (enumerator.MoveNext()) {
AssertEquals (enumerator.Current, asmbarray[i++]);
}
-
}
- public void TestCount()
+ [Test]
+ public void Count ()
{
object[] hostarray = { "host-1", "host-2", "host-3", "host-4" };
object[] asmbarray = { "asmb-1", "asmb-2", "asmb-3", "asmb-4" };
- Evidence evidence;
-
- evidence = new Evidence (hostarray, asmbarray);
+ Evidence evidence = new Evidence (hostarray, asmbarray);
Assertion.AssertEquals (evidence.Count, 8);
for( int i=0; i<100; i++ ) {
@@ -197,69 +185,69 @@ namespace MonoTests.System.Security.Policy
}
}
- public void TestNullCopyToException()
+ [Test]
+ [ExpectedException (typeof (ArgumentNullException))]
+ public void NullCopyToException()
{
- Evidence evidence;
-
- evidence = new Evidence ();
+ Evidence evidence = new Evidence ();
evidence.AddHost ("host-1");
-
- try {
- evidence.CopyTo (null, 100);
- Fail ("CopyTo should throw exception when recieving a null array");
- } catch (Exception e) {
- Assert ("Should have caught an ArgumentNull Exception", e is ArgumentNullException);
- }
+ evidence.CopyTo (null, 100);
}
/// <summary>
/// No Exception will be generated because the copy won't run because the evidence list is empty
/// </summary>
- public void TestCopyToNoException()
+ [Test]
+ public void CopyToNoException()
{
Evidence evidence = new Evidence ();;
-
evidence.CopyTo (null, 100);
}
- public void TestArgOutOfRangeCopyToException()
+ [Test]
+ [ExpectedException (typeof (ArgumentOutOfRangeException))]
+ public void ArgOutOfRangeCopyToException()
{
Evidence evidence = new Evidence (new object[10], new object[10]);
-
- try {
- evidence.CopyTo (new object[10], -100);
- Fail ("CopyTo should throw exception when recieving a negative index");
- } catch (Exception e) {
- Assert("Should have caught an ArgumentOutOfRangeException Exception",
- e is ArgumentOutOfRangeException);
- }
+ evidence.CopyTo (new object[10], -100);
}
/// <summary>
/// No Exception will be generated because the copy won't run because the evidence list is empty
/// </summary>
- public void TestArgOutOfRangeCopyToNoException()
+ [Test]
+ public void ArgOutOfRangeCopyToNoException()
{
Evidence evidence = new Evidence ();
-
evidence.CopyTo (new object[10], -100);
}
- public void BadMergeTest() {
- Evidence evidence, evidence2;
-
- evidence = new Evidence (null, null);
- evidence2 = new Evidence ();
+ [Test]
+ public void BadMerge ()
+ {
+ Evidence evidence = new Evidence (null, null);
+ Evidence evidence2 = new Evidence ();
+ evidence2.Merge (evidence);
}
- public void MergeTest() {
- Evidence evidence, evidence2;
-
- evidence = new Evidence (new object[10], new object[10]);
- evidence2 = new Evidence ();
-
+ [Test]
+ public void Merge ()
+ {
+ Evidence evidence = new Evidence (new object[10], new object[10]);
+ Evidence evidence2 = new Evidence ();
evidence2.Merge (evidence);
}
+
+ [Test]
+ public void DefaultProperties ()
+ {
+ Evidence e = new Evidence ();
+ AssertEquals ("Count", 0, e.Count);
+ Assert ("IsReadOnly", !e.IsReadOnly);
+ // LAMESPEC: Always TRUE (not FALSE)
+ Assert ("IsSynchronized", e.IsSynchronized);
+ Assert ("Locked", !e.Locked);
+ AssertNotNull ("SyncRoot", e.SyncRoot);
+ }
}
}
-
diff --git a/mcs/class/corlib/Test/System.Security.Policy/FileCodeGroupTest.cs b/mcs/class/corlib/Test/System.Security.Policy/FileCodeGroupTest.cs
new file mode 100755
index 00000000000..f04f04a449d
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Security.Policy/FileCodeGroupTest.cs
@@ -0,0 +1,164 @@
+//
+// MonoTests.System.Security.Policy.FileCodeGroupTest
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2004 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using NUnit.Framework;
+using System;
+using System.Collections;
+using System.Security;
+using System.Security.Policy;
+using System.Security.Permissions;
+
+namespace MonoTests.System.Security.Policy {
+
+ [TestFixture]
+ public class FileCodeGroupTest : Assertion {
+
+ [Test]
+ [ExpectedException (typeof (ArgumentNullException))]
+ public void Constructor_MembershipConditionNullFileIOPermissionAccess ()
+ {
+ FileCodeGroup cg = new FileCodeGroup (null, FileIOPermissionAccess.AllAccess);
+ }
+
+ [Test]
+ public void Constructor_AllAccess ()
+ {
+ FileCodeGroup cg = new FileCodeGroup (new AllMembershipCondition (), FileIOPermissionAccess.AllAccess);
+ AssertNotNull ("MembershipCondition", cg.MembershipCondition);
+ AssertNull ("PolicyStatement", cg.PolicyStatement);
+ // documented as always null
+ AssertNull ("AttributeString", cg.AttributeString);
+ }
+
+ [Test]
+ public void Constructor_Append ()
+ {
+ FileCodeGroup cg = new FileCodeGroup (new AllMembershipCondition (), FileIOPermissionAccess.Append);
+ AssertNotNull ("MembershipCondition", cg.MembershipCondition);
+ AssertNull ("PolicyStatement", cg.PolicyStatement);
+ // documented as always null
+ AssertNull ("AttributeString", cg.AttributeString);
+ }
+
+ [Test]
+ public void Constructor_NoAccess ()
+ {
+ FileCodeGroup cg = new FileCodeGroup (new AllMembershipCondition (), FileIOPermissionAccess.NoAccess);
+ AssertNotNull ("MembershipCondition", cg.MembershipCondition);
+ AssertNull ("PolicyStatement", cg.PolicyStatement);
+ // documented as always null
+ AssertNull ("AttributeString", cg.AttributeString);
+ }
+
+ [Test]
+ public void Constructor_PathDiscovery ()
+ {
+ FileCodeGroup cg = new FileCodeGroup (new AllMembershipCondition (), FileIOPermissionAccess.PathDiscovery);
+ AssertNotNull ("MembershipCondition", cg.MembershipCondition);
+ AssertNull ("PolicyStatement", cg.PolicyStatement);
+ // documented as always null
+ AssertNull ("AttributeString", cg.AttributeString);
+ }
+
+ [Test]
+ public void Constructor_Read ()
+ {
+ FileCodeGroup cg = new FileCodeGroup (new AllMembershipCondition (), FileIOPermissionAccess.Read);
+ AssertNotNull ("MembershipCondition", cg.MembershipCondition);
+ AssertNull ("PolicyStatement", cg.PolicyStatement);
+ // documented as always null
+ AssertNull ("AttributeString", cg.AttributeString);
+ }
+
+ [Test]
+ public void Constructor_Write ()
+ {
+ FileCodeGroup cg = new FileCodeGroup (new AllMembershipCondition (), FileIOPermissionAccess.Write);
+ AssertNotNull ("MembershipCondition", cg.MembershipCondition);
+ AssertNull ("PolicyStatement", cg.PolicyStatement);
+ // documented as always null
+ AssertNull ("AttributeString", cg.AttributeString);
+ }
+
+ [Test]
+ public void MergeLogic ()
+ {
+ FileCodeGroup cg = new FileCodeGroup (new AllMembershipCondition (), FileIOPermissionAccess.AllAccess);
+ AssertEquals ("MergeLogic", "Union", cg.MergeLogic);
+ }
+
+ [Test]
+ public void Copy ()
+ {
+ FileCodeGroup cg = new FileCodeGroup (new AllMembershipCondition (), FileIOPermissionAccess.AllAccess);
+ FileCodeGroup cg2 = (FileCodeGroup) cg.Copy ();
+ AssertEquals ("AttributeString", cg.AttributeString, cg2.AttributeString);
+ AssertEquals ("Children", cg.Children.Count, cg2.Children.Count);
+ AssertEquals ("Description", cg.Description, cg2.Description);
+ AssertEquals ("MergeLogic", cg.MergeLogic, cg2.MergeLogic);
+ AssertEquals ("Name", cg.Name, cg2.Name);
+ AssertEquals ("PermissionSetName", cg.PermissionSetName, cg2.PermissionSetName);
+ AssertEquals ("ToXml", cg.ToXml ().ToString (), cg2.ToXml ().ToString ());
+ }
+
+ [Test]
+ public void CopyWithChildren ()
+ {
+ FileCodeGroup cgChild = new FileCodeGroup (new AllMembershipCondition (), FileIOPermissionAccess.AllAccess);
+ FileCodeGroup cg = new FileCodeGroup (new AllMembershipCondition (), FileIOPermissionAccess.AllAccess);
+ cg.AddChild (cgChild);
+ FileCodeGroup cg2 = (FileCodeGroup) cg.Copy ();
+ AssertEquals ("Children", cg.Children.Count, cg2.Children.Count);
+ AssertEquals ("ToXml", cg.ToXml ().ToString (), cg2.ToXml ().ToString ());
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentNullException))]
+ public void Resolve_Null ()
+ {
+ FileCodeGroup cg = new FileCodeGroup (new AllMembershipCondition (), FileIOPermissionAccess.AllAccess);
+ cg.Resolve (null);
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentNullException))]
+ public void ResolveMatchingCodeGroups_Null ()
+ {
+ FileCodeGroup cg = new FileCodeGroup (new AllMembershipCondition (), FileIOPermissionAccess.AllAccess);
+ cg.ResolveMatchingCodeGroups (null);
+ }
+
+ [Test]
+ public void ToXml ()
+ {
+ FileIOPermissionAccess access = FileIOPermissionAccess.Read | FileIOPermissionAccess.Write;
+ FileCodeGroup cg = new FileCodeGroup (new AllMembershipCondition (), access);
+ string s = cg.ToXml ().ToString ();
+ Assert ("Access='Read, Write'", s.IndexOf ("Access=\"Read, Write\"") > 0);
+ }
+
+ [Test]
+ public void ToFromXmlRoundtrip ()
+ {
+ FileCodeGroup cg = new FileCodeGroup (new AllMembershipCondition (), FileIOPermissionAccess.AllAccess);
+ cg.Name = "SomeName";
+ cg.Description = "Some Description";
+ Assert ("Equals (itself)", cg.Equals (cg));
+ SecurityElement se = cg.ToXml ();
+
+ FileCodeGroup cg2 = new FileCodeGroup (new AllMembershipCondition (), FileIOPermissionAccess.NoAccess);
+ cg2.Name = "SomeOtherName";
+ cg2.Description = "Some Other Description";
+ Assert ("Equals (another)", !cg.Equals (cg2));
+
+ cg2.FromXml (se);
+ Assert ("Equals (FromXml)", cg.Equals (cg2));
+ }
+ }
+}
diff --git a/mcs/class/corlib/Test/System.Security.Policy/FirstMatchCodeGroupTest.cs b/mcs/class/corlib/Test/System.Security.Policy/FirstMatchCodeGroupTest.cs
new file mode 100755
index 00000000000..a0e848a458b
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Security.Policy/FirstMatchCodeGroupTest.cs
@@ -0,0 +1,113 @@
+//
+// MonoTests.System.Security.Policy.FirstMatchCodeGroupTest
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2004 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using NUnit.Framework;
+using System;
+using System.Collections;
+using System.Security;
+using System.Security.Policy;
+using System.Security.Permissions;
+
+namespace MonoTests.System.Security.Policy {
+
+ [TestFixture]
+ public class FirstMatchCodeGroupTest : Assertion {
+
+ [Test]
+ [ExpectedException (typeof (ArgumentNullException))]
+ public void Constructor_MembershipConditionNullPolicyStatement ()
+ {
+ FirstMatchCodeGroup cg = new FirstMatchCodeGroup (null, new PolicyStatement (new PermissionSet (PermissionState.None)));
+ }
+
+ [Test]
+ public void Constructor_MembershipConditionPolicyStatementNull ()
+ {
+ // legal
+ FirstMatchCodeGroup cg = new FirstMatchCodeGroup (new AllMembershipCondition (), null);
+ AssertNull ("PolicyStatement", cg.PolicyStatement);
+ }
+
+ [Test]
+ public void Constructor ()
+ {
+ FirstMatchCodeGroup cg = new FirstMatchCodeGroup (new AllMembershipCondition (), new PolicyStatement (new PermissionSet (PermissionState.None)));
+ AssertNotNull ("PolicyStatement", cg.PolicyStatement);
+ AssertNotNull ("MembershipCondition", cg.MembershipCondition);
+ }
+
+ [Test]
+ public void MergeLogic ()
+ {
+ FirstMatchCodeGroup cg = new FirstMatchCodeGroup (new AllMembershipCondition (), new PolicyStatement (new PermissionSet (PermissionState.None)));
+ AssertEquals ("MergeLogic", "First Match", cg.MergeLogic);
+ }
+
+ [Test]
+ public void Copy ()
+ {
+ FirstMatchCodeGroup cg = new FirstMatchCodeGroup (new AllMembershipCondition (), new PolicyStatement (new PermissionSet (PermissionState.None)));
+ FirstMatchCodeGroup cg2 = (FirstMatchCodeGroup) cg.Copy ();
+ AssertEquals ("AttributeString", cg.AttributeString, cg2.AttributeString);
+ AssertEquals ("Children", cg.Children.Count, cg2.Children.Count);
+ AssertEquals ("Description", cg.Description, cg2.Description);
+ AssertEquals ("MergeLogic", cg.MergeLogic, cg2.MergeLogic);
+ AssertEquals ("Name", cg.Name, cg2.Name);
+ AssertEquals ("PermissionSetName", cg.PermissionSetName, cg2.PermissionSetName);
+ AssertEquals ("ToXml", cg.ToXml ().ToString (), cg2.ToXml ().ToString ());
+ }
+
+ [Test]
+ public void CopyWithChildren ()
+ {
+ FirstMatchCodeGroup cgChild = new FirstMatchCodeGroup (new AllMembershipCondition (), new PolicyStatement (new PermissionSet (PermissionState.Unrestricted)));
+ FirstMatchCodeGroup cg = new FirstMatchCodeGroup (new AllMembershipCondition (), new PolicyStatement (new PermissionSet (PermissionState.None)));
+ cg.AddChild (cgChild);
+ FirstMatchCodeGroup cg2 = (FirstMatchCodeGroup) cg.Copy ();
+ AssertEquals ("Children", cg.Children.Count, cg2.Children.Count);
+ AssertEquals ("ToXml", cg.ToXml ().ToString (), cg2.ToXml ().ToString ());
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentNullException))]
+ public void Resolve_Null ()
+ {
+ FirstMatchCodeGroup cg = new FirstMatchCodeGroup (new AllMembershipCondition (), new PolicyStatement (new PermissionSet (PermissionState.None)));
+ cg.Resolve (null);
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentNullException))]
+ public void ResolveMatchingCodeGroups_Null ()
+ {
+ FirstMatchCodeGroup cg = new FirstMatchCodeGroup (new AllMembershipCondition (), new PolicyStatement (new PermissionSet (PermissionState.None)));
+ cg.ResolveMatchingCodeGroups (null);
+ }
+
+ [Test]
+ public void ToFromXmlRoundtrip ()
+ {
+ const string ps_Name = "TestName";
+ PolicyStatement ps = new PolicyStatement (new NamedPermissionSet (ps_Name));
+ FirstMatchCodeGroup cg = new FirstMatchCodeGroup (new AllMembershipCondition (), ps);
+ cg.Name = "SomeName";
+ cg.Description = "Some Description";
+ Assert ("Equals (itself)", cg.Equals (cg));
+ SecurityElement se = cg.ToXml ();
+
+ FirstMatchCodeGroup cg2 = new FirstMatchCodeGroup (new AllMembershipCondition(), ps);
+ cg2.Name = "SomeOtherName";
+ cg2.Description = "Some Other Description";
+ Assert ("Equals (another)", !cg.Equals (cg2));
+
+ cg2.FromXml (se);
+ Assert ("Equals (FromXml)", cg.Equals (cg2));
+ }
+ }
+}
diff --git a/mcs/class/corlib/Test/System.Security.Policy/NetCodeGroupTest.cs b/mcs/class/corlib/Test/System.Security.Policy/NetCodeGroupTest.cs
new file mode 100755
index 00000000000..4aba6b2b770
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Security.Policy/NetCodeGroupTest.cs
@@ -0,0 +1,107 @@
+//
+// MonoTests.System.Security.Policy.NetCodeGroupTest
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2004 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using NUnit.Framework;
+using System;
+using System.Collections;
+using System.Security;
+using System.Security.Policy;
+using System.Security.Permissions;
+
+namespace MonoTests.System.Security.Policy {
+
+ [TestFixture]
+ public class NetCodeGroupTest : Assertion {
+
+ [Test]
+ [ExpectedException (typeof (ArgumentNullException))]
+ public void Constructor_Null ()
+ {
+ NetCodeGroup cg = new NetCodeGroup ((IMembershipCondition)null);
+ }
+
+ [Test]
+ public void Constructor ()
+ {
+ NetCodeGroup cg = new NetCodeGroup (new AllMembershipCondition ());
+ AssertNotNull ("MembershipCondition", cg.MembershipCondition);
+ AssertNull ("PolicyStatement", cg.PolicyStatement);
+ // documented as always null
+ AssertNull ("AttributeString", cg.AttributeString);
+ // documented as always "Same site Web" but it's "Same site Web." (missing .)
+ AssertEquals ("PermissionSetName", "Same site Web.", cg.PermissionSetName);
+ }
+
+ [Test]
+ public void MergeLogic ()
+ {
+ NetCodeGroup cg = new NetCodeGroup (new AllMembershipCondition ());
+ AssertEquals ("MergeLogic", "Union", cg.MergeLogic);
+ }
+
+ [Test]
+ public void Copy ()
+ {
+ NetCodeGroup cg = new NetCodeGroup (new AllMembershipCondition ());
+ NetCodeGroup cg2 = (NetCodeGroup) cg.Copy ();
+ AssertEquals ("AttributeString", cg.AttributeString, cg2.AttributeString);
+ AssertEquals ("Children", cg.Children.Count, cg2.Children.Count);
+ AssertEquals ("Description", cg.Description, cg2.Description);
+ AssertEquals ("MergeLogic", cg.MergeLogic, cg2.MergeLogic);
+ AssertEquals ("Name", cg.Name, cg2.Name);
+ AssertEquals ("PermissionSetName", cg.PermissionSetName, cg2.PermissionSetName);
+ AssertEquals ("ToXml", cg.ToXml ().ToString (), cg2.ToXml ().ToString ());
+ }
+
+ [Test]
+ public void CopyWithChildren ()
+ {
+ NetCodeGroup cgChild = new NetCodeGroup (new AllMembershipCondition ());
+ NetCodeGroup cg = new NetCodeGroup (new AllMembershipCondition ());
+ cg.AddChild (cgChild);
+ NetCodeGroup cg2 = (NetCodeGroup) cg.Copy ();
+ AssertEquals ("Children", cg.Children.Count, cg2.Children.Count);
+ AssertEquals ("ToXml", cg.ToXml ().ToString (), cg2.ToXml ().ToString ());
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentNullException))]
+ public void Resolve_Null ()
+ {
+ NetCodeGroup cg = new NetCodeGroup (new AllMembershipCondition ());
+ cg.Resolve (null);
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentNullException))]
+ public void ResolveMatchingCodeGroups_Null ()
+ {
+ NetCodeGroup cg = new NetCodeGroup (new AllMembershipCondition ());
+ cg.ResolveMatchingCodeGroups (null);
+ }
+
+ [Test]
+ public void ToFromXmlRoundtrip ()
+ {
+ NetCodeGroup cg = new NetCodeGroup (new AllMembershipCondition ());
+ cg.Name = "SomeName";
+ cg.Description = "Some Description";
+ Assert ("Equals (itself)", cg.Equals (cg));
+ SecurityElement se = cg.ToXml ();
+
+ NetCodeGroup cg2 = new NetCodeGroup (new AllMembershipCondition());
+ cg2.Name = "SomeOtherName";
+ cg2.Description = "Some Other Description";
+ Assert ("Equals (another)", !cg.Equals (cg2));
+
+ cg2.FromXml (se);
+ Assert ("Equals (FromXml)", cg.Equals (cg2));
+ }
+ }
+}
diff --git a/mcs/class/corlib/Test/System.Security.Policy/PermissionRequestEvidenceTest.cs b/mcs/class/corlib/Test/System.Security.Policy/PermissionRequestEvidenceTest.cs
index 0519e7cf3ad..e5c9d26522f 100755
--- a/mcs/class/corlib/Test/System.Security.Policy/PermissionRequestEvidenceTest.cs
+++ b/mcs/class/corlib/Test/System.Security.Policy/PermissionRequestEvidenceTest.cs
@@ -17,6 +17,13 @@ namespace MonoTests.System.Security.Policy {
[TestFixture]
public class PermissionRequestEvidenceTest : Assertion {
+
+ private string AdjustNewLine (string s)
+ {
+ if (Environment.NewLine != "\r\n")
+ s = s.Replace ("\r\n", Environment.NewLine);
+ return s;
+ }
[Test]
public void NullConstructor () {
@@ -24,6 +31,8 @@ namespace MonoTests.System.Security.Policy {
AssertNull ("Requested", pre.RequestedPermissions);
AssertNull ("Optional", pre.OptionalPermissions);
AssertNull ("Denied", pre.DeniedPermissions);
+ string expected = AdjustNewLine ("<System.Security.Policy.PermissionRequestEvidence version=\"1\"/>\r\n");
+ AssertEquals ("ToString", expected, pre.ToString ());
}
[Test]
@@ -33,6 +42,8 @@ namespace MonoTests.System.Security.Policy {
Assert ("Requested", !pre.RequestedPermissions.IsUnrestricted ());
Assert ("Optional", !pre.OptionalPermissions.IsUnrestricted ());
Assert ("Denied", !pre.DeniedPermissions.IsUnrestricted ());
+ string expected = AdjustNewLine ("<System.Security.Policy.PermissionRequestEvidence version=\"1\">\r\n <Request>\r\n <PermissionSet class=\"System.Security.PermissionSet\"\r\n version=\"1\"/>\r\n </Request>\r\n <Optional>\r\n <PermissionSet class=\"System.Security.PermissionSet\"\r\n version=\"1\"/>\r\n </Optional>\r\n <Denied>\r\n <PermissionSet class=\"System.Security.PermissionSet\"\r\n version=\"1\"/>\r\n </Denied>\r\n</System.Security.Policy.PermissionRequestEvidence>\r\n");
+ AssertEquals ("ToString", expected, pre.ToString ());
}
[Test]
@@ -42,6 +53,8 @@ namespace MonoTests.System.Security.Policy {
Assert ("Requested", pre.RequestedPermissions.IsUnrestricted ());
Assert ("Optional", pre.OptionalPermissions.IsUnrestricted ());
Assert ("Denied", pre.DeniedPermissions.IsUnrestricted ());
+ string expected = AdjustNewLine ("<System.Security.Policy.PermissionRequestEvidence version=\"1\">\r\n <Request>\r\n <PermissionSet class=\"System.Security.PermissionSet\"\r\n version=\"1\"\r\n Unrestricted=\"true\"/>\r\n </Request>\r\n <Optional>\r\n <PermissionSet class=\"System.Security.PermissionSet\"\r\n version=\"1\"\r\n Unrestricted=\"true\"/>\r\n </Optional>\r\n <Denied>\r\n <PermissionSet class=\"System.Security.PermissionSet\"\r\n version=\"1\"\r\n Unrestricted=\"true\"/>\r\n </Denied>\r\n</System.Security.Policy.PermissionRequestEvidence>\r\n");
+ AssertEquals ("ToString", expected, pre.ToString ());
}
[Test]
@@ -52,6 +65,8 @@ namespace MonoTests.System.Security.Policy {
Assert ("Requested", !pre.RequestedPermissions.IsUnrestricted ());
Assert ("Optional", pre.OptionalPermissions.IsUnrestricted ());
Assert ("Denied", !pre.DeniedPermissions.IsUnrestricted ());
+ string expected = AdjustNewLine ("<System.Security.Policy.PermissionRequestEvidence version=\"1\">\r\n <Request>\r\n <PermissionSet class=\"System.Security.PermissionSet\"\r\n version=\"1\"/>\r\n </Request>\r\n <Optional>\r\n <PermissionSet class=\"System.Security.PermissionSet\"\r\n version=\"1\"\r\n Unrestricted=\"true\"/>\r\n </Optional>\r\n <Denied>\r\n <PermissionSet class=\"System.Security.PermissionSet\"\r\n version=\"1\"/>\r\n </Denied>\r\n</System.Security.Policy.PermissionRequestEvidence>\r\n");
+ AssertEquals ("ToString", expected, pre.ToString ());
}
[Test]
@@ -62,6 +77,8 @@ namespace MonoTests.System.Security.Policy {
Assert ("Requested", pre.RequestedPermissions.IsUnrestricted ());
Assert ("Optional", !pre.OptionalPermissions.IsUnrestricted ());
Assert ("Denied", pre.DeniedPermissions.IsUnrestricted ());
+ string expected = AdjustNewLine ("<System.Security.Policy.PermissionRequestEvidence version=\"1\">\r\n <Request>\r\n <PermissionSet class=\"System.Security.PermissionSet\"\r\n version=\"1\"\r\n Unrestricted=\"true\"/>\r\n </Request>\r\n <Optional>\r\n <PermissionSet class=\"System.Security.PermissionSet\"\r\n version=\"1\"/>\r\n </Optional>\r\n <Denied>\r\n <PermissionSet class=\"System.Security.PermissionSet\"\r\n version=\"1\"\r\n Unrestricted=\"true\"/>\r\n </Denied>\r\n</System.Security.Policy.PermissionRequestEvidence>\r\n");
+ AssertEquals ("ToString", expected, pre.ToString ());
}
[Test]
@@ -73,6 +90,9 @@ namespace MonoTests.System.Security.Policy {
Assert ("Requested", pre2.RequestedPermissions.IsUnrestricted ());
Assert ("Optional", !pre2.OptionalPermissions.IsUnrestricted ());
Assert ("Denied", pre2.DeniedPermissions.IsUnrestricted ());
+ string expected = AdjustNewLine ("<System.Security.Policy.PermissionRequestEvidence version=\"1\">\r\n <Request>\r\n <PermissionSet class=\"System.Security.PermissionSet\"\r\n version=\"1\"\r\n Unrestricted=\"true\"/>\r\n </Request>\r\n <Optional>\r\n <PermissionSet class=\"System.Security.PermissionSet\"\r\n version=\"1\"/>\r\n </Optional>\r\n <Denied>\r\n <PermissionSet class=\"System.Security.PermissionSet\"\r\n version=\"1\"\r\n Unrestricted=\"true\"/>\r\n </Denied>\r\n</System.Security.Policy.PermissionRequestEvidence>\r\n");
+ AssertEquals ("ToString", expected, pre.ToString ());
+ AssertEquals ("ToString-Copy", pre.ToString (), pre2.ToString ());
}
-} // class
-} // namespace \ No newline at end of file
+ } // class
+} // namespace
diff --git a/mcs/class/corlib/Test/System.Security.Policy/PolicyLevelTest.cs b/mcs/class/corlib/Test/System.Security.Policy/PolicyLevelTest.cs
new file mode 100755
index 00000000000..dccfe8bd817
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Security.Policy/PolicyLevelTest.cs
@@ -0,0 +1,511 @@
+//
+// PolicyLevelTest.cs - NUnit Test Cases for PolicyLevel
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2004 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using NUnit.Framework;
+using System;
+using System.IO;
+using System.Security;
+using System.Security.Permissions;
+using System.Security.Policy;
+
+namespace MonoTests.System.Security.Policy {
+
+ [TestFixture]
+ public class PolicyLevelTest : Assertion {
+
+ static string minimal = null;
+ static string minimal_policy = null;
+ static byte[] snPublicKey = { 0x00, 0x24, 0x00, 0x00, 0x04, 0x80, 0x00, 0x00, 0x94, 0x00, 0x00, 0x00, 0x06, 0x02, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x52, 0x53, 0x41, 0x31, 0x00, 0x04, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x3D, 0xBD, 0x72, 0x08, 0xC6, 0x2B, 0x0E, 0xA8, 0xC1, 0xC0, 0x58, 0x07, 0x2B, 0x63, 0x5F, 0x7C, 0x9A, 0xBD, 0xCB, 0x22, 0xDB, 0x20, 0xB2, 0xA9, 0xDA, 0xDA, 0xEF, 0xE8, 0x00, 0x64, 0x2F, 0x5D, 0x8D, 0xEB, 0x78, 0x02, 0xF7, 0xA5, 0x36, 0x77, 0x28, 0xD7, 0x55, 0x8D, 0x14, 0x68, 0xDB, 0xEB, 0x24, 0x09, 0xD0, 0x2B, 0x13, 0x1B, 0x92, 0x6E, 0x2E, 0x59, 0x54, 0x4A, 0xAC, 0x18, 0xCF, 0xC9, 0x09, 0x02, 0x3F, 0x4F, 0xA8, 0x3E, 0x94, 0x00, 0x1F, 0xC2, 0xF1, 0x1A, 0x27, 0x47, 0x7D, 0x10, 0x84, 0xF5, 0x14, 0xB8, 0x61, 0x62, 0x1A, 0x0C, 0x66, 0xAB, 0xD2, 0x4C, 0x4B, 0x9F, 0xC9, 0x0F, 0x3C, 0xD8, 0x92, 0x0F, 0xF5, 0xFF, 0xCE, 0xD7, 0x6E, 0x5C, 0x6F, 0xB1, 0xF5, 0x7D, 0xD3, 0x56, 0xF9, 0x67, 0x27, 0xA4, 0xA5, 0x48, 0x5B, 0x07, 0x93, 0x44, 0x00, 0x4A, 0xF8, 0xFF, 0xA4, 0xCB };
+
+ [SetUp]
+ void Prepare ()
+ {
+ if (minimal == null) {
+ minimal_policy = "<PolicyLevel version=\"1\">\r\n <SecurityClasses>\r\n <SecurityClass Name=\"PrintingPermission\"\r\n Description=\"System.Drawing.Printing.PrintingPermission, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\"/>\r\n <SecurityClass Name=\"NamedPermissionSet\"\r\n Description=\"System.Security.NamedPermissionSet\"/>\r\n <SecurityClass Name=\"ReflectionPermission\"\r\n Description=\"System.Security.Permissions.ReflectionPermission, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\"/>\r\n <SecurityClass Name=\"DnsPermission\"\r\n Description=\"System.Net.DnsPermission, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\"/>\r\n <SecurityClass Name=\"EventLogPermission\"\r\n Description=\"System.Diagnostics.EventLogPermission, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\"/>\r\n <SecurityClass Name=\"IsolatedStorageFilePermission\"\r\n Description=\"System.Security.Permissions.IsolatedStorageFilePermission, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\"/>\r\n <SecurityClass Name=\"AllMembershipCondition\"\r\n Description=\"System.Security.Policy.AllMembershipCondition, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\"/>\r\n <SecurityClass Name=\"FirstMatchCodeGroup\"\r\n Description=\"System.Security.Policy.FirstMatchCodeGroup\"/>\r\n <SecurityClass Name=\"EnvironmentPermission\"\r\n Description=\"System.Security.Permissions.EnvironmentPermission, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\"/>\r\n";
+ minimal_policy += " <SecurityClass Name=\"StrongNameMembershipCondition\"\r\n Description=\"System.Security.Policy.StrongNameMembershipCondition, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\"/>\r\n <SecurityClass Name=\"SecurityPermission\"\r\n Description=\"System.Security.Permissions.SecurityPermission, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\"/>\r\n <SecurityClass Name=\"UIPermission\"\r\n Description=\"System.Security.Permissions.UIPermission, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\"/>\r\n <SecurityClass Name=\"FileDialogPermission\"\r\n Description=\"System.Security.Permissions.FileDialogPermission, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\"/>\r\n </SecurityClasses>\r\n <NamedPermissionSets>\r\n <PermissionSet class=\"NamedPermissionSet\"\r\n version=\"1\"\r\n Unrestricted=\"true\"\r\n Name=\"FullTrust\"\r\n Description=\"Allows full access to all resources\"/>\r\n <PermissionSet class=\"NamedPermissionSet\"\r\n version=\"1\"\r\n Name=\"SkipVerification\"\r\n Description=\"Grants right to bypass the verification\">\r\n <IPermission class=\"SecurityPermission\"\r\n version=\"1\"\r\n Flags=\"SkipVerification\"/>\r\n </PermissionSet>\r\n <PermissionSet class=\"NamedPermissionSet\"\r\n version=\"1\"\r\n Name=\"Execution\"\r\n Description=\"Permits execution\">\r\n <IPermission class=\"SecurityPermission\"\r\n version=\"1\"\r\n Flags=\"Execution\"/>\r\n </PermissionSet>\r\n";
+ minimal_policy += " <PermissionSet class=\"NamedPermissionSet\"\r\n version=\"1\"\r\n Name=\"Nothing\"\r\n Description=\"Denies all resources, including the right to execute\"/>\r\n <PermissionSet class=\"NamedPermissionSet\"\r\n version=\"1\"\r\n Name=\"LocalIntranet\"\r\n Description=\"Default rights given to applications on the local intranet\">\r\n <IPermission class=\"EnvironmentPermission\"\r\n version=\"1\"\r\n Read=\"USERNAME\"/>\r\n <IPermission class=\"FileDialogPermission\"\r\n version=\"1\"\r\n Unrestricted=\"true\"/>\r\n <IPermission class=\"IsolatedStorageFilePermission\"\r\n version=\"1\"\r\n Allowed=\"AssemblyIsolationByUser\"\r\n UserQuota=\"9223372036854775807\"\r\n Expiry=\"9223372036854775807\"\r\n Permanent=\"True\"/>\r\n <IPermission class=\"ReflectionPermission\"\r\n version=\"1\"\r\n Flags=\"ReflectionEmit\"/>\r\n <IPermission class=\"SecurityPermission\"\r\n version=\"1\"\r\n Flags=\"Assertion, Execution, BindingRedirects\"/>\r\n <IPermission class=\"UIPermission\"\r\n version=\"1\"\r\n Unrestricted=\"true\"/>\r\n <IPermission class=\"DnsPermission\"\r\n version=\"1\"\r\n Unrestricted=\"true\"/>\r\n <IPermission class=\"PrintingPermission\"\r\n version=\"1\"\r\n Level=\"DefaultPrinting\"/>\r\n <IPermission class=\"EventLogPermission\"\r\n version=\"1\">\r\n <Machine name=\".\"\r\n access=\"Instrument\"/>\r\n";
+ minimal_policy += " </IPermission>\r\n </PermissionSet>\r\n <PermissionSet class=\"NamedPermissionSet\"\r\n version=\"1\"\r\n Name=\"Internet\"\r\n Description=\"Default rights given to internet applications\">\r\n <IPermission class=\"FileDialogPermission\"\r\n version=\"1\"\r\n Access=\"Open\"/>\r\n <IPermission class=\"IsolatedStorageFilePermission\"\r\n version=\"1\"\r\n Allowed=\"DomainIsolationByUser\"\r\n UserQuota=\"10240\"/>\r\n <IPermission class=\"SecurityPermission\"\r\n version=\"1\"\r\n Flags=\"Execution\"/>\r\n <IPermission class=\"UIPermission\"\r\n version=\"1\"\r\n Window=\"SafeTopLevelWindows\"\r\n Clipboard=\"OwnClipboard\"/>\r\n <IPermission class=\"PrintingPermission\"\r\n version=\"1\"\r\n Level=\"SafePrinting\"/>\r\n </PermissionSet>\r\n </NamedPermissionSets>\r\n <CodeGroup class=\"FirstMatchCodeGroup\"\r\n version=\"1\"\r\n PermissionSetName=\"Nothing\">\r\n <IMembershipCondition class=\"AllMembershipCondition\"\r\n version=\"1\"/>\r\n </CodeGroup>\r\n <FullTrustAssemblies>\r\n <IMembershipCondition class=\"StrongNameMembershipCondition\"\r\n version=\"1\"\r\n PublicKeyBlob=\"00000000000000000400000000000000\"\r\n Name=\"System\"/>\r\n </FullTrustAssemblies>\r\n</PolicyLevel>\r\n";
+ minimal = Envelope (minimal_policy);
+ }
+ }
+
+ private string Envelope (string policy)
+ {
+ return "<configuration><mscorlib><security><policy>" + policy + "</policy></security></mscorlib></configuration>";
+ }
+
+ private PolicyLevel Load (string xml, PolicyLevelType type)
+ {
+ return SecurityManager.LoadPolicyLevelFromString (xml, type);
+// return SecurityManager.LoadPolicyLevelFromFile (@"C:\WINDOWS\Microsoft.NET\Framework\v1.0.3705\CONFIG\minimal.config", type);
+ }
+
+ [Test]
+ public void AddFullTrustAssembly ()
+ {
+ PolicyLevel pl = Load (minimal, PolicyLevelType.Machine);
+ int n = pl.FullTrustAssemblies.Count;
+
+ StrongName sn = new StrongName (new StrongNamePublicKeyBlob (snPublicKey), "First", new Version (1, 2, 3, 4));
+ pl.AddFullTrustAssembly (sn);
+ AssertEquals ("FullTrustAssemblies.Count+1", n+1, pl.FullTrustAssemblies.Count);
+
+ StrongNameMembershipCondition snmc = new StrongNameMembershipCondition (new StrongNamePublicKeyBlob (snPublicKey), "Second", new Version ("0.1.2.3"));
+ pl.AddFullTrustAssembly (snmc);
+ AssertEquals ("FullTrustAssemblies.Count+2", n+2, pl.FullTrustAssemblies.Count);
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentNullException))]
+ public void AddFullTrustAssembly_NullStrongName ()
+ {
+ PolicyLevel pl = Load (minimal, PolicyLevelType.Machine);
+ StrongName sn = null;
+ pl.AddFullTrustAssembly (sn);
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentNullException))]
+ public void AddFullTrustAssembly_NullStrongNameMembershipCondition ()
+ {
+ PolicyLevel pl = Load (minimal, PolicyLevelType.Machine);
+ StrongNameMembershipCondition snmc = null;
+ pl.AddFullTrustAssembly (snmc);
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentException))]
+ public void AddFullTrustAssembly_DuplicateStrongName ()
+ {
+ PolicyLevel pl = Load (minimal, PolicyLevelType.Machine);
+ StrongName sn = new StrongName (new StrongNamePublicKeyBlob (snPublicKey), "First", new Version (1, 2, 3, 4));
+ pl.AddFullTrustAssembly (sn);
+ pl.AddFullTrustAssembly (sn);
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentException))]
+ public void AddFullTrustAssembly_DuplicateStrongNameMembershipCondition ()
+ {
+ PolicyLevel pl = Load (minimal, PolicyLevelType.Machine);
+ StrongNameMembershipCondition snmc = new StrongNameMembershipCondition (new StrongNamePublicKeyBlob (snPublicKey), "Second", new Version ("0.1.2.3"));
+ pl.AddFullTrustAssembly (snmc);
+ pl.AddFullTrustAssembly (snmc);
+ }
+
+ [Test]
+ [Ignore ("System.ExecutionEngineException on MS runtime (1.1)")]
+ public void AddNamedPermissionSet ()
+ {
+ PolicyLevel pl = Load (minimal, PolicyLevelType.Machine);
+ int n = pl.NamedPermissionSets.Count;
+
+ NamedPermissionSet nps = new NamedPermissionSet ("Mono", PermissionState.Unrestricted);
+ pl.AddNamedPermissionSet (nps);
+ // ExecutionEngineException here!
+ AssertEquals ("NamedPermissionSets.Count+1", n+1, pl.NamedPermissionSets.Count);
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentNullException))]
+ public void AddNamedPermissionSet_Null ()
+ {
+ PolicyLevel pl = Load (minimal, PolicyLevelType.Machine);
+ pl.AddNamedPermissionSet (null);
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentException))]
+ [Ignore ("System.ExecutionEngineException on MS runtime (1.1)")]
+ public void AddNamedPermissionSet_Duplicate ()
+ {
+ PolicyLevel pl = Load (minimal, PolicyLevelType.Machine);
+ NamedPermissionSet nps1 = new NamedPermissionSet ("Mono", PermissionState.Unrestricted);
+ pl.AddNamedPermissionSet (nps1);
+ NamedPermissionSet nps2 = new NamedPermissionSet ("Mono", PermissionState.None);
+ // ExecutionEngineException here!
+ pl.AddNamedPermissionSet (nps2);
+ }
+
+ [Test]
+ [Ignore ("System.ExecutionEngineException on MS runtime (1.1)")]
+ public void ChangeNamedPermissionSet ()
+ {
+ PolicyLevel pl = Load (minimal, PolicyLevelType.Machine);
+ NamedPermissionSet nps1 = new NamedPermissionSet ("Mono", PermissionState.Unrestricted);
+ pl.AddNamedPermissionSet (nps1);
+
+ NamedPermissionSet nps2 = new NamedPermissionSet ("Mono", PermissionState.None);
+ // ExecutionEngineException here!
+ pl.ChangeNamedPermissionSet ("Mono", nps2);
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentNullException))]
+ public void ChangeNamedPermissionSet_NullName ()
+ {
+ PolicyLevel pl = Load (minimal, PolicyLevelType.Machine);
+ NamedPermissionSet nps2 = new NamedPermissionSet ("Mono", PermissionState.None);
+ pl.ChangeNamedPermissionSet (null, nps2);
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentNullException))]
+ public void ChangeNamedPermissionSet_NullPermissionSet ()
+ {
+ PolicyLevel pl = Load (minimal, PolicyLevelType.Machine);
+ pl.ChangeNamedPermissionSet ("Mono", null);
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentException))]
+ public void ChangeNamedPermissionSet_NotFound ()
+ {
+ PolicyLevel pl = Load (minimal, PolicyLevelType.Machine);
+ NamedPermissionSet nps2 = new NamedPermissionSet ("Mono", PermissionState.None);
+ pl.ChangeNamedPermissionSet ("Mono", nps2);
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentException))]
+ public void ChangeNamedPermissionSet_Reserved_FullTrust ()
+ {
+ PolicyLevel pl = Load (minimal, PolicyLevelType.Machine);
+ PermissionSet ps = new PermissionSet (PermissionState.None);
+ pl.ChangeNamedPermissionSet ("FullTrust", ps);
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentException))]
+ public void ChangeNamedPermissionSet_Reserved_LocalIntranet ()
+ {
+ PolicyLevel pl = Load (minimal, PolicyLevelType.Machine);
+ PermissionSet ps = new PermissionSet (PermissionState.None);
+ pl.ChangeNamedPermissionSet ("LocalIntranet", ps);
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentException))]
+ public void ChangeNamedPermissionSet_Reserved_Internet ()
+ {
+ PolicyLevel pl = Load (minimal, PolicyLevelType.Machine);
+ PermissionSet ps = new PermissionSet (PermissionState.None);
+ pl.ChangeNamedPermissionSet ("Internet", ps);
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentException))]
+ public void ChangeNamedPermissionSet_Reserved_SkipVerification ()
+ {
+ PolicyLevel pl = Load (minimal, PolicyLevelType.Machine);
+ PermissionSet ps = new PermissionSet (PermissionState.None);
+ pl.ChangeNamedPermissionSet ("SkipVerification", ps);
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentException))]
+ public void ChangeNamedPermissionSet_Reserved_ ()
+ {
+ PolicyLevel pl = Load (minimal, PolicyLevelType.Machine);
+ PermissionSet ps = new PermissionSet (PermissionState.None);
+ pl.ChangeNamedPermissionSet ("Execution", ps);
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentException))]
+ public void ChangeNamedPermissionSet_Reserved_Nothing ()
+ {
+ PolicyLevel pl = Load (minimal, PolicyLevelType.Machine);
+ PermissionSet ps = new PermissionSet (PermissionState.None);
+ pl.ChangeNamedPermissionSet ("SkipVerification", ps);
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentException))]
+ public void ChangeNamedPermissionSet_Reserved_Everything ()
+ {
+ PolicyLevel pl = Load (minimal, PolicyLevelType.Machine);
+ PermissionSet ps = new PermissionSet (PermissionState.None);
+ pl.ChangeNamedPermissionSet ("Everything", ps);
+ }
+
+ [Test]
+ public void CreateAppDomainLevel ()
+ {
+ PolicyLevel pl = PolicyLevel.CreateAppDomainLevel ();
+ AssertEquals ("Label", "AppDomain", pl.Label);
+ AssertEquals ("RootCodeGroup==FullTrust", "FullTrust", pl.RootCodeGroup.PermissionSetName);
+ AssertEquals ("RootCodeGroup/NoChildren", 0, pl.RootCodeGroup.Children.Count);
+ Assert ("RootCodeGroup.PolicyStatement.PermissionSet.IsUnrestricted", pl.RootCodeGroup.PolicyStatement.PermissionSet.IsUnrestricted ());
+ }
+
+ [Test]
+ public void FromXml ()
+ {
+ PolicyLevel pl = PolicyLevel.CreateAppDomainLevel ();
+ SecurityElement se = pl.ToXml ();
+ pl.FromXml (se);
+ AssertEquals ("Label", "AppDomain", pl.Label);
+ AssertEquals ("RootCodeGroup", "All_Code", pl.RootCodeGroup.Name);
+ AssertEquals ("RootCodeGroup", "FullTrust", pl.RootCodeGroup.PermissionSetName);
+ AssertEquals ("RootCodeGroup", 0, pl.RootCodeGroup.Children.Count);
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentNullException))]
+ public void FromXml_Null ()
+ {
+ PolicyLevel pl = PolicyLevel.CreateAppDomainLevel ();
+ pl.FromXml (null);
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentException))]
+ public void FromXml_Invalid ()
+ {
+ PolicyLevel pl = PolicyLevel.CreateAppDomainLevel ();
+ SecurityElement se = pl.ToXml ();
+ se.Tag = "Mono";
+ // strangely this works :(
+ pl.FromXml (se);
+ // let's get weirder :)
+ foreach (SecurityElement child in se.Children) {
+ child.Tag = "Mono";
+ }
+ pl.FromXml (se);
+ // it's enough >:)
+ }
+
+ [Test]
+ [Ignore ("System.ExecutionEngineException on MS runtime (1.1)")]
+ public void GetNamedPermissionSet ()
+ {
+ PolicyLevel pl = Load (minimal, PolicyLevelType.Machine);
+ NamedPermissionSet nps = pl.GetNamedPermissionSet ("Mono");
+ AssertNull ("GetNamedPermissionSet(notfound)", nps);
+ nps = new NamedPermissionSet ("Mono", PermissionState.None);
+ pl.AddNamedPermissionSet (nps);
+ // ExecutionEngineException here!
+ nps = pl.GetNamedPermissionSet ("Mono");
+ AssertNotNull ("GetNamedPermissionSet(found)", nps);
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentNullException))]
+ public void GetNamedPermissionSet_Null ()
+ {
+ PolicyLevel pl = Load (minimal, PolicyLevelType.Machine);
+ NamedPermissionSet nps = pl.GetNamedPermissionSet (null);
+ }
+
+ [Test]
+ public void Label ()
+ {
+ PolicyLevel pl = Load (minimal, PolicyLevelType.AppDomain);
+ AssertEquals ("Label.AppDomain", "AppDomain", pl.Label);
+ pl = Load (minimal, PolicyLevelType.Enterprise);
+ AssertEquals ("Label.Enterprise", "Enterprise", pl.Label);
+ pl = Load (minimal, PolicyLevelType.Machine);
+ AssertEquals ("Label.Machine", "Machine", pl.Label);
+ pl = Load (minimal, PolicyLevelType.User);
+ AssertEquals ("Label.User", "User", pl.Label);
+ // static method
+ pl = PolicyLevel.CreateAppDomainLevel ();
+ AssertEquals ("Label.AppDomain", "AppDomain", pl.Label);
+ }
+
+ [Test]
+ public void Recover ()
+ {
+ // note: may be dangerous to test
+ }
+
+ [Test]
+ public void RemoveFullTrustAssembly ()
+ {
+ PolicyLevel pl = Load (minimal, PolicyLevelType.Machine);
+ int n = pl.FullTrustAssemblies.Count;
+
+ StrongName sn = new StrongName (new StrongNamePublicKeyBlob (snPublicKey), "First", new Version (1, 2, 3, 4));
+ pl.AddFullTrustAssembly (sn);
+ AssertEquals ("FullTrustAssemblies.Count+1", n+1, pl.FullTrustAssemblies.Count);
+
+ StrongNameMembershipCondition snmc = new StrongNameMembershipCondition (new StrongNamePublicKeyBlob (snPublicKey), "Second", new Version ("0.1.2.3"));
+ pl.AddFullTrustAssembly (snmc);
+ AssertEquals ("FullTrustAssemblies.Count+2", n+2, pl.FullTrustAssemblies.Count);
+
+ pl.RemoveFullTrustAssembly (sn);
+ AssertEquals ("FullTrustAssemblies.Count-1", n+1, pl.FullTrustAssemblies.Count);
+
+ pl.RemoveFullTrustAssembly (snmc);
+ AssertEquals ("FullTrustAssemblies.Count-2", n, pl.FullTrustAssemblies.Count);
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentNullException))]
+ public void RemoveFullTrustAssembly_NullStrongName ()
+ {
+ PolicyLevel pl = Load (minimal, PolicyLevelType.Machine);
+ StrongName sn = null;
+ pl.RemoveFullTrustAssembly (sn);
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentNullException))]
+ public void RemoveFullTrustAssembly_NullStrongNameMembershipCondition ()
+ {
+ PolicyLevel pl = Load (minimal, PolicyLevelType.Machine);
+ StrongNameMembershipCondition snmc = null;
+ pl.RemoveFullTrustAssembly (snmc);
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentException))]
+ public void RemoveFullTrustAssembly_UnknownStrongName () {
+ PolicyLevel pl = Load (minimal, PolicyLevelType.Machine);
+ StrongName sn = new StrongName (new StrongNamePublicKeyBlob (snPublicKey), "First", new Version (1, 2, 3, 4));
+ pl.RemoveFullTrustAssembly (sn);
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentException))]
+ public void RemoveFullTrustAssembly_UnknownStrongNameMembershipCondition ()
+ {
+ PolicyLevel pl = Load (minimal, PolicyLevelType.Machine);
+ StrongNameMembershipCondition snmc = new StrongNameMembershipCondition (new StrongNamePublicKeyBlob (snPublicKey), "Second", new Version ("0.1.2.3"));
+ pl.RemoveFullTrustAssembly (snmc);
+ }
+
+ [Test]
+ [Ignore ("System.ExecutionEngineException on MS runtime (1.1)")]
+ public void RemoveNamedPermissionSet ()
+ {
+ PolicyLevel pl = Load (minimal, PolicyLevelType.Machine);
+ int n = pl.NamedPermissionSets.Count;
+ NamedPermissionSet nps = new NamedPermissionSet ("Mono", PermissionState.Unrestricted);
+ pl.AddNamedPermissionSet (nps);
+ // ExecutionEngineException here!
+ pl.RemoveNamedPermissionSet (nps);
+ AssertEquals ("NamedPermissionSets.Count", n, pl.NamedPermissionSets.Count);
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentNullException))]
+ public void RemoveNamedPermissionSet_Null ()
+ {
+ PolicyLevel pl = Load (minimal, PolicyLevelType.Machine);
+ pl.RemoveNamedPermissionSet ((NamedPermissionSet)null);
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentException))]
+ public void RemoveNamedPermissionSet_NotFound ()
+ {
+ PolicyLevel pl = Load (minimal, PolicyLevelType.Machine);
+ NamedPermissionSet nps = new NamedPermissionSet ("Mono", PermissionState.Unrestricted);
+ pl.RemoveNamedPermissionSet (nps);
+ }
+
+ [Test]
+ [Ignore ("System.ExecutionEngineException on MS runtime (1.1)")]
+ public void RemoveNamedPermissionSet_String ()
+ {
+ PolicyLevel pl = Load (minimal, PolicyLevelType.Machine);
+ int n = pl.NamedPermissionSets.Count;
+ NamedPermissionSet nps = new NamedPermissionSet ("Mono", PermissionState.Unrestricted);
+ pl.AddNamedPermissionSet (nps);
+ // ExecutionEngineException here!
+ pl.RemoveNamedPermissionSet ("Mono");
+ AssertEquals ("NamedPermissionSets.Count", n, pl.NamedPermissionSets.Count);
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentNullException))]
+ public void RemoveNamedPermissionSet_StringNull ()
+ {
+ PolicyLevel pl = Load (minimal, PolicyLevelType.Machine);
+ pl.RemoveNamedPermissionSet ((string)null);
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentException))]
+ public void RemoveNamedPermissionSet_StringNotFound ()
+ {
+ PolicyLevel pl = Load (minimal, PolicyLevelType.Machine);
+ pl.RemoveNamedPermissionSet ("Mono");
+ }
+
+ [Test]
+ public void Reset ()
+ {
+ PolicyLevel pl = PolicyLevel.CreateAppDomainLevel ();
+
+ int n = pl.FullTrustAssemblies.Count;
+ StrongName sn = new StrongName (new StrongNamePublicKeyBlob (snPublicKey), "First", new Version (1, 2, 3, 4));
+ pl.AddFullTrustAssembly (sn);
+ AssertEquals ("FullTrustAssemblies.Count+1", n+1, pl.FullTrustAssemblies.Count);
+
+ int m = pl.NamedPermissionSets.Count;
+
+ NamedPermissionSet nps = new NamedPermissionSet ("Mono");
+ // ExecutionEngineException here!
+ //AssertEquals ("NamedPermissionSets.Count+1", m+1, pl.NamedPermissionSets.Count);
+
+ pl.Reset ();
+ AssertEquals ("FullTrustAssemblies.Count", n, pl.FullTrustAssemblies.Count);
+ // ExecutionEngineException here!
+ AssertEquals ("NamedPermissionSets.Count", m, pl.NamedPermissionSets.Count);
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentNullException))]
+ public void Resolve_Null ()
+ {
+ PolicyLevel pl = PolicyLevel.CreateAppDomainLevel ();
+ pl.Resolve (null);
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentNullException))]
+ public void RootCodeGroup_Null ()
+ {
+ PolicyLevel pl = PolicyLevel.CreateAppDomainLevel ();
+ pl.RootCodeGroup = null;
+ }
+
+ [Test]
+ public void StoreLocation ()
+ {
+ PolicyLevel pl = Load (minimal, PolicyLevelType.Machine);
+ // loaded from a string - no store
+ AssertNull ("StoreLocation(string)", pl.StoreLocation);
+
+ string filename = Path.GetFullPath ("unittest.config");
+ using (StreamWriter sw = new StreamWriter (filename, false)) {
+ sw.Write (minimal);
+ }
+ pl = SecurityManager.LoadPolicyLevelFromFile (filename, PolicyLevelType.Machine);
+ AssertEquals ("StoreLocation(file)", filename, pl.StoreLocation);
+ }
+
+ [Test]
+ public void ToXml ()
+ {
+ PolicyLevel pl = Load (minimal, PolicyLevelType.Machine);
+ PolicyLevel pl2 = PolicyLevel.CreateAppDomainLevel ();
+ SecurityElement se = pl.ToXml ();
+ pl2.FromXml (se);
+
+ AssertEquals ("ToXml-FullTrustAssemblies", pl.FullTrustAssemblies.Count, pl2.FullTrustAssemblies.Count);
+ AssertEquals ("ToXml-NamedPermissionSets", pl.NamedPermissionSets.Count, pl2.NamedPermissionSets.Count);
+ Assert ("ToXml-RootCodeGroup", pl.RootCodeGroup.Equals (pl2.RootCodeGroup, true));
+ AssertEquals ("ToXml-StoreLocation", pl.StoreLocation, pl2.StoreLocation);
+ }
+ }
+}
diff --git a/mcs/class/corlib/Test/System.Security.Policy/PublisherMembershipConditionTest.cs b/mcs/class/corlib/Test/System.Security.Policy/PublisherMembershipConditionTest.cs
index 41f59eedfa5..97b5d1348cd 100644
--- a/mcs/class/corlib/Test/System.Security.Policy/PublisherMembershipConditionTest.cs
+++ b/mcs/class/corlib/Test/System.Security.Policy/PublisherMembershipConditionTest.cs
@@ -167,12 +167,13 @@ public class PublisherMembershipConditionTest : Assertion {
SecurityElement se = pmc.ToXml ();
// note: different version #
- string expectedXmlFragment = "\"\r\n version=\"1\"\r\n X509Certificate=\"3082050F308203F7A003020102020A61071143000000000034300D06092A864886F70D01010505003081A6310B3009060355040613025553311330110603550408130A57617368696E67746F6E3110300E060355040713075265646D6F6E64311E301C060355040A13154D6963726F736F667420436F72706F726174696F6E312B3029060355040B1322436F7079726967687420";
+ string expectedXmlFragment = "\"{0} version=\"1\"{0} X509Certificate=\"3082050F308203F7A003020102020A61071143000000000034300D06092A864886F70D01010505003081A6310B3009060355040613025553311330110603550408130A57617368696E67746F6E3110300E060355040713075265646D6F6E64311E301C060355040A13154D6963726F736F667420436F72706F726174696F6E312B3029060355040B1322436F7079726967687420";
expectedXmlFragment += "2863292032303030204D6963726F736F667420436F72702E312330210603550403131A4D6963726F736F667420436F6465205369676E696E6720504341301E170D3032303532353030353534385A170D3033313132353031303534385A3081A1310B3009060355040613025553311330110603550408130A57617368696E67746F6E3110300E060355040713075265646D6F6E64311E301C060355040A13154D6963726F736F667420436F72706F726174696F6E312B3029060355040B1322436F70797269676874202863292032303032204D6963726F736F667420436F72702E311E301C060355040313154D6963726F736F667420436F72706F726174696F6E30820122300D06092A864886F70D010101";
expectedXmlFragment += "05000382010F003082010A0282010100AA99BD39A81827F42B3D0B4C3F7C772EA7CBB5D18C0DC23A74D793B5E0A04B3F595ECE454F9A7929F149CC1A47EE55C2083E1220F855F2EE5FD3E0CA96BC30DEFE58C82732D08554E8F09110BBF32BBE19E5039B0B861DF3B0398CB8FD0B1D3C7326AC572BCA29A215908215E277A34052038B9DC270BA1FE934F6F335924E5583F8DA30B620DE5706B55A4206DE59CBF2DFA6BD154771192523D2CB6F9B1979DF6A5BF176057929FCC356CA8F440885558ACBC80F464B55CB8C96774A87E8A94106C7FF0DE968576372C36957B443CF323A30DC1BE9D543262A79FE95DB226724C92FD034E3E6FB514986B83CD0255FD6EC9E036187A96840C7F8E203E6CF050203";
expectedXmlFragment += "010001A38201403082013C300E0603551D0F0101FF0404030206C030130603551D25040C300A06082B06010505070303301D0603551D0E041604146BC8C65120F0B42FD3A0B6AE7F5E26B2B88752293081A90603551D230481A130819E8014295CB91BB6CD33EEBB9E597DF7E5CA2EC40D3428A174A4723070312B3029060355040B1322436F70797269676874202863292031393937204D6963726F736F667420436F72702E311E301C060355040B13154D6963726F736F667420436F72706F726174696F6E3121301F060355040313184D6963726F736F667420526F6F7420417574686F7269747982106A0B994FC000DEAA11D4D8409AA8BEE6304A0603551D1F04433041303FA03DA03B863968747470";
expectedXmlFragment += "3A2F2F63726C2E6D6963726F736F66742E636F6D2F706B692F63726C2F70726F64756374732F436F64655369676E5043412E63726C300D06092A864886F70D010105050003820101003523FD1354FCE9DCF0DD0C147AFAA7B3CEFDA73AC8BAE5E7F603FB53DBA799A9A09B369C03EB82471C21BD14CBE7674009C716910255CE4342B4CD1B5DB0F332043D12E51DA707A78FA37E4555761B96959169F0DD38F34889EF7040B7DBB55580C003C42EB628DC0A820EC743E37A485DB8068992406C6EC5DCF89AEF0BBE210A8C2F3AB5EDA7CE71876823E1B3E4187DB84701A52BC458CBB2896C5FFDD32CC46FB823B20DFF3CF2114574F209069918DD6FC0860118121D2B16AF56EF6533A1EA674EF44B82ABE9";
- expectedXmlFragment += "0FDC01FADF607F66475DCB2C70CC7B4ED906B86E8C0CFE621E42F9937CA2AB0A9ED02310AE4D7B27916F26BE68FAA63F9F23EBC89DBB87\"/>\r\n";
+ expectedXmlFragment += "0FDC01FADF607F66475DCB2C70CC7B4ED906B86E8C0CFE621E42F9937CA2AB0A9ED02310AE4D7B27916F26BE68FAA63F9F23EBC89DBB87\"/>{0}";
+ expectedXmlFragment = String.Format (expectedXmlFragment, Environment.NewLine);
AssertEquals ("ToXml().Tag", "IMembershipCondition", se.Tag);
Assert ("ToXml().ToString()", se.ToString ().EndsWith (expectedXmlFragment));
@@ -181,4 +182,4 @@ public class PublisherMembershipConditionTest : Assertion {
}
}
-} \ No newline at end of file
+}
diff --git a/mcs/class/corlib/Test/System.Security.Policy/PublisherTest.cs b/mcs/class/corlib/Test/System.Security.Policy/PublisherTest.cs
index 65c838441f1..8135c25daa2 100644
--- a/mcs/class/corlib/Test/System.Security.Policy/PublisherTest.cs
+++ b/mcs/class/corlib/Test/System.Security.Policy/PublisherTest.cs
@@ -43,7 +43,7 @@ public class PublisherTest {
Publisher p = new Publisher (x509);
Assertion.AssertEquals ("GetHashCode", x509.GetHashCode (), p.GetHashCode ());
- Assertion.AssertEquals ("ToString", "<System.Security.Policy.Publisher version=\"1\">\r\n <X509v3Certificate/>\r\n</System.Security.Policy.Publisher>\r\n", p.ToString ());
+ Assertion.AssertEquals ("ToString", "<System.Security.Policy.Publisher version=\"1\">" + Environment.NewLine + " <X509v3Certificate/>" + Environment.NewLine +"</System.Security.Policy.Publisher>" + Environment.NewLine, p.ToString ());
}
[Test]
@@ -67,9 +67,9 @@ public class PublisherTest {
IPermission ip = p.CreateIdentityPermission (null);
Assertion.Assert ("CreateIdentityPermission", (ip is PublisherIdentityPermission));
- string s = "<System.Security.Policy.Publisher version=\"1\">\r\n <X509v3Certificate>3082050F308203F7A003020102020A61071143000000000034300D06092A864886F70D01010505003081A6310B3009060355040613025553311330110603550408130A57617368696E67746F6E3110300E060355040713075265646D6F6E64311E301C060355040A13154D6963726F736F667420436F72706F726174696F6E312B3029060355040B1322436F70797269676874202863292032303030204D6963726F736F667420436F72702E312330210603550403131A4D6963726F736F667420436F6465205369676E696E6720504341301E170D3032303532353030353534385A170D3033313132353031303534385A3081A1310B3009060355040613025553311330110603550408130A57617368696E67746F6E3110300E060355040713075265646D6F6E64311E301C060355040A13154D6963726F736F667420436F72706F726174696F6E312B3029060355040B1322436F70797269676874202863292032303032204D6963726F736F667420436F72702E311E301C060355040313154D6963726F736F667420436F72706F726174696F6E30820122300D06092A864886F70D01010105000382010F003082010A0282010100AA99BD39A81827F42B3D0B4C3F";
+ string s = "<System.Security.Policy.Publisher version=\"1\">" + Environment.NewLine + " <X509v3Certificate>3082050F308203F7A003020102020A61071143000000000034300D06092A864886F70D01010505003081A6310B3009060355040613025553311330110603550408130A57617368696E67746F6E3110300E060355040713075265646D6F6E64311E301C060355040A13154D6963726F736F667420436F72706F726174696F6E312B3029060355040B1322436F70797269676874202863292032303030204D6963726F736F667420436F72702E312330210603550403131A4D6963726F736F667420436F6465205369676E696E6720504341301E170D3032303532353030353534385A170D3033313132353031303534385A3081A1310B3009060355040613025553311330110603550408130A57617368696E67746F6E3110300E060355040713075265646D6F6E64311E301C060355040A13154D6963726F736F667420436F72706F726174696F6E312B3029060355040B1322436F70797269676874202863292032303032204D6963726F736F667420436F72702E311E301C060355040313154D6963726F736F667420436F72706F726174696F6E30820122300D06092A864886F70D01010105000382010F003082010A0282010100AA99BD39A81827F42B3D0B4C3F";
s += "7C772EA7CBB5D18C0DC23A74D793B5E0A04B3F595ECE454F9A7929F149CC1A47EE55C2083E1220F855F2EE5FD3E0CA96BC30DEFE58C82732D08554E8F09110BBF32BBE19E5039B0B861DF3B0398CB8FD0B1D3C7326AC572BCA29A215908215E277A34052038B9DC270BA1FE934F6F335924E5583F8DA30B620DE5706B55A4206DE59CBF2DFA6BD154771192523D2CB6F9B1979DF6A5BF176057929FCC356CA8F440885558ACBC80F464B55CB8C96774A87E8A94106C7FF0DE968576372C36957B443CF323A30DC1BE9D543262A79FE95DB226724C92FD034E3E6FB514986B83CD0255FD6EC9E036187A96840C7F8E203E6CF050203010001A38201403082013C300E0603551D0F0101FF0404030206C030130603551D25040C300A06082B06010505070303301D0603551D0E041604146BC8C65120F0B42FD3A0B6AE7F5E26B2B88752293081A90603551D230481A130819E8014295CB91BB6CD33EEBB9E597DF7E5CA2EC40D3428A174A4723070312B3029060355040B1322436F70797269676874202863292031393937204D6963726F736F667420436F72702E311E301C060355040B13154D6963726F736F667420436F72706F726174696F6E3121301F060355040313184D6963726F736F667420526F6F7420417574686F7269747982106A0B994FC000DEAA11D4D8";
- s += "409AA8BEE6304A0603551D1F04433041303FA03DA03B8639687474703A2F2F63726C2E6D6963726F736F66742E636F6D2F706B692F63726C2F70726F64756374732F436F64655369676E5043412E63726C300D06092A864886F70D010105050003820101003523FD1354FCE9DCF0DD0C147AFAA7B3CEFDA73AC8BAE5E7F603FB53DBA799A9A09B369C03EB82471C21BD14CBE7674009C716910255CE4342B4CD1B5DB0F332043D12E51DA707A78FA37E4555761B96959169F0DD38F34889EF7040B7DBB55580C003C42EB628DC0A820EC743E37A485DB8068992406C6EC5DCF89AEF0BBE210A8C2F3AB5EDA7CE71876823E1B3E4187DB84701A52BC458CBB2896C5FFDD32CC46FB823B20DFF3CF2114574F209069918DD6FC0860118121D2B16AF56EF6533A1EA674EF44B82ABE90FDC01FADF607F66475DCB2C70CC7B4ED906B86E8C0CFE621E42F9937CA2AB0A9ED02310AE4D7B27916F26BE68FAA63F9F23EBC89DBB87</X509v3Certificate>\r\n</System.Security.Policy.Publisher>\r\n";
+ s += "409AA8BEE6304A0603551D1F04433041303FA03DA03B8639687474703A2F2F63726C2E6D6963726F736F66742E636F6D2F706B692F63726C2F70726F64756374732F436F64655369676E5043412E63726C300D06092A864886F70D010105050003820101003523FD1354FCE9DCF0DD0C147AFAA7B3CEFDA73AC8BAE5E7F603FB53DBA799A9A09B369C03EB82471C21BD14CBE7674009C716910255CE4342B4CD1B5DB0F332043D12E51DA707A78FA37E4555761B96959169F0DD38F34889EF7040B7DBB55580C003C42EB628DC0A820EC743E37A485DB8068992406C6EC5DCF89AEF0BBE210A8C2F3AB5EDA7CE71876823E1B3E4187DB84701A52BC458CBB2896C5FFDD32CC46FB823B20DFF3CF2114574F209069918DD6FC0860118121D2B16AF56EF6533A1EA674EF44B82ABE90FDC01FADF607F66475DCB2C70CC7B4ED906B86E8C0CFE621E42F9937CA2AB0A9ED02310AE4D7B27916F26BE68FAA63F9F23EBC89DBB87</X509v3Certificate>" + Environment.NewLine + "</System.Security.Policy.Publisher>" + Environment.NewLine;
Assertion.AssertEquals ("ToString", s, p.ToString ());
}
@@ -87,4 +87,4 @@ public class PublisherTest {
}
}
-} \ No newline at end of file
+}
diff --git a/mcs/class/corlib/Test/System.Security.Policy/SiteMembershipConditionTest.cs b/mcs/class/corlib/Test/System.Security.Policy/SiteMembershipConditionTest.cs
new file mode 100755
index 00000000000..f5e5b88c61c
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Security.Policy/SiteMembershipConditionTest.cs
@@ -0,0 +1,222 @@
+//
+// SiteMembershipConditionTest.cs - NUnit Test Cases for SiteMembershipCondition
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2004 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using NUnit.Framework;
+using System;
+using System.Collections;
+using System.Security;
+using System.Security.Permissions;
+using System.Security.Policy;
+
+namespace MonoTests.System.Security.Policy {
+
+ [TestFixture]
+ public class SiteMembershipConditionTest : Assertion {
+
+ [Test]
+ [ExpectedException (typeof (ArgumentNullException))]
+ public void SiteMembershipCondition_Null ()
+ {
+ SiteMembershipCondition smc = new SiteMembershipCondition (null);
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentException))]
+ public void SiteMembershipCondition_Empty ()
+ {
+ SiteMembershipCondition smc = new SiteMembershipCondition (String.Empty);
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentException))]
+ public void SiteMembershipCondition_FileUrl ()
+ {
+ SiteMembershipCondition smc = new SiteMembershipCondition ("file://mono/index.html");
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentException))]
+ public void SiteMembershipCondition_FullUrlWithPort ()
+ {
+ SiteMembershipCondition smc = new SiteMembershipCondition ("http://www.go-mono.com:8080/index.html");
+ }
+
+ [Test]
+ public void SiteMembershipCondition_GoMonoWebSite ()
+ {
+ SiteMembershipCondition smc = new SiteMembershipCondition ("www.go-mono.com");
+ AssertEquals ("Site", "www.go-mono.com", smc.Site);
+ AssertEquals ("ToString", "Site - www.go-mono.com", smc.ToString ());
+
+ SiteMembershipCondition smc2 = (SiteMembershipCondition) smc.Copy ();
+ AssertEquals ("Copy.Site", smc.Site, smc2.Site);
+ AssertEquals ("Copy.GetHashCode", smc.GetHashCode (), smc2.GetHashCode ());
+
+ SecurityElement se = smc2.ToXml ();
+ SiteMembershipCondition smc3 = new SiteMembershipCondition ("*");
+ smc3.FromXml (se);
+ AssertEquals ("ToXml/FromXml", smc.Site, smc3.Site);
+
+ Assert ("Equals", smc.Equals (smc2));
+ SiteMembershipCondition smc4 = new SiteMembershipCondition ("go-mono.com");
+ Assert ("!Equals", !smc.Equals (smc4));
+ }
+
+ [Test]
+ public void Site_AllGoMonoSite ()
+ {
+ SiteMembershipCondition smc = new SiteMembershipCondition ("*.go-mono.com");
+ AssertEquals ("Site", "*.go-mono.com", smc.Site);
+ AssertEquals ("ToString", "Site - *.go-mono.com", smc.ToString ());
+
+ SiteMembershipCondition smc2 = (SiteMembershipCondition) smc.Copy ();
+ AssertEquals ("Copy.Site", smc.Site, smc2.Site);
+ AssertEquals ("Copy.GetHashCode", smc.GetHashCode (), smc2.GetHashCode ());
+
+ SecurityElement se = smc2.ToXml ();
+ SiteMembershipCondition smc3 = new SiteMembershipCondition ("*");
+ smc3.FromXml (se);
+ AssertEquals ("ToXml/FromXml", smc.Site, smc3.Site);
+
+ Assert ("Equals", smc.Equals (smc2));
+ SiteMembershipCondition smc4 = new SiteMembershipCondition ("go-mono.com");
+ Assert ("!Equals", !smc.Equals (smc4));
+ }
+
+ [Test]
+ public void CheckNull ()
+ {
+ SiteMembershipCondition smc = new SiteMembershipCondition ("*.go-mono.com");
+ Assert ("Check(null)", !smc.Check (null));
+ }
+
+ [Test]
+ public void CheckPositive ()
+ {
+ SiteMembershipCondition smc = new SiteMembershipCondition ("*.go-mono.com");
+ Evidence e = new Evidence ();
+ e.AddHost (new Site ("*.go-mono.com"));
+ Assert ("Check(+)", smc.Check (e));
+ }
+
+ [Test]
+ public void CheckPositive_Partial ()
+ {
+ SiteMembershipCondition smc = new SiteMembershipCondition ("*.go-mono.com");
+ Evidence e = new Evidence ();
+ e.AddHost (new Site ("www.go-mono.com"));
+ Assert ("Check(+-)", smc.Check (e));
+ }
+
+ [Test]
+ public void CheckNegative ()
+ {
+ SiteMembershipCondition smc = new SiteMembershipCondition ("*.go-mono.com");
+ Evidence e = new Evidence ();
+ e.AddHost (new Site ("*.go-mono.org"));
+ Assert ("Check(-)", !smc.Check (e));
+ }
+
+ [Test]
+ public void CheckNegative_NoSiteEvidence ()
+ {
+ SiteMembershipCondition smc = new SiteMembershipCondition ("*.go-mono.com");
+ Evidence e = new Evidence ();
+ e.AddHost (new Zone (SecurityZone.MyComputer));
+ Assert ("Check(?)", !smc.Check (e));
+ }
+
+ [Test]
+ public void EqualsCaseSensitive ()
+ {
+ SiteMembershipCondition smc1 = new SiteMembershipCondition ("*.go-mono.com");
+ SiteMembershipCondition smc2 = new SiteMembershipCondition ("*.Go-Mono.com");
+ Assert ("CaseSensitive", smc1.Equals (smc2));
+ }
+
+ [Test]
+ public void EqualsNull ()
+ {
+ SiteMembershipCondition smc = new SiteMembershipCondition ("*.go-mono.com");
+ Assert ("EqualsNull", !smc.Equals (null));
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentNullException))]
+ public void FromXmlNull ()
+ {
+ SiteMembershipCondition smc = new SiteMembershipCondition ("*.go-mono.com");
+ smc.FromXml (null);
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentException))]
+ public void FromXmlInvalid ()
+ {
+ SiteMembershipCondition smc = new SiteMembershipCondition ("*.go-mono.com");
+ SecurityElement se = smc.ToXml ();
+ se.Tag = "IMonoship";
+ smc.FromXml (se);
+ }
+
+ [Test]
+ public void FromXmlPolicyLevel ()
+ {
+ SiteMembershipCondition smc = new SiteMembershipCondition ("*.go-mono.com");
+ SecurityElement se = smc.ToXml ();
+ // is it accepted for all policy levels ?
+ IEnumerator e = SecurityManager.PolicyHierarchy ();
+ while (e.MoveNext ()) {
+ PolicyLevel pl = e.Current as PolicyLevel;
+ SiteMembershipCondition spl = new SiteMembershipCondition ("*");
+ spl.FromXml (se, pl);
+ Assert ("FromXml(PolicyLevel='" + pl.Label + "')", spl.Equals (smc));
+ }
+ // yes!
+ }
+
+ [Test]
+ public void ToXmlNull ()
+ {
+ SiteMembershipCondition smc = new SiteMembershipCondition ("*.go-mono.com");
+ // no ArgumentNullException here
+ SecurityElement se = smc.ToXml (null);
+ AssertNotNull ("ToXml(null)", se);
+ }
+
+ [Test]
+ public void ToXmlPolicyLevel ()
+ {
+ SiteMembershipCondition smc = new SiteMembershipCondition ("*.go-mono.com");
+ SecurityElement se = smc.ToXml ();
+ string s = smc.ToXml ().ToString ();
+ // is it accepted for all policy levels ?
+ IEnumerator e = SecurityManager.PolicyHierarchy ();
+ while (e.MoveNext ()) {
+ PolicyLevel pl = e.Current as PolicyLevel;
+ SiteMembershipCondition spl = new SiteMembershipCondition ("*");
+ spl.FromXml (se, pl);
+ AssertEquals ("ToXml(PolicyLevel='" + pl.Label + "')", s, spl.ToXml (pl).ToString ());
+ }
+ // yes!
+ }
+
+ [Test]
+ public void ToFromXmlRoundTrip ()
+ {
+ SiteMembershipCondition smc1 = new SiteMembershipCondition ("*.go-mono.com");
+ SecurityElement se = smc1.ToXml ();
+
+ SiteMembershipCondition smc2 = new SiteMembershipCondition ("*");
+ smc2.FromXml (se);
+
+ AssertEquals ("ToFromXmlRoundTrip", smc1.GetHashCode (), smc2.GetHashCode ());
+ }
+ }
+}
diff --git a/mcs/class/corlib/Test/System.Security.Policy/SiteTest.cs b/mcs/class/corlib/Test/System.Security.Policy/SiteTest.cs
new file mode 100755
index 00000000000..e184661e756
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Security.Policy/SiteTest.cs
@@ -0,0 +1,174 @@
+//
+// SiteTest.cs - NUnit Test Cases for Site
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2004 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using NUnit.Framework;
+using System;
+using System.Security;
+using System.Security.Permissions;
+using System.Security.Policy;
+
+namespace MonoTests.System.Security.Policy {
+
+ [TestFixture]
+ public class SiteTest : Assertion {
+
+ [Test]
+ [ExpectedException (typeof (ArgumentNullException))]
+ public void Site_Null ()
+ {
+ Site s = new Site (null);
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentException))]
+ public void Site_Empty ()
+ {
+ Site s = new Site (String.Empty);
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentException))]
+ public void Site_FileUrl ()
+ {
+ Site s = new Site ("file://mono/index.html");
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentException))]
+ public void Site_AllGoMono ()
+ {
+ Site s = new Site ("http://*.go-mono.com");
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentException))]
+ public void Site_FullUrlWithPort ()
+ {
+ Site s = new Site ("http://www.go-mono.com:8080/index.html");
+ }
+
+ [Test]
+ public void Site_GoMonoWebSite ()
+ {
+ Site s = new Site ("www.go-mono.com");
+ AssertEquals ("Name", "www.go-mono.com", s.Name);
+ AssertEquals ("ToString", "<System.Security.Policy.Site version=\"1\">" + Environment.NewLine + " <Name>www.go-mono.com</Name>" + Environment.NewLine + "</System.Security.Policy.Site>" + Environment.NewLine, s.ToString ());
+
+ Site s2 = (Site) s.Copy ();
+ AssertEquals ("Copy.Name", s.Name, s2.Name);
+ AssertEquals ("Copy.GetHashCode", s.GetHashCode (), s2.GetHashCode ());
+
+ SiteIdentityPermission sip = (SiteIdentityPermission) s.CreateIdentityPermission (null);
+ AssertEquals ("CreateIdentityPermission", s.Name, sip.Site);
+
+ Assert ("Equals", s.Equals (s2));
+ Site s3 = new Site ("go-mono.com");
+ Assert ("!Equals", !s.Equals (s3));
+ }
+
+ [Test]
+ public void Site_AllGoMonoSite ()
+ {
+ Site s = new Site ("*.go-mono.com");
+ AssertEquals ("Name", "*.go-mono.com", s.Name);
+ AssertEquals ("ToString", "<System.Security.Policy.Site version=\"1\">" + Environment.NewLine + " <Name>*.go-mono.com</Name>" + Environment.NewLine + "</System.Security.Policy.Site>" + Environment.NewLine, s.ToString ());
+
+ Site s2 = (Site) s.Copy ();
+ AssertEquals ("Copy.Name", s.Name, s2.Name);
+ AssertEquals ("Copy.GetHashCode", s.GetHashCode (), s2.GetHashCode ());
+
+ SiteIdentityPermission sip = (SiteIdentityPermission) s.CreateIdentityPermission (null);
+ AssertEquals ("CreateIdentityPermission", s.Name, sip.Site);
+
+ Assert ("Equals", s.Equals (s2));
+ Site s3 = new Site ("go-mono.com");
+ Assert ("!Equals", !s.Equals (s3));
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentException))]
+ public void Site_GoMonoAllTLD ()
+ {
+ Site s = new Site ("www.go-mono.*");
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentException))]
+ public void Site_TwoStars ()
+ {
+ Site s = new Site ("*.*.go-mono.com");
+ }
+
+ [Test]
+ public void EqualsCaseSensitive () {
+ Site s1 = new Site ("*.go-mono.com");
+ Site s2 = new Site ("*.Go-Mono.com");
+ Assert ("CaseSensitive", s1.Equals (s2));
+ }
+
+ [Test]
+ public void EqualsPartial ()
+ {
+ Site s1 = new Site ("www.go-mono.com");
+ Site s2 = new Site ("*.go-mono.com");
+ Assert ("Partial:1-2", !s1.Equals (s2));
+ Assert ("Partial:2-1", !s2.Equals (s1));
+ }
+
+ [Test]
+ public void EqualsNull ()
+ {
+ Site s1 = new Site ("*.go-mono.com");
+ Assert ("EqualsNull", !s1.Equals (null));
+ }
+
+ [Test]
+ public void Site_LoneStar ()
+ {
+ Site s = new Site ("*");
+ AssertEquals ("Name", "*", s.Name);
+ AssertEquals ("ToString", "<System.Security.Policy.Site version=\"1\">" + Environment.NewLine + " <Name>*</Name>" + Environment.NewLine + "</System.Security.Policy.Site>" + Environment.NewLine, s.ToString ());
+
+ Site s2 = (Site) s.Copy ();
+ AssertEquals ("Copy.Name", s.Name, s2.Name);
+ AssertEquals ("Copy.GetHashCode", s.GetHashCode (), s2.GetHashCode ());
+
+ SiteIdentityPermission sip = (SiteIdentityPermission) s.CreateIdentityPermission (null);
+ AssertEquals ("CreateIdentityPermission", s.Name, sip.Site);
+
+ Assert ("Equals", s.Equals (s2));
+ Site s3 = new Site ("go-mono.com");
+ Assert ("!Equals", !s.Equals (s3));
+ }
+
+ [Test]
+ public void AllChars ()
+ {
+ for (int i=0; i < 256; i++) {
+ bool actual = false;
+ char c = Convert.ToChar (i);
+ try {
+ Site s = new Site (Convert.ToString (c));
+ actual = true;
+ // Console.WriteLine ("GOOD: {0} - {1}", i, c);
+ }
+ catch {
+ // Console.WriteLine ("FAIL: {0} - {1}", i, c);
+ }
+ bool result = ((i == 42) // *
+ || (i == 45) // -
+ || (i >= 47 && i <= 57) // /,0-9
+ || (i >= 64 && i <= 90) // @,A-Z
+ || (i == 95) // _
+ || (i >= 97 && i <= 122)); // a-z
+ Assert ("#"+i, (actual == result));
+ }
+ }
+ }
+}
diff --git a/mcs/class/corlib/Test/System.Security.Policy/StrongNameTest.cs b/mcs/class/corlib/Test/System.Security.Policy/StrongNameTest.cs
index 289e66da28c..4e359f7ee03 100644
--- a/mcs/class/corlib/Test/System.Security.Policy/StrongNameTest.cs
+++ b/mcs/class/corlib/Test/System.Security.Policy/StrongNameTest.cs
@@ -17,7 +17,7 @@ using System.Security.Policy;
namespace MonoTests.System.Security.Policy {
[TestFixture]
-public class StrongNameTest {
+public class StrongNameTest : Assertion {
static byte[] pk = { 0x00, 0x24, 0x00, 0x00, 0x04, 0x80, 0x00, 0x00, 0x94, 0x00, 0x00, 0x00, 0x06, 0x02, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x52, 0x53, 0x41, 0x31, 0x00, 0x04, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x3D, 0xBD, 0x72, 0x08, 0xC6, 0x2B, 0x0E, 0xA8, 0xC1, 0xC0, 0x58, 0x07, 0x2B, 0x63, 0x5F, 0x7C, 0x9A, 0xBD, 0xCB, 0x22, 0xDB, 0x20, 0xB2, 0xA9, 0xDA, 0xDA, 0xEF, 0xE8, 0x00, 0x64, 0x2F, 0x5D, 0x8D, 0xEB, 0x78, 0x02, 0xF7, 0xA5, 0x36, 0x77, 0x28, 0xD7, 0x55, 0x8D, 0x14, 0x68, 0xDB, 0xEB, 0x24, 0x09, 0xD0, 0x2B, 0x13, 0x1B, 0x92, 0x6E, 0x2E, 0x59, 0x54, 0x4A, 0xAC, 0x18, 0xCF, 0xC9, 0x09, 0x02, 0x3F, 0x4F, 0xA8, 0x3E, 0x94, 0x00, 0x1F, 0xC2, 0xF1, 0x1A, 0x27, 0x47, 0x7D, 0x10, 0x84, 0xF5, 0x14, 0xB8, 0x61, 0x62, 0x1A, 0x0C, 0x66, 0xAB, 0xD2, 0x4C, 0x4B, 0x9F, 0xC9, 0x0F, 0x3C, 0xD8, 0x92, 0x0F, 0xF5, 0xFF, 0xCE, 0xD7, 0x6E, 0x5C, 0x6F, 0xB1, 0xF5, 0x7D, 0xD3, 0x56, 0xF9, 0x67, 0x27, 0xA4, 0xA5, 0x48, 0x5B, 0x07, 0x93, 0x44, 0x00, 0x4A, 0xF8, 0xFF, 0xA4, 0xCB };
@@ -59,18 +59,19 @@ public class StrongNameTest {
{
StrongName sn = new StrongName (snpkb, name, version);
- Assertion.AssertEquals ("Name", name, sn.Name);
- Assertion.AssertEquals ("PublicKey", snpkb.ToString (), sn.PublicKey.ToString ());
- Assertion.AssertEquals ("Version", version.ToString (), sn.Version.ToString ());
+ AssertEquals ("Name", name, sn.Name);
+ AssertEquals ("PublicKey", snpkb.ToString (), sn.PublicKey.ToString ());
+ AssertEquals ("Version", version.ToString (), sn.Version.ToString ());
// same as StrongNamePublicKeyBlob
- Assertion.AssertEquals ("GetHashCode", 2359296, sn.GetHashCode ());
+ AssertEquals ("GetHashCode", 2359296, sn.GetHashCode ());
IPermission ip = sn.CreateIdentityPermission (null);
- Assertion.Assert ("CreateIdentityPermission", (ip is StrongNameIdentityPermission));
+ Assert ("CreateIdentityPermission", (ip is StrongNameIdentityPermission));
- string s = "<StrongName version=\"1\"\r\n Key=\"00240000048000009400000006020000002400005253413100040000010001003DBD7208C62B0EA8C1C058072B635F7C9ABDCB22DB20B2A9DADAEFE800642F5D8DEB7802F7A5367728D7558D1468DBEB2409D02B131B926E2E59544AAC18CFC909023F4FA83E94001FC2F11A27477D1084F514B861621A0C66ABD24C4B9FC90F3CD8920FF5FFCED76E5C6FB1F57DD356F96727A4A5485B079344004AF8FFA4CB\"\r\n Name=\"StrongNameName\"\r\n Version=\"1.2.3.4\"/>\r\n";
- Assertion.AssertEquals ("ToString", s, sn.ToString ());
+ string s = String.Format ("<StrongName version=\"1\"{0} Key=\"00240000048000009400000006020000002400005253413100040000010001003DBD7208C62B0EA8C1C058072B635F7C9ABDCB22DB20B2A9DADAEFE800642F5D8DEB7802F7A5367728D7558D1468DBEB2409D02B131B926E2E59544AAC18CFC909023F4FA83E94001FC2F11A27477D1084F514B861621A0C66ABD24C4B9FC90F3CD8920FF5FFCED76E5C6FB1F57DD356F96727A4A5485B079344004AF8FFA4CB\"{0} Name=\"StrongNameName\"{0} Version=\"1.2.3.4\"/>{0}",
+ Environment.NewLine);
+ AssertEquals ("ToString", s, sn.ToString ());
}
[Test]
@@ -79,11 +80,11 @@ public class StrongNameTest {
StrongName sn = new StrongName (snpkb, name, version);
StrongName snCopy = (StrongName) sn.Copy ();
- Assertion.AssertNotNull ("Copy", snCopy);
- Assertion.Assert("Copy-Equals", sn.Equals (snCopy));
- Assertion.AssertEquals ("Copy-GetHashCode", sn.GetHashCode (), snCopy.GetHashCode ());
- Assertion.AssertEquals ("Copy-ToString", sn.ToString (), snCopy.ToString ());
+ AssertNotNull ("Copy", snCopy);
+ Assert("Copy-Equals", sn.Equals (snCopy));
+ AssertEquals ("Copy-GetHashCode", sn.GetHashCode (), snCopy.GetHashCode ());
+ AssertEquals ("Copy-ToString", sn.ToString (), snCopy.ToString ());
}
}
-} \ No newline at end of file
+}
diff --git a/mcs/class/corlib/Test/System.Security.Policy/UnionCodeGroupTest.cs b/mcs/class/corlib/Test/System.Security.Policy/UnionCodeGroupTest.cs
new file mode 100755
index 00000000000..cadf82d4fdc
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Security.Policy/UnionCodeGroupTest.cs
@@ -0,0 +1,113 @@
+//
+// MonoTests.System.Security.Policy.UnionCodeGroupTest
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2004 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using NUnit.Framework;
+using System;
+using System.Collections;
+using System.Security;
+using System.Security.Policy;
+using System.Security.Permissions;
+
+namespace MonoTests.System.Security.Policy {
+
+ [TestFixture]
+ public class UnionCodeGroupTest : Assertion {
+
+ [Test]
+ [ExpectedException (typeof (ArgumentNullException))]
+ public void Constructor_MembershipConditionNullPolicyStatement ()
+ {
+ UnionCodeGroup cg = new UnionCodeGroup (null, new PolicyStatement (new PermissionSet (PermissionState.None)));
+ }
+
+ [Test]
+ public void Constructor_MembershipConditionPolicyStatementNull ()
+ {
+ // legal
+ UnionCodeGroup cg = new UnionCodeGroup (new AllMembershipCondition (), null);
+ AssertNull ("PolicyStatement", cg.PolicyStatement);
+ }
+
+ [Test]
+ public void Constructor ()
+ {
+ UnionCodeGroup cg = new UnionCodeGroup (new AllMembershipCondition (), new PolicyStatement (new PermissionSet (PermissionState.None)));
+ AssertNotNull ("PolicyStatement", cg.PolicyStatement);
+ AssertNotNull ("MembershipCondition", cg.MembershipCondition);
+ }
+
+ [Test]
+ public void MergeLogic ()
+ {
+ UnionCodeGroup cg = new UnionCodeGroup (new AllMembershipCondition (), new PolicyStatement (new PermissionSet (PermissionState.None)));
+ AssertEquals ("MergeLogic", "Union", cg.MergeLogic);
+ }
+
+ [Test]
+ public void Copy ()
+ {
+ UnionCodeGroup cg = new UnionCodeGroup (new AllMembershipCondition (), new PolicyStatement (new PermissionSet (PermissionState.None)));
+ UnionCodeGroup cg2 = (UnionCodeGroup) cg.Copy ();
+ AssertEquals ("AttributeString", cg.AttributeString, cg2.AttributeString);
+ AssertEquals ("Children", cg.Children.Count, cg2.Children.Count);
+ AssertEquals ("Description", cg.Description, cg2.Description);
+ AssertEquals ("MergeLogic", cg.MergeLogic, cg2.MergeLogic);
+ AssertEquals ("Name", cg.Name, cg2.Name);
+ AssertEquals ("PermissionSetName", cg.PermissionSetName, cg2.PermissionSetName);
+ AssertEquals ("ToXml", cg.ToXml ().ToString (), cg2.ToXml ().ToString ());
+ }
+
+ [Test]
+ public void CopyWithChildren ()
+ {
+ UnionCodeGroup cgChild = new UnionCodeGroup (new AllMembershipCondition (), new PolicyStatement (new PermissionSet (PermissionState.Unrestricted)));
+ UnionCodeGroup cg = new UnionCodeGroup (new AllMembershipCondition (), new PolicyStatement (new PermissionSet (PermissionState.None)));
+ cg.AddChild (cgChild);
+ UnionCodeGroup cg2 = (UnionCodeGroup) cg.Copy ();
+ AssertEquals ("Children", cg.Children.Count, cg2.Children.Count);
+ AssertEquals ("ToXml", cg.ToXml ().ToString (), cg2.ToXml ().ToString ());
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentNullException))]
+ public void Resolve_Null ()
+ {
+ UnionCodeGroup cg = new UnionCodeGroup (new AllMembershipCondition (), new PolicyStatement (new PermissionSet (PermissionState.None)));
+ cg.Resolve (null);
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentNullException))]
+ public void ResolveMatchingCodeGroups_Null ()
+ {
+ UnionCodeGroup cg = new UnionCodeGroup (new AllMembershipCondition (), new PolicyStatement (new PermissionSet (PermissionState.None)));
+ cg.ResolveMatchingCodeGroups (null);
+ }
+
+ [Test]
+ public void ToFromXmlRoundtrip ()
+ {
+ const string ps_Name = "TestName";
+ PolicyStatement ps = new PolicyStatement (new NamedPermissionSet (ps_Name));
+ UnionCodeGroup cg = new UnionCodeGroup (new AllMembershipCondition (), ps);
+ cg.Name = "SomeName";
+ cg.Description = "Some Description";
+ Assert ("Equals (itself)", cg.Equals (cg));
+ SecurityElement se = cg.ToXml ();
+
+ UnionCodeGroup cg2 = new UnionCodeGroup (new AllMembershipCondition(), ps);
+ cg2.Name = "SomeOtherName";
+ cg2.Description = "Some Other Description";
+ Assert ("Equals (another)", !cg.Equals (cg2));
+
+ cg2.FromXml (se);
+ Assert ("Equals (FromXml)", cg.Equals (cg2));
+ }
+ }
+}
diff --git a/mcs/class/corlib/Test/System.Security.Policy/UrlMembershipConditionTest.cs b/mcs/class/corlib/Test/System.Security.Policy/UrlMembershipConditionTest.cs
new file mode 100755
index 00000000000..3418065621b
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Security.Policy/UrlMembershipConditionTest.cs
@@ -0,0 +1,309 @@
+//
+// UrlMembershipConditionTest.cs - NUnit Test Cases for UrlMembershipCondition
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2004 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using NUnit.Framework;
+using System;
+using System.Collections;
+using System.Security;
+using System.Security.Permissions;
+using System.Security.Policy;
+
+namespace MonoTests.System.Security.Policy {
+
+ [TestFixture]
+ public class UrlMembershipConditionTest : Assertion {
+
+ [Test]
+ [ExpectedException (typeof (ArgumentNullException))]
+ public void UrlMembershipCondition_Null ()
+ {
+ UrlMembershipCondition umc = new UrlMembershipCondition (null);
+ }
+
+ [Test]
+ [ExpectedException (typeof (FormatException))]
+ public void UrlMembershipCondition_Empty ()
+ {
+ UrlMembershipCondition umc = new UrlMembershipCondition (String.Empty);
+ }
+
+ [Test]
+ public void UrlMembershipCondition_FileUrl ()
+ {
+ UrlMembershipCondition umc = new UrlMembershipCondition ("file://mono/index.html");
+ }
+
+ [Test]
+ public void UrlMembershipCondition_FullUrlWithPort ()
+ {
+ UrlMembershipCondition umc = new UrlMembershipCondition ("http://www.go-mono.com:8080/index.html");
+ }
+
+ [Test]
+ public void UrlMembershipCondition_GoMonoWebUrl ()
+ {
+ UrlMembershipCondition umc = new UrlMembershipCondition ("http://www.go-mono.com/");
+ AssertEquals ("Url", "http://www.go-mono.com/", umc.Url);
+ AssertEquals ("ToString", "Url - http://www.go-mono.com/", umc.ToString ());
+
+ UrlMembershipCondition umc2 = (UrlMembershipCondition) umc.Copy ();
+ AssertEquals ("Copy.Url", umc.Url, umc2.Url);
+ AssertEquals ("Copy.GetHashCode", umc.GetHashCode (), umc2.GetHashCode ());
+
+ SecurityElement se = umc2.ToXml ();
+ UrlMembershipCondition umc3 = new UrlMembershipCondition ("*");
+ umc3.FromXml (se);
+ AssertEquals ("ToXml/FromXml", umc.Url, umc3.Url);
+
+ Assert ("Equals", umc.Equals (umc2));
+ UrlMembershipCondition umc4 = new UrlMembershipCondition ("http://www.go-mono.com");
+ // note that a last slash is added to Url - so it's equal
+ Assert ("Equals-AutoAddedLastSlash", umc.Equals (umc4));
+ }
+
+ [Test]
+ public void Url_AllGoMonoUrl ()
+ {
+ UrlMembershipCondition umc = new UrlMembershipCondition ("http://www.go-mono.com/*");
+ AssertEquals ("Url", "http://www.go-mono.com/*", umc.Url);
+ AssertEquals ("ToString", "Url - http://www.go-mono.com/*", umc.ToString ());
+
+ UrlMembershipCondition umc2 = (UrlMembershipCondition) umc.Copy ();
+ AssertEquals ("Copy.Url", umc.Url, umc2.Url);
+ AssertEquals ("Copy.GetHashCode", umc.GetHashCode (), umc2.GetHashCode ());
+
+ SecurityElement se = umc2.ToXml ();
+ UrlMembershipCondition umc3 = new UrlMembershipCondition ("*");
+ umc3.FromXml (se);
+ AssertEquals ("ToXml/FromXml", umc.Url, umc3.Url);
+
+ Assert ("Equals", umc.Equals (umc2));
+ UrlMembershipCondition umc4 = new UrlMembershipCondition ("http://www.go-mono.com/");
+ Assert ("Equals-*", umc.Equals (umc4));
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentException))]
+ public void Url_InvalidSite ()
+ {
+ UrlMembershipCondition umc = new UrlMembershipCondition ("http://www.go-mono.*");
+ }
+
+ [Test]
+ public void Url_NoProtocol ()
+ {
+ UrlMembershipCondition umc = new UrlMembershipCondition ("www.go-mono.com");
+ // note: no last slash here
+ AssertEquals ("Url", "file://WWW.GO-MONO.COM", umc.Url);
+ AssertEquals ("ToString", "Url - file://WWW.GO-MONO.COM", umc.ToString ());
+ }
+
+ [Test]
+ public void Url_WellKnownProtocol ()
+ {
+ UrlMembershipCondition umc = new UrlMembershipCondition ("http://www.go-mono.com");
+ AssertEquals ("Url", "http://www.go-mono.com/", umc.Url);
+ AssertEquals ("ToString", "Url - http://www.go-mono.com/", umc.ToString ());
+
+ umc = new UrlMembershipCondition ("https://www.go-mono.com");
+ AssertEquals ("Url", "https://www.go-mono.com/", umc.Url);
+ AssertEquals ("ToString", "Url - https://www.go-mono.com/", umc.ToString ());
+
+ umc = new UrlMembershipCondition ("ftp://www.go-mono.com");
+ AssertEquals ("Url", "ftp://www.go-mono.com/", umc.Url);
+ AssertEquals ("ToString", "Url - ftp://www.go-mono.com/", umc.ToString ());
+
+ umc = new UrlMembershipCondition ("file://www.go-mono.com");
+ AssertEquals ("Url", "file://WWW.GO-MONO.COM", umc.Url);
+ AssertEquals ("ToString", "Url - file://WWW.GO-MONO.COM", umc.ToString ());
+ }
+
+ [Test]
+ public void Url_UnknownProtocol ()
+ {
+ UrlMembershipCondition umc = new UrlMembershipCondition ("mono://www.go-mono.com");
+ AssertEquals ("Url", "mono://www.go-mono.com/", umc.Url);
+ AssertEquals ("ToString", "Url - mono://www.go-mono.com/", umc.ToString ());
+ }
+
+ [Test]
+ public void Url_RelativePath ()
+ {
+ UrlMembershipCondition umc = new UrlMembershipCondition ("http://www.go-mono.com/path/../newpath/index.html");
+ AssertEquals ("Url", "http://www.go-mono.com/path/../newpath/index.html", umc.Url);
+ AssertEquals ("ToString", "Url - http://www.go-mono.com/path/../newpath/index.html", umc.ToString ());
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentNullException))]
+ public void Url_Null ()
+ {
+ UrlMembershipCondition umc = new UrlMembershipCondition ("ftp://www.go-mono.com");
+ umc.Url = null;
+ }
+
+ [Test]
+ [ExpectedException (typeof (FormatException))]
+ public void Url_Empty ()
+ {
+ UrlMembershipCondition umc = new UrlMembershipCondition ("ftp://www.go-mono.com");
+ umc.Url = String.Empty;
+ }
+
+ [Test]
+ public void CheckNull ()
+ {
+ UrlMembershipCondition umc = new UrlMembershipCondition ("http://www.go-mono.com");
+ Assert ("Check(null)", !umc.Check (null));
+ }
+
+ [Test]
+ public void CheckPositive ()
+ {
+ UrlMembershipCondition umc = new UrlMembershipCondition ("http://www.go-mono.com");
+ Evidence e = new Evidence ();
+ e.AddHost (new Url ("http://www.go-mono.com"));
+ Assert ("Check(+)", umc.Check (e));
+ }
+
+ [Test]
+ public void CheckPositive_Partial ()
+ {
+ UrlMembershipCondition umc = new UrlMembershipCondition ("http://www.go-mono.com/*");
+ Evidence e = new Evidence ();
+ e.AddHost (new Url ("http://www.go-mono.com/index.html"));
+ Assert ("Check(+-)", umc.Check (e));
+ }
+
+ [Test]
+ public void CheckNegative ()
+ {
+ UrlMembershipCondition umc = new UrlMembershipCondition ("http://www.go-mono.com");
+ Evidence e = new Evidence ();
+ e.AddHost (new Url ("http://www.go-mono.org"));
+ Assert ("Check(-)", !umc.Check (e));
+ }
+
+ [Test]
+ public void CheckNegative_NoUrlEvidence ()
+ {
+ UrlMembershipCondition umc = new UrlMembershipCondition ("http://www.go-mono.com");
+ Evidence e = new Evidence ();
+ e.AddHost (new Zone (SecurityZone.MyComputer));
+ Assert ("Check(?)", !umc.Check (e));
+ }
+
+ [Test]
+ public void CheckMultipleEvidences ()
+ {
+ UrlMembershipCondition umc = new UrlMembershipCondition ("http://www.go-mono.com");
+ Evidence e = new Evidence ();
+ e.AddHost (new Url ("http://www.go-mono.org")); // the bad
+ e.AddHost (new Url ("http://www.go-mono.com")); // the good
+ e.AddHost (new Zone (SecurityZone.MyComputer)); // and the ugly (couldn't resist ;)
+ Assert ("Check(n)", umc.Check (e));
+ // check all Url evidence (i.e. do not stop at the first Url evidence)
+ }
+
+ [Test]
+ public void EqualsCaseSensitive_Http ()
+ {
+ UrlMembershipCondition umc1 = new UrlMembershipCondition ("http://www.go-mono.com");
+ UrlMembershipCondition umc2 = new UrlMembershipCondition ("http://www.Go-Mono.com");
+ Assert ("CaseSensitive", umc1.Equals (umc2));
+ }
+
+ [Test]
+ public void EqualsCaseSensitive_File ()
+ {
+ UrlMembershipCondition umc1 = new UrlMembershipCondition ("file://MONO");
+ UrlMembershipCondition umc2 = new UrlMembershipCondition ("file://mono");
+ Assert ("CaseSensitive", umc1.Equals (umc2));
+ }
+
+ [Test]
+ public void EqualsNull ()
+ {
+ UrlMembershipCondition umc = new UrlMembershipCondition ("http://www.go-mono.com");
+ Assert ("EqualsNull", !umc.Equals (null));
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentNullException))]
+ public void FromXmlNull ()
+ {
+ UrlMembershipCondition umc = new UrlMembershipCondition ("http://www.go-mono.com");
+ umc.FromXml (null);
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentException))]
+ public void FromXmlInvalid ()
+ {
+ UrlMembershipCondition umc = new UrlMembershipCondition ("http://www.go-mono.com");
+ SecurityElement se = umc.ToXml ();
+ se.Tag = "IMonoship";
+ umc.FromXml (se);
+ }
+
+ [Test]
+ public void FromXmlPolicyLevel ()
+ {
+ UrlMembershipCondition umc = new UrlMembershipCondition ("http://www.go-mono.com");
+ SecurityElement se = umc.ToXml ();
+ // is it accepted for all policy levels ?
+ IEnumerator e = SecurityManager.PolicyHierarchy ();
+ while (e.MoveNext ()) {
+ PolicyLevel pl = e.Current as PolicyLevel;
+ UrlMembershipCondition spl = new UrlMembershipCondition ("*");
+ spl.FromXml (se, pl);
+ Assert ("FromXml(PolicyLevel='" + pl.Label + "')", spl.Equals (umc));
+ }
+ // yes!
+ }
+
+ [Test]
+ public void ToXmlNull ()
+ {
+ UrlMembershipCondition umc = new UrlMembershipCondition ("http://www.go-mono.com");
+ // no ArgumentNullException here
+ SecurityElement se = umc.ToXml (null);
+ AssertNotNull ("ToXml(null)", se);
+ }
+
+ [Test]
+ public void ToXmlPolicyLevel ()
+ {
+ UrlMembershipCondition umc = new UrlMembershipCondition ("http://www.go-mono.com");
+ SecurityElement se = umc.ToXml ();
+ string s = umc.ToXml ().ToString ();
+ // is it accepted for all policy levels ?
+ IEnumerator e = SecurityManager.PolicyHierarchy ();
+ while (e.MoveNext ()) {
+ PolicyLevel pl = e.Current as PolicyLevel;
+ UrlMembershipCondition spl = new UrlMembershipCondition ("*");
+ spl.FromXml (se, pl);
+ AssertEquals ("ToXml(PolicyLevel='" + pl.Label + "')", s, spl.ToXml (pl).ToString ());
+ }
+ // yes!
+ }
+
+ [Test]
+ public void ToFromXmlRoundTrip ()
+ {
+ UrlMembershipCondition umc1 = new UrlMembershipCondition ("http://www.go-mono.com");
+ SecurityElement se = umc1.ToXml ();
+
+ UrlMembershipCondition umc2 = new UrlMembershipCondition ("*");
+ umc2.FromXml (se);
+
+ AssertEquals ("ToFromXmlRoundTrip", umc1.GetHashCode (), umc2.GetHashCode ());
+ }
+ }
+}
diff --git a/mcs/class/corlib/Test/System.Security.Policy/UrlTest.cs b/mcs/class/corlib/Test/System.Security.Policy/UrlTest.cs
new file mode 100755
index 00000000000..198bd209aed
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Security.Policy/UrlTest.cs
@@ -0,0 +1,141 @@
+//
+// UrlTest.cs - NUnit Test Cases for Url
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2004 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using NUnit.Framework;
+using System;
+using System.Security;
+using System.Security.Permissions;
+using System.Security.Policy;
+
+namespace MonoTests.System.Security.Policy {
+
+ [TestFixture]
+ public class UrlTest : Assertion {
+
+ [Test]
+ [ExpectedException (typeof (ArgumentNullException))]
+ public void Url_Null ()
+ {
+ Url u = new Url (null);
+ }
+
+ [Test]
+ [ExpectedException (typeof (FormatException))]
+ public void Url_Empty ()
+ {
+ Url u = new Url (String.Empty);
+ }
+
+ [Test]
+ public void Url_NoProtocol ()
+ {
+ Url u = new Url ("index.html");
+ AssertEquals ("Value", "file://INDEX.HTML", u.Value);
+ }
+
+ [Test]
+ public void Url_WellKnownProtocol ()
+ {
+ Url u = new Url ("file://mono/index.html");
+ AssertEquals ("file.Value", "file://MONO/INDEX.HTML", u.Value);
+
+ u = new Url ("ftp://www.go-mono.com");
+ AssertEquals ("ftp.Value", "ftp://www.go-mono.com/", u.Value);
+
+ u = new Url ("http://www.go-mono.com");
+ AssertEquals ("http.Value", "http://www.go-mono.com/", u.Value);
+
+ u = new Url ("https://www.go-mono.com");
+ AssertEquals ("https.Value", "https://www.go-mono.com/", u.Value);
+ }
+
+ [Test]
+ public void Url_UnknownProtocol ()
+ {
+ Url u = new Url ("mono://www.go-mono.com");
+ AssertEquals ("mono.Value", "mono://www.go-mono.com/", u.Value);
+ }
+
+ [Test]
+ public void Url_RelativePath ()
+ {
+ Url u = new Url ("http://www.go-mono.com/path/../newpath/index.html");
+ AssertEquals ("Value", "http://www.go-mono.com/path/../newpath/index.html", u.Value);
+ }
+
+ [Test]
+ public void Url_GoMonoWebUrl ()
+ {
+ Url u = new Url ("http://www.go-mono.com");
+ AssertEquals ("Value", "http://www.go-mono.com/", u.Value);
+ AssertEquals ("ToString", "<System.Security.Policy.Url version=\"1\">" + Environment.NewLine + " <Url>http://www.go-mono.com/</Url>" + Environment.NewLine + "</System.Security.Policy.Url>" + Environment.NewLine, u.ToString ());
+
+ Url u2 = (Url) u.Copy ();
+ AssertEquals ("Copy.Value", u.Value, u2.Value);
+ AssertEquals ("Copy.GetHashCode", u.GetHashCode (), u2.GetHashCode ());
+
+ UrlIdentityPermission uip = (UrlIdentityPermission) u.CreateIdentityPermission (null);
+ AssertEquals ("CreateIdentityPermission", u.Value, uip.Url);
+
+ Assert ("Equals", u.Equals (u2));
+ Url u3 = new Url ("go-mono.com");
+ Assert ("!Equals", !u.Equals (u3));
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentException))]
+ public void Url_InvalidSite ()
+ {
+ Url u = new Url ("http://www.go-mono.*");
+ }
+
+ [Test]
+ public void EqualsCaseSensitive ()
+ {
+ Url u1 = new Url ("http://www.go-mono.com");
+ Url u2 = new Url ("http://www.Go-Mono.com");
+ Assert ("CaseSensitive", u1.Equals (u2));
+ }
+
+ [Test]
+ public void EqualsPartial ()
+ {
+ Url u1 = new Url ("http://www.go-mono.com/index.html");
+ Url u2 = new Url ("http://www.go-mono.com/*");
+ Assert ("Partial:1-2", !u1.Equals (u2));
+ Assert ("Partial:2-1", !u2.Equals (u1));
+ }
+
+ [Test]
+ public void EqualsNull ()
+ {
+ Url u = new Url ("http://www.go-mono.com");
+ Assert ("EqualsNull", !u.Equals (null));
+ }
+
+ [Test]
+ public void Url_LoneStar ()
+ {
+ Url u = new Url ("*");
+ AssertEquals ("Value", "file://*", u.Value);
+ AssertEquals ("ToString", "<System.Security.Policy.Url version=\"1\">" + Environment.NewLine + " <Url>file://*</Url>" + Environment.NewLine + "</System.Security.Policy.Url>" + Environment.NewLine, u.ToString ());
+
+ Url u2 = (Url) u.Copy ();
+ AssertEquals ("Copy.Value", u.Value, u2.Value);
+ AssertEquals ("Copy.GetHashCode", u.GetHashCode (), u2.GetHashCode ());
+
+ UrlIdentityPermission uip = (UrlIdentityPermission) u.CreateIdentityPermission (null);
+ AssertEquals ("CreateIdentityPermission", u.Value, uip.Url);
+
+ Assert ("Equals", u.Equals (u2));
+ Url u3 = new Url ("index.html");
+ Assert ("!Equals(*)", !u.Equals (u3));
+ }
+ }
+}
diff --git a/mcs/class/corlib/Test/System.Security/ChangeLog b/mcs/class/corlib/Test/System.Security/ChangeLog
index b64c7b78251..aa6f2ff4a14 100644
--- a/mcs/class/corlib/Test/System.Security/ChangeLog
+++ b/mcs/class/corlib/Test/System.Security/ChangeLog
@@ -1,3 +1,40 @@
+2004-01-27 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * SecurityElementTest.cs: Added new tests for duplicate attributes
+ and multiple attribute order and ToString representation.
+
+2004-01-24 David Sheldon <dave-mono@earth.li>
+
+ * CodeAccessPermissionTest.cs (To_String): Compared
+ Environment.NewLine rather than "\r\n"
+
+2004-01-11 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * CodeAccessPermissionTest.cs: Fixed CustomCAS test under Windows.
+
+2004-01-06 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * CodeAccessPermissionTest.cs: Added a new test for calling Demand on
+ custom code access permission.
+ Ref: http://bugzilla.ximian.com/show_bug.cgi?id=52626
+ * SecurityExceptionTest.cs: New. Unit tests for SecurityException.
+
+2004-01-05 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * CodeAccessPermissionTest.cs: New. Unit tests on a non-abstract
+ CodeAccessPermission class.
+ * SecurityManagerTest.cs: Removed .Policy from namespace.
+
+2004-01-03 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * SecurityManagerTest.cs: New. Added VERY minimal unit tests that I
+ used to validate some behaviors.
+
+2004-01-02 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * SecurityElementTest.cs: Added new tests, constructors and null
+ related, and converted to NUnit2.
+
2003-06-28 Sebastien Pouliot <spouliot@videotron.ca>
* PermissionSetTest.cs: New. Partial unit tests for PermissionSet.
diff --git a/mcs/class/corlib/Test/System.Security/CodeAccessPermissionTest.cs b/mcs/class/corlib/Test/System.Security/CodeAccessPermissionTest.cs
new file mode 100755
index 00000000000..124130d964e
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Security/CodeAccessPermissionTest.cs
@@ -0,0 +1,90 @@
+//
+// CodeAccessPermissionTest.cs - NUnit Test Cases for CodeAccessPermission
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2004 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using NUnit.Framework;
+using System;
+using System.Security;
+using System.Security.Permissions;
+using System.Text;
+
+namespace MonoTests.System.Security {
+
+ // Almost minimal CAS class for unit tests
+ [Serializable]
+ public class NonAbstractCodeAccessPermission : CodeAccessPermission {
+
+ private string _tag;
+ private string _text;
+
+ public NonAbstractCodeAccessPermission (string tag, string text)
+ {
+ _tag = tag;
+ _text = text;
+ }
+
+ public override IPermission Copy ()
+ {
+ return new NonAbstractCodeAccessPermission (_tag, _text);
+ }
+
+ public override void FromXml (SecurityElement elem) {}
+
+ public override IPermission Intersect (IPermission target)
+ {
+ return null;
+ }
+
+ public override bool IsSubsetOf (IPermission target)
+ {
+ return true;
+ }
+
+ public override SecurityElement ToXml ()
+ {
+ if (_tag == null)
+ return null;
+ return new SecurityElement (_tag, _text);
+ }
+ }
+
+ [TestFixture]
+ public class CodeAccessPermissionTest : Assertion {
+
+ [Test]
+ public void CustomCAS ()
+ {
+ // test for http://bugzilla.ximian.com/show_bug.cgi?id=52626
+ NonAbstractCodeAccessPermission p = new NonAbstractCodeAccessPermission ("custom", null);
+ p.Demand ();
+ }
+
+ [Test]
+ public void Union ()
+ {
+ NonAbstractCodeAccessPermission cap = new NonAbstractCodeAccessPermission (null, null);
+ IPermission p = cap.Union (null);
+ }
+
+ [Test]
+ [ExpectedException (typeof (NullReferenceException))]
+ public void To_String_Exception ()
+ {
+ NonAbstractCodeAccessPermission cap = new NonAbstractCodeAccessPermission (null, null);
+ string s = cap.ToString ();
+ }
+
+ [Test]
+ public void To_String ()
+ {
+ NonAbstractCodeAccessPermission cap = new NonAbstractCodeAccessPermission ("CodeAccessPermission", "NonAbstract");
+ string s = cap.ToString ();
+ AssertEquals ("ToString", "<CodeAccessPermission>NonAbstract</CodeAccessPermission>" + Environment.NewLine, s);
+ }
+ }
+}
diff --git a/mcs/class/corlib/Test/System.Security/SecurityElementTest.cs b/mcs/class/corlib/Test/System.Security/SecurityElementTest.cs
index fb71028b2aa..a1a8521399b 100644
--- a/mcs/class/corlib/Test/System.Security/SecurityElementTest.cs
+++ b/mcs/class/corlib/Test/System.Security/SecurityElementTest.cs
@@ -1,216 +1,329 @@
-//
-// SecurityElementTest.cs - NUnit Test Cases for System.Security.SecurityElement
-//
-// Author:
-// Lawrence Pit (loz@cable.a2000.nl)
-//
-
-using NUnit.Framework;
-using System;
-using System.Collections;
-using System.Security;
-
-namespace MonoTests.System.Security
-{
-
-public class SecurityElementTest : TestCase
-{
- SecurityElement elem;
-
- protected override void SetUp ()
- {
- elem = CreateElement ();
- }
-
- protected override void TearDown () {}
-
- private SecurityElement CreateElement ()
- {
- SecurityElement elem = new SecurityElement ("IPermission");
- elem.AddAttribute ("class", "System");
- elem.AddAttribute ("version", "1");
-
- SecurityElement child = new SecurityElement ("ConnectAccess");
- elem.AddChild (child);
-
- SecurityElement grandchild = new SecurityElement ("ENDPOINT", "some text");
- grandchild.AddAttribute ("transport", "All");
- grandchild.AddAttribute ("host", "localhost");
- grandchild.AddAttribute ("port", "8080");
- child.AddChild (grandchild);
-
- SecurityElement grandchild2 = new SecurityElement ("ENDPOINT");
- grandchild2.AddAttribute ("transport", "Tcp");
- grandchild2.AddAttribute ("host", "www.ximian.com");
- grandchild2.AddAttribute ("port", "All");
- child.AddChild (grandchild2);
-
- return elem;
- }
-
- public void TestConstructors ()
- {
-
- }
-
- public void TestAddAttribute ()
- {
- try {
- elem.AddAttribute (null, "valid");
- Fail ("#1");
- } catch (ArgumentNullException) { }
- try {
- elem.AddAttribute ("valid", null);
- Fail ("#2");
- } catch (ArgumentNullException) { }
- try {
- elem.AddAttribute ("<invalid>", "valid");
- Fail ("#3");
- } catch (ArgumentException) { }
- try {
- elem.AddAttribute ("valid", "invalid\"");
- Fail ("#4");
- } catch (ArgumentException) { }
- try {
- elem.AddAttribute ("valid", "valid\'");
- } catch (ArgumentException) { Fail ("#5"); }
- try {
- elem.AddAttribute ("valid", "valid&");
- Fail ("#6");
- // in xml world this is actually not considered valid
- // but it is by MS.Net
- } catch (ArgumentException) { }
- try {
- elem.AddAttribute ("valid", "<invalid>");
- Fail ("#7");
- } catch (ArgumentException) { }
- }
-
- public void TestAttributes ()
- {
- Hashtable h = elem.Attributes;
-
- /*
- // this will result in an InvalidCastException on MS.Net
- // I have no clue why
-
- h.Add ("<invalid>", "valid");
- try {
- elem.Attributes = h;
- Fail ("#1");
- } catch (ArgumentException) { }
- */
-
- h = elem.Attributes;
- h.Add ("valid", "\"invalid\"");
- try {
- elem.Attributes = h;
- Fail ("#2");
- } catch (ArgumentException) { }
-
- h = elem.Attributes;
- h.Add ("foo", "bar");
- Assert ("#3", elem.Attributes.Count != h.Count);
-
- elem.Attributes = h;
- Assert ("#4", elem.Attribute ("foo") != null);
- }
-
- public void TestEqual ()
- {
- int iTest = 0;
- try {
- SecurityElement elem2 = CreateElement ();
- iTest++;
- Assert ("#1", elem.Equal (elem2));
- iTest++;
- SecurityElement child = (SecurityElement) elem2.Children [0];
- iTest++;
- child = (SecurityElement) child.Children [1];
- iTest++;
- child.Text = "some text";
- iTest++;
- Assert ("#2", !elem.Equal (elem2));
- } catch (Exception e) {
- Fail ("Unexpected Exception at iTest = " + iTest + ". e = " + e);
- }
- }
-
- public void TestEscape ()
- {
- AssertEquals ("#1", SecurityElement.Escape ("foo<>\"'& bar"), "foo&lt;&gt;&quot;&apos;&amp; bar");
- }
-
- public void TestIsValidAttributeName ()
- {
- Assert ("#1", !SecurityElement.IsValidAttributeName ("x x"));
- Assert ("#2", !SecurityElement.IsValidAttributeName ("x<x"));
- Assert ("#3", !SecurityElement.IsValidAttributeName ("x>x"));
- Assert ("#4", SecurityElement.IsValidAttributeName ("x\"x"));
- Assert ("#5", SecurityElement.IsValidAttributeName ("x'x"));
- Assert ("#6", SecurityElement.IsValidAttributeName ("x&x"));
- }
-
- public void TestIsValidAttributeValue ()
- {
- Assert ("#1", SecurityElement.IsValidAttributeValue ("x x"));
- Assert ("#2", !SecurityElement.IsValidAttributeValue ("x<x"));
- Assert ("#3", !SecurityElement.IsValidAttributeValue ("x>x"));
- Assert ("#4", !SecurityElement.IsValidAttributeValue ("x\"x"));
- Assert ("#5", SecurityElement.IsValidAttributeValue ("x'x"));
- Assert ("#6", SecurityElement.IsValidAttributeValue ("x&x"));
- }
-
- public void TestIsValidTag ()
- {
- Assert ("#1", !SecurityElement.IsValidTag ("x x"));
- Assert ("#2", !SecurityElement.IsValidTag ("x<x"));
- Assert ("#3", !SecurityElement.IsValidTag ("x>x"));
- Assert ("#4", SecurityElement.IsValidTag ("x\"x"));
- Assert ("#5", SecurityElement.IsValidTag ("x'x"));
- Assert ("#6", SecurityElement.IsValidTag ("x&x"));
- }
-
- public void TestIsValidText ()
- {
- Assert ("#1", SecurityElement.IsValidText ("x x"));
- Assert ("#2", !SecurityElement.IsValidText ("x<x"));
- Assert ("#3", !SecurityElement.IsValidText ("x>x"));
- Assert ("#4", SecurityElement.IsValidText ("x\"x"));
- Assert ("#5", SecurityElement.IsValidText ("x'x"));
- Assert ("#6", SecurityElement.IsValidText ("x&x"));
- }
-
- public void TestSearchForChildByTag ()
- {
- SecurityElement child = null;
- try {
- child = elem.SearchForChildByTag (null);
- Fail ("#1 should have thrown an ArgumentNullException");
- } catch (ArgumentNullException) { }
-
- child = elem.SearchForChildByTag ("doesnotexist");
- AssertEquals ("#2", child, null);
-
- child = elem.SearchForChildByTag ("ENDPOINT");
- AssertEquals ("#3", child, null);
-
- child = (SecurityElement) elem.Children [0];
- child = child.SearchForChildByTag ("ENDPOINT");
- AssertEquals ("#4", child.Attribute ("transport"), "All");
- }
-
- public void TestSearchForTextOfTag ()
- {
- try {
- string t1 = elem.SearchForTextOfTag (null);
- Fail ("#1 should have thrown an ArgumentNullException");
- } catch (ArgumentNullException) { }
-
- string t2 = elem.SearchForTextOfTag ("ENDPOINT");
- AssertEquals ("#2", t2, "some text");
- }
-}
-
-}
-
+//
+// SecurityElementTest.cs - NUnit Test Cases for System.Security.SecurityElement
+//
+// Authors:
+// Lawrence Pit (loz@cable.a2000.nl)
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// Portions (C) 2004 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using NUnit.Framework;
+using System;
+using System.Collections;
+using System.Security;
+
+namespace MonoTests.System.Security {
+
+ [TestFixture]
+ public class SecurityElementTest : Assertion {
+
+ SecurityElement elem;
+
+ [SetUp]
+ void SetUp ()
+ {
+ elem = CreateElement ();
+ }
+
+ private SecurityElement CreateElement ()
+ {
+ SecurityElement elem = new SecurityElement ("IPermission");
+ elem.AddAttribute ("class", "System");
+ elem.AddAttribute ("version", "1");
+
+ SecurityElement child = new SecurityElement ("ConnectAccess");
+ elem.AddChild (child);
+
+ SecurityElement grandchild = new SecurityElement ("ENDPOINT", "some text");
+ grandchild.AddAttribute ("transport", "All");
+ grandchild.AddAttribute ("host", "localhost");
+ grandchild.AddAttribute ("port", "8080");
+ child.AddChild (grandchild);
+
+ SecurityElement grandchild2 = new SecurityElement ("ENDPOINT");
+ grandchild2.AddAttribute ("transport", "Tcp");
+ grandchild2.AddAttribute ("host", "www.ximian.com");
+ grandchild2.AddAttribute ("port", "All");
+ child.AddChild (grandchild2);
+
+ return elem;
+ }
+
+ [Test]
+ public void ConstructorsTagTest ()
+ {
+ SecurityElement se = new SecurityElement ("tag", "text");
+ AssertNull ("EmptyAttributes", se.Attributes);
+ AssertNull ("EmptyChildren", se.Children);
+ AssertEquals ("Tag", "tag", se.Tag);
+ AssertEquals ("Text", "text", se.Text);
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentNullException))]
+ public void ConstructorsTagNullText ()
+ {
+ SecurityElement se = new SecurityElement (null, "text");
+ }
+
+ [Test]
+ public void ConstructorsTagTextNull ()
+ {
+ SecurityElement se = new SecurityElement ("tag", null);
+ AssertNull ("EmptyAttributes", se.Attributes);
+ AssertNull ("EmptyChildren", se.Children);
+ AssertEquals ("Tag", "tag", se.Tag);
+ AssertNull ("Text", se.Text);
+ }
+
+ [Test]
+ public void ConstructorsTag ()
+ {
+ SecurityElement se = new SecurityElement ("tag");
+ AssertNull ("EmptyAttributes", se.Attributes);
+ AssertNull ("EmptyChildren", se.Children);
+ AssertEquals ("Tag", "tag", se.Tag);
+ AssertNull ("Text", se.Text);
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentNullException))]
+ public void ConstructorsTagNull ()
+ {
+ SecurityElement se = new SecurityElement (null);
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentNullException))]
+ public void AddAttribute_NameNullValue ()
+ {
+ elem.AddAttribute (null, "valid");
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentNullException))]
+ public void AddAttribute_NameValueNull ()
+ {
+ elem.AddAttribute ("valid", null);
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentException))]
+ public void AddAttribute_InvalidName ()
+ {
+ elem.AddAttribute ("<invalid>", "valid");
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentException))]
+ public void AddAttribute_InvalidValue ()
+ {
+ elem.AddAttribute ("valid", "invalid\"");
+ }
+
+ [Test]
+ public void AddAttribute_InvalidValue2 ()
+ {
+ elem.AddAttribute ("valid", "valid&");
+ // in xml world this is actually not considered valid
+ // but it is by MS.Net
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentException))]
+ public void AddAttribute_InvalidValue3 ()
+ {
+ elem.AddAttribute ("valid", "<invalid>");
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentException))]
+ public void AddAttribute_Duplicate ()
+ {
+ elem.AddAttribute ("valid", "first time");
+ elem.AddAttribute ("valid", "second time");
+ }
+
+ [Test]
+ public void AddAttribute ()
+ {
+ elem.AddAttribute ("valid", "valid\'");
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentNullException))]
+ public void AddChild_Null ()
+ {
+ elem.AddChild (null);
+ }
+
+ [Test]
+ public void AddChild ()
+ {
+ int n = elem.Children.Count;
+ // add itself
+ elem.AddChild (elem);
+ AssertEquals ("Count", (n+1), elem.Children.Count);
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentException))]
+ [Ignore ("this will result in an InvalidCastException on MS.Net - I have no clue why")]
+ public void Attributes_StrangeCase ()
+ {
+ Hashtable h = elem.Attributes;
+ h.Add ("<invalid>", "valid");
+ elem.Attributes = h;
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentException))]
+ public void Attributes_ArgumentException ()
+ {
+ Hashtable h = elem.Attributes;
+ h.Add ("valid", "\"invalid\"");
+ elem.Attributes = h;
+ }
+
+ [Test]
+ public void Attributes ()
+ {
+ Hashtable h = elem.Attributes;
+
+ h = elem.Attributes;
+ h.Add ("foo", "bar");
+ Assert ("#1", elem.Attributes.Count != h.Count);
+
+ elem.Attributes = h;
+ AssertNotNull ("#2", elem.Attribute ("foo"));
+ }
+
+ [Test]
+ public void Equal ()
+ {
+ int iTest = 0;
+ SecurityElement elem2 = CreateElement ();
+ iTest++;
+ Assert ("#1", elem.Equal (elem2));
+ iTest++;
+ SecurityElement child = (SecurityElement) elem2.Children [0];
+ iTest++;
+ child = (SecurityElement) child.Children [1];
+ iTest++;
+ child.Text = "some text";
+ iTest++;
+ Assert ("#2", !elem.Equal (elem2));
+ }
+
+ [Test]
+ public void Escape ()
+ {
+ AssertEquals ("#1", "foo&lt;&gt;&quot;&apos;&amp; bar", SecurityElement.Escape ("foo<>\"'& bar"));
+ }
+
+ [Test]
+ public void IsValidAttributeName ()
+ {
+ Assert ("#1", !SecurityElement.IsValidAttributeName ("x x"));
+ Assert ("#2", !SecurityElement.IsValidAttributeName ("x<x"));
+ Assert ("#3", !SecurityElement.IsValidAttributeName ("x>x"));
+ Assert ("#4", SecurityElement.IsValidAttributeName ("x\"x"));
+ Assert ("#5", SecurityElement.IsValidAttributeName ("x'x"));
+ Assert ("#6", SecurityElement.IsValidAttributeName ("x&x"));
+ }
+
+ [Test]
+ public void IsValidAttributeValue ()
+ {
+ Assert ("#1", SecurityElement.IsValidAttributeValue ("x x"));
+ Assert ("#2", !SecurityElement.IsValidAttributeValue ("x<x"));
+ Assert ("#3", !SecurityElement.IsValidAttributeValue ("x>x"));
+ Assert ("#4", !SecurityElement.IsValidAttributeValue ("x\"x"));
+ Assert ("#5", SecurityElement.IsValidAttributeValue ("x'x"));
+ Assert ("#6", SecurityElement.IsValidAttributeValue ("x&x"));
+ }
+
+ [Test]
+ public void IsValidTag ()
+ {
+ Assert ("#1", !SecurityElement.IsValidTag ("x x"));
+ Assert ("#2", !SecurityElement.IsValidTag ("x<x"));
+ Assert ("#3", !SecurityElement.IsValidTag ("x>x"));
+ Assert ("#4", SecurityElement.IsValidTag ("x\"x"));
+ Assert ("#5", SecurityElement.IsValidTag ("x'x"));
+ Assert ("#6", SecurityElement.IsValidTag ("x&x"));
+ }
+
+ [Test]
+ public void IsValidText ()
+ {
+ Assert ("#1", SecurityElement.IsValidText ("x x"));
+ Assert ("#2", !SecurityElement.IsValidText ("x<x"));
+ Assert ("#3", !SecurityElement.IsValidText ("x>x"));
+ Assert ("#4", SecurityElement.IsValidText ("x\"x"));
+ Assert ("#5", SecurityElement.IsValidText ("x'x"));
+ Assert ("#6", SecurityElement.IsValidText ("x&x"));
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentNullException))]
+ public void SearchForChildByTag_Null ()
+ {
+ SecurityElement child = elem.SearchForChildByTag (null);
+ }
+
+ [Test]
+ public void SearchForChildByTag ()
+ {
+ SecurityElement child = elem.SearchForChildByTag ("doesnotexist");
+ AssertNull ("#1", child);
+
+ child = elem.SearchForChildByTag ("ENDPOINT");
+ AssertNull ("#2", child);
+
+ child = (SecurityElement) elem.Children [0];
+ child = child.SearchForChildByTag ("ENDPOINT");
+ AssertEquals ("#3", "All", child.Attribute ("transport"));
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentNullException))]
+ public void SearchForTextOfTag_Null ()
+ {
+ string s = elem.SearchForTextOfTag (null);
+ }
+
+ [Test]
+ public void SearchForTextOfTag ()
+ {
+ string s = elem.SearchForTextOfTag ("ENDPOINT");
+ AssertEquals ("SearchForTextOfTag", "some text", s);
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentNullException))]
+ public void Tag_Null ()
+ {
+ elem.Tag = null;
+ AssertNull ("Tag", elem.Tag);
+ }
+
+ [Test]
+ public void Text_Null ()
+ {
+ elem.Text = null;
+ AssertNull ("Text", elem.Text);
+ }
+
+ [Test]
+ public void MultipleAttributes ()
+ {
+ SecurityElement se = new SecurityElement ("Multiple");
+ se.AddAttribute ("Attribute1", "One");
+ se.AddAttribute ("Attribute2", "Two");
+ string expected = String.Format ("<Multiple Attribute1=\"One\"{0} Attribute2=\"Two\"/>{0}", Environment.NewLine);
+ AssertEquals ("ToString()", expected, se.ToString ());
+ }
+ }
+}
diff --git a/mcs/class/corlib/Test/System.Security/SecurityExceptionTest.cs b/mcs/class/corlib/Test/System.Security/SecurityExceptionTest.cs
new file mode 100755
index 00000000000..e29f85d2ef8
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Security/SecurityExceptionTest.cs
@@ -0,0 +1,90 @@
+//
+// SecurityExceptionTest.cs - NUnit Test Cases for SecurityException
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2004 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using NUnit.Framework;
+using System;
+using System.Security;
+using System.Security.Permissions;
+
+namespace MonoTests.System.Security {
+
+ [TestFixture]
+ public class SecurityExceptionTest : Assertion {
+
+ [Test]
+ public void Constructor_Empty ()
+ {
+ SecurityException se = new SecurityException ();
+#if ! NET_1_0
+ AssertNull ("GrantedSet", se.GrantedSet);
+ AssertNull ("RefusedSet", se.RefusedSet);
+#endif
+ AssertNull ("PermissionState", se.PermissionState);
+ AssertNull ("PermissionType", se.PermissionType);
+ Assert ("ToString()", se.ToString ().StartsWith ("System.Security.SecurityException: "));
+ }
+
+ [Test]
+ public void Constructor_Message ()
+ {
+ SecurityException se = new SecurityException ("message");
+#if ! NET_1_0
+ AssertNull ("GrantedSet", se.GrantedSet);
+ AssertNull ("RefusedSet", se.RefusedSet);
+#endif
+ AssertNull ("PermissionState", se.PermissionState);
+ AssertNull ("PermissionType", se.PermissionType);
+ AssertEquals ("ToString()", "System.Security.SecurityException: message", se.ToString ());
+ }
+
+ [Test]
+ public void Constructor_MessageInner ()
+ {
+ SecurityException se = new SecurityException ("message", new Exception ());
+#if ! NET_1_0
+ AssertNull ("GrantedSet", se.GrantedSet);
+ AssertNull ("RefusedSet", se.RefusedSet);
+#endif
+ AssertNull ("PermissionState", se.PermissionState);
+ AssertNull ("PermissionType", se.PermissionType);
+ Assert ("ToString().Starts", se.ToString ().StartsWith ("System.Security.SecurityException: message"));
+ Assert ("ToString().Include", (se.ToString ().IndexOf ("System.Exception") > 0));
+ }
+
+ [Test]
+ public void Constructor_MessageType ()
+ {
+ SecurityException se = new SecurityException ("message", typeof (EnvironmentPermission));
+#if ! NET_1_0
+ AssertNull ("GrantedSet", se.GrantedSet);
+ AssertNull ("RefusedSet", se.RefusedSet);
+#endif
+ AssertNull ("PermissionState", se.PermissionState);
+ AssertEquals ("PermissionType", typeof (EnvironmentPermission), se.PermissionType);
+
+ Assert ("ToString().Starts", se.ToString ().StartsWith ("System.Security.SecurityException: message"));
+ // note: can't check for PermissionType as it's not shown with MS class lib
+ }
+
+ [Test]
+ public void Constructor_MessageTypeState ()
+ {
+ SecurityException se = new SecurityException ("message", typeof (EnvironmentPermission), "mono");
+#if ! NET_1_0
+ AssertNull ("GrantedSet", se.GrantedSet);
+ AssertNull ("RefusedSet", se.RefusedSet);
+#endif
+ AssertEquals ("PermissionState", "mono", se.PermissionState);
+ AssertEquals ("PermissionType", typeof (EnvironmentPermission), se.PermissionType);
+
+ Assert ("ToString().Include(mono)", (se.ToString ().IndexOf ("mono") > 0));
+ // note: can't check for PermissionType as it's not shown with MS class lib
+ }
+ }
+}
diff --git a/mcs/class/corlib/Test/System.Security/SecurityManagerTest.cs b/mcs/class/corlib/Test/System.Security/SecurityManagerTest.cs
new file mode 100755
index 00000000000..d66ff181ad5
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Security/SecurityManagerTest.cs
@@ -0,0 +1,36 @@
+//
+// SecurityManagerTest.cs - NUnit Test Cases for SecurityManager
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2004 Motus Technologies Inc. (http://www.motus.com)
+//
+
+using NUnit.Framework;
+using System;
+using System.Collections;
+using System.Security;
+using System.Security.Permissions;
+using System.Security.Policy;
+
+namespace MonoTests.System.Security {
+
+ [TestFixture]
+ public class SecurityManagerTest : Assertion {
+
+ [Test]
+ public void IsGranted_Null ()
+ {
+ // null is always granted
+ Assert ("IsGranted_Null", SecurityManager.IsGranted (null));
+ }
+
+ [Test]
+ public void PolicyHierarchy ()
+ {
+ IEnumerator e = SecurityManager.PolicyHierarchy ();
+ AssertNotNull ("PolicyHierarchy", e);
+ }
+ }
+}
diff --git a/mcs/class/corlib/Test/System.Text/ChangeLog b/mcs/class/corlib/Test/System.Text/ChangeLog
index 86a1abeb14f..3b7bd150d5f 100644
--- a/mcs/class/corlib/Test/System.Text/ChangeLog
+++ b/mcs/class/corlib/Test/System.Text/ChangeLog
@@ -1,3 +1,12 @@
+2004-01-23 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * StringBuilderTest.cs: added test for bug #53240.
+
+2004-01-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * StringBuilderTest.cs: added tests for the couple of bugs found in the
+ new StringBuilder implementation.
+
2003-05-14 Nick Drochak <ndrochak@gol.com>
* UTF7EncodingTest.cs:
diff --git a/mcs/class/corlib/Test/System.Text/StringBuilderTest.cs b/mcs/class/corlib/Test/System.Text/StringBuilderTest.cs
index cfe91f0c641..14894f8b643 100644
--- a/mcs/class/corlib/Test/System.Text/StringBuilderTest.cs
+++ b/mcs/class/corlib/Test/System.Text/StringBuilderTest.cs
@@ -246,6 +246,34 @@ namespace MonoTests.System.Text {
sb.Replace (",", "comma-separated", 11, sb.Length-11);
AssertEquals ("#02", "This, is, acomma-separated list", sb.ToString ());
}
+
+ [Test]
+ public void Insert0 ()
+ {
+ StringBuilder sb = new StringBuilder();
+ sb.Append("testtesttest");
+ sb.Insert(0, '^');
+ AssertEquals ("#01", "^testtesttest", sb.ToString ());
+ }
+
+ [Test]
+ public void AppendToEmpty ()
+ {
+ StringBuilder sb = new StringBuilder();
+ char [] ca = new char [] { 'c' };
+ sb.Append (ca);
+ AssertEquals ("#01", "c", sb.ToString ());
+ }
+
+
+ [Test]
+ public void TestRemove ()
+ {
+ StringBuilder b = new StringBuilder ();
+ b.Append ("Hello, I am a StringBuilder");
+ b.Remove (0, 7); // Should remove "Hello, "
+ AssertEquals ("#01", "I am a StringBuilder", b.ToString ());
+ }
}
}
diff --git a/mcs/class/corlib/Test/System/AppDomainSetupTest.cs b/mcs/class/corlib/Test/System/AppDomainSetupTest.cs
index 26e64a3eb67..625871433f3 100755
--- a/mcs/class/corlib/Test/System/AppDomainSetupTest.cs
+++ b/mcs/class/corlib/Test/System/AppDomainSetupTest.cs
@@ -39,8 +39,8 @@ namespace MonoTests.System
public void ApplicationBase3 ()
{
AppDomainSetup setup = new AppDomainSetup ();
- setup.ApplicationBase = "lalala";
string expected = Path.Combine (Path.GetTempPath (), "lalala");
+ setup.ApplicationBase = "lalala";
AssertEquals ("AB3 #01", expected, setup.ApplicationBase);
}
diff --git a/mcs/class/corlib/Test/System/ChangeLog b/mcs/class/corlib/Test/System/ChangeLog
index 12d339a8d50..c6be9669426 100644
--- a/mcs/class/corlib/Test/System/ChangeLog
+++ b/mcs/class/corlib/Test/System/ChangeLog
@@ -1,3 +1,47 @@
+2004-01-31 Nick Drochak <ndrochak@ieee.org)
+
+ * ConvertTest: Cannot partially qualify the type name with csc.
+
+2004-01-31 David Sheldon <dave-mono@earth.li>
+
+ * ConvertTest.cs: Added test for malformed Base64. Bug 52928
+
+2004-01-30 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * DateTimeTest.cs: Modified X509Certificate test to use
+ ToUniversalTime ().
+
+2004-01-28 Sebastien Pouliot <spouliot@videotron.ca>
+
+ * DateTimeTest.cs: Added a new unit test (X509Certificate) to better
+ detect regressions in DateTime. See bugzilla entry #53461.
+
+2004-01-27 Nick Drochak <ndrochak@gol.com>
+
+ * AppDomainSetupTest.cs: When I run this on .NET the AppBase uses the
+ temp dir. Perhaps a different runner gives different results? I'm
+ using 'make run-test' from the mcs directory.
+
+2004-01-22 David Sheldon <dave-mono@earth.li>
+
+ * AppDomainSetupTest: Changed test 3 to test that the
+ appdomain is relative to the current dir, rather than
+ the temp dir. This is what the MS runtime appears to
+ give, and handily is what we do too.
+
+2004-01-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * DateTimeTest.cs: added test for bug 52075.
+
+2004-01-16 Zoltan Varga <vargaz@freemail.hu>
+
+ * TypeTest.cs: Add Tests for vectors<->one dim. arrays.
+
+2003-01-11 David Sheldon <dave-mono@earth.li>
+
+ * DateTimeTest.cs: Tests for bug 52274 fix, formats such as
+ '--MM--'
+
2003-12-27 Nick Drochak <ndrochak@gol.com>
* AppDomainSetupTest.cs: Seems that AppDomainSetup's use the temp
diff --git a/mcs/class/corlib/Test/System/ConvertTest.cs b/mcs/class/corlib/Test/System/ConvertTest.cs
index 15bf0c143c8..10fb2fcccf6 100755
--- a/mcs/class/corlib/Test/System/ConvertTest.cs
+++ b/mcs/class/corlib/Test/System/ConvertTest.cs
@@ -2613,6 +2613,14 @@ namespace MonoTests.System
}
}
+ [Test]
+ [ExpectedException (typeof (FormatException))]
+ public void TestInvalidBase64() {
+ string brokenB64 = "AB~";
+ Convert.FromBase64String(brokenB64);
+ }
+
+
public void TestToBase64CharArray() {
byte[] byteArr = {33, 127, 255, 109, 170, 54};
// 0 1 2 3 4 5 6 7
diff --git a/mcs/class/corlib/Test/System/DateTimeTest.cs b/mcs/class/corlib/Test/System/DateTimeTest.cs
index b90473db3d3..261ff7f4080 100755
--- a/mcs/class/corlib/Test/System/DateTimeTest.cs
+++ b/mcs/class/corlib/Test/System/DateTimeTest.cs
@@ -529,6 +529,16 @@ public class DateTimeTest : Assertion
t1 = DateTime.ParseExact ("Sun Nov 6 08:49:37 1994", formats, enUS,
DateTimeStyles.AllowWhiteSpaces);
AssertEquals ("M06", myTicks[6], t1.Ticks);
+
+ // Bug 52274
+ t1 = DateTime.ParseExact ("--12--", "--MM--" , null);
+ AssertEquals("Dash01", 12, t1.Month);
+ t1=DateTime.ParseExact ("--12-24", "--MM-dd" , null);
+ AssertEquals("Dash02", 24, t1.Day);
+ AssertEquals("Dash03", 12, t1.Month);
+ t1=DateTime.ParseExact ("---24", "---dd" , null);
+ AssertEquals("Dash04", 24, t1.Day);
+
}
[Ignore ("need to fix tests that run on different timezones")]
@@ -628,6 +638,21 @@ public class DateTimeTest : Assertion
DTAssertEquals ("I01", d, new DateTime(1913, 9, 8, 9, 56, 46, 0), Resolution.Second);
AssertEquals ("I02", d.ToOADate(), number);
}
+
+ [Test]
+ public void MaxValueYear () // bug52075
+ {
+ AssertEquals ("#01", "9999", DateTime.MaxValue.Year.ToString ());
+ }
+
+ [Test]
+ public void X509Certificate ()
+ {
+ // if this test fails then *ALL* or *MOST* X509Certificate tests will also fails
+ AssertEquals ("yyyyMMddHHmmssZ", "03/12/1996 18:38:47", DateTime.ParseExact ("19960312183847Z", "yyyyMMddHHmmssZ", null).ToUniversalTime ().ToString ());
+ // technically this is invalid (PKIX) because of the missing seconds but it exists so...
+ AssertEquals ("yyMMddHHmmZ", "02/23/1996 19:15:00", DateTime.ParseExact ("9602231915Z", "yyMMddHHmmZ", null).ToUniversalTime ().ToString ());
+ }
}
}
diff --git a/mcs/class/corlib/Test/System/TypeTest.cs b/mcs/class/corlib/Test/System/TypeTest.cs
index 56215b86c5e..6dd98772f4b 100644
--- a/mcs/class/corlib/Test/System/TypeTest.cs
+++ b/mcs/class/corlib/Test/System/TypeTest.cs
@@ -73,6 +73,13 @@ namespace MonoTests.System
AssertEquals (typeof (Object[][]).IsAssignableFrom (typeof (Duper[][])) , true);
AssertEquals (typeof (ICloneable[][]).IsAssignableFrom (typeof (Duper[][])) , true);
+ // Tests for vectors<->one dimensional arrays */
+ Array arr1 = Array.CreateInstance (typeof (int), new int[] {1}, new int[] {0});
+ Array arr2 = Array.CreateInstance (typeof (int), new int[] {1}, new int[] {10});
+
+ AssertEquals (typeof (int[]).IsAssignableFrom (arr1.GetType ()), true);
+ AssertEquals (typeof (int[]).IsAssignableFrom (arr2.GetType ()), false);
+
// Test that arrays of enums can be cast to their base types
AssertEquals (typeof (int[]).IsAssignableFrom (typeof (TypeCode[])) , true);
diff --git a/mcs/class/corlib/corlib.dll.sources b/mcs/class/corlib/corlib.dll.sources
index 48828f5602c..f037f299179 100755
--- a/mcs/class/corlib/corlib.dll.sources
+++ b/mcs/class/corlib/corlib.dll.sources
@@ -411,6 +411,7 @@ System.Resources/ResourceReader.cs
System.Resources/ResourceSet.cs
System.Resources/ResourceWriter.cs
System.Resources/SatelliteContractVersionAttribute.cs
+System.Resources/Win32Resources.cs
System.Runtime.CompilerServices/AccessedThroughPropertyAttribute.cs
System.Runtime.CompilerServices/CallConvCdecl.cs
System.Runtime.CompilerServices/CallConvFastcall.cs
@@ -923,14 +924,19 @@ System.Security.Permissions/UrlIdentityPermissionAttribute.cs
System.Security.Permissions/ZoneIdentityPermission.cs
System.Security.Permissions/ZoneIdentityPermissionAttribute.cs
System.Security.Policy/AllMembershipCondition.cs
+System.Security.Policy/ApplicationDirectory.cs
System.Security.Policy/ApplicationDirectoryMembershipCondition.cs
System.Security.Policy/CodeGroup.cs
System.Security.Policy/Evidence.cs
System.Security.Policy/FileCodeGroup.cs
+System.Security.Policy/FirstMatchCodeGroup.cs
+System.Security.Policy/Hash.cs
+System.Security.Policy/HashMembershipCondition.cs
System.Security.Policy/IBuiltInEvidence.cs
System.Security.Policy/IConstantMembershipCondition.cs
System.Security.Policy/IIdentityPermissionFactory.cs
System.Security.Policy/IMembershipCondition.cs
+System.Security.Policy/NetCodeGroup.cs
System.Security.Policy/PermissionRequestEvidence.cs
System.Security.Policy/PolicyException.cs
System.Security.Policy/PolicyLevel.cs
@@ -939,6 +945,7 @@ System.Security.Policy/PolicyStatementAttribute.cs
System.Security.Policy/Publisher.cs
System.Security.Policy/PublisherMembershipCondition.cs
System.Security.Policy/Site.cs
+System.Security.Policy/SiteMembershipCondition.cs
System.Security.Policy/StrongName.cs
System.Security.Policy/StrongNameMembershipCondition.cs
System.Security.Policy/UnionCodeGroup.cs
diff --git a/mcs/class/corlib/corlib_test.dll.sources b/mcs/class/corlib/corlib_test.dll.sources
index 10377dddd1b..8073665540d 100755
--- a/mcs/class/corlib/corlib_test.dll.sources
+++ b/mcs/class/corlib/corlib_test.dll.sources
@@ -83,6 +83,7 @@ System.Runtime.Serialization/FormatterServicesTests.cs
System.Runtime.Serialization/ObjectIDGeneratorTests.cs
System.Runtime.Serialization/SerializationTest.cs
System/SByteTest.cs
+System.Security/CodeAccessPermissionTest.cs
System.Security.Cryptography/AllTests2.cs
System.Security.Cryptography/AsymmetricAlgorithmTest.cs
System.Security.Cryptography/CryptoConfigTest.cs
@@ -157,16 +158,27 @@ System.Security.Permissions/UrlIdentityPermissionAttributeTest.cs
System.Security.Permissions/ZoneIdentityPermissionAttributeTest.cs
System.Security.Policy/CodeGroupTest.cs
System.Security.Policy/EvidenceTest.cs
+System.Security.Policy/FileCodeGroupTest.cs
+System.Security.Policy/FirstMatchCodeGroupTest.cs
+System.Security.Policy/NetCodeGroupTest.cs
System.Security.Policy/PermissionRequestEvidenceTest.cs
+System.Security.Policy/PolicyLevelTest.cs
System.Security.Policy/PublisherMembershipConditionTest.cs
System.Security.Policy/PublisherTest.cs
+System.Security.Policy/SiteMembershipConditionTest.cs
+System.Security.Policy/SiteTest.cs
System.Security.Policy/StrongNameTest.cs
+System.Security.Policy/UnionCodeGroupTest.cs
+System.Security.Policy/UrlMembershipConditionTest.cs
+System.Security.Policy/UrlTest.cs
System.Security.Policy/ZoneTest.cs
System.Security.Principal/GenericIdentityTest.cs
System.Security.Principal/GenericPrincipalTest.cs
System.Security.Principal/WindowsIdentityTest.cs
System.Security.Principal/WindowsPrincipalTest.cs
System.Security/SecurityElementTest.cs
+System.Security/SecurityExceptionTest.cs
+System.Security/SecurityManagerTest.cs
System/SingleFormatterTest.cs
System/StringTest.cs
System.Text/ASCIIEncodingTest.cs
diff --git a/mcs/docs/compiler b/mcs/docs/compiler
index 72d54e2ef4e..de1f66909cd 100755
--- a/mcs/docs/compiler
+++ b/mcs/docs/compiler
@@ -562,3 +562,17 @@
RootContext.WarningLevel in a few places to decide whether a
warning is worth reporting to the user or not.
+* Debugging the compiler
+
+ Sometimes it is convenient to find *how* a particular error
+ message is being reported from, to do that, you might want to use
+ the --fatal flag to mcs. The flag will instruct the compiler to
+ abort with a stack trace execution when the error is reported.
+
+ You can use this with -warnaserror to obtain the same effect
+ with warnings.
+
+* Editing the compiler sources
+
+ The compiler sources are intended to be edited with 134 columns of width
+ \ No newline at end of file
diff --git a/mcs/errors/ChangeLog b/mcs/errors/ChangeLog
index 1040ad68e90..7f25647f4e3 100644
--- a/mcs/errors/ChangeLog
+++ b/mcs/errors/ChangeLog
@@ -1,6 +1,71 @@
+2004-01-21 Marek Safar <marek.safar@seznam.cz>
+
+ * cs0102.cs,
+ cs0111-2.cs,
+ cs246-{2,3,4}.cs,
+ cs663.cs: New tests.
+
+2004-01-05 Marek Safar <marek.safar@seznam.cz>
+
+ * cs3001.cs,
+ cs3001-1.cs,
+ cs3001-2.cs,
+ cs3001-3.cs,
+ cs3001-4.cs,
+ cs3001-5.cs,
+ cs3001-6.cs,
+ cs3001-7.cs,
+ cs3002.cs,
+ cs3002-1.cs,
+ cs3002-10.cs,
+ cs3002-2.cs,
+ cs3002-3.cs,
+ cs3002-4.cs,
+ cs3002-5.cs,
+ cs3002-6.cs,
+ cs3002-7.cs,
+ cs3002-8.cs,
+ cs3002-9.cs,
+ cs3003.cs,
+ cs3003-1.cs,
+ cs3008.cs,
+ cs3008-1.cs,
+ cs3008-2.cs,
+ cs3008-3.cs,
+ cs3008-4.cs,
+ cs3008-5.cs,
+ cs3008-6.cs,
+ cs3010.cs,
+ cs3011.cs,
+ cs3011-1.cs,
+ cs3014.cs,
+ cs3014-1.cs,
+ cs3014-2.cs,
+ cs3014-3.cs,
+ cs3014-4.cs,
+ cs3014-5.cs,
+ cs3014-6.cs,
+ cs3014-7.cs,
+ cs3015.cs,
+ cs3015-1.cs,
+ cs3016.cs,
+ cs3016-1.cs,
+ cs3016-2.cs,
+ cs3016-3.cs: New tests for CLS-compliance.
+
+ * cs108-2.cs,
+ cs116-2.cs,
+ cs592-4.cs,
+ cs592-5.cs,
+ cs592-6.cs: New tests.
+
+2004-01-04 Ben Maurer <bmaurer@users.sourceforge.net>
+
+ * cs157-{2,3,4}: test cases we fail.
+
2003-11-01 Marek Safar <marek.safar@seznam.cz>
- * makefile: Added "// Compiler options:" handling
+ * makefile: Added "// Compiler options:" handling.
2003-09-22 Martin Baulig <martin@ximian.com>
diff --git a/mcs/errors/cs0102.cs b/mcs/errors/cs0102.cs
new file mode 100644
index 00000000000..d79c36302ad
--- /dev/null
+++ b/mcs/errors/cs0102.cs
@@ -0,0 +1,7 @@
+// cs0102.cs: The class 'SampleClass' already contains a definition for 'set_Item'
+// Line: 6
+
+public class SampleClass {
+ protected int set_Item;
+ public int this[int index] { set {} }
+} \ No newline at end of file
diff --git a/mcs/errors/cs0108-2.cs b/mcs/errors/cs0108-2.cs
new file mode 100644
index 00000000000..a8fb740b7a7
--- /dev/null
+++ b/mcs/errors/cs0108-2.cs
@@ -0,0 +1,10 @@
+// cs0108-2.cs: The new keyword is required on 'Derived.Test(bool)' because it hides 'BaseInterface.Test(bool)'
+// Line: 9
+
+interface BaseInterface {
+ void Test (bool arg);
+}
+
+interface Derived : BaseInterface {
+ void Test (bool arg);
+} \ No newline at end of file
diff --git a/mcs/errors/cs0111-2.cs b/mcs/errors/cs0111-2.cs
new file mode 100644
index 00000000000..22d2e80bda8
--- /dev/null
+++ b/mcs/errors/cs0111-2.cs
@@ -0,0 +1,9 @@
+// cs0111.cs: Identifier 'CLSClass.vAluE' differing only in case is not CLS-compliant
+// Line: 8
+
+[assembly:System.CLSCompliant(true)]
+
+public interface ISample {
+ void set_Item (int a, int b);
+ int this[int i] { set; }
+} \ No newline at end of file
diff --git a/mcs/errors/cs0116-2.cs b/mcs/errors/cs0116-2.cs
new file mode 100644
index 00000000000..ff0364d95bf
--- /dev/null
+++ b/mcs/errors/cs0116-2.cs
@@ -0,0 +1,4 @@
+// cs0116.cs: A namespace does not directly contain members such as fields or methods
+// Line: 4
+
+n
diff --git a/mcs/errors/cs0157-2.cs b/mcs/errors/cs0157-2.cs
new file mode 100644
index 00000000000..a0009d63307
--- /dev/null
+++ b/mcs/errors/cs0157-2.cs
@@ -0,0 +1,15 @@
+// cs0157-2.cs: Control can not leave the body of a finally clause
+// Line: 11
+
+class T {
+ static void Main ()
+ {
+ while (true) {
+ try {
+ System.Console.WriteLine ("trying");
+ } finally {
+ break;
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/mcs/errors/cs0157-3.cs b/mcs/errors/cs0157-3.cs
new file mode 100644
index 00000000000..dcfd325c7c2
--- /dev/null
+++ b/mcs/errors/cs0157-3.cs
@@ -0,0 +1,15 @@
+// cs0157-3.cs: Control can not leave the body of a finally clause
+// Line: 11
+
+class T {
+ static void Main ()
+ {
+ while (true) {
+ try {
+ System.Console.WriteLine ("trying");
+ } finally {
+ continue;
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/mcs/errors/cs0157-4.cs b/mcs/errors/cs0157-4.cs
new file mode 100644
index 00000000000..61c911a3274
--- /dev/null
+++ b/mcs/errors/cs0157-4.cs
@@ -0,0 +1,17 @@
+// cs0157-4.cs: Control can not leave the body of a finally clause
+// Line: 11
+
+class T {
+ static void Main ()
+ {
+ while (true) {
+ try {
+ System.Console.WriteLine ("trying");
+ } finally {
+ goto foo;
+ }
+ foo :
+ ;
+ }
+ }
+} \ No newline at end of file
diff --git a/mcs/errors/cs0246-2.cs b/mcs/errors/cs0246-2.cs
new file mode 100644
index 00000000000..0e2559c50d3
--- /dev/null
+++ b/mcs/errors/cs0246-2.cs
@@ -0,0 +1,6 @@
+// cs0246.cs: The type or namespace name 'ErrorType' could not be found (are you missing a using directive or an assembly reference?)
+// Line: 5
+
+interface A {
+ event ErrorType Test;
+} \ No newline at end of file
diff --git a/mcs/errors/cs0246-3.cs b/mcs/errors/cs0246-3.cs
new file mode 100644
index 00000000000..2dbc9466975
--- /dev/null
+++ b/mcs/errors/cs0246-3.cs
@@ -0,0 +1,6 @@
+// cs0246.cs: The type or namespace name 'ErrorType' could not be found (are you missing a using directive or an assembly reference?)
+// Line: 5
+
+interface A {
+ ErrorType Method();
+} \ No newline at end of file
diff --git a/mcs/errors/cs0246-4.cs b/mcs/errors/cs0246-4.cs
new file mode 100644
index 00000000000..bbf199b7ea8
--- /dev/null
+++ b/mcs/errors/cs0246-4.cs
@@ -0,0 +1,4 @@
+// cs0246.cs: The type or namespace name 'ErrorType' could not be found (are you missing a using directive or an assembly reference?)
+// Line: 4
+
+public delegate ErrorType Delegate (); \ No newline at end of file
diff --git a/mcs/errors/cs0428.cs b/mcs/errors/cs0428.cs
new file mode 100644
index 00000000000..b80e783ecca
--- /dev/null
+++ b/mcs/errors/cs0428.cs
@@ -0,0 +1,12 @@
+// cs0428.cs: Can not convert method group to type X, since type is not a delegate
+// Line: 9
+class X {
+ static void Method ()
+ {
+ }
+
+ static void Main ()
+ {
+ object o = Method;
+ }
+}
diff --git a/mcs/errors/cs0592-4.cs b/mcs/errors/cs0592-4.cs
new file mode 100644
index 00000000000..91adbb65ca8
--- /dev/null
+++ b/mcs/errors/cs0592-4.cs
@@ -0,0 +1,9 @@
+// cs0592-4.cs: Attribute 'TestAttribute' is not valid on this declaration type. It is valid on 'constructor' declarations only.
+// Line: 5
+
+using System;
+[assembly:TestAttribute ()]
+
+[AttributeUsage(AttributeTargets.Constructor)]
+public class TestAttribute: Attribute {
+} \ No newline at end of file
diff --git a/mcs/errors/cs0592-5.cs b/mcs/errors/cs0592-5.cs
new file mode 100644
index 00000000000..010193eb306
--- /dev/null
+++ b/mcs/errors/cs0592-5.cs
@@ -0,0 +1,12 @@
+// cs0592-5.cs: Attribute 'TestAttribute' is not valid on this declaration type. It is valid on 'constructor' declarations only.
+// Line: 6
+
+using System;
+
+[TestAttribute ()]
+enum E {
+}
+
+[AttributeUsage(AttributeTargets.Constructor)]
+public class TestAttribute: Attribute {
+} \ No newline at end of file
diff --git a/mcs/errors/cs0592-6.cs b/mcs/errors/cs0592-6.cs
new file mode 100644
index 00000000000..ae495fbb1b0
--- /dev/null
+++ b/mcs/errors/cs0592-6.cs
@@ -0,0 +1,11 @@
+// cs0592-6.cs: Attribute 'TestAttribute' is not valid on this declaration type. It is valid on 'constructor' declarations only.
+// Line: 6
+
+using System;
+
+[TestAttribute ()]
+delegate void D ();
+
+[AttributeUsage(AttributeTargets.Constructor)]
+public class TestAttribute: Attribute {
+} \ No newline at end of file
diff --git a/mcs/errors/cs0663.cs b/mcs/errors/cs0663.cs
new file mode 100644
index 00000000000..af76b20fea5
--- /dev/null
+++ b/mcs/errors/cs0663.cs
@@ -0,0 +1,7 @@
+// cs0663.cs: 'Test' cannot define overloaded methods which differ only on ref and out
+// Line: 6
+
+public interface WrongInterface {
+ int Test(out int obj);
+ int Test(ref int obj);
+}
diff --git a/mcs/errors/cs1585.cs b/mcs/errors/cs1585.cs
new file mode 100644
index 00000000000..2f9ae84eb1f
--- /dev/null
+++ b/mcs/errors/cs1585.cs
@@ -0,0 +1,11 @@
+// cs1585: Modifier `static' should appear before type
+// Line: 7
+using System;
+
+class t
+{
+ public void static Main (string[] args)
+ {
+ Console.WriteLine("Hello");
+ }
+}
diff --git a/mcs/errors/cs1593-2.cs b/mcs/errors/cs1593-2.cs
new file mode 100644
index 00000000000..bbeaf68aaf1
--- /dev/null
+++ b/mcs/errors/cs1593-2.cs
@@ -0,0 +1,14 @@
+// cs1593: Using different kind of signatures for delegate invocation.
+// Line: 11
+//
+// The delegate has an explicit signature with 0 arguments, so it
+// can not be assigned to a delegate with one argument.
+//
+delegate void D (int x);
+
+class X {
+ static void Main ()
+ {
+ D d2 = delegate () {};
+ }
+}
diff --git a/mcs/errors/cs1662.cs b/mcs/errors/cs1662.cs
new file mode 100644
index 00000000000..defcc6558af
--- /dev/null
+++ b/mcs/errors/cs1662.cs
@@ -0,0 +1,13 @@
+// cs1662: Can not convert the anonymous method, as the returned value does not match the return type of the delegate
+// Line: 11
+//
+// Return type mismatch.
+//
+delegate void D (int x);
+
+class X {
+ static void Main ()
+ {
+ D d6 = delegate (int x) { return x; }; // Return type mismatch.
+ }
+}
diff --git a/mcs/errors/cs1667.cs b/mcs/errors/cs1667.cs
new file mode 100644
index 00000000000..90b8b3ef85d
--- /dev/null
+++ b/mcs/errors/cs1667.cs
@@ -0,0 +1,13 @@
+// cs1677: out parameters are not permitted on anonymous delegate declarations.
+// Line: 11
+//
+// The delegate has an explicit signature, so it can not be assigned.
+//
+delegate void D (int x);
+
+class X {
+ static void Main ()
+ {
+ D d2 = delegate (out int x) {};
+ }
+}
diff --git a/mcs/errors/cs1676.cs b/mcs/errors/cs1676.cs
new file mode 100644
index 00000000000..ba2895d46ef
--- /dev/null
+++ b/mcs/errors/cs1676.cs
@@ -0,0 +1,13 @@
+// CS1676: Signature mismatch in parameter modifier for parameter #1
+// Line: 11
+//
+// The delegate has an explicit signature, so it can not be assigned.
+//
+delegate void D (ref int x);
+
+class X {
+ static void Main ()
+ {
+ D d2 = delegate (int x) {};
+ }
+}
diff --git a/mcs/errors/cs1678.cs b/mcs/errors/cs1678.cs
new file mode 100644
index 00000000000..4e26e76516d
--- /dev/null
+++ b/mcs/errors/cs1678.cs
@@ -0,0 +1,13 @@
+// cs1678: signature missmatch on type parameter.
+// Line: 11
+//
+// Signature mismatch.
+//
+delegate void D (int x);
+
+class X {
+ static void Main ()
+ {
+ D d2 = delegate (long x) {};
+ }
+}
diff --git a/mcs/errors/cs3001-1.cs b/mcs/errors/cs3001-1.cs
new file mode 100644
index 00000000000..930db0951e9
--- /dev/null
+++ b/mcs/errors/cs3001-1.cs
@@ -0,0 +1,7 @@
+// cs3001.cs: Argument type 'ulong' is not CLS-compliant
+// Line: 7
+
+using System;
+[assembly:CLSCompliant (true)]
+
+public delegate long MyDelegate (ulong arg);
diff --git a/mcs/errors/cs3001-2.cs b/mcs/errors/cs3001-2.cs
new file mode 100644
index 00000000000..34dfd9336d1
--- /dev/null
+++ b/mcs/errors/cs3001-2.cs
@@ -0,0 +1,10 @@
+// cs3001.cs: Argument type 'ref ulong' is not CLS-compliant
+// Line: 9
+
+using System;
+[assembly:CLSCompliant (true)]
+
+public class CLSClass {
+ public CLSClass (long a) {}
+ public CLSClass (ref ulong a) {}
+} \ No newline at end of file
diff --git a/mcs/errors/cs3001-3.cs b/mcs/errors/cs3001-3.cs
new file mode 100644
index 00000000000..7ba56d1c00b
--- /dev/null
+++ b/mcs/errors/cs3001-3.cs
@@ -0,0 +1,13 @@
+// cs3001.cs: Argument type 'ulong' is not CLS-compliant
+// Line: 8
+
+using System;
+[assembly:CLSCompliant (true)]
+
+public class CLSClass {
+ public long this [ulong index] {
+ get {
+ return 2;
+ }
+ }
+} \ No newline at end of file
diff --git a/mcs/errors/cs3001-4.cs b/mcs/errors/cs3001-4.cs
new file mode 100644
index 00000000000..75d97473545
--- /dev/null
+++ b/mcs/errors/cs3001-4.cs
@@ -0,0 +1,17 @@
+// cs3001-4.cs: Argument type 'out IError' is not CLS-compliant
+// Line: 12
+
+using System;
+[assembly:CLSCompliant(true)]
+
+[CLSCompliant(false)]
+public interface IError{
+}
+
+public interface I {
+ void Error(out IError arg);
+}
+
+public class c {
+ public void Error (out IError arg) { arg = null; }
+} \ No newline at end of file
diff --git a/mcs/errors/cs3001-5.cs b/mcs/errors/cs3001-5.cs
new file mode 100644
index 00000000000..48ce5e089df
--- /dev/null
+++ b/mcs/errors/cs3001-5.cs
@@ -0,0 +1,9 @@
+// cs3001.cs: Argument type 'sbyte' is not CLS-compliant
+// Line: 8
+
+using System;
+[assembly:CLSCompliant(true)]
+
+public class CLSClass {
+ public delegate int MyDelegate(sbyte i);
+} \ No newline at end of file
diff --git a/mcs/errors/cs3001-6.cs b/mcs/errors/cs3001-6.cs
new file mode 100644
index 00000000000..0ef4c502b16
--- /dev/null
+++ b/mcs/errors/cs3001-6.cs
@@ -0,0 +1,15 @@
+// cs3001.cs: Argument type 'sbyte' is not CLS-compliant
+// Line: 8
+
+using System;
+[assembly:CLSCompliant(true)]
+
+public class CLSClass {
+ static public implicit operator CLSClass(byte value) {
+ return new CLSClass();
+ }
+
+ static public implicit operator CLSClass(sbyte value) {
+ return new CLSClass();
+ }
+} \ No newline at end of file
diff --git a/mcs/errors/cs3001-7.cs b/mcs/errors/cs3001-7.cs
new file mode 100644
index 00000000000..2ffebcfad6c
--- /dev/null
+++ b/mcs/errors/cs3001-7.cs
@@ -0,0 +1,14 @@
+// cs3001-4.cs: Identifier 'CLSClass.vAluE' differing only in case is not CLS-compliant
+// Line: 8
+
+using System;
+[assembly:CLSCompliant(true)]
+
+[CLSCompliant(false)]
+public interface I {
+ [CLSCompliant(false)]
+ void Foo();
+
+ [CLSCompliant(true)]
+ long this[uint indexA] { set; }
+}
diff --git a/mcs/errors/cs3001.cs b/mcs/errors/cs3001.cs
new file mode 100644
index 00000000000..765850183bd
--- /dev/null
+++ b/mcs/errors/cs3001.cs
@@ -0,0 +1,9 @@
+// cs3001.cs: Argument type 'sbyte' is not CLS-compliant
+// Line: 8
+
+using System;
+[assembly:CLSCompliant (true)]
+
+public class CLSClass {
+ protected internal void Foo (string text, sbyte value) { }
+} \ No newline at end of file
diff --git a/mcs/errors/cs3002-1.cs b/mcs/errors/cs3002-1.cs
new file mode 100644
index 00000000000..3e57f0e8903
--- /dev/null
+++ b/mcs/errors/cs3002-1.cs
@@ -0,0 +1,17 @@
+// cs3002-2.cs: Return type of 'CLSClass.Foo()' is not CLS-compliant
+// Line: 13
+
+using System;
+[assembly:CLSCompliant(true)]
+
+[CLSCompliant(false)]
+public interface I1 {
+}
+
+public class CLSClass {
+ protected internal I1 Foo() {
+ return null;
+ }
+
+ static void Main() {}
+} \ No newline at end of file
diff --git a/mcs/errors/cs3002-10.cs b/mcs/errors/cs3002-10.cs
new file mode 100644
index 00000000000..fc97275f164
--- /dev/null
+++ b/mcs/errors/cs3002-10.cs
@@ -0,0 +1,9 @@
+// cs3002-2.cs: Return type of 'I.Error()' is not CLS-compliant
+// Line: 13
+
+[assembly:System.CLSCompliant (true)]
+
+public interface I
+{
+ ulong Error();
+} \ No newline at end of file
diff --git a/mcs/errors/cs3002-2.cs b/mcs/errors/cs3002-2.cs
new file mode 100644
index 00000000000..7b989403475
--- /dev/null
+++ b/mcs/errors/cs3002-2.cs
@@ -0,0 +1,18 @@
+// cs3002-2.cs: Return type of 'CLSClass.Foo()' is not CLS-compliant
+// Line: 13
+
+using System;
+[assembly:CLSCompliant(true)]
+
+public class CLSClass {
+ [CLSCompliant(false)]
+ public ulong Valid() {
+ return 1;
+ }
+
+ protected internal ulong Foo() {
+ return 1;
+ }
+
+ static void Main() {}
+} \ No newline at end of file
diff --git a/mcs/errors/cs3002-3.cs b/mcs/errors/cs3002-3.cs
new file mode 100644
index 00000000000..1055c66ae83
--- /dev/null
+++ b/mcs/errors/cs3002-3.cs
@@ -0,0 +1,9 @@
+// cs3002.cs: Return type of 'CLSClass.MyDelegate' is not CLS-compliant
+// Line: 8
+
+using System;
+[assembly:CLSCompliant(true)]
+
+public class CLSClass {
+ public delegate uint MyDelegate();
+} \ No newline at end of file
diff --git a/mcs/errors/cs3002-4.cs b/mcs/errors/cs3002-4.cs
new file mode 100644
index 00000000000..72b98fde702
--- /dev/null
+++ b/mcs/errors/cs3002-4.cs
@@ -0,0 +1,13 @@
+// cs3002.cs: Argument type 'CLSClass.Index' is not CLS-compliant
+// Line: 10
+
+using System;
+[assembly:CLSCompliant(true)]
+
+public class CLSClass {
+ public ulong Index {
+ set
+ {
+ }
+ }
+} \ No newline at end of file
diff --git a/mcs/errors/cs3002-5.cs b/mcs/errors/cs3002-5.cs
new file mode 100644
index 00000000000..9697c7a2aa1
--- /dev/null
+++ b/mcs/errors/cs3002-5.cs
@@ -0,0 +1,15 @@
+// cs3002.cs: Argument type 'CLSClass.Test1()' is not CLS-compliant
+// Line: 11
+
+using System;
+[assembly:CLSCompliant(true)]
+
+[CLSCompliant(false)]
+public interface I {}
+
+public class C {}
+
+public class CLSClass {
+ public I Test1() { return null; }
+ public C Test2() { return null; }
+}
diff --git a/mcs/errors/cs3002-6.cs b/mcs/errors/cs3002-6.cs
new file mode 100644
index 00000000000..e39b560aa6a
--- /dev/null
+++ b/mcs/errors/cs3002-6.cs
@@ -0,0 +1,11 @@
+// cs3002-6.cs: Return type of 'I.Error()' is not CLS-compliant
+// Line: 10
+
+using System;
+[assembly:CLSCompliant(true)]
+
+[CLSCompliant(false)]
+public interface I {
+ [CLSCompliant(true)]
+ ulong[] Error();
+} \ No newline at end of file
diff --git a/mcs/errors/cs3002-7.cs b/mcs/errors/cs3002-7.cs
new file mode 100644
index 00000000000..c685152efe5
--- /dev/null
+++ b/mcs/errors/cs3002-7.cs
@@ -0,0 +1,9 @@
+// cs3002-7.cs: Return type of 'I.Error' is not CLS-compliant
+// Line: 8
+
+using System;
+[assembly:CLSCompliant(true)]
+
+public interface I {
+ UIntPtr Error { get; }
+} \ No newline at end of file
diff --git a/mcs/errors/cs3002-8.cs b/mcs/errors/cs3002-8.cs
new file mode 100644
index 00000000000..869693c164d
--- /dev/null
+++ b/mcs/errors/cs3002-8.cs
@@ -0,0 +1,9 @@
+// cs3002-8.cs: Return type of 'I.Error' is not CLS-compliant
+// Line: 8
+
+using System;
+[assembly:CLSCompliant(true)]
+
+public interface I {
+ ulong this[bool index] { get; }
+}
diff --git a/mcs/errors/cs3002-9.cs b/mcs/errors/cs3002-9.cs
new file mode 100644
index 00000000000..6605699657d
--- /dev/null
+++ b/mcs/errors/cs3002-9.cs
@@ -0,0 +1,12 @@
+// cs3002.cs: Return type of 'Delegate' is not CLS-compliant
+// Line: 7
+
+using System;
+[assembly:CLSCompliant(true)]
+
+public delegate CLSDelegate Delegate ();
+
+[Serializable]
+[CLSCompliant (false)]
+public class CLSDelegate {
+} \ No newline at end of file
diff --git a/mcs/errors/cs3002.cs b/mcs/errors/cs3002.cs
new file mode 100644
index 00000000000..bd79c5b3e85
--- /dev/null
+++ b/mcs/errors/cs3002.cs
@@ -0,0 +1,15 @@
+// cs3002.cs: Return type of 'CLSClass.Foo()' is not CLS-compliant
+// Line: 12
+
+using System;
+[assembly:CLSCompliant(true)]
+
+public class CLSClass {
+ private ulong Valid() {
+ return 1;
+ }
+
+ protected ulong Foo() {
+ return 1;
+ }
+} \ No newline at end of file
diff --git a/mcs/errors/cs3003-1.cs b/mcs/errors/cs3003-1.cs
new file mode 100644
index 00000000000..d1f9ee4d2fd
--- /dev/null
+++ b/mcs/errors/cs3003-1.cs
@@ -0,0 +1,11 @@
+// cs3003.cs: Type of 'CLSClass.MyEvent' is not CLS-compliant
+// Line: 8
+
+[assembly:System.CLSCompliant (true)]
+
+[System.CLSCompliant (false)]
+public delegate void MyDelegate ();
+
+public class CLSClass {
+ public event MyDelegate MyEvent;
+} \ No newline at end of file
diff --git a/mcs/errors/cs3003.cs b/mcs/errors/cs3003.cs
new file mode 100644
index 00000000000..920c20ef9db
--- /dev/null
+++ b/mcs/errors/cs3003.cs
@@ -0,0 +1,9 @@
+// cs3003.cs: Type of 'CLSClass.value' is not CLS-compliant
+// Line: 8
+
+using System;
+[assembly:CLSCompliant(true)]
+
+public class CLSClass {
+ protected uint value;
+} \ No newline at end of file
diff --git a/mcs/errors/cs3008-1.cs b/mcs/errors/cs3008-1.cs
new file mode 100644
index 00000000000..316f824100b
--- /dev/null
+++ b/mcs/errors/cs3008-1.cs
@@ -0,0 +1,9 @@
+// cs3008.cs: Identifier 'CLSClass._value' is not CLS-compliant
+// Line: 8
+
+using System;
+[assembly: CLSCompliant(true)]
+
+public class CLSClass {
+ public const string _value = "";
+}
diff --git a/mcs/errors/cs3008-2.cs b/mcs/errors/cs3008-2.cs
new file mode 100644
index 00000000000..e45687ebde3
--- /dev/null
+++ b/mcs/errors/cs3008-2.cs
@@ -0,0 +1,11 @@
+// cs3008.cs: Identifier 'CLSClass._myEvent' is not CLS-compliant
+// Line: 8
+
+using System;
+[assembly: CLSCompliant(true)]
+
+public delegate void MyDelegate();
+
+public class CLSClass {
+ public event MyDelegate _myEvent;
+}
diff --git a/mcs/errors/cs3008-3.cs b/mcs/errors/cs3008-3.cs
new file mode 100644
index 00000000000..222900d2592
--- /dev/null
+++ b/mcs/errors/cs3008-3.cs
@@ -0,0 +1,8 @@
+// cs3008.cs: Identifier '_A' is not CLS-compliant
+// Line: 7
+
+using System;
+[assembly:CLSCompliant(true)]
+
+public class _A {
+} \ No newline at end of file
diff --git a/mcs/errors/cs3008-4.cs b/mcs/errors/cs3008-4.cs
new file mode 100644
index 00000000000..f5e63fc6e27
--- /dev/null
+++ b/mcs/errors/cs3008-4.cs
@@ -0,0 +1,8 @@
+// cs3008.cs: Identifier '_I' is not CLS-compliant
+// Line: 7
+
+using System;
+[assembly:CLSCompliant(true)]
+
+public interface _I {
+} \ No newline at end of file
diff --git a/mcs/errors/cs3008-5.cs b/mcs/errors/cs3008-5.cs
new file mode 100644
index 00000000000..bdbcf7e2b76
--- /dev/null
+++ b/mcs/errors/cs3008-5.cs
@@ -0,0 +1,9 @@
+// cs3008.cs: Identifier 'I._()' is not CLS-compliant
+// Line: 8
+
+using System;
+[assembly:CLSCompliant(true)]
+
+public interface I {
+ void _();
+} \ No newline at end of file
diff --git a/mcs/errors/cs3008-6.cs b/mcs/errors/cs3008-6.cs
new file mode 100644
index 00000000000..2d3595f5e7f
--- /dev/null
+++ b/mcs/errors/cs3008-6.cs
@@ -0,0 +1,9 @@
+// cs3008.cs: Identifier 'C._()' is not CLS-compliant
+// Line: 8
+
+using System;
+[assembly:CLSCompliant(true)]
+
+public class C {
+ public void _() {}
+} \ No newline at end of file
diff --git a/mcs/errors/cs3008.cs b/mcs/errors/cs3008.cs
new file mode 100644
index 00000000000..41838c6b49c
--- /dev/null
+++ b/mcs/errors/cs3008.cs
@@ -0,0 +1,9 @@
+// cs3008.cs: Identifier 'CLSClass._value' is not CLS-compliant
+// Line: 8
+
+using System;
+[assembly: CLSCompliant(true)]
+
+public class CLSClass {
+ public static int _value = 3;
+}
diff --git a/mcs/errors/cs3010.cs b/mcs/errors/cs3010.cs
new file mode 100644
index 00000000000..ae9b9fef306
--- /dev/null
+++ b/mcs/errors/cs3010.cs
@@ -0,0 +1,13 @@
+// cs3010.cs: 'I.Error': CLS-compliant interfaces must have CLS-compliant members
+// Line: 12
+
+using System;
+[assembly:CLSCompliant (true)]
+
+public interface I {
+ [CLSCompliant (true)]
+ void Valid (bool arg);
+
+ [CLSCompliant (false)]
+ event AssemblyLoadEventHandler Error;
+} \ No newline at end of file
diff --git a/mcs/errors/cs3011-1.cs b/mcs/errors/cs3011-1.cs
new file mode 100644
index 00000000000..bfc73ada68f
--- /dev/null
+++ b/mcs/errors/cs3011-1.cs
@@ -0,0 +1,11 @@
+// cs3011-1.cs: 'CLSClass.this[long]': only CLS-compliant members can be abstract
+// Line: 9
+
+using System;
+[assembly:CLSCompliant (true)]
+
+public abstract class CLSClass {
+ [CLSCompliant (false)]
+ public abstract int this[long index] { set; }
+}
+
diff --git a/mcs/errors/cs3011.cs b/mcs/errors/cs3011.cs
new file mode 100644
index 00000000000..1a28549f636
--- /dev/null
+++ b/mcs/errors/cs3011.cs
@@ -0,0 +1,14 @@
+// cs3011.cs: 'CLSClass.Error(System.IComparable)': only CLS-compliant members can be abstract
+// Line: 12
+
+using System;
+[assembly:CLSCompliant (true)]
+
+public abstract class CLSClass {
+ [CLSCompliant (false)]
+ internal abstract int Valid ();
+
+ [CLSCompliant (false)]
+ protected abstract void Error (IComparable arg);
+}
+
diff --git a/mcs/errors/cs3014-1.cs b/mcs/errors/cs3014-1.cs
new file mode 100644
index 00000000000..394a21fd24e
--- /dev/null
+++ b/mcs/errors/cs3014-1.cs
@@ -0,0 +1,11 @@
+// cs3014-1.cs: 'C.Error(bool)' cannot be marked as CLS compliant because the assembly is not marked as compliant
+// Line: 8
+
+using System;
+[assembly:CLSCompliant (false)]
+
+public class C {
+ [CLSCompliant (true)]
+ protected void Error (bool arg) {}
+
+} \ No newline at end of file
diff --git a/mcs/errors/cs3014-2.cs b/mcs/errors/cs3014-2.cs
new file mode 100644
index 00000000000..c2cff890f90
--- /dev/null
+++ b/mcs/errors/cs3014-2.cs
@@ -0,0 +1,8 @@
+// cs3014-2.cs: 'C' cannot be marked as CLS compliant because the assembly is not marked as compliant
+// Line: 7
+
+using System;
+
+[CLSCompliant (true)]
+public class C {
+} \ No newline at end of file
diff --git a/mcs/errors/cs3014-3.cs b/mcs/errors/cs3014-3.cs
new file mode 100644
index 00000000000..d3db0337ab9
--- /dev/null
+++ b/mcs/errors/cs3014-3.cs
@@ -0,0 +1,8 @@
+// cs3014-1.cs: 'I' cannot be marked as CLS compliant because the assembly is not marked as compliant
+// Line: 7
+
+using System;
+
+[CLSCompliant (true)]
+public interface I {
+} \ No newline at end of file
diff --git a/mcs/errors/cs3014-4.cs b/mcs/errors/cs3014-4.cs
new file mode 100644
index 00000000000..f6159bf971c
--- /dev/null
+++ b/mcs/errors/cs3014-4.cs
@@ -0,0 +1,7 @@
+// cs3014-1.cs: 'D' cannot be marked as CLS compliant because the assembly is not marked as compliant
+// Line: 8
+
+using System;
+
+[CLSCompliant (true)]
+public delegate void D ();
diff --git a/mcs/errors/cs3014-5.cs b/mcs/errors/cs3014-5.cs
new file mode 100644
index 00000000000..b830fd76166
--- /dev/null
+++ b/mcs/errors/cs3014-5.cs
@@ -0,0 +1,8 @@
+// cs3014-1.cs: 'E' cannot be marked as CLS compliant because the assembly is not marked as compliant
+// Line: 8
+
+using System;
+
+[CLSCompliant (true)]
+public enum E {
+}
diff --git a/mcs/errors/cs3014-6.cs b/mcs/errors/cs3014-6.cs
new file mode 100644
index 00000000000..7f8b003dc17
--- /dev/null
+++ b/mcs/errors/cs3014-6.cs
@@ -0,0 +1,10 @@
+// cs3014.cs: 'C.field' cannot be marked as CLS-compliant because the assembly is not marked as compliant
+// Line: 8
+
+using System;
+[assembly:CLSCompliant (false)]
+
+public class C {
+ [CLSCompliant (true)]
+ public long field;
+} \ No newline at end of file
diff --git a/mcs/errors/cs3014-7.cs b/mcs/errors/cs3014-7.cs
new file mode 100644
index 00000000000..5227bf4be48
--- /dev/null
+++ b/mcs/errors/cs3014-7.cs
@@ -0,0 +1,11 @@
+// cs3014-1.cs: 'CLSClass.implicit operator CLSClass(byte)' cannot be marked as CLS compliant because the assembly is not marked as compliant
+// Line: 7
+
+using System;
+
+public abstract class CLSClass {
+ [CLSCompliant (true)]
+ public static implicit operator CLSClass(byte value) {
+ return null;
+ }
+} \ No newline at end of file
diff --git a/mcs/errors/cs3014.cs b/mcs/errors/cs3014.cs
new file mode 100644
index 00000000000..d24c5170297
--- /dev/null
+++ b/mcs/errors/cs3014.cs
@@ -0,0 +1,9 @@
+// cs3014.cs: 'I.Valid(bool)' cannot be marked as CLS compliant because the assembly is not marked as compliant
+// Line: 8
+
+using System;
+
+public interface I {
+ [CLSCompliant (true)]
+ void Valid (bool arg);
+} \ No newline at end of file
diff --git a/mcs/errors/cs3015-1.cs b/mcs/errors/cs3015-1.cs
new file mode 100644
index 00000000000..6603f21701c
--- /dev/null
+++ b/mcs/errors/cs3015-1.cs
@@ -0,0 +1,10 @@
+// cs3015.cs: 'CLSAttribute' has no accessible constructors which use only CLS compliant types
+// Line: 7
+
+using System;
+[assembly:CLSCompliant (true)]
+
+public class CLSAttribute: Attribute {
+ private CLSAttribute(int arg) {
+ }
+}
diff --git a/mcs/errors/cs3015.cs b/mcs/errors/cs3015.cs
new file mode 100644
index 00000000000..2ad8fd05e6e
--- /dev/null
+++ b/mcs/errors/cs3015.cs
@@ -0,0 +1,10 @@
+// cs3015.cs: 'CLSAttribute' has no accessible constructors which use only CLS compliant types
+// Line: 7
+
+using System;
+[assembly:CLSCompliant (true)]
+
+public class CLSAttribute: Attribute {
+ public CLSAttribute(string[] array) {
+ }
+}
diff --git a/mcs/errors/cs3016-1.cs b/mcs/errors/cs3016-1.cs
new file mode 100644
index 00000000000..d60e0fe0f81
--- /dev/null
+++ b/mcs/errors/cs3016-1.cs
@@ -0,0 +1,17 @@
+// cs3016.cs: Arrays as attribute arguments are not CLS-compliant
+// Line: 7
+
+using System;
+[assembly: System.CLSCompliant (true)]
+
+[CLSAttribute (new bool [] {true, false})]
+public enum E {
+}
+
+public class CLSAttribute: System.Attribute {
+ public CLSAttribute () {
+ }
+
+ public CLSAttribute(bool[] array) {
+ }
+} \ No newline at end of file
diff --git a/mcs/errors/cs3016-2.cs b/mcs/errors/cs3016-2.cs
new file mode 100644
index 00000000000..84db73dd9e3
--- /dev/null
+++ b/mcs/errors/cs3016-2.cs
@@ -0,0 +1,14 @@
+// cs3016.cs: Arrays as attribute arguments are not CLS-compliant
+// Line: 5
+
+using System;
+[assembly:CLSAttribute (new bool [] {true, false})]
+[assembly:CLSCompliant (true)]
+
+public class CLSAttribute: Attribute {
+ public CLSAttribute () {
+ }
+
+ public CLSAttribute(bool[] array) {
+ }
+} \ No newline at end of file
diff --git a/mcs/errors/cs3016-3.cs b/mcs/errors/cs3016-3.cs
new file mode 100644
index 00000000000..95aae9ae63a
--- /dev/null
+++ b/mcs/errors/cs3016-3.cs
@@ -0,0 +1,14 @@
+// cs3016.cs: Arrays as attribute arguments is not CLS-compliant
+// Line: 12
+
+using System;
+[assembly:CLSCompliant(true)]
+
+public class CLSAttribute: Attribute {
+ public CLSAttribute() {}
+ public CLSAttribute(string[] array) {}
+}
+
+[CLSAttribute(new string[] { "", "" })]
+public interface ITest {
+} \ No newline at end of file
diff --git a/mcs/errors/cs3016.cs b/mcs/errors/cs3016.cs
new file mode 100644
index 00000000000..f5b82da009a
--- /dev/null
+++ b/mcs/errors/cs3016.cs
@@ -0,0 +1,14 @@
+// cs3016.cs: Arrays as attribute arguments are not CLS-compliant
+// Line: 7
+
+using System;
+[assembly:CLSCompliant (true)]
+
+[CLSAttribute (new bool [] {true, false})]
+public class CLSAttribute: Attribute {
+ public CLSAttribute () {
+ }
+
+ public CLSAttribute(bool[] array) {
+ }
+} \ No newline at end of file
diff --git a/mcs/errors/errors.txt b/mcs/errors/errors.txt
index ae7ca5b2fe0..5453183e89a 100755
--- a/mcs/errors/errors.txt
+++ b/mcs/errors/errors.txt
@@ -127,3 +127,7 @@ the Microsoft C# compiler:
-219 Type argument doesn't meet constraints.
-220 Cannot resolve constructed type
+
+-221 params modifier present in anonymous method declaration
+
+-222 yield statement only available in C# 2.0 mode \ No newline at end of file
diff --git a/mcs/gmcs/AssemblyInfo.cs b/mcs/gmcs/AssemblyInfo.cs
index 8fcadbb1115..a80bb2813a0 100644
--- a/mcs/gmcs/AssemblyInfo.cs
+++ b/mcs/gmcs/AssemblyInfo.cs
@@ -1,7 +1,7 @@
using System.Reflection;
using System.Runtime.CompilerServices;
-[assembly: AssemblyVersion("0.28")]
+[assembly: AssemblyVersion("0.29.99")]
[assembly: AssemblyTitle ("Mono C# Compiler")]
[assembly: AssemblyDescription ("Mono C# Compiler with Generics")]
[assembly: AssemblyCopyright ("2001, 2002, 2003 Ximian, Inc.")]
diff --git a/mcs/gmcs/ChangeLog b/mcs/gmcs/ChangeLog
index a5d95fda90b..74d5f470bac 100755
--- a/mcs/gmcs/ChangeLog
+++ b/mcs/gmcs/ChangeLog
@@ -1,3 +1,827 @@
+2004-01-29 Martin Baulig <martin@ximian.com>
+
+ * expression.cs (Invocation.DoResolve): If we're a
+ `ConstructedType', then we're actually a generic method, so
+ rewrite the expr as a GenericMemberAccess.
+
+ * cs-parser.jay (member_name): Don't use `namespace_or_type_name'
+ here; manually parse it into a string.
+
+2004-01-28 Martin Baulig <martin@ximian.com>
+
+ * typemanager.cs (TypeManager.IsEqual): New static method.
+ (TypeManager.FilterWithClosure): Call TypeManager.IsEqual() to
+ check for equality instead of using `=='.
+
+2004-01-26 Martin Baulig <martin@ximian.com>
+
+ * decl.cs (DeclSpace.CurrentType): New public field.
+
+ * expression.cs (This.ResolveBase): If we have an
+ `ec.TypeContainer.CurrentType', use it instead of
+ `ec.ContainerType'.
+
+ * class.cs (TypeContainer.DefineType): If we're a generic type,
+ create the `CurrentType' (unresolved).
+ (TypeContainer.GenericType): New private field.
+ (TypeContainer.DefineMembers): If we have a `CurrentType', resolve
+ it and store it in `GenericType' before creating the MemberCache.
+ (TypeContainer.GetMembers): If we have a `GenericType', call
+ TypeManager.FindMembers() on it.
+
+ * interface.cs (Interface.GenericType): New private field.
+ (Interface.DefineType): If we're a generic type, create the
+ `CurrentType' (unresolved).
+ (Interface.DefineMembers): If we have a `CurrentType', resolve it
+ and store it in `GenericType' before creating the MemberCache.
+ (Interface.GetMembers): If we have a `GenericType', call
+ TypeManager.FindMembers() on it.
+
+2004-01-22 Martin Baulig <martin@ximian.com>
+
+ * cs-parser.jay (namespace_or_type_name): Return an Expression,
+ not a QualifiedIdentifier. This is what `type_name_expression'
+ was previously doing.
+ (type_name_expression): Removed; the code is now in
+ `namespace_or_type_name'.
+ (qualified_identifier): Removed, use `namespace_or_type_name'
+ instead.
+ (QualifiedIdentifier): Removed this class.
+
+2004-01-22 Martin Baulig <martin@ximian.com>
+
+ * namespace.cs (NamespaceEntry.UsingAlias): Take an Expression,
+ not a string as alias name.
+
+2004-01-21 Miguel de Icaza <miguel@ximian.com>
+
+ * ecore.cs (FieldInfo.AddressOf): Revert patch from previous
+ #52730 bug, and instead compute correctly the need to use a
+ temporary variable when requesting an address based on the
+ static/instace modified of the field and the constructor.
+
+2004-01-21 Martin Baulig <martin@ximian.com>
+
+ * ecore.cs (SimpleName.ResolveAsTypeStep): Lookup in the current
+ class and namespace before looking up aliases. Fixes #52517.
+
+2004-01-21 Martin Baulig <martin@ximian.com>
+
+ * flowanalysis.cs (UsageVector.Merge): Allow variables being
+ assinged in a 'try'; fixes exception4.cs.
+
+2004-01-21 Marek Safar <marek.safar@seznam.cz>
+ * class.cs : Implemented parameter-less constructor for TypeContainer
+
+ * decl.cs: Attributes are now stored here. New property OptAttributes
+
+ * delegate.cs, enum.cs, interface.cs: Removed attribute member.
+
+ * rootcontext.cs, tree.cs: Now use parameter-less constructor of TypeContainer
+
+2004-01-21 Marek Safar <marek.safar@seznam.cz>
+
+ * typemanager.cs (CSharpSignature): Now reports also inner class name.
+ (CSharpSignature): New method for indexer and property signature.
+
+2004-01-21 Marek Safar <marek.safar@seznam.cz>
+
+ * pending.cs (IsVirtualFilter): Faster implementation.
+
+2004-01-21 Marek Safar <marek.safar@seznam.cz>
+
+ * typemanager.cs: Avoid inclusion of same assembly more than once.
+
+2004-01-21 Marek Safar <marek.safar@seznam.cz>
+
+ * cs-parser.jay: Fixed problem where the last assembly attribute
+ has been applied also to following declaration (class, struct, etc.)
+
+2004-01-21 Marek Safar <marek.safar@seznam.cz>
+
+ * class.cs: Added error CS0538, CS0539 reporting.
+ Fixed crash on Microsoft runtime when field type is void.
+
+ * cs-parser.jay: Added error CS0537 reporting.
+
+ * pending.cs: Added error CS0535 reporting.
+ Improved error report for errors CS0536, CS0534.
+
+2004-01-20 Miguel de Icaza <miguel@ximian.com>
+
+ Merge a few bits from the Anonymous Method MCS tree.
+
+ * statement.cs (ToplevelBlock): New class for toplevel methods,
+ will hold anonymous methods, lifted variables.
+
+ * cs-parser.jay: Create toplevel blocks for delegates and for
+ regular blocks of code.
+
+2004-01-20 Martin Baulig <martin@ximian.com>
+
+ * codegen.cs (EmitContext): Removed `InTry', `InCatch',
+ `InFinally', `InLoop', `TryCatchLevel', `LoopBeginTryCatchLevel'
+ and `NeedExplicitReturn'; added `IsLastStatement'.
+ (EmitContext.EmitTopBlock): Emit the explicit "ret" if we either
+ have a `ReturnLabel' or we're not unreachable.
+
+ * flowanalysis.cs (FlowBranching.MergeChild): Actually merge the
+ child's reachability; don't just override ours with it. Fixes
+ #58058 (lluis's example).
+ (FlowBranching): Added public InTryOrCatch(), InCatch(),
+ InFinally(), InLoop(), InSwitch() and
+ BreakCrossesTryCatchBoundary() methods.
+
+ * statement.cs (Return): Do all error checking in Resolve().
+ Unless we are the last statement in a top-level block, always
+ create a return label and jump to it.
+ (Break, Continue): Do all error checking in Resolve(); also make
+ sure we aren't leaving a `finally'.
+ (Block.DoEmit): Set `ec.IsLastStatement' when emitting the last
+ statement in a top-level block.
+ (Block.Flags): Added `IsDestructor'.
+ (Block.IsDestructor): New public property.
+
+2004-01-20 Martin Baulig <martin@ximian.com>
+
+ * statement.cs (Break.DoEmit): Set ec.NeedExplicitReturn; fixes #52427.
+
+2004-01-20 Martin Baulig <martin@ximian.com>
+
+ * statement.cs (Statement.ResolveUnreachable): New public method.
+ (If, While): Do the dead-code elimination in Resolve(), not in Emit().
+ (Block.Resolve): Resolve unreachable statements.
+
+2004-01-19 Ben Maurer <bmaurer@users.sourceforge.net>
+
+ * expression.cs: We need to fix the case where we do
+ not have a temp variable here.
+
+ * assign.cs: Only expression compound assignments need
+ temporary variables.
+
+2004-01-19 Ben Maurer <bmaurer@users.sourceforge.net>
+
+ * flowanalysis.cs: Reduce memory allocation in a few ways:
+ - A block with no variables should not allocate a bit
+ vector for itself.
+ - A method with no out parameters does not need any tracking
+ for assignment of the parameters, so we need not allocate
+ any data for it.
+ - The arrays:
+ public readonly Type[] VariableTypes;
+ public readonly string[] VariableNames;
+ Are redundant. The data is already stored in the variable
+ map, so we need not allocate another array for it.
+ - We need to add alot of checks for if (params | locals) == null
+ due to the first two changes.
+
+2004-01-18 Miguel de Icaza <miguel@ximian.com>
+
+ * ecore.cs (FieldExpr.AddressOf): For ValueTypes that do not
+ implement IMemoryLocation, we store a copy on a local variable and
+ take the address of it. Patch from Benjamin Jemlich
+
+ * cs-parser.jay: Applied patch from Ben Maurer to the "type" rule
+ to use a special "type_name_expression" rule which reduces the
+ number of "QualifiedIdentifier" classes created, and instead
+ directly creates MemberAccess expressions.
+
+2004-01-17 Miguel de Icaza <miguel@ximian.com>
+
+ * convert.cs: Applied patch from Benjamin Jemlich (pcgod@gmx.net)
+ that fixes #52853. Null literal assignment to ValueType
+
+ * class.cs (MethodData.Emit): Instead of checking the name of the
+ method to determine if its a destructor, create a new derived
+ class from Method called Destructor, and test for that.
+
+ * cs-parser.jay: Create a Destructor object instead of a Method.
+
+ Based on a fix from Benjamin Jemlich (pcgod@gmx.net)
+
+ Fixes: 52933
+
+2004-01-16 Miguel de Icaza <miguel@ximian.com>
+
+ * expression.cs (Binary.ResolveOperator): Perform an implicit
+ conversion from MethodGroups to their delegate types on the
+ Addition operation.
+
+ * delegate.cs: Introduce a new class DelegateCreation that is the
+ base class for `NewDelegate' and `ImplicitDelegateCreation',
+ factor some code in here.
+
+ * convert.cs (Convert.ImplicitConversionStandard): Add an implicit
+ conversion from MethodGroups to compatible delegate types.
+
+ * ecore.cs (Expression.Resolve): Do not flag error 654
+ (Methodgroupd needs parenthesis) if running on the V2 compiler, as
+ we allow conversions from MethodGroups to delegate types now.
+
+ * assign.cs (Assign.DoResolve): Do not flag errors on methodgroup
+ assignments in v2 either.
+
+2004-01-10 Miguel de Icaza <miguel@ximian.com>
+
+ * ecore.cs (FieldExpr.AddressOf): Fix generated IL for accessing
+ static read-only fields in ctors.
+
+ Applied patch from Benjamin Jemlich
+
+ * expression.cs (UnaryMutator): Avoid leaking local variables.
+
+2004-01-09 Miguel de Icaza <miguel@ximian.com>
+
+ * cs-tokenizer.cs (IsCastToken): Allow the various native types
+ here to return true, as they can be used like this:
+
+ (XXX) int.MEMBER ()
+
+ Fixed 49836 and all the other dups
+
+2004-01-09 Zoltan Varga <vargaz@freemail.hu>
+
+ * driver.cs: Implement /win32res and /win32icon.
+
+2004-01-08 Miguel de Icaza <miguel@ximian.com>
+
+ * cs-parser.jay: Add a rule to improve error handling for the
+ common mistake of placing modifiers after the type.
+
+2004-01-07 Miguel de Icaza <miguel@ximian.com>
+
+ * cs-parser.jay (interface_event_declaration): Catch
+ initialization of events on interfaces, and report cs0068
+
+ * cs-parser.jay (interface_event_declaration): Catch
+ initialization of events.
+
+ * ecore.cs: Better report missing constructors.
+
+ * expression.cs (Binary.ResolveOperator): My previous bug fix had
+ the error reporting done in the wrong place. Fix.
+
+ * expression.cs (Binary.ResolveOperator): Catch the
+ operator + (E x, E y) error earlier, and later allow for implicit
+ conversions in operator +/- (E e, U x) from U to the underlying
+ type of E.
+
+ * class.cs (TypeContainer.DefineDefaultConstructor): Fix bug
+ 52596, if the container class is abstract, the default constructor
+ is protected otherwise its public (before, we were always public).
+
+ * statement.cs (Fixed.Resolve): Catch a couple more errors in the
+ fixed statement.
+
+ (Using.EmitLocalVariableDecls): Applied patch from Benjamin
+ Jemlich that fixes bug #52597, MCS was generating invalid code for
+ idisposable structs. Thanks to Ben for following up with this
+ bug as well.
+
+2004-01-06 Miguel de Icaza <miguel@ximian.com>
+
+ * driver.cs: Allow assemblies without code to be generated, fixes
+ 52230.
+
+2004-01-07 Nick Drochak <ndrochak@gol.com>
+
+ * attribute.cs: Remove unneeded catch variables. Eliminates a warning.
+
+2004-01-05 Miguel de Icaza <miguel@ximian.com>
+
+ * cs-parser.jay: Add rules to improve error reporting if fields or
+ methods are declared at the namespace level (error 116)
+
+ * Add rules to catch event add/remove
+
+2004-01-04 David Sheldon <dave-mono@earth.li>
+
+ * expression.cs: Added matching ")" to error message for
+ CS0077
+
+2004-01-03 Todd Berman <tberman@gentoo.org>
+
+ * ecore.cs, attribute.cs:
+ Applying fix from #52429.
+
+2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
+
+ * ecore.cs, expression.cs, statement.cs:
+ Total rewrite of how we handle branching. We
+ now handle complex boolean expressions with fewer
+ jumps. As well if (x == 0) no longer emits a ceq.
+
+ if (x is Foo) is much faster now, because we generate
+ better code.
+
+ Overall, we get a pretty big improvement on our benchmark
+ tests. The code we generate is smaller and more readable.
+
+ I did a full two-stage bootstrap. The patch was reviewed
+ by Martin and Miguel.
+
+2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
+
+ * cs-parser.jay: Make primary_expression not take a QI.
+ we dont need this because the member_access rule covers
+ us here. So we replace the rule with just IDENTIFIER.
+
+ This has two good effects. First, we remove a s/r conflict.
+ Second, we allocate many fewer QualifiedIdentifier objects.
+
+2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
+
+ * attribute.cs: Handle MarshalAs attributes as pseudo, and
+ set the correct information via SRE. This prevents
+ hanging on the MS runtime. Fixes #29374.
+
+2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
+
+ * convert.cs: correctly handle conversions to value types
+ from Enum and ValueType as unboxing conversions.
+
+ Fixes bug #52569. Patch by Benjamin Jemlich.
+
+2004-01-02 Ravi Pratap <ravi@ximian.com>
+
+ * expression.cs (BetterConversion): Prefer int -> uint
+ over int -> ulong (csc's behaviour). This fixed bug #52046.
+
+2004-01-02 Ben Maurer <bmaurer@users.sourceforge.net>
+
+ * decl.cs (MemberCache.FindMembers): now returns a
+ MemberInfo [].
+
+ * typemanager.cs: In general, go with with ^^.
+ (CopyNewMethods): take an IList.
+ (RealMemberLookup): Only allocate an arraylist
+ if we copy from two sets of methods.
+
+ This change basically does two things:
+ 1) Fewer array lists allocated due to CopyNewMethods.
+ 2) the explicit cast in MemberList costed ALOT.
+
+2004-01-02 Zoltan Varga <vargaz@freemail.hu>
+
+ * cs-tokenizer.cs (consume_identifier) driver.cs: Cache identifiers in
+ a hashtable to avoid needless string allocations when an identifier is
+ used more than once (the common case).
+
+2004-01-01 Ben Maurer <bmaurer@users.sourceforge.net>
+
+ * pending.cs: MS's TypeBuilder.GetInterfaces ()
+ is broken, it will not return anything. So, we
+ have to use the information we have in mcs to
+ do the task.
+
+ * typemanager.cs: Add a cache for GetInterfaces,
+ since this will now be used more often (due to ^^)
+
+ (GetExplicitInterfaces) New method that gets the
+ declared, not effective, interfaces on a type
+ builder (eg, if you have interface IFoo, interface
+ IBar, Foo : IFoo, Bar : Foo, IBar, GetExplInt (Bar) ==
+ { IBar }.
+
+ This patch makes MCS able to bootstrap itself on
+ Windows again.
+
+2004-01-01 Ben Maurer <bmaurer@users.sourceforge.net>
+
+ * expression.cs: Remove the Nop's that Miguel put
+ in by mistake.
+
+2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
+
+ * report.cs, codegen.cs: Give the real stack trace to
+ the error when an exception is thrown.
+
+2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
+
+ * decl.cs: only allocate hashtables for ifaces if
+ it is an iface!
+
+2003-12-31 Ben Maurer <bmaurer@users.sourceforge.net>
+
+ * expression.cs: fix the error from cs0121-2.cs
+ (a parent interface has two child interfaces that
+ have a function with the same name and 0 params
+ and the function is called through the parent).
+
+2003-12-30 Ben Maurer <bmaurer@users.sourceforge.net>
+
+ * class.cs, rootcontext.cs, typmanager.cs: do not
+ leak pointers.
+
+2003-12-28 Ben Maurer <bmaurer@users.sourceforge.net>
+
+ * codegen.cs: remove stack for the ec flow branching.
+ It is already a linked list, so no need.
+
+2003-12-27 Ben Maurer <bmaurer@users.sourceforge.net>
+
+ * Makefile: Allow custom profiler here.
+
+2003-12-26 Ben Maurer <bmaurer@users.sourceforge.net>
+
+ * typemanager.cs (LookupType):
+ - Use a static char [], because split takes
+ a param array for args, so it was allocating
+ every time.
+ - Do not store true in a hashtable, it boxes.
+
+2003-12-26 Ben Maurer <bmaurer@users.sourceforge.net>
+
+ * flowanalysis.cs: bytify common enums.
+
+2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
+
+ * modifiers.cs: Add a new set of flags for the
+ flags allowed on explicit interface impls.
+ * cs-parser.jay: catch the use of modifiers in
+ interfaces correctly.
+ * class.cs: catch private void IFoo.Blah ().
+
+ All related to bug #50572.
+
+2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
+
+ * decl.cs: Rewrite the consistant accessability checking.
+ Accessability is not linear, it must be implemented in
+ a tableish way. Fixes #49704.
+
+2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
+
+ * expression.cs: Handle negation in a checked context.
+ We must use subtraction from zero. Fixes #38674.
+
+2003-12-23 Ben Maurer <bmaurer@users.sourceforge.net>
+
+ * class.cs: Ignore static void main in DLLs.
+ * rootcontext.cs: Handle the target type here,
+ since we are have to access it from class.cs
+ * driver.cs: account for the above.
+
+2003-12-23 Ben Maurer <bmaurer@users.sourceforge.net>
+
+ * report.cs: Give line numbers and files if available.
+
+2003-12-20 Zoltan Varga <vargaz@freemail.hu>
+
+ * driver.cs: Implement /addmodule.
+
+ * typemanager.cs: Change 'modules' field so it now contains Modules not
+ ModuleBuilders.
+
+2003-12-20 Martin Baulig <martin@ximian.com>
+
+ * class.cs (TypeContainer.DefineMembers): Don't do the CS0649 check here.
+ (FieldBase.IsAssigned): Removed this field.
+ (FieldBase.SetAssigned): New public method.
+ (TypeContainer.Emit): Make the CS0169/CS0649 checks actually work.
+
+2003-12-20 Martin Baulig <martin@ximian.com>
+
+ * expression.cs (LocalVariableReference.DoResolve): Don't set
+ `vi.Used' if we're called from DoResolveLValue().
+
+ * statement.cs (Block.DoResolve): `ec.DoEndFlowBranching()' now
+ returns the usage vector it just merged into the current one -
+ pass this one to UsageWarning().
+ (Block.UsageWarning): Take the `FlowBranching.UsageVector' instead
+ of the `EmitContext', don't call this recursively on our children.
+
+2003-12-19 Zoltan Varga <vargaz@freemail.hu>
+
+ * driver.cs: Implement /target:module.
+
+2003-12-18 Zoltan Varga <vargaz@freemail.hu>
+
+ * support.cs (CharArrayHashtable): New helper class.
+
+ * cs-tokenizer.cs: Store keywords in a hashtable indexed by
+ char arrays, not strings, so we can avoid creating a string in
+ consume_identifier if the identifier is a keyword.
+
+2003-12-16 Martin Baulig <martin@ximian.com>
+
+ * statement.cs (LocalInfo.Assigned): Removed this property.
+ (LocalInfo.Flags): Removed `Assigned'.
+ (LocalInfo.IsAssigned): New public method; takes the EmitContext
+ and uses flow analysis.
+ (Block.UsageWarning): Made this method private.
+ (Block.Resolve): Call UsageWarning() if appropriate.
+
+ * expression.cs (LocalVariableReference.DoResolve): Always set
+ LocalInfo.Used here.
+
+2003-12-13 Martin Baulig <martin@ximian.com>
+
+ * statement.cs (Statement.DoEmit, Statement.Emit): Don't return
+ any value here; we're now using flow analysis to figure out
+ whether a statement/block returns a value.
+
+2003-12-13 Martin Baulig <martin@ximian.com>
+
+ * flowanalysis.cs (UsageVector.MergeFinallyOrigins): Made this
+ working again.
+ (FlowBranching.MergeFinally): Don't call
+ `branching.CheckOutParameters()' here, this is called in
+ MergeTopBlock().
+ (FlowBranchingException.AddSibling): Call MergeFinallyOrigins()
+ when adding the `finally' vector.
+
+2003-12-13 Martin Baulig <martin@ximian.com>
+
+ * flowanalysis.cs
+ (UsageVector.MergeJumpOrigins, FlowBranching.Label): Make this
+ actually work and also fix #48962.
+
+2003-12-12 Ben Maurer <bmaurer@users.sourceforge.net>
+
+ * decl.cs: Do not check System.Object for nested types,
+ since we know it does not have any. Big bang for buck:
+
+ BEFORE:
+ Run 1: 8.35 seconds
+ Run 2: 8.32 seconds
+ corlib: 17.99 seconds
+ AFTER:
+ Run 1: 8.17 seconds
+ Run 2: 8.17 seconds
+ corlib: 17.39 seconds
+
+2003-12-11 Ben Maurer <bmaurer@users.sourceforge.net>
+
+ * class.cs (FindMembers): Allocate arraylists on demand. Most of the
+ time we are returning 0 members, so we save alot here.
+
+2003-12-11 Martin Baulig <martin@ximian.com>
+
+ * flowanalysis.cs (UsageVector.MergeResult): Renamed this back to
+ `MergeChild()', also just take the `FlowBranching' as argument;
+ call Merge() on it and return the result.
+ (FlowBranching.Merge): We don't need to do anything if we just
+ have one sibling.
+
+2003-12-11 Martin Baulig <martin@ximian.com>
+
+ * flowanalysis.cs: Use a list of `UsageVector's instead of storing
+ them in an `ArrayList' to reduce memory usage. Thanks to Ben
+ Maurer for this idea.
+
+2003-12-11 Martin Baulig <martin@ximian.com>
+
+ * flowanalysis.cs (MergeResult): This class is now gone; we now
+ use the `UsageVector' for this. The reason for this is that if a
+ branching just has one sibling, we don't need to "merge" them at
+ all - that's the next step to do.
+ (FlowBranching.Merge): We now return a `UsageVector' instead of a
+ `MergeResult'.
+
+2003-12-11 Martin Baulig <martin@ximian.com>
+
+ Reworked flow analyis and made it more precise and bug-free. The
+ most important change is that we're now using a special `Reachability'
+ class instead of having "magic" meanings of `FlowReturns'. I'll
+ do some more cleanups and optimizations and also add some more
+ documentation this week.
+
+ * flowanalysis.cs (Reachability): Added `Throws' and `Barrier';
+ largely reworked this class.
+ (FlowReturns): Removed `Unreachable' and `Exception'; we now use
+ the new `Reachability' class instead of having "magic" values here.
+ (FlowBranching): We're now using an instance of `Reachability'
+ instead of having separate `Returns', `Breaks' etc. fields.
+
+ * codegen.cs (EmitContext.EmitTopBlock): Set `has_ret' solely
+ based on flow analysis; ignore the return value of block.Emit ().
+
+2003-12-10 Zoltan Varga <vargaz@freemail.hu>
+
+ * driver.cs typemanager.cs: Find the mono extensions to corlib even
+ if they are private.
+
+2003-12-09 Martin Baulig <martin@ximian.com>
+
+ * flowanalyis.cs (FlowBranching.Return, Goto, Throw): Removed;
+ call them directly on the UsageVector.
+
+2003-12-09 Martin Baulig <martin@ximian.com>
+
+ * flowanalysis.cs (FlowBranching.MergeChild, MergeTopBlock):
+ Changed return type from `FlowReturns' to `Reachability'.
+
+2003-12-09 Martin Baulig <martin@ximian.com>
+
+ * flowanalysis.cs (FlowBranching.Reachability): New sealed class.
+ (FlowBranching.MergeResult): Replaced the `Returns', `Breaks' and
+ `Reachable' fields with a single `Reachability' one.
+
+2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
+
+ * class.cs (FindMembers): Remove foreach's.
+
+ Bootstrap times:
+
+ BEFORE
+ Run 1: 8.74 seconds
+ Run 2: 8.71 seconds
+
+ AFTER
+ Run 1: 8.64 seconds
+ Run 2: 8.58 seconds
+
+
+2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
+
+ * cs-parser.jay:
+ * gen-treedump.cs:
+ * statement.cs:
+ This patch does a few things:
+ 1. EmptyStatement is now a singleton, so it is never reallocated.
+ 2. All blah is EmptyStatement constructs have been changed to
+ blah == EmptyStatement.Value, which is much faster and valid
+ now that EmptyStatement is a singleton.
+ 3. When resolving a block, rather than allocating a new array for
+ the non-empty statements, empty statements are replaced with
+ EmptyStatement.Value
+ 4. Some recursive functions have been made non-recursive.
+ Mainly the performance impact is from (3), however (1) and (2) are needed for
+ this to work. (4) does not make a big difference in normal situations, however
+ it makes the profile look saner.
+
+ Bootstrap times:
+
+ BEFORE
+ 9.25user 0.23system 0:10.28elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k
+ 9.34user 0.13system 0:10.23elapsed 92%CPU (0avgtext+0avgdata 0maxresident)k
+ Total memory allocated: 56397 KB
+
+ AFTER
+ 9.13user 0.09system 0:09.64elapsed 95%CPU (0avgtext+0avgdata 0maxresident)k
+ 8.96user 0.24system 0:10.13elapsed 90%CPU (0avgtext+0avgdata 0maxresident)k
+ Total memory allocated: 55666 KB
+
+2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
+
+ * support.cs: Rewrite DoubleHash to use its own impl. Is faster
+ than the hashtable in a hashtable version
+
+ * decl.cs: Right now, whenever we try to lookup a type inside a namespace,
+ we always end up concating a string. This results in a huge perf
+ loss, because many strings have to be tracked by the GC. In this
+ patch, we first use a hashtable that works with two keys, so that
+ the strings do not need to be concat'ed.
+
+ Bootstrap times:
+ BEFORE
+ Run 1: 8.74 seconds
+ Run 2: 8.71 seconds
+
+ AFTER
+ Run 1: 8.65 seconds
+ Run 2: 8.56 seconds
+
+2003-12-08 Ben Maurer <bmaurer@users.sourceforge.net>
+
+ * Makefile: Add a new target `do-time' that does a quick and simple
+ profile, leaving easy to parse output.
+
+2003-12-08 Zoltan Varga <vargaz@freemail.hu>
+
+ * codegen.cs (Init): Create the dynamic assembly with
+ AssemblyBuilderAccess.Save, to enable some optimizations in the runtime.
+
+2003-12-02 Ben Maurer <bmaurer@users.sourceforge.net>
+
+ * support.cs: Make the PtrHashtable use only one
+ instance of its comparer.
+
+2003-11-30 Zoltan Varga <vargaz@freemail.hu>
+
+ * typemanager.cs: Fix lookup of GetNamespaces.
+
+2003-11-29 Miguel de Icaza <miguel@ximian.com>
+
+ * expression.cs: Removed redundant line.
+
+ * statement.cs (Block.Resolve, Block.Emit): Avoid foreach on
+ ArrayLists, use for loops with bounds.
+
+ * flowanalysis.cs (FlowBranching.Merge): Avoid foreach on
+ arraylist.
+
+ * expression.cs (Invocation.OverloadResolve): Avoid foreach on
+ arraylists, use for loop with bounds.
+
+ The above three changes give us a 0.071 second performance
+ improvement out of 3.294 seconds down to 3.223. On my machine
+ the above changes reduced the memory usage by 1,387 KB during
+ compiler bootstrap.
+
+ * cs-parser.jay (QualifiedIdentifier): New class used to represent
+ QualifiedIdentifiers. Before we created a new string through
+ concatenation, and mostly later on, the result would be
+ manipulated by DecomposeQI through string manipulation.
+
+ This reduced the compiler memory usage for bootstrapping from
+ 59380 KB to 59007 KB on my machine, 373 KB, and also reduced the
+ compile times in 0.05 seconds.
+
+2003-11-28 Dick Porter <dick@ximian.com>
+
+ * support.cs: Do string compares with the Invariant culture.
+
+ * rootcontext.cs:
+ * gen-treedump.cs:
+ * expression.cs:
+ * driver.cs:
+ * decl.cs:
+ * codegen.cs:
+ * class.cs: Use the char forms of IndexOf and LastIndexOf, so that
+ the comparison is done with the Invariant culture.
+
+2003-11-27 Miguel de Icaza <miguel@ximian.com>
+
+ * statement.cs (Foreach.TryType): Use DeclaredOnly to find the
+ GetEnumerator method.
+
+ (ProbeCollectionType): Iterate starting at the most specific type
+ upwards looking for a GetEnumerator
+
+ * expression.cs: Shift count can be up to 31 for int/uint and 63
+ for long/ulong.
+
+2003-11-26 Miguel de Icaza <miguel@ximian.com>
+
+ * statement.cs (Block.LookupLabel): Also look for the label on the
+ children blocks. Use a hash table to keep track of visited
+ nodes.
+
+ * cfold.cs (IntConstant to UIntConstant mapping): Only return if
+ we actually did transform the other operand, otherwise fall back
+ to the common codepath that casts to long.
+
+ * cs-tokenizer.cs: Use the same code pattern as the int case.
+ Maybe I should do the parsing myself, and avoid depending on the
+ Parse routines to get this done.
+
+2003-11-25 Miguel de Icaza <miguel@ximian.com>
+
+ * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),
+ which fixes bug 51347. This time test it.
+
+ * expression.cs: Make TypeOfVoid derive from TypeOf, so code in
+ attributes for example can not tell the difference between these.
+ The difference was only a syntax feature of the language.
+
+ * attribute.cs: Apply attributes to delegates.
+
+ * delegate.cs: Call the apply attributes method.
+
+2003-11-24 Miguel de Icaza <miguel@ximian.com>
+
+ * convert.cs (TryImplicitIntConversion): One line bug fix: we were
+ comparing 0 vs Byte.MinValue, not the value
+
+ (ImplicitConversionRequired): When reporting a conversion error,
+ use error 31 to print out the constant error instead of the
+ simpler 29.
+
+ * expression.cs: Apply fix from l_m@pacbell.net (Laurent Morichetti),
+ which fixes bug 51347.
+
+2003-11-22 Miguel de Icaza <miguel@ximian.com>
+
+ * driver.cs: Applied patch from gert.driesen@pandora.be (Gert Driesen)
+ which fixes the -warnaserror command line option.
+
+2003-11-21 Miguel de Icaza <miguel@ximian.com>
+
+ * cfold.cs (DoNumericPromotions): During constant folding of
+ additions on UIntConstant, special case intconstants with
+ IntConstants like we do on the expression binary operator.
+
+2003-11-12 Miguel de Icaza <miguel@ximian.com>
+
+ * convert.cs (ImplicitReferenceConversion): We were missing a case
+ (System.Enum are not value types or class types, so we need to
+ classify them separatedly).
+
+ * driver.cs: We do not support error 2007.
+
+2003-11-12 Jackson Harper <jackson@ximian.com>
+
+ * driver.cs: Use corlib.dll or mscorlib.dll when looking up the
+ system directory. Also use the full file name so users can
+ libraries names mscorlib-o-tron.dll in a non system dir.
+
+2004-01-04 David Sheldon <dave-mono@earth.li>
+
+ * expression.cs: Added matching ")" to error message for CS0077.
+
2003-12-19 Martin Baulig <martin@ximian.com>
* typemanager.cs (TypeManager.IsEqualGenericType): New public
diff --git a/mcs/gmcs/Makefile b/mcs/gmcs/Makefile
index d379bf3a969..97b722ba142 100644
--- a/mcs/gmcs/Makefile
+++ b/mcs/gmcs/Makefile
@@ -93,5 +93,27 @@ ctest:
-rm mcs2.exe mcs3.exe
make btest USE_MCS_FLAGS=
+# we need this because bash tries to use its own crappy timer
+FRIENDLY_TIME = $(shell which time) -f'%U seconds'
+
+do-time : mcs.exe
+ @ echo -n "Run 1: "
+ @ $(FRIENDLY_TIME) $(RUNTIME) ./mcs.exe $(USE_MCS_FLAGS) /target:exe /out:mcs2.exe $(all_sources) > /dev/null || (echo FAILED; exit 1)
+ @ echo -n "Run 2: "
+ @ $(FRIENDLY_TIME) $(RUNTIME) ./mcs2.exe $(USE_MCS_FLAGS) /target:exe /out:mcs3.exe $(all_sources) > /dev/null || (echo FAILED; exit 1)
+ @ echo -n "corlib: "
+ @ rm -f ../class/lib/mscorlib.dll
+ @ (cd ../class/corlib ; make BOOTSTRAP_MCS="$(FRIENDLY_TIME) mono ../../mcs/mcs.exe" > /dev/null ) || (echo FAILED; exit 1)
+
+do-corlib:
+ @ echo -n "corlib: "
+ @ rm -f ../class/lib/mscorlib.dll
+ @ (cd ../class/corlib ; make BOOTSTRAP_MCS="$(FRIENDLY_TIME) mono ../../mcs/mcs.exe" > /dev/null ) || (echo FAILED; exit 1)
+
+PROFILER=default
+
+profile : mcs.exe
+ $(RUNTIME) --profile=$(PROFILER) ./mcs.exe $(USE_MCS_FLAGS) /target:exe /out:mcs2.exe $(all_sources)
+
response:
echo $(all_sources) > res
diff --git a/mcs/gmcs/assign.cs b/mcs/gmcs/assign.cs
index b489fc60d27..ff3521059bf 100755
--- a/mcs/gmcs/assign.cs
+++ b/mcs/gmcs/assign.cs
@@ -262,9 +262,10 @@ namespace Mono.CSharp {
if ((source.eclass == ExprClass.Type) && (source is TypeExpr)) {
source.Error_UnexpectedKind ("variable or value");
return null;
- } else if (source is MethodGroupExpr){
+ } else if (!RootContext.V2 && (source is MethodGroupExpr)){
((MethodGroupExpr) source).ReportUsageError ();
return null;
+
}
if (target_type == source_type)
@@ -303,7 +304,7 @@ namespace Mono.CSharp {
return null;
}
}
-
+
source = Convert.ImplicitConversionRequired (ec, source, target_type, loc);
if (source == null)
return null;
@@ -378,10 +379,8 @@ namespace Mono.CSharp {
//
IAssignMethod am = (IAssignMethod) target;
- if (this is CompoundAssign){
+ if (this is CompoundAssign)
am.CacheTemporaries (ec);
- use_temporaries = true;
- }
if (!is_statement)
use_temporaries = true;
diff --git a/mcs/gmcs/attribute.cs b/mcs/gmcs/attribute.cs
index a0b6b1100a6..0605282a645 100644
--- a/mcs/gmcs/attribute.cs
+++ b/mcs/gmcs/attribute.cs
@@ -150,6 +150,12 @@ namespace Mono.CSharp {
result = ((ArrayCreation) e).EncodeAsAttribute ();
if (result != null)
return true;
+ } else if (e is EmptyCast) {
+ result = e;
+ if (((EmptyCast) e).Child is Constant) {
+ result = ((Constant) ((EmptyCast)e).Child).GetValue();
+ }
+ return true;
}
result = null;
@@ -306,6 +312,8 @@ namespace Mono.CSharp {
} else if (e is TypeOf) {
prop_values.Add (((TypeOf) e).TypeArg);
+ } else if (e is ArrayCreation) {
+ prop_values.Add (((ArrayCreation) e).EncodeAsAttribute());
} else {
Error_AttributeArgumentNotValid (Location);
return null;
@@ -776,27 +784,37 @@ namespace Mono.CSharp {
static UnmanagedMarshal GetMarshal (Attribute a)
{
- UnmanagedMarshal marshal;
-
- if (a.UnmanagedType == UnmanagedType.CustomMarshaler) {
+ object o = GetFieldValue (a, "ArraySubType");
+ UnmanagedType array_sub_type = o == null ? UnmanagedType.I4 : (UnmanagedType) o;
+ switch (a.UnmanagedType) {
+ case UnmanagedType.CustomMarshaler:
MethodInfo define_custom = typeof (UnmanagedMarshal).GetMethod ("DefineCustom",
BindingFlags.Static | BindingFlags.Public);
- if (define_custom == null) {
+ if (define_custom == null)
return null;
- }
- object[] args = new object [4];
+
+ object [] args = new object [4];
args [0] = GetFieldValue (a, "MarshalTypeRef");
args [1] = GetFieldValue (a, "MarshalCookie");
args [2] = GetFieldValue (a, "MarshalType");
args [3] = Guid.Empty;
- marshal = (UnmanagedMarshal) define_custom.Invoke (null, args);
- /*
- * need to special case other special marshal types
- */
- } else {
- marshal = UnmanagedMarshal.DefineUnmanagedMarshal (a.UnmanagedType);
+ return (UnmanagedMarshal) define_custom.Invoke (null, args);
+
+ case UnmanagedType.LPArray:
+ return UnmanagedMarshal.DefineLPArray (array_sub_type);
+
+ case UnmanagedType.SafeArray:
+ return UnmanagedMarshal.DefineSafeArray (array_sub_type);
+
+ case UnmanagedType.ByValArray:
+ return UnmanagedMarshal.DefineByValArray ((int) GetFieldValue (a, "SizeConst"));
+
+ case UnmanagedType.ByValTStr:
+ return UnmanagedMarshal.DefineByValTStr ((int) GetFieldValue (a, "SizeConst"));
+
+ default:
+ return UnmanagedMarshal.DefineUnmanagedMarshal (a.UnmanagedType);
}
- return marshal;
}
/// <summary>
@@ -867,7 +885,18 @@ namespace Mono.CSharp {
} else if (kind is Constructor) {
((ConstructorBuilder) builder).SetCustomAttribute (cb);
} else if (kind is Field) {
- ((FieldBuilder) builder).SetCustomAttribute (cb);
+ if (attr_type == TypeManager.marshal_as_attr_type) {
+ UnmanagedMarshal marshal = GetMarshal (a);
+ if (marshal == null) {
+ Report.Warning (-24, loc,
+ "The Microsoft Runtime cannot set this marshal info. " +
+ "Please use the Mono runtime instead.");
+ } else {
+ ((FieldBuilder) builder).SetMarshal (marshal);
+ }
+ } else {
+ ((FieldBuilder) builder).SetCustomAttribute (cb);
+ }
} else if (kind is Property || kind is Indexer ||
kind is InterfaceProperty || kind is InterfaceIndexer) {
((PropertyBuilder) builder).SetCustomAttribute (cb);
@@ -927,7 +956,23 @@ namespace Mono.CSharp {
try {
((TypeBuilder) builder).SetCustomAttribute (cb);
- } catch (System.ArgumentException e) {
+ } catch (System.ArgumentException) {
+ Report.Warning (
+ -21, loc,
+ "The CharSet named property on StructLayout\n"+
+ "\tdoes not work correctly on Microsoft.NET\n"+
+ "\tYou might want to remove the CharSet declaration\n"+
+ "\tor compile using the Mono runtime instead of the\n"+
+ "\tMicrosoft .NET runtime");
+ }
+ } else if (kind is Delegate){
+ if (!CheckAttributeTarget (a, kind)) {
+ Error_AttributeNotValidForElement (a, loc);
+ return;
+ }
+ try {
+ ((TypeBuilder) builder).SetCustomAttribute (cb);
+ } catch (System.ArgumentException) {
Report.Warning (
-21, loc,
"The CharSet named property on StructLayout\n"+
@@ -936,7 +981,6 @@ namespace Mono.CSharp {
"\tor compile using the Mono runtime instead of the\n"+
"\tMicrosoft .NET runtime");
}
-
} else if (kind is Interface) {
Interface iface = (Interface) kind;
@@ -1036,7 +1080,9 @@ namespace Mono.CSharp {
CallingConvention cc = CallingConvention.Winapi;
CharSet charset = CharSet.Ansi;
bool preserve_sig = true;
+#if FIXME
bool exact_spelling = false;
+#endif
bool set_last_err = false;
string entry_point = null;
@@ -1081,8 +1127,10 @@ namespace Mono.CSharp {
entry_point = (string) c.GetValue ();
else if (member_name == "SetLastError")
set_last_err = (bool) c.GetValue ();
+#if FIXME
else if (member_name == "ExactSpelling")
exact_spelling = (bool) c.GetValue ();
+#endif
else if (member_name == "PreserveSig")
preserve_sig = (bool) c.GetValue ();
} else {
diff --git a/mcs/gmcs/cfold.cs b/mcs/gmcs/cfold.cs
index 7d0860211da..a87f83621c7 100755
--- a/mcs/gmcs/cfold.cs
+++ b/mcs/gmcs/cfold.cs
@@ -59,16 +59,22 @@ namespace Mono.CSharp {
// converted to type ulong. or an error ocurrs if the other
// operand is of type sbyte, short, int or long
//
+#if WRONG
Constant match, other;
+#endif
if (left is ULongConstant){
+#if WRONG
other = right;
match = left;
+#endif
if (!(right is ULongConstant))
right = right.ToULong (loc);
} else {
+#if WRONG
other = left;
match = right;
+#endif
left = left.ToULong (loc);
}
@@ -98,21 +104,28 @@ namespace Mono.CSharp {
// operand is of type sbyte, short or int, the operands are
// converted to type long.
//
- Constant match, other;
- if (left is UIntConstant){
+ Constant other;
+ if (left is UIntConstant)
other = right;
- match = left;
- } else {
+ else
other = left;
- match = right;
- }
// Nothing to do.
if (other is UIntConstant)
return;
- if (other is SByteConstant || other is ShortConstant ||
- other is IntConstant){
+ IntConstant ic = other as IntConstant;
+ if (ic != null){
+ if (ic.Value >= 0){
+ if (left == other)
+ left = new UIntConstant ((uint) ic.Value);
+ else
+ right = new UIntConstant ((uint) ic.Value);
+ return;
+ }
+ }
+
+ if (other is SByteConstant || other is ShortConstant || ic != null){
left = left.ToLong (loc);
right = right.ToLong (loc);
}
@@ -180,7 +193,7 @@ namespace Mono.CSharp {
Type rt = right.Type;
Type result_type = null;
bool bool_res;
-
+
//
// Enumerator folding
//
@@ -960,7 +973,7 @@ namespace Mono.CSharp {
((StringConstant) right).Value);
}
-
+
DoConstantNumericPromotions (ec, oper, ref left, ref right, loc);
if (left == null || right == null)
return null;
diff --git a/mcs/gmcs/class.cs b/mcs/gmcs/class.cs
index 5aaa2aa3da4..f6e79ca7f2a 100755
--- a/mcs/gmcs/class.cs
+++ b/mcs/gmcs/class.cs
@@ -113,9 +113,6 @@ namespace Mono.CSharp {
ArrayList type_bases;
- // Attributes for this type
- protected Attributes attributes;
-
// Information in the case we are an attribute type
public AttributeTargets Targets = AttributeTargets.All;
@@ -134,20 +131,18 @@ namespace Mono.CSharp {
//
public string IndexerName;
- public TypeContainer (NamespaceEntry ns, TypeContainer parent, string name, Location l)
- : base (ns, parent, name, l)
+ Type GenericType;
+
+ public TypeContainer ():
+ this (null, null, "", null, new Location (-1)) {
+ }
+
+ public TypeContainer (NamespaceEntry ns, TypeContainer parent, string name, Attributes attrs, Location l)
+ : base (ns, parent, name, attrs, l)
{
- string n;
types = new ArrayList ();
- if (parent == null)
- n = "";
- else
- n = parent.Name;
-
base_class_name = null;
-
- //Console.WriteLine ("New class " + name + " inside " + n);
}
public AdditionResult AddConstant (Const constant)
@@ -245,7 +240,7 @@ namespace Mono.CSharp {
if (methods == null)
methods = new ArrayList ();
- if (method.Name.IndexOf (".") != -1)
+ if (method.Name.IndexOf ('.') != -1)
methods.Insert (0, method);
else
methods.Add (method);
@@ -357,7 +352,7 @@ namespace Mono.CSharp {
if (properties == null)
properties = new ArrayList ();
- if (prop.Name.IndexOf (".") != -1)
+ if (prop.Name.IndexOf ('.') != -1)
properties.Insert (0, prop);
else
properties.Add (prop);
@@ -507,12 +502,6 @@ namespace Mono.CSharp {
}
}
- public Attributes OptAttributes {
- get {
- return attributes;
- }
- }
-
public bool HaveStaticConstructor {
get {
return have_static_constructor;
@@ -531,7 +520,6 @@ namespace Mono.CSharp {
public bool EmitFieldInitializers (EmitContext ec)
{
ArrayList fields;
- ILGenerator ig = ec.ig;
Expression instance_expr;
if (ec.IsStatic){
@@ -582,11 +570,17 @@ namespace Mono.CSharp {
if (is_static)
mods = Modifiers.STATIC;
+ //
+ // If the class is abstract, the default constructor is protected
+ //
+ if ((ModFlags & Modifiers.ABSTRACT) != 0)
+ mods |= Modifiers.PROTECTED;
+
c.ModFlags = mods;
AddConstructor (c);
- c.Block = new Block (null);
+ c.Block = new ToplevelBlock (null, Location);
}
@@ -832,6 +826,9 @@ namespace Mono.CSharp {
}
if (IsGeneric) {
+ CurrentType = new ConstructedType (
+ Name, TypeParameters, Location);
+
foreach (TypeParameter type_param in TypeParameters)
type_param.Define (TypeBuilder);
}
@@ -1109,14 +1106,6 @@ namespace Mono.CSharp {
if (fields != null)
DefineMembers (fields, defined_names);
- if ((RootContext.WarningLevel >= 4) && (fields != null)) {
- foreach (Field f in fields) {
- if (((f.ModFlags & Modifiers.READONLY) != 0) && !f.IsAssigned)
- Report.Warning (649, "Field `" + MakeFQN (Name, f.Name) + "; is never " +
- "assigned and will ever have its default value");
- }
- }
-
if (this is Class){
if (instance_constructors == null){
if (default_constructor == null)
@@ -1178,6 +1167,13 @@ namespace Mono.CSharp {
if (delegates != null)
DefineMembers (delegates, defined_names);
+ if (CurrentType != null) {
+ GenericType = CurrentType.ResolveType (ec);
+
+ ec.ContainerType = GenericType;
+ }
+
+
#if CACHE
if (TypeBuilder.BaseType != null)
parent_container = TypeManager.LookupMemberContainer (TypeBuilder.BaseType);
@@ -1248,7 +1244,7 @@ namespace Mono.CSharp {
public override MemberList FindMembers (MemberTypes mt, BindingFlags bf,
MemberFilter filter, object criteria)
{
- ArrayList members = new ArrayList ();
+ ArrayList members = null;
int modflags = 0;
if ((bf & BindingFlags.Public) != 0)
@@ -1280,35 +1276,52 @@ namespace Mono.CSharp {
if ((mt & MemberTypes.Field) != 0) {
if (fields != null) {
- foreach (Field f in fields) {
+ int len = fields.Count;
+ for (int i = 0; i < len; i++) {
+ Field f = (Field) fields [i];
+
if ((f.ModFlags & modflags) == 0)
continue;
if ((f.ModFlags & static_mask) != static_flags)
continue;
FieldBuilder fb = f.FieldBuilder;
- if (fb != null && filter (fb, criteria) == true)
+ if (fb != null && filter (fb, criteria) == true) {
+ if (members == null)
+ members = new ArrayList ();
+
members.Add (fb);
}
}
+ }
if (constants != null) {
- foreach (Const con in constants) {
+ int len = constants.Count;
+ for (int i = 0; i < len; i++) {
+ Const con = (Const) constants [i];
+
if ((con.ModFlags & modflags) == 0)
continue;
if ((con.ModFlags & static_mask) != static_flags)
continue;
FieldBuilder fb = con.FieldBuilder;
- if (fb != null && filter (fb, criteria) == true)
+ if (fb != null && filter (fb, criteria) == true) {
+ if (members == null)
+ members = new ArrayList ();
+
members.Add (fb);
}
}
}
+ }
if ((mt & MemberTypes.Method) != 0) {
if (methods != null) {
- foreach (Method m in methods) {
+ int len = methods.Count;
+ for (int i = 0; i < len; i++) {
+ Method m = (Method) methods [i];
+
if ((m.ModFlags & modflags) == 0)
continue;
if ((m.ModFlags & static_mask) != static_flags)
@@ -1316,26 +1329,40 @@ namespace Mono.CSharp {
MethodBuilder mb = m.MethodBuilder;
- if (mb != null && filter (mb, criteria) == true)
+ if (mb != null && filter (mb, criteria) == true) {
+ if (members == null)
+ members = new ArrayList ();
+
members.Add (mb);
}
}
+ }
+
+ if (operators != null) {
+ int len = operators.Count;
+ for (int i = 0; i < len; i++) {
+ Operator o = (Operator) operators [i];
- if (operators != null){
- foreach (Operator o in operators) {
if ((o.ModFlags & modflags) == 0)
continue;
if ((o.ModFlags & static_mask) != static_flags)
continue;
MethodBuilder ob = o.OperatorMethodBuilder;
- if (ob != null && filter (ob, criteria) == true)
+ if (ob != null && filter (ob, criteria) == true) {
+ if (members == null)
+ members = new ArrayList ();
+
members.Add (ob);
}
}
+ }
+
+ if (properties != null) {
+ int len = properties.Count;
+ for (int i = 0; i < len; i++) {
+ Property p = (Property) properties [i];
- if (properties != null){
- foreach (Property p in properties){
if ((p.ModFlags & modflags) == 0)
continue;
if ((p.ModFlags & static_mask) != static_flags)
@@ -1344,17 +1371,28 @@ namespace Mono.CSharp {
MethodBuilder b;
b = p.GetBuilder;
- if (b != null && filter (b, criteria) == true)
+ if (b != null && filter (b, criteria) == true) {
+ if (members == null)
+ members = new ArrayList ();
+
members.Add (b);
+ }
b = p.SetBuilder;
- if (b != null && filter (b, criteria) == true)
+ if (b != null && filter (b, criteria) == true) {
+ if (members == null)
+ members = new ArrayList ();
+
members.Add (b);
}
}
+ }
+
+ if (indexers != null) {
+ int len = indexers.Count;
+ for (int i = 0; i < len; i++) {
+ Indexer ix = (Indexer) indexers [i];
- if (indexers != null){
- foreach (Indexer ix in indexers){
if ((ix.ModFlags & modflags) == 0)
continue;
if ((ix.ModFlags & static_mask) != static_flags)
@@ -1363,33 +1401,52 @@ namespace Mono.CSharp {
MethodBuilder b;
b = ix.GetBuilder;
- if (b != null && filter (b, criteria) == true)
+ if (b != null && filter (b, criteria) == true) {
+ if (members == null)
+ members = new ArrayList ();
+
members.Add (b);
+ }
b = ix.SetBuilder;
- if (b != null && filter (b, criteria) == true)
+ if (b != null && filter (b, criteria) == true) {
+ if (members == null)
+ members = new ArrayList ();
+
members.Add (b);
}
}
}
+ }
if ((mt & MemberTypes.Event) != 0) {
- if (events != null)
- foreach (Event e in events) {
+ if (events != null) {
+ int len = events.Count;
+ for (int i = 0; i < len; i++) {
+ Event e = (Event) events [i];
+
if ((e.ModFlags & modflags) == 0)
continue;
if ((e.ModFlags & static_mask) != static_flags)
continue;
MemberInfo eb = e.EventBuilder;
- if (eb != null && filter (eb, criteria) == true)
+ if (eb != null && filter (eb, criteria) == true) {
+ if (members == null)
+ members = new ArrayList ();
+
members.Add (e.EventBuilder);
}
}
+ }
+ }
if ((mt & MemberTypes.Property) != 0){
- if (properties != null)
- foreach (Property p in properties) {
+ if (properties != null) {
+ int len = properties.Count;
+ for (int i = 0; i < len; i++) {
+ Property p = (Property) properties [i];
+
if ((p.ModFlags & modflags) == 0)
continue;
if ((p.ModFlags & static_mask) != static_flags)
@@ -1397,12 +1454,19 @@ namespace Mono.CSharp {
MemberInfo pb = p.PropertyBuilder;
if (pb != null && filter (pb, criteria) == true) {
+ if (members == null)
+ members = new ArrayList ();
+
members.Add (p.PropertyBuilder);
}
}
+ }
+
+ if (indexers != null) {
+ int len = indexers.Count;
+ for (int i = 0; i < len; i++) {
+ Indexer ix = (Indexer) indexers [i];
- if (indexers != null)
- foreach (Indexer ix in indexers) {
if ((ix.ModFlags & modflags) == 0)
continue;
if ((ix.ModFlags & static_mask) != static_flags)
@@ -1410,87 +1474,136 @@ namespace Mono.CSharp {
MemberInfo ib = ix.PropertyBuilder;
if (ib != null && filter (ib, criteria) == true) {
+ if (members == null)
+ members = new ArrayList ();
+
members.Add (ix.PropertyBuilder);
}
}
}
+ }
if ((mt & MemberTypes.NestedType) != 0) {
- if (types != null){
- foreach (TypeContainer t in types) {
+ if (types != null) {
+ int len = types.Count;
+ for (int i = 0; i < len; i++) {
+ TypeContainer t = (TypeContainer) types [i];
+
if ((t.ModFlags & modflags) == 0)
continue;
TypeBuilder tb = t.TypeBuilder;
- if (tb != null && (filter (tb, criteria) == true))
+ if (tb != null && (filter (tb, criteria) == true)) {
+ if (members == null)
+ members = new ArrayList ();
+
members.Add (tb);
}
}
+ }
+
+ if (enums != null) {
+ int len = enums.Count;
+ for (int i = 0; i < len; i++) {
+ Enum en = (Enum) enums [i];
- if (enums != null){
- foreach (Enum en in enums){
if ((en.ModFlags & modflags) == 0)
continue;
TypeBuilder tb = en.TypeBuilder;
- if (tb != null && (filter (tb, criteria) == true))
+ if (tb != null && (filter (tb, criteria) == true)) {
+ if (members == null)
+ members = new ArrayList ();
+
members.Add (tb);
}
}
+ }
+
+ if (delegates != null) {
+ int len = delegates.Count;
+ for (int i = 0; i < len; i++) {
+ Delegate d = (Delegate) delegates [i];
- if (delegates != null){
- foreach (Delegate d in delegates){
if ((d.ModFlags & modflags) == 0)
continue;
TypeBuilder tb = d.TypeBuilder;
- if (tb != null && (filter (tb, criteria) == true))
+ if (tb != null && (filter (tb, criteria) == true)) {
+ if (members == null)
+ members = new ArrayList ();
+
members.Add (tb);
}
}
+ }
+
+ if (interfaces != null) {
+ int len = interfaces.Count;
+ for (int i = 0; i < len; i++) {
+ Interface iface = (Interface) interfaces [i];
- if (interfaces != null){
- foreach (Interface iface in interfaces){
if ((iface.ModFlags & modflags) == 0)
continue;
TypeBuilder tb = iface.TypeBuilder;
- if (tb != null && (filter (tb, criteria) == true))
+ if (tb != null && (filter (tb, criteria) == true)) {
+ if (members == null)
+ members = new ArrayList ();
+
members.Add (tb);
}
}
}
+ }
if ((mt & MemberTypes.Constructor) != 0){
if (((bf & BindingFlags.Instance) != 0) && (instance_constructors != null)){
- foreach (Constructor c in instance_constructors){
+ int len = instance_constructors.Count;
+ for (int i = 0; i < len; i++) {
+ Constructor c = (Constructor) instance_constructors [i];
+
ConstructorBuilder cb = c.ConstructorBuilder;
- if (cb != null)
- if (filter (cb, criteria) == true)
+ if (cb != null && filter (cb, criteria) == true) {
+ if (members == null)
+ members = new ArrayList ();
+
members.Add (cb);
}
}
+ }
if (((bf & BindingFlags.Static) != 0) && (default_static_constructor != null)){
ConstructorBuilder cb =
default_static_constructor.ConstructorBuilder;
- if (cb != null)
- if (filter (cb, criteria) == true)
+ if (cb != null && filter (cb, criteria) == true) {
+ if (members == null)
+ members = new ArrayList ();
+
members.Add (cb);
}
}
+ }
//
// Lookup members in parent if requested.
//
if (((bf & BindingFlags.DeclaredOnly) == 0) && (TypeBuilder.BaseType != null)) {
MemberList list = FindMembers (TypeBuilder.BaseType, mt, bf, filter, criteria);
+ if (list.Count > 0) {
+ if (members == null)
+ members = new ArrayList ();
+
members.AddRange (list);
}
+ }
Timer.StopTimer (TimerType.TcFindMembers);
+ if (members == null)
+ return MemberList.Empty;
+ else
return new MemberList (members);
}
@@ -1587,10 +1700,10 @@ namespace Mono.CSharp {
if (RootContext.WarningLevel >= 3) {
if (fields != null){
foreach (Field f in fields) {
- if ((f.ModFlags & Modifiers.PUBLIC) != 0)
+ if ((f.ModFlags & Modifiers.Accessibility) != Modifiers.PRIVATE)
continue;
- if (f.status == 0){
+ if ((f.status & Field.Status.USED) == 0){
Report.Warning (
169, f.Location, "Private field " +
MakeName (f.Name) + " is never used");
@@ -1628,11 +1741,12 @@ namespace Mono.CSharp {
public override void CloseType ()
{
+ if (Created)
+ return;
+
try {
- if (!Created){
Created = true;
TypeBuilder.CreateType ();
- }
} catch (TypeLoadException){
//
// This is fine, the code still created the type
@@ -1666,6 +1780,29 @@ namespace Mono.CSharp {
if (Delegates != null)
foreach (Delegate d in Delegates)
d.CloseType ();
+
+ types = null;
+ properties = null;
+ enums = null;
+ delegates = null;
+ fields = null;
+ initialized_fields = null;
+ initialized_static_fields = null;
+ constants = null;
+ interfaces = null;
+ interface_order = null;
+ methods = null;
+ events = null;
+ indexers = null;
+ operators = null;
+ ec = null;
+ default_constructor = null;
+ default_static_constructor = null;
+ type_bases = null;
+ OptAttributes = null;
+ ifaces = null;
+ parent_container = null;
+ member_cache = null;
}
public string MakeName (string n)
@@ -1819,11 +1956,6 @@ namespace Mono.CSharp {
return true;
}
- public static void Error_ExplicitInterfaceNotMemberInterface (Location loc, string name)
- {
- Report.Error (539, loc, "Explicit implementation: `" + name + "' is not a member of the interface");
- }
-
//
// IMemberContainer
//
@@ -1860,7 +1992,13 @@ namespace Mono.CSharp {
MemberList IMemberContainer.GetMembers (MemberTypes mt, BindingFlags bf)
{
- return FindMembers (mt, bf | BindingFlags.DeclaredOnly, null, null);
+ BindingFlags new_bf = bf | BindingFlags.DeclaredOnly;
+
+ if (GenericType != null)
+ return TypeManager.FindMembers (GenericType, mt, new_bf,
+ null, null);
+ else
+ return FindMembers (mt, new_bf, null, null);
}
//
@@ -2052,7 +2190,7 @@ namespace Mono.CSharp {
Modifiers.UNSAFE;
public Class (NamespaceEntry ns, TypeContainer parent, string name, int mod, Attributes attrs, Location l)
- : base (ns, parent, name, l)
+ : base (ns, parent, name, attrs, l)
{
int accmods;
@@ -2062,7 +2200,6 @@ namespace Mono.CSharp {
accmods = Modifiers.PRIVATE;
this.ModFlags = Modifiers.Check (AllowedModifiers, mod, accmods, l);
- this.attributes = attrs;
}
//
@@ -2089,7 +2226,7 @@ namespace Mono.CSharp {
Modifiers.PRIVATE;
public Struct (NamespaceEntry ns, TypeContainer parent, string name, int mod, Attributes attrs, Location l)
- : base (ns, parent, name, l)
+ : base (ns, parent, name, attrs, l)
{
int accmods;
@@ -2101,8 +2238,6 @@ namespace Mono.CSharp {
this.ModFlags = Modifiers.Check (AllowedModifiers, mod, accmods, l);
this.ModFlags |= Modifiers.SEALED;
- this.attributes = attrs;
-
}
//
@@ -2544,7 +2679,7 @@ namespace Mono.CSharp {
// This is used to track the Entry Point,
//
if (Name == "Main" &&
- ((ModFlags & Modifiers.STATIC) != 0) &&
+ ((ModFlags & Modifiers.STATIC) != 0) && RootContext.NeedsEntryPoint &&
(RootContext.MainClass == null ||
RootContext.MainClass == container.TypeBuilder.FullName)){
if (IsEntryPoint (MethodBuilder, ParameterInfo)) {
@@ -2574,6 +2709,7 @@ namespace Mono.CSharp {
{
MethodData.Emit (container, Block, this);
Block = null;
+ MethodData = null;
}
void IIteratorContainer.SetYields ()
@@ -2607,7 +2743,7 @@ namespace Mono.CSharp {
Expression parent_constructor_group;
Type t;
- ec.CurrentBlock = new Block (null, Block.Flags.Implicit, parameters);
+ ec.CurrentBlock = new ToplevelBlock (Block.Flags.Implicit, parameters, loc);
if (argument_list != null){
foreach (Argument a in argument_list){
@@ -2683,7 +2819,6 @@ namespace Mono.CSharp {
public class Constructor : MethodCore {
public ConstructorBuilder ConstructorBuilder;
public ConstructorInitializer Initializer;
- new public Attributes OptAttributes;
// <summary>
// Modifiers allowed for a constructor.
@@ -3162,8 +3297,7 @@ namespace Mono.CSharp {
member.InterfaceType, name, ReturnType, ParameterTypes);
if (member.InterfaceType != null && implementing == null){
- TypeContainer.Error_ExplicitInterfaceNotMemberInterface (
- Location, name);
+ Report.Error (539, Location, "'{0}' in explicit interface declaration is not an interface", method_name);
return false;
}
}
@@ -3378,7 +3512,7 @@ namespace Mono.CSharp {
//
// FIXME: This code generates buggy code
//
- if (member.Name == "Finalize" && ReturnType == TypeManager.void_type)
+ if (member is Destructor)
EmitDestructor (ec, block);
else {
SymbolWriter sw = CodeGen.SymbolWriter;
@@ -3400,18 +3534,15 @@ namespace Mono.CSharp {
ILGenerator ig = ec.ig;
Label finish = ig.DefineLabel ();
- bool old_in_try = ec.InTry;
+
+ block.SetDestructor ();
ig.BeginExceptionBlock ();
- ec.InTry = true;
ec.ReturnLabel = finish;
ec.HasReturnLabel = true;
ec.EmitTopBlock (block, null, Location);
- ec.InTry = old_in_try;
// ig.MarkLabel (finish);
- bool old_in_finally = ec.InFinally;
- ec.InFinally = true;
ig.BeginFinallyBlock ();
if (ec.ContainerType.BaseType != null) {
@@ -3426,7 +3557,6 @@ namespace Mono.CSharp {
ig.Emit (OpCodes.Call, (MethodInfo) parent_destructor.Methods [0]);
}
}
- ec.InFinally = old_in_finally;
ig.EndExceptionBlock ();
//ig.MarkLabel (ec.ReturnLabel);
@@ -3434,12 +3564,22 @@ namespace Mono.CSharp {
}
}
+ public class Destructor : Method {
+
+ public Destructor (DeclSpace ds, Expression return_type, int mod, string name,
+ Parameters parameters, Attributes attrs, Location l)
+ : base (ds, return_type, mod, name, parameters, attrs, l)
+ { }
+
+ }
+
abstract public class MemberBase : MemberCore {
public Expression Type;
- public readonly Attributes OptAttributes;
protected MethodAttributes flags;
+ protected readonly int explicit_mod_flags;
+
//
// The "short" name of this property / indexer / event. This is the
// name without the explicit interface.
@@ -3481,11 +3621,11 @@ namespace Mono.CSharp {
//
protected MemberBase (Expression type, int mod, int allowed_mod, int def_mod, string name,
Attributes attrs, Location loc)
- : base (name, loc)
+ : base (name, attrs, loc)
{
+ explicit_mod_flags = mod;
Type = type;
ModFlags = Modifiers.Check (allowed_mod, mod, def_mod, loc);
- OptAttributes = attrs;
}
protected virtual bool CheckBase (TypeContainer container)
@@ -3744,8 +3884,8 @@ namespace Mono.CSharp {
//
// Check for explicit interface implementation
//
- if ((ExplicitInterfaceName == null) && (Name.IndexOf (".") != -1)){
- int pos = Name.LastIndexOf (".");
+ if ((ExplicitInterfaceName == null) && (Name.IndexOf ('.') != -1)){
+ int pos = Name.LastIndexOf ('.');
ExplicitInterfaceName = Name.Substring (0, pos);
ShortName = Name.Substring (pos + 1);
@@ -3758,12 +3898,19 @@ namespace Mono.CSharp {
if (InterfaceType == null)
return false;
+ if (InterfaceType.IsClass) {
+ Report.Error (538, Location, "'{0}' in explicit interface declaration is not an interface", ExplicitInterfaceName);
+ return false;
+ }
+
// Compute the full name that we need to export.
Name = InterfaceType.FullName + "." + ShortName;
if (!container.VerifyImplements (InterfaceType, ShortName, Name, Location))
return false;
+ Modifiers.Check (Modifiers.AllowedExplicitImplFlags, explicit_mod_flags, 0, Location);
+
IsExplicitImpl = true;
} else
IsExplicitImpl = false;
@@ -3802,8 +3949,6 @@ namespace Mono.CSharp {
}
}
- public bool IsAssigned;
-
protected readonly Object init;
// Private.
Expression init_expr;
@@ -3832,6 +3977,11 @@ namespace Mono.CSharp {
return init_expr;
}
+
+ public void SetAssigned ()
+ {
+ status |= Status.ASSIGNED;
+ }
}
//
@@ -3934,10 +4084,17 @@ namespace Mono.CSharp {
return false;
}
+ try {
FieldBuilder = container.TypeBuilder.DefineField (
Name, t, Modifiers.FieldAttr (ModFlags));
TypeManager.RegisterFieldBase (FieldBuilder, this);
+ }
+ catch (ArgumentException) {
+ Report.Warning (-24, Location, "The Microsoft runtime is unable to use [void|void*] as a field type, try using the Mono runtime.");
+ return false;
+ }
+
return true;
}
@@ -4584,8 +4741,6 @@ namespace Mono.CSharp {
//
// Are we implementing an interface ?
//
- bool IsImplementing = false;
-
public Indexer (DeclSpace ds, Expression type, string int_type, int flags,
Parameters parameters, Accessor get_block, Accessor set_block,
Attributes attrs, Location loc)
@@ -4712,11 +4867,6 @@ namespace Mono.CSharp {
}
}
- if (GetData != null)
- IsImplementing = GetData.IsImplementing;
- else if (SetData != null)
- IsImplementing = SetData.IsImplementing;
-
//
// Define the PropertyBuilder if one of the following conditions are met:
// a) we're not implementing an interface indexer.
diff --git a/mcs/gmcs/codegen.cs b/mcs/gmcs/codegen.cs
index a8c6ca296da..6e97979afc5 100755
--- a/mcs/gmcs/codegen.cs
+++ b/mcs/gmcs/codegen.cs
@@ -27,12 +27,12 @@ namespace Mono.CSharp {
public static string Basename (string name)
{
- int pos = name.LastIndexOf ("/");
+ int pos = name.LastIndexOf ('/');
if (pos != -1)
return name.Substring (pos + 1);
- pos = name.LastIndexOf ("\\");
+ pos = name.LastIndexOf ('\\');
if (pos != -1)
return name.Substring (pos + 1);
@@ -41,12 +41,12 @@ namespace Mono.CSharp {
public static string Dirname (string name)
{
- int pos = name.LastIndexOf ("/");
+ int pos = name.LastIndexOf ('/');
if (pos != -1)
return name.Substring (0, pos);
- pos = name.LastIndexOf ("\\");
+ pos = name.LastIndexOf ('\\');
if (pos != -1)
return name.Substring (0, pos);
@@ -55,7 +55,7 @@ namespace Mono.CSharp {
static string TrimExt (string name)
{
- int pos = name.LastIndexOf (".");
+ int pos = name.LastIndexOf ('.');
return name.Substring (0, pos);
}
@@ -92,7 +92,7 @@ namespace Mono.CSharp {
current_domain = AppDomain.CurrentDomain;
AssemblyBuilder = current_domain.DefineDynamicAssembly (
- an, AssemblyBuilderAccess.RunAndSave, Dirname (name));
+ an, AssemblyBuilderAccess.Save, Dirname (name));
//
// Pass a path-less name to DefineDynamicModule. Wonder how
@@ -254,24 +254,11 @@ namespace Mono.CSharp {
public bool HasReturnLabel;
/// <summary>
- /// Whether we are in a Finally block
- /// </summary>
- public bool InFinally;
-
- /// <summary>
- /// Whether we are in a Try block
- /// </summary>
- public bool InTry;
-
- /// <summary>
/// Whether we are inside an iterator block.
/// </summary>
public bool InIterator;
- /// <summary>
- /// Whether we need an explicit return statement at the end of the method.
- /// </summary>
- public bool NeedExplicitReturn;
+ public bool IsLastStatement;
/// <summary>
/// Whether remapping of locals, parameters and fields is turned on.
@@ -280,11 +267,6 @@ namespace Mono.CSharp {
public bool RemapToProxy;
/// <summary>
- /// Whether we are in a Catch block
- /// </summary>
- public bool InCatch;
-
- /// <summary>
/// Whether we are inside an unsafe block
/// </summary>
public bool InUnsafe;
@@ -321,7 +303,7 @@ namespace Mono.CSharp {
/// </summary>
public bool InEnumContext;
- protected Stack FlowStack;
+ FlowBranching current_flow_branching;
public EmitContext (DeclSpace parent, DeclSpace ds, Location l, ILGenerator ig,
Type return_type, int code_flags, bool is_constructor)
@@ -351,8 +333,6 @@ namespace Mono.CSharp {
}
loc = l;
- FlowStack = new Stack ();
-
if (ReturnType == TypeManager.void_type)
ReturnType = null;
}
@@ -371,7 +351,7 @@ namespace Mono.CSharp {
public FlowBranching CurrentBranching {
get {
- return (FlowBranching) FlowStack.Peek ();
+ return current_flow_branching;
}
}
@@ -381,11 +361,8 @@ namespace Mono.CSharp {
// </summary>
public FlowBranching StartFlowBranching (FlowBranching.BranchingType type, Location loc)
{
- FlowBranching cfb = FlowBranching.CreateBranching (CurrentBranching, type, null, loc);
-
- FlowStack.Push (cfb);
-
- return cfb;
+ current_flow_branching = FlowBranching.CreateBranching (CurrentBranching, type, null, loc);
+ return current_flow_branching;
}
// <summary>
@@ -393,7 +370,6 @@ namespace Mono.CSharp {
// </summary>
public FlowBranching StartFlowBranching (Block block)
{
- FlowBranching cfb;
FlowBranching.BranchingType type;
if (CurrentBranching.Type == FlowBranching.BranchingType.Switch)
@@ -401,22 +377,31 @@ namespace Mono.CSharp {
else
type = FlowBranching.BranchingType.Block;
- cfb = FlowBranching.CreateBranching (CurrentBranching, type, block, block.StartLocation);
+ current_flow_branching = FlowBranching.CreateBranching (CurrentBranching, type, block, block.StartLocation);
+ return current_flow_branching;
+ }
- FlowStack.Push (cfb);
+ // <summary>
+ // Ends a code branching. Merges the state of locals and parameters
+ // from all the children of the ending branching.
+ // </summary>
+ public FlowBranching.UsageVector DoEndFlowBranching ()
+ {
+ FlowBranching old = current_flow_branching;
+ current_flow_branching = current_flow_branching.Parent;
- return cfb;
+ return current_flow_branching.MergeChild (old);
}
// <summary>
// Ends a code branching. Merges the state of locals and parameters
// from all the children of the ending branching.
// </summary>
- public FlowBranching.FlowReturns EndFlowBranching ()
+ public FlowBranching.Reachability EndFlowBranching ()
{
- FlowBranching cfb = (FlowBranching) FlowStack.Pop ();
+ FlowBranching.UsageVector vector = DoEndFlowBranching ();
- return CurrentBranching.MergeChild (cfb);
+ return vector.Reachability;
}
// <summary>
@@ -425,12 +410,12 @@ namespace Mono.CSharp {
// </summary>
public void KillFlowBranching ()
{
- FlowBranching cfb = (FlowBranching) FlowStack.Pop ();
+ current_flow_branching = current_flow_branching.Parent;
}
public void EmitTopBlock (Block block, InternalParameters ip, Location loc)
{
- bool has_ret = false;
+ bool unreachable = false;
if (!Location.IsNull (loc))
CurrentFile = loc.File;
@@ -445,34 +430,28 @@ namespace Mono.CSharp {
bool old_do_flow_analysis = DoFlowAnalysis;
DoFlowAnalysis = true;
- FlowBranching cfb = FlowBranching.CreateBranching (
+ current_flow_branching = FlowBranching.CreateBranching (
null, FlowBranching.BranchingType.Block, block, loc);
- FlowStack.Push (cfb);
if (!block.Resolve (this)) {
- FlowStack.Pop ();
+ current_flow_branching = null;
DoFlowAnalysis = old_do_flow_analysis;
return;
}
- cfb = (FlowBranching) FlowStack.Pop ();
- FlowBranching.FlowReturns returns = cfb.MergeTopBlock ();
+ FlowBranching.Reachability reachability = current_flow_branching.MergeTopBlock ();
+ current_flow_branching = null;
DoFlowAnalysis = old_do_flow_analysis;
- has_ret = block.Emit (this);
-
- if ((returns == FlowBranching.FlowReturns.Always) ||
- (returns == FlowBranching.FlowReturns.Exception) ||
- (returns == FlowBranching.FlowReturns.Unreachable))
- has_ret = true;
+ block.Emit (this);
- if (Report.Errors == errors){
- if (RootContext.WarningLevel >= 3)
- block.UsageWarning ();
+ if (reachability.AlwaysReturns ||
+ reachability.AlwaysThrows ||
+ reachability.IsUnreachable)
+ unreachable = true;
}
- }
- } catch {
+ } catch (Exception e) {
Console.WriteLine ("Exception caught by the compiler while compiling:");
Console.WriteLine (" Block that caused the problem begin at: " + loc);
@@ -480,16 +459,14 @@ namespace Mono.CSharp {
Console.WriteLine (" Block being compiled: [{0},{1}]",
CurrentBlock.StartLocation, CurrentBlock.EndLocation);
}
- throw;
+ Console.WriteLine (e.GetType ().FullName + ": " + e.Message);
+ Console.WriteLine (Report.FriendlyStackTrace (e));
+
+ Environment.Exit (1);
}
}
- if (ReturnType != null && !has_ret){
- //
- // FIXME: we need full flow analysis to implement this
- // correctly and emit an error instead of a warning.
- //
- //
+ if (ReturnType != null && !unreachable){
if (!InIterator){
Report.Error (161, loc, "Not all code paths return a value");
return;
@@ -502,22 +479,22 @@ namespace Mono.CSharp {
ig.Emit (OpCodes.Ldloc, return_value);
ig.Emit (OpCodes.Ret);
} else {
- if (!InTry){
- if (InIterator)
- has_ret = true;
-
- if (!has_ret || HasReturnLabel) {
- ig.Emit (OpCodes.Ret);
- NeedExplicitReturn = false;
- }
- }
-
- // Unfortunately, System.Reflection.Emit automatically emits a leave
- // to the end of a finally block. This is a problem if no code is
- // following the try/finally block since we may jump to a point after
- // the end of the method. As a workaround, emit an explicit ret here.
+ //
+ // If `HasReturnLabel' is set, then we already emitted a
+ // jump to the end of the method, so we must emit a `ret'
+ // there.
+ //
+ // Unfortunately, System.Reflection.Emit automatically emits
+ // a leave to the end of a finally block. This is a problem
+ // if no code is following the try/finally block since we may
+ // jump to a point after the end of the method.
+ // As a workaround, we're always creating a return label in
+ // this case.
+ //
- if (NeedExplicitReturn) {
+ if ((block != null) && block.IsDestructor) {
+ // Nothing to do; S.R.E automatically emits a leave.
+ } else if (HasReturnLabel || (!unreachable && !InIterator)) {
if (ReturnType != null)
ig.Emit (OpCodes.Ldloc, TemporaryReturn ());
ig.Emit (OpCodes.Ret);
@@ -606,22 +583,6 @@ namespace Mono.CSharp {
public Label LoopBegin, LoopEnd;
/// <summary>
- /// Whether we are inside a loop and break/continue are possible.
- /// </summary>
- public bool InLoop;
-
- /// <summary>
- /// This is incremented each time we enter a try/catch block and
- /// decremented if we leave it.
- /// </summary>
- public int TryCatchLevel;
-
- /// <summary>
- /// The TryCatchLevel at the begin of the current loop.
- /// </summary>
- public int LoopBeginTryCatchLevel;
-
- /// <summary>
/// Default target in a switch statement. Only valid if
/// InSwitch is true
/// </summary>
@@ -649,6 +610,14 @@ namespace Mono.CSharp {
return return_value;
}
+ public void NeedReturnLabel ()
+ {
+ if (!HasReturnLabel) {
+ ReturnLabel = ig.DefineLabel ();
+ HasReturnLabel = true;
+ }
+ }
+
//
// Creates a field `name' with the type `t' on the proxy class
//
diff --git a/mcs/gmcs/const.cs b/mcs/gmcs/const.cs
index 47fc56ec5af..97f1e5a76d5 100755
--- a/mcs/gmcs/const.cs
+++ b/mcs/gmcs/const.cs
@@ -192,6 +192,12 @@ namespace Mono.CSharp {
in_transit = true;
int errors = Report.Errors;
+ //
+ // We might have cleared Expr ourselves in a recursive definition
+ //
+ if (Expr == null)
+ return null;
+
Expr = Expr.Resolve (const_ec);
in_transit = false;
diff --git a/mcs/gmcs/convert.cs b/mcs/gmcs/convert.cs
index bce856c6cb7..6e9407ecc12 100644
--- a/mcs/gmcs/convert.cs
+++ b/mcs/gmcs/convert.cs
@@ -59,7 +59,7 @@ namespace Mono.CSharp {
if (TypeManager.IsValueType (expr_type))
return new BoxedCast (expr);
if (expr is NullLiteral)
- return new BoxedCast (expr);
+ return new NullCast (expr, target_type);
} else if (expr_type.IsSubclassOf (target_type)) {
//
// Special case: enumeration to System.Enum.
@@ -91,8 +91,11 @@ namespace Mono.CSharp {
if (TypeManager.ImplementsInterface (expr_type, target_type)){
if (expr_type.IsClass)
return new EmptyCast (expr, target_type);
- else if (TypeManager.IsValueType (expr_type))
+ else if (TypeManager.IsValueType (expr_type) ||
+ TypeManager.IsEnumType (expr_type))
return new BoxedCast (expr, target_type);
+ else
+ return new EmptyCast (expr, target_type);
}
}
@@ -167,9 +170,9 @@ namespace Mono.CSharp {
if (expr_type.IsClass || TypeManager.IsValueType (expr_type) ||
expr_type.IsInterface || expr_type == TypeManager.enum_type)
return true;
- } else if (expr_type.IsSubclassOf (target_type)) {
+ } else if (expr_type.IsSubclassOf (target_type))
return true;
- } else {
+ else {
// Please remember that all code below actually comes
// from ImplicitReferenceConversion so make sure code remains in sync
@@ -243,7 +246,7 @@ namespace Mono.CSharp {
Type target_type, Location loc)
{
Type expr_type = expr.Type;
-
+
//
// Attempt to do the implicit constant expression conversions
@@ -1000,7 +1003,6 @@ namespace Mono.CSharp {
static public Expression ImplicitConversion (EmitContext ec, Expression expr,
Type target_type, Location loc)
{
- Type expr_type = expr.Type;
Expression e;
if (target_type == null)
@@ -1034,6 +1036,18 @@ namespace Mono.CSharp {
Type expr_type = expr.Type;
Expression e;
+ if (expr.eclass == ExprClass.MethodGroup){
+ if (!TypeManager.IsDelegateType (target_type)){
+ Report.Error (428, loc,
+ String.Format (
+ "Cannot convert method group to `{0}', since it is not a delegate",
+ TypeManager.CSharpName (target_type)));
+ return null;
+ }
+
+ return ImplicitDelegateCreation.Create (ec, (MethodGroupExpr) expr, target_type, loc);
+ }
+
if (expr_type.Equals (target_type) && !(expr is NullLiteral))
return expr;
@@ -1094,7 +1108,7 @@ namespace Mono.CSharp {
if (value >= SByte.MinValue && value <= SByte.MaxValue)
return new SByteConstant ((sbyte) value);
} else if (target_type == TypeManager.byte_type){
- if (Byte.MinValue >= 0 && value <= Byte.MaxValue)
+ if (value >= Byte.MinValue && value <= Byte.MaxValue)
return new ByteConstant ((byte) value);
} else if (target_type == TypeManager.short_type){
if (value >= Int16.MinValue && value <= Int16.MaxValue)
@@ -1165,6 +1179,13 @@ namespace Mono.CSharp {
"float type, use F suffix to create a float literal");
}
+ if (source is Constant){
+ Constant c = (Constant) source;
+
+ Expression.Error_ConstantValueCannotBeConverted (loc, c.AsString (), target_type);
+ return null;
+ }
+
Error_CannotImplicitConversion (loc, source.Type, target_type);
return null;
@@ -1493,6 +1514,13 @@ namespace Mono.CSharp {
if (source_type == TypeManager.object_type && !target_is_value_type)
return new ClassCast (source, target_type);
+ //
+ // Unboxing conversion.
+ //
+ if (((source_type == TypeManager.enum_type &&
+ !(source is EmptyCast)) ||
+ source_type == TypeManager.value_type) && target_is_value_type)
+ return new UnboxCast (source, target_type);
//
// From any class S to any class-type T, provided S is a base class of T
@@ -1635,7 +1663,6 @@ namespace Mono.CSharp {
return new UnboxCast (expr, target_type);
}
-
ne = ExplicitReferenceConversion (expr, target_type);
if (ne != null)
return ne;
diff --git a/mcs/gmcs/cs-parser.jay b/mcs/gmcs/cs-parser.jay
index 0ef8c4a3711..77a8f24cbf6 100755
--- a/mcs/gmcs/cs-parser.jay
+++ b/mcs/gmcs/cs-parser.jay
@@ -35,48 +35,55 @@ namespace Mono.CSharp
IIteratorContainer iterator_container;
- // <summary>
- // Current block is used to add statements as we find
- // them.
- // </summary>
+ /// <summary>
+ /// Current block is used to add statements as we find
+ /// them.
+ /// </summary>
Block current_block;
- // <summary>
- // Current interface is used by the various declaration
- // productions in the interface declaration to "add"
- // the interfaces as we find them.
- // </summary>
+ /// <summary>
+ /// If true, creates a toplevel block in the block production
+ /// This is flagged by the delegate creation
+ /// </summary>
+ bool create_toplevel_block;
+
+ /// <summary>
+ /// <summary>
+ /// Current interface is used by the various declaration
+ /// productions in the interface declaration to "add"
+ /// the interfaces as we find them.
+ /// </summary>
Interface current_interface;
- // <summary>
- // This is used by the unary_expression code to resolve
- // a name against a parameter.
- // </summary>
+ /// <summary>
+ /// This is used by the unary_expression code to resolve
+ /// a name against a parameter.
+ /// </summary>
Parameters current_local_parameters;
- // <summary>
- // Using during property parsing to describe the implicit
- // value parameter that is passed to the "set" and "get"accesor
- // methods (properties and indexers).
- // </summary>
+ /// <summary>
+ /// Using during property parsing to describe the implicit
+ /// value parameter that is passed to the "set" and "get"accesor
+ /// methods (properties and indexers).
+ /// </summary>
Expression implicit_value_parameter_type;
Parameters indexer_parameters;
- // <summary>
- // Used to determine if we are parsing the get/set pair
- // of an indexer or a property
- // </summmary>
+ /// <summary>
+ /// Used to determine if we are parsing the get/set pair
+ /// of an indexer or a property
+ /// </summmary>
bool parsing_indexer;
- //
- // An out-of-band stack.
- //
+ ///
+ /// An out-of-band stack.
+ ///
Stack oob_stack;
- //
- // Switch stack.
- //
+ ///
+ /// Switch stack.
+ ///
Stack switch_stack;
public bool yacc_verbose_flag;
@@ -84,9 +91,9 @@ namespace Mono.CSharp
// Name of the file we are parsing
public string name;
- //
- // The current file.
- //
+ ///
+ /// The current file.
+ ///
SourceFile file;
%}
@@ -334,7 +341,7 @@ using_namespace_directive
// detach them
//
namespace_declaration
- : opt_attributes NAMESPACE qualified_identifier
+ : opt_attributes NAMESPACE namespace_or_type_name
{
Attributes attrs = (Attributes) $1;
@@ -348,7 +355,7 @@ namespace_declaration
+ " Expected class, delegate, enum, interface, or struct");
}
- current_namespace = RootContext.Tree.RecordNamespace (current_namespace, file, (string) $3, lexer.Location);
+ current_namespace = RootContext.Tree.RecordNamespace (current_namespace, file, $3.ToString (), lexer.Location);
}
namespace_body opt_semicolon
{
@@ -366,15 +373,8 @@ opt_comma
| COMMA
;
-qualified_identifier
- : IDENTIFIER
- | qualified_identifier DOT IDENTIFIER {
- $$ = (($1).ToString ()) + "." + ($3.ToString ()); }
- ;
-
-
namespace_name
- : qualified_identifier
+ : namespace_or_type_name { $$ = ($1).ToString (); }
;
namespace_body
@@ -429,6 +429,13 @@ namespace_member_declaration
| namespace_declaration {
current_namespace.DeclarationFound = true;
}
+
+ | field_declaration {
+ Report.Error (116, lexer.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");
+ }
;
type_declaration
@@ -460,22 +467,24 @@ attribute_sections
{
AttributeSection sect = (AttributeSection) $1;
- if (sect.Target == "assembly")
+ if (sect.Target == "assembly") {
RootContext.AddGlobalAttributeSection (current_container, sect);
-
-
- $$ = new Attributes ((AttributeSection) $1);
+ $$ = null;
+ }
+ else
+ $$ = new Attributes (sect);
}
| attribute_sections attribute_section
{
- Attributes attrs = null;
+ Attributes attrs = $1 as Attributes;
AttributeSection sect = (AttributeSection) $2;
- if (sect.Target == "assembly")
+ if (sect.Target == "assembly") {
RootContext.AddGlobalAttributeSection (current_container, sect);
-
- if ($1 != null) {
- attrs = (Attributes) $1;
+ } else {
+ if (attrs == null)
+ attrs = new Attributes (sect);
+ else
attrs.AddAttributeSection (sect);
}
@@ -926,10 +935,12 @@ method_header
"Type parameter constraints only valid if there is a type parameter list");
Method method;
+
GenericMethod generic = null;
if ($5 != null) {
generic = new GenericMethod (current_namespace, current_container,
- (string) $4, lexer.Location);
+ (string) $4, (Attributes) $1,
+ lexer.Location);
CheckDef (generic.SetParameterInfo ((ArrayList) $5, (ArrayList) $10), generic.Name, generic.Location);
method = new Method (generic, (Expression) $3, (int) $2, (string) $4,
@@ -962,7 +973,8 @@ method_header
GenericMethod generic = null;
if ($5 != null) {
generic = new GenericMethod (current_namespace, current_container,
- (string) $4, lexer.Location);
+ (string) $4, (Attributes) $1,
+ lexer.Location);
CheckDef (generic.SetParameterInfo ((ArrayList) $5, (ArrayList) $10), generic.Name, generic.Location);
@@ -978,6 +990,21 @@ method_header
$$ = method;
}
+ | opt_attributes
+ opt_modifiers
+ type
+ modifiers member_name OPEN_PARENS opt_formal_parameter_list CLOSE_PARENS
+ {
+ Report.Error (1585, lexer.Location,
+ String.Format ("Modifier {0} should appear before type",
+ Modifiers.Name ((int) $4)));
+ Method method = new Method (current_container, TypeManager.system_void_expr, 0,
+ (string) $5, (Parameters) $7, (Attributes) $1,
+ lexer.Location);
+
+ current_local_parameters = (Parameters) $7;
+ $$ = method;
+ }
;
method_body
@@ -1072,7 +1099,10 @@ parameter_array
;
member_name
- : qualified_identifier
+ : IDENTIFIER
+ | member_name DOT IDENTIFIER {
+ $$ = String.Concat ((string) $1, $3);
+ }
;
property_declaration
@@ -1291,10 +1321,11 @@ interface_member_declaration
}
| interface_event_declaration
{
+ if ($1 != null){
InterfaceEvent e = (InterfaceEvent) $1;
-
CheckDef (current_interface.AddEvent (e), e.Name, lexer.Location);
}
+ }
| interface_indexer_declaration
{
InterfaceIndexer i = (InterfaceIndexer) $1;
@@ -1304,8 +1335,13 @@ interface_member_declaration
;
opt_new
- : /* empty */ { $$ = false; }
- | NEW { $$ = true; }
+ : opt_modifiers
+ {
+ int val = (int) $1;
+
+ val = Modifiers.Check (Modifiers.NEW, val, 0, lexer.Location);
+ $$ = (bool) (val != 0);
+ }
;
interface_method_declaration
@@ -1369,6 +1405,14 @@ interface_event_declaration
CheckIdentifierToken (yyToken);
$$ = null;
}
+ | opt_attributes opt_new EVENT type IDENTIFIER ASSIGN {
+ Report.Error (68, lexer.Location, "Event declarations on interfaces can not be initialized.");
+ $$ = null;
+ }
+ | opt_attributes opt_new EVENT type IDENTIFIER OPEN_BRACE event_accessor_declarations CLOSE_BRACE {
+ Report.Error (69, lexer.Location, "Event accessors not valid on interfaces");
+ $$ = null;
+ }
;
interface_indexer_declaration
@@ -1632,7 +1676,7 @@ destructor_declaration
}
}
- Method d = new Method (
+ Method d = new Destructor (
current_container, TypeManager.system_void_expr, m, "Finalize",
new Parameters (null, null, l), (Attributes) $1, l);
@@ -1674,6 +1718,10 @@ event_declaration
{
Location loc = (Location) oob_stack.Pop ();
+ if ($8 == null){
+ Report.Error (65, lexer.Location, "Event must have both add and remove accesors");
+ $$ = null;
+ } else {
Pair pair = (Pair) $8;
Accessor add_accessor = null;
Accessor rem_accessor = null;
@@ -1689,6 +1737,7 @@ event_declaration
CheckDef (current_container.AddEvent (e), e.Name, loc);
implicit_value_parameter_type = null;
}
+ }
;
event_accessor_declarations
@@ -1700,6 +1749,8 @@ event_accessor_declarations
{
$$ = new Pair ($2, $1);
}
+ | add_accessor_declaration { $$ = null; }
+ | remove_accessor_declaration { $$ = null; }
;
add_accessor_declaration
@@ -1805,14 +1856,14 @@ indexer_declarator
$$ = new IndexerDeclaration ((Expression) $1, null, pars);
}
- | type qualified_identifier DOT THIS OPEN_BRACKET opt_formal_parameter_list CLOSE_BRACKET
+ | type namespace_or_type_name DOT THIS OPEN_BRACKET opt_formal_parameter_list CLOSE_BRACKET
{
Parameters pars = (Parameters) $6;
if (pars.FixedParameters == null && pars.ArrayParameter == null){
Report.Error (1551, lexer.Location, "Indexers must have at least one parameter");
}
- $$ = new IndexerDeclaration ((Expression) $1, (string) $2, pars);
+ $$ = new IndexerDeclaration ((Expression) $1, $2.ToString (), pars);
}
;
@@ -2519,7 +2570,9 @@ anonymous_method_expression
: DELEGATE opt_anonymous_method_signature {
oob_stack.Push (current_local_parameters);
current_local_parameters = (Parameters)$2;
+ create_toplevel_block = true;
} block {
+ create_toplevel_block = false;
if (!RootContext.V2){
Report.Error (-213, lexer.Location, "Anonymous methods are only supported in V2");
$$ = null;
@@ -2940,8 +2993,13 @@ class_declaration
if ($6 != null)
CheckDef (new_class.SetParameterInfo ((ArrayList) $6, (ArrayList) $8), new_class.Name, new_class.Location);
- if ($7 != null)
+ if ($7 != null) {
+ if (new_class.Name == "System.Object") {
+ Report.Error (537, new_class.Location, "The class System.Object cannot have a base class or implement an interface.");
+ }
+
new_class.Bases = (ArrayList) $7;
+ }
current_container = current_container.Parent;
CheckDef (current_container.AddClass (new_class), new_class.Name, new_class.Location);
@@ -3099,8 +3157,12 @@ type_parameter_constraint
block
: OPEN_BRACE
{
+ if (current_block == null || create_toplevel_block){
+ current_block = new ToplevelBlock (current_local_parameters, lexer.Location);
+ } else {
current_block = new Block (current_block, current_local_parameters,
lexer.Location, Location.Null);
+ }
}
opt_statement_list CLOSE_BRACE
{
@@ -3132,9 +3194,6 @@ statement
}
| embedded_statement
{
- Statement s = (Statement) $1;
-
-
current_block.AddStatement ((Statement) $1);
}
| labeled_statement
@@ -3159,7 +3218,7 @@ embedded_statement
empty_statement
: SEMICOLON
{
- $$ = new EmptyStatement ();
+ $$ = EmptyStatement.Value;
}
;
@@ -3211,7 +3270,7 @@ local_variable_type
// Ok, the above "primary_expression" is there to get rid of
// both reduce/reduce and shift/reduces in the grammar, it should
// really just be "type_name". If you use type_name, a reduce/reduce
- // creeps up. If you use qualified_identifier (which is all we need
+ // creeps up. If you use namespace_or_type_name (which is all we need
// really) two shift/reduces appear.
//
@@ -3365,7 +3424,7 @@ if_statement_rest
$$ = new If ((Expression) $1, (Statement) $3, l);
if (RootContext.WarningLevel >= 3){
- if ($3 is EmptyStatement)
+ if ($3 == EmptyStatement.Value)
Report.Warning (642, lexer.Location, "Possibly mistaken empty statement");
}
@@ -3487,7 +3546,7 @@ while_statement
$$ = new While ((Expression) $4, (Statement) $6, l);
if (RootContext.WarningLevel >= 3){
- if ($6 is EmptyStatement)
+ if ($6 == EmptyStatement.Value)
Report.Warning (642, lexer.Location, "Possibly mistaken empty statement");
}
}
@@ -3562,7 +3621,7 @@ for_statement
For f = new For ((Statement) $3, (Expression) $6, (Statement) $8, (Statement) $10, l);
if (RootContext.WarningLevel >= 3){
- if ($10 is EmptyStatement)
+ if ($10 == EmptyStatement.Value)
Report.Warning (642, lexer.Location, "Possibly mistaken empty statement");
}
@@ -3575,7 +3634,7 @@ for_statement
;
opt_for_initializer
- : /* empty */ { $$ = new EmptyStatement (); }
+ : /* empty */ { $$ = EmptyStatement.Value; }
| for_initializer
;
@@ -3590,7 +3649,7 @@ opt_for_condition
;
opt_for_iterator
- : /* empty */ { $$ = new EmptyStatement (); }
+ : /* empty */ { $$ = EmptyStatement.Value; }
| for_iterator
;
@@ -3932,10 +3991,7 @@ fixed_statement
embedded_statement
{
Location l = (Location) oob_stack.Pop ();
- Block assign_block = (Block) oob_stack.Pop ();
-
- ArrayList list = (ArrayList) $4;
- int top = list.Count;
+ oob_stack.Pop ();
$$ = new Fixed ((Expression) $3, (ArrayList) $4, (Statement) $7, l);
}
@@ -4067,7 +4123,6 @@ public class VariableDeclaration {
// <summary>
// A class used to hold info about an indexer declarator
// </summary>
-
public class IndexerDeclaration {
public Expression type;
public string interface_type;
@@ -4084,7 +4139,6 @@ public class IndexerDeclaration {
// <summary>
// A class used to hold info about an operator declarator
// </summary>
-
public class OperatorDeclaration {
public Operator.OpType optype;
public Expression ret_type, arg1type, arg2type;
@@ -4185,23 +4239,6 @@ CheckDef (bool result, string name, Location l)
CheckDef (DeclSpace.AdditionResult.NameExists, name, l);
}
-Expression DecomposeQI (string name, Location loc)
-{
- Expression o;
-
- if (name.IndexOf ('.') == -1){
- return new SimpleName (name, loc);
- } else {
- int pos = name.LastIndexOf (".");
- string left = name.Substring (0, pos);
- string right = name.Substring (pos + 1);
-
- o = DecomposeQI (left, loc);
-
- return new MemberAccess (o, right, loc);
- }
-}
-
Block declare_local_variables (Expression type, ArrayList variable_declarators, Location loc)
{
Block implicit_block;
diff --git a/mcs/gmcs/cs-tokenizer.cs b/mcs/gmcs/cs-tokenizer.cs
index 93f0a254937..946242000fe 100755
--- a/mcs/gmcs/cs-tokenizer.cs
+++ b/mcs/gmcs/cs-tokenizer.cs
@@ -147,7 +147,7 @@ namespace Mono.CSharp
//
// Class variables
//
- static Hashtable keywords;
+ static CharArrayHashtable[] keywords;
static NumberStyles styles;
static NumberFormatInfo csharp_format_info;
@@ -178,6 +178,8 @@ namespace Mono.CSharp
const int max_id_size = 512;
static char [] id_builder = new char [max_id_size];
+ static CharArrayHashtable [] identifiers = new CharArrayHashtable [max_id_size + 1];
+
const int max_number_size = 128;
static char [] number_builder = new char [max_number_size];
static int number_pos;
@@ -205,97 +207,104 @@ namespace Mono.CSharp
}
}
+ static void AddKeyword (string kw, int token) {
+ if (keywords [kw.Length] == null) {
+ keywords [kw.Length] = new CharArrayHashtable (kw.Length);
+ }
+ keywords [kw.Length] [kw.ToCharArray ()] = token;
+ }
+
static void InitTokens ()
{
- keywords = new Hashtable ();
-
- keywords.Add ("abstract", Token.ABSTRACT);
- keywords.Add ("as", Token.AS);
- keywords.Add ("add", Token.ADD);
- keywords.Add ("assembly", Token.ASSEMBLY);
- keywords.Add ("base", Token.BASE);
- keywords.Add ("bool", Token.BOOL);
- keywords.Add ("break", Token.BREAK);
- keywords.Add ("byte", Token.BYTE);
- keywords.Add ("case", Token.CASE);
- keywords.Add ("catch", Token.CATCH);
- keywords.Add ("char", Token.CHAR);
- keywords.Add ("checked", Token.CHECKED);
- keywords.Add ("class", Token.CLASS);
- keywords.Add ("const", Token.CONST);
- keywords.Add ("continue", Token.CONTINUE);
- keywords.Add ("decimal", Token.DECIMAL);
- keywords.Add ("default", Token.DEFAULT);
- keywords.Add ("delegate", Token.DELEGATE);
- keywords.Add ("do", Token.DO);
- keywords.Add ("double", Token.DOUBLE);
- keywords.Add ("else", Token.ELSE);
- keywords.Add ("enum", Token.ENUM);
- keywords.Add ("event", Token.EVENT);
- keywords.Add ("explicit", Token.EXPLICIT);
- keywords.Add ("extern", Token.EXTERN);
- keywords.Add ("false", Token.FALSE);
- keywords.Add ("finally", Token.FINALLY);
- keywords.Add ("fixed", Token.FIXED);
- keywords.Add ("float", Token.FLOAT);
- keywords.Add ("for", Token.FOR);
- keywords.Add ("foreach", Token.FOREACH);
- keywords.Add ("goto", Token.GOTO);
- keywords.Add ("get", Token.GET);
- keywords.Add ("if", Token.IF);
- keywords.Add ("implicit", Token.IMPLICIT);
- keywords.Add ("in", Token.IN);
- keywords.Add ("int", Token.INT);
- keywords.Add ("interface", Token.INTERFACE);
- keywords.Add ("internal", Token.INTERNAL);
- keywords.Add ("is", Token.IS);
- keywords.Add ("lock", Token.LOCK);
- keywords.Add ("long", Token.LONG);
- keywords.Add ("namespace", Token.NAMESPACE);
- keywords.Add ("new", Token.NEW);
- keywords.Add ("null", Token.NULL);
- keywords.Add ("object", Token.OBJECT);
- keywords.Add ("operator", Token.OPERATOR);
- keywords.Add ("out", Token.OUT);
- keywords.Add ("override", Token.OVERRIDE);
- keywords.Add ("params", Token.PARAMS);
- keywords.Add ("private", Token.PRIVATE);
- keywords.Add ("protected", Token.PROTECTED);
- keywords.Add ("public", Token.PUBLIC);
- keywords.Add ("readonly", Token.READONLY);
- keywords.Add ("ref", Token.REF);
- keywords.Add ("remove", Token.REMOVE);
- keywords.Add ("return", Token.RETURN);
- keywords.Add ("sbyte", Token.SBYTE);
- keywords.Add ("sealed", Token.SEALED);
- keywords.Add ("set", Token.SET);
- keywords.Add ("short", Token.SHORT);
- keywords.Add ("sizeof", Token.SIZEOF);
- keywords.Add ("stackalloc", Token.STACKALLOC);
- keywords.Add ("static", Token.STATIC);
- keywords.Add ("string", Token.STRING);
- keywords.Add ("struct", Token.STRUCT);
- keywords.Add ("switch", Token.SWITCH);
- keywords.Add ("this", Token.THIS);
- keywords.Add ("throw", Token.THROW);
- keywords.Add ("true", Token.TRUE);
- keywords.Add ("try", Token.TRY);
- keywords.Add ("typeof", Token.TYPEOF);
- keywords.Add ("uint", Token.UINT);
- keywords.Add ("ulong", Token.ULONG);
- keywords.Add ("unchecked", Token.UNCHECKED);
- keywords.Add ("unsafe", Token.UNSAFE);
- keywords.Add ("ushort", Token.USHORT);
- keywords.Add ("using", Token.USING);
- keywords.Add ("virtual", Token.VIRTUAL);
- keywords.Add ("void", Token.VOID);
- keywords.Add ("volatile", Token.VOLATILE);
- keywords.Add ("where", Token.WHERE);
- keywords.Add ("while", Token.WHILE);
+ keywords = new CharArrayHashtable [64];
+
+ AddKeyword ("abstract", Token.ABSTRACT);
+ AddKeyword ("as", Token.AS);
+ AddKeyword ("add", Token.ADD);
+ AddKeyword ("assembly", Token.ASSEMBLY);
+ AddKeyword ("base", Token.BASE);
+ AddKeyword ("bool", Token.BOOL);
+ AddKeyword ("break", Token.BREAK);
+ AddKeyword ("byte", Token.BYTE);
+ AddKeyword ("case", Token.CASE);
+ AddKeyword ("catch", Token.CATCH);
+ AddKeyword ("char", Token.CHAR);
+ AddKeyword ("checked", Token.CHECKED);
+ AddKeyword ("class", Token.CLASS);
+ AddKeyword ("const", Token.CONST);
+ AddKeyword ("continue", Token.CONTINUE);
+ AddKeyword ("decimal", Token.DECIMAL);
+ AddKeyword ("default", Token.DEFAULT);
+ AddKeyword ("delegate", Token.DELEGATE);
+ AddKeyword ("do", Token.DO);
+ AddKeyword ("double", Token.DOUBLE);
+ AddKeyword ("else", Token.ELSE);
+ AddKeyword ("enum", Token.ENUM);
+ AddKeyword ("event", Token.EVENT);
+ AddKeyword ("explicit", Token.EXPLICIT);
+ AddKeyword ("extern", Token.EXTERN);
+ AddKeyword ("false", Token.FALSE);
+ AddKeyword ("finally", Token.FINALLY);
+ AddKeyword ("fixed", Token.FIXED);
+ AddKeyword ("float", Token.FLOAT);
+ AddKeyword ("for", Token.FOR);
+ AddKeyword ("foreach", Token.FOREACH);
+ AddKeyword ("goto", Token.GOTO);
+ AddKeyword ("get", Token.GET);
+ AddKeyword ("if", Token.IF);
+ AddKeyword ("implicit", Token.IMPLICIT);
+ AddKeyword ("in", Token.IN);
+ AddKeyword ("int", Token.INT);
+ AddKeyword ("interface", Token.INTERFACE);
+ AddKeyword ("internal", Token.INTERNAL);
+ AddKeyword ("is", Token.IS);
+ AddKeyword ("lock", Token.LOCK);
+ AddKeyword ("long", Token.LONG);
+ AddKeyword ("namespace", Token.NAMESPACE);
+ AddKeyword ("new", Token.NEW);
+ AddKeyword ("null", Token.NULL);
+ AddKeyword ("object", Token.OBJECT);
+ AddKeyword ("operator", Token.OPERATOR);
+ AddKeyword ("out", Token.OUT);
+ AddKeyword ("override", Token.OVERRIDE);
+ AddKeyword ("params", Token.PARAMS);
+ AddKeyword ("private", Token.PRIVATE);
+ AddKeyword ("protected", Token.PROTECTED);
+ AddKeyword ("public", Token.PUBLIC);
+ AddKeyword ("readonly", Token.READONLY);
+ AddKeyword ("ref", Token.REF);
+ AddKeyword ("remove", Token.REMOVE);
+ AddKeyword ("return", Token.RETURN);
+ AddKeyword ("sbyte", Token.SBYTE);
+ AddKeyword ("sealed", Token.SEALED);
+ AddKeyword ("set", Token.SET);
+ AddKeyword ("short", Token.SHORT);
+ AddKeyword ("sizeof", Token.SIZEOF);
+ AddKeyword ("stackalloc", Token.STACKALLOC);
+ AddKeyword ("static", Token.STATIC);
+ AddKeyword ("string", Token.STRING);
+ AddKeyword ("struct", Token.STRUCT);
+ AddKeyword ("switch", Token.SWITCH);
+ AddKeyword ("this", Token.THIS);
+ AddKeyword ("throw", Token.THROW);
+ AddKeyword ("true", Token.TRUE);
+ AddKeyword ("try", Token.TRY);
+ AddKeyword ("typeof", Token.TYPEOF);
+ AddKeyword ("uint", Token.UINT);
+ AddKeyword ("ulong", Token.ULONG);
+ AddKeyword ("unchecked", Token.UNCHECKED);
+ AddKeyword ("unsafe", Token.UNSAFE);
+ AddKeyword ("ushort", Token.USHORT);
+ AddKeyword ("using", Token.USING);
+ AddKeyword ("virtual", Token.VIRTUAL);
+ AddKeyword ("void", Token.VOID);
+ AddKeyword ("volatile", Token.VOLATILE);
+ AddKeyword ("where", Token.WHERE);
+ AddKeyword ("while", Token.WHILE);
if (RootContext.V2){
- keywords.Add ("__yield", Token.YIELD);
- keywords.Add ("yield", Token.YIELD);
+ AddKeyword ("__yield", Token.YIELD);
+ AddKeyword ("yield", Token.YIELD);
}
}
@@ -311,9 +320,16 @@ namespace Mono.CSharp
string_builder = new System.Text.StringBuilder ();
}
- int GetKeyword (string name)
+ int GetKeyword (char[] id, int id_len)
{
- object o = keywords [name];
+ /*
+ * Keywords are stored in an array of hashtables grouped by their
+ * length.
+ */
+
+ if ((id_len >= keywords.Length) || (keywords [id_len] == null))
+ return -1;
+ object o = keywords [id_len] [id];
if (o == null)
return -1;
@@ -369,6 +385,10 @@ namespace Mono.CSharp
Mono.CSharp.Location.Push (file);
}
+ public static void Cleanup () {
+ identifiers = null;
+ }
+
bool is_identifier_start_character (char c)
{
return (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || c == '_' || Char.IsLetter (c);
@@ -626,37 +646,6 @@ namespace Mono.CSharp
return Token.CARRET;
}
-#if FIXME
- if (c == '>'){
- if (deambiguate_greater_than == 0)
- return Token.OP_GT;
-
- --deambiguate_greater_than;
-
- // Save current position and parse next token.
- int old = reader.Position;
- int new_token = token ();
- reader.Position = old;
- putback_char = -1;
-
- switch (new_token) {
- case Token.OPEN_PARENS:
- case Token.CLOSE_PARENS:
- case Token.CLOSE_BRACKET:
- case Token.OP_GT:
- case Token.COLON:
- case Token.SEMICOLON:
- case Token.COMMA:
- case Token.DOT:
- case Token.INTERR:
- return Token.OP_GENERICS_GT;
-
- default:
- return Token.OP_GT;
- }
- }
-#endif
-
return Token.ERROR;
}
@@ -891,10 +880,6 @@ namespace Mono.CSharp
getChar ();
while ((d = peekChar ()) != -1){
if (is_hex (d)){
- if (number_pos == 16){
- Report.Error (1021, Location, "Integral constant too large");
- return Token.ERROR;
- }
number_builder [number_pos++] = (char) d;
getChar ();
} else
@@ -902,10 +887,18 @@ namespace Mono.CSharp
}
string s = new String (number_builder, 0, number_pos);
- if (number_pos <= 8)
- ul = System.UInt32.Parse (s, NumberStyles.HexNumber);
- else
- ul = System.UInt64.Parse (s, NumberStyles.HexNumber);
+ try {
+ if (number_pos <= 8)
+ ul = System.UInt32.Parse (s, NumberStyles.HexNumber);
+ else
+ ul = System.UInt64.Parse (s, NumberStyles.HexNumber);
+ } catch (OverflowException){
+ error_details = "Integral constant is too large";
+ Report.Error (1021, Location, error_details);
+ val = 0ul;
+ return Token.LITERAL_INTEGER;
+ }
+
return integer_type_suffix (ul, peekChar ());
}
@@ -995,7 +988,6 @@ namespace Mono.CSharp
//
int getHex (int count, out bool error)
{
- int [] buffer = new int [8];
int i;
int total = 0;
int c;
@@ -1164,6 +1156,19 @@ namespace Mono.CSharp
case Token.TYPEOF:
case Token.UNCHECKED:
case Token.UNSAFE:
+
+ //
+ // These can be part of a member access
+ //
+ case Token.INT:
+ case Token.UINT:
+ case Token.SHORT:
+ case Token.USHORT:
+ case Token.LONG:
+ case Token.ULONG:
+ case Token.DOUBLE:
+ case Token.FLOAT:
+ case Token.CHAR:
return true;
default:
@@ -1491,7 +1496,6 @@ namespace Mono.CSharp
//
bool handle_preprocessing_directive (bool caller_is_taking)
{
- char [] blank = { ' ', '\t' };
string cmd, arg;
bool region_directive = false;
@@ -1746,21 +1750,37 @@ namespace Mono.CSharp
}
}
- string ids = new String (id_builder, 0, pos);
-
//
// Optimization: avoids doing the keyword lookup
// on uppercase letters and _
//
if (s >= 'a'){
- int keyword = GetKeyword (ids);
- if (keyword == -1 || quoted){
- val = ids;
+ int keyword = GetKeyword (id_builder, pos);
+ if (keyword != -1 && !quoted)
+ return keyword;
+ }
+
+ //
+ // Keep identifiers in an array of hashtables to avoid needless
+ // allocations
+ //
+
+ if (identifiers [pos] != null) {
+ val = identifiers [pos][id_builder];
+ if (val != null) {
return Token.IDENTIFIER;
}
- return keyword;
}
- val = ids;
+ else
+ identifiers [pos] = new CharArrayHashtable (pos);
+
+ val = new String (id_builder, 0, pos);
+
+ char [] chars = new char [pos];
+ Array.Copy (id_builder, chars, pos);
+
+ identifiers [pos] [chars] = val;
+
return Token.IDENTIFIER;
}
@@ -1972,7 +1992,6 @@ namespace Mono.CSharp
}
}
-
}
}
diff --git a/mcs/gmcs/decl.cs b/mcs/gmcs/decl.cs
index 9126314d932..e9402b746cf 100755
--- a/mcs/gmcs/decl.cs
+++ b/mcs/gmcs/decl.cs
@@ -37,14 +37,30 @@ namespace Mono.CSharp {
/// </summary>
public readonly Location Location;
- public MemberCore (string name, Location loc)
+ /// <summary>
+ /// Attributes for this type
+ /// </summary>
+ Attributes attributes;
+
+ public MemberCore (string name, Attributes attrs, Location loc)
{
Name = name;
Location = loc;
+ attributes = attrs;
}
public abstract bool Define (TypeContainer parent);
+ public Attributes OptAttributes
+ {
+ get {
+ return attributes;
+ }
+ set {
+ attributes = value;
+ }
+ }
+
//
// Whehter is it ok to use an unsafe pointer in this type container
//
@@ -74,12 +90,19 @@ namespace Mono.CSharp {
/// </remarks>
public abstract class DeclSpace : MemberCore {
/// <summary>
- /// this points to the actual definition that is being
+ /// This points to the actual definition that is being
/// created with System.Reflection.Emit
/// </summary>
public TypeBuilder TypeBuilder;
/// <summary>
+ /// If we are a generic type, this is the type we are
+ /// currently defining. We need to lookup members on this
+ /// instead of the TypeBuilder.
+ /// </summary>
+ public TypeExpr CurrentType;
+
+ /// <summary>
/// This variable tracks whether we have Closed the type
/// </summary>
public bool Created = false;
@@ -106,8 +129,8 @@ namespace Mono.CSharp {
TypeContainer parent;
- public DeclSpace (NamespaceEntry ns, TypeContainer parent, string name, Location l)
- : base (name, l)
+ public DeclSpace (NamespaceEntry ns, TypeContainer parent, string name, Attributes attrs, Location l)
+ : base (name, attrs, l)
{
NamespaceEntry = ns;
Basename = name.Substring (1 + name.LastIndexOf ('.'));
@@ -194,7 +217,7 @@ namespace Mono.CSharp {
defined_names.Add (name, o);
#if DEBUGME
- int p = name.LastIndexOf (".");
+ int p = name.LastIndexOf ('.');
int l = name.Length;
length += l;
small += l -p;
@@ -410,7 +433,7 @@ namespace Mono.CSharp {
string check_type_name = check_type.FullName;
string type_name = TypeBuilder.FullName;
- int cio = check_type_name.LastIndexOf ("+");
+ int cio = check_type_name.LastIndexOf ('+');
string container = check_type_name.Substring (0, cio);
//
@@ -456,9 +479,8 @@ namespace Mono.CSharp {
return true;
string check_type_name = check_type.FullName;
- string type_name = TypeBuilder.FullName;
- int cio = check_type_name.LastIndexOf ("+");
+ int cio = check_type_name.LastIndexOf ('+');
string container = check_type_name.Substring (0, cio);
//
@@ -471,108 +493,107 @@ namespace Mono.CSharp {
}
// Access level of a type.
- enum AccessLevel {
- Public = 0,
- ProtectedInternal = 1,
- Internal = 2,
- Protected = 3,
- Private = 4
+ const int X = 1;
+ enum AccessLevel { // Each column represents `is this scope larger or equal to Blah scope'
+ // Public Assembly Protected
+ Protected = (0 << 0) | (0 << 1) | (X << 2),
+ Public = (X << 0) | (X << 1) | (X << 2),
+ Private = (0 << 0) | (0 << 1) | (0 << 2),
+ Internal = (0 << 0) | (X << 1) | (0 << 2),
+ ProtectedOrInternal = (0 << 0) | (X << 1) | (X << 2),
}
- // Check whether `flags' denotes a more restricted access than `level'
- // and return the new level.
- static AccessLevel CheckAccessLevel (AccessLevel level, int flags)
+ static AccessLevel GetAccessLevelFromModifiers (int flags)
{
- AccessLevel old_level = level;
-
if ((flags & Modifiers.INTERNAL) != 0) {
- if ((flags & Modifiers.PROTECTED) != 0) {
- if ((int) level < (int) AccessLevel.ProtectedInternal)
- level = AccessLevel.ProtectedInternal;
- } else {
- if ((int) level < (int) AccessLevel.Internal)
- level = AccessLevel.Internal;
- }
- } else if ((flags & Modifiers.PROTECTED) != 0) {
- if ((int) level < (int) AccessLevel.Protected)
- level = AccessLevel.Protected;
- } else if ((flags & Modifiers.PRIVATE) != 0)
- level = AccessLevel.Private;
- return level;
- }
+ if ((flags & Modifiers.PROTECTED) != 0)
+ return AccessLevel.ProtectedOrInternal;
+ else
+ return AccessLevel.Internal;
- // Return the access level for a new member which is defined in the current
- // TypeContainer with access modifiers `flags'.
- AccessLevel GetAccessLevel (int flags)
- {
- if ((flags & Modifiers.PRIVATE) != 0)
+ } else if ((flags & Modifiers.PROTECTED) != 0)
+ return AccessLevel.Protected;
+ else if ((flags & Modifiers.PRIVATE) != 0)
return AccessLevel.Private;
-
- AccessLevel level;
- if (!IsTopLevel && (Parent != null))
- level = Parent.GetAccessLevel (flags);
else
- level = AccessLevel.Public;
+ return AccessLevel.Public;
+ }
- return CheckAccessLevel (CheckAccessLevel (level, flags), ModFlags);
+ // What is the effective access level of this?
+ // TODO: Cache this?
+ AccessLevel EffectiveAccessLevel {
+ get {
+ AccessLevel myAccess = GetAccessLevelFromModifiers (ModFlags);
+ if (!IsTopLevel && (Parent != null))
+ return myAccess & Parent.EffectiveAccessLevel;
+ return myAccess;
+ }
}
- // Return the access level for type `t', but don't give more access than `flags'.
- static AccessLevel GetAccessLevel (Type t, int flags)
+ // Return the access level for type `t'
+ static AccessLevel TypeEffectiveAccessLevel (Type t)
{
- if (((flags & Modifiers.PRIVATE) != 0) || t.IsNestedPrivate)
- return AccessLevel.Private;
-
- AccessLevel level;
- if (TypeManager.IsBuiltinType (t))
+ if (t.IsPublic)
return AccessLevel.Public;
- else if ((t.DeclaringType != null) && (t != t.DeclaringType))
- level = GetAccessLevel (t.DeclaringType, flags);
- else {
- level = CheckAccessLevel (AccessLevel.Public, flags);
- }
-
- if (t.IsNestedPublic)
- return level;
+ if (t.IsNestedPrivate)
+ return AccessLevel.Private;
+ if (t.IsNotPublic)
+ return AccessLevel.Internal;
- if (t.IsNestedAssembly || t.IsNotPublic) {
- if ((int) level < (int) AccessLevel.Internal)
- level = AccessLevel.Internal;
- }
+ // By now, it must be nested
+ AccessLevel parentLevel = TypeEffectiveAccessLevel (t.DeclaringType);
- if (t.IsNestedFamily) {
- if ((int) level < (int) AccessLevel.Protected)
- level = AccessLevel.Protected;
- }
+ if (t.IsNestedPublic)
+ return parentLevel;
+ if (t.IsNestedAssembly)
+ return parentLevel & AccessLevel.Internal;
+ if (t.IsNestedFamily)
+ return parentLevel & AccessLevel.Protected;
+ if (t.IsNestedFamORAssem)
+ return parentLevel & AccessLevel.ProtectedOrInternal;
+ if (t.IsNestedFamANDAssem)
+ throw new NotImplementedException ("NestedFamANDAssem not implemented, cant make this kind of type from c# anyways");
- if (t.IsNestedFamORAssem) {
- if ((int) level < (int) AccessLevel.ProtectedInternal)
- level = AccessLevel.ProtectedInternal;
- }
+ // nested private is taken care of
- return level;
+ throw new Exception ("I give up, what are you?");
}
//
- // Returns true if `parent' is as accessible as the flags `flags'
- // given for this member.
+ // This answers `is the type P, as accessible as a member M which has the
+ // accessability @flags which is declared as a nested member of the type T, this declspace'
//
- public bool AsAccessible (Type parent, int flags)
+ public bool AsAccessible (Type p, int flags)
{
- while (parent.IsArray || parent.IsPointer || parent.IsByRef)
- parent = TypeManager.GetElementType (parent);
-
- if (parent.IsGenericParameter)
+ if (p.IsGenericParameter)
return true; // FIXME
- AccessLevel level = GetAccessLevel (flags);
- AccessLevel level2 = GetAccessLevel (parent, flags);
+ //
+ // 1) if M is private, its accessability is the same as this declspace.
+ // we already know that P is accessible to T before this method, so we
+ // may return true.
+ //
- return (int) level >= (int) level2;
+ if ((flags & Modifiers.PRIVATE) != 0)
+ return true;
+
+ while (p.IsArray || p.IsPointer || p.IsByRef)
+ p = TypeManager.GetElementType (p);
+
+ AccessLevel pAccess = TypeEffectiveAccessLevel (p);
+ AccessLevel mAccess = this.EffectiveAccessLevel &
+ GetAccessLevelFromModifiers (flags);
+
+ // for every place from which we can access M, we must
+ // be able to access P as well. So, we want
+ // For every bit in M and P, M_i -> P_1 == true
+ // or, ~ (M -> P) == 0 <-> ~ ( ~M | P) == 0
+
+ return ~ (~ mAccess | pAccess) == 0;
}
- static DoubleHash dh = new DoubleHash ();
+ static DoubleHash dh = new DoubleHash (1000);
Type LookupInterfaceOrClass (string ns, string name, out bool error)
{
@@ -583,7 +604,7 @@ namespace Mono.CSharp {
error = false;
if (dh.Lookup (ns, name, out r))
- t = (Type) r;
+ return (Type) r;
else {
if (ns != ""){
if (Namespace.IsNamespace (ns)){
@@ -595,8 +616,10 @@ namespace Mono.CSharp {
t = TypeManager.LookupType (name);
}
- if (t != null)
+ if (t != null) {
+ dh.Insert (ns, name, t);
return t;
+ }
//
// In case we are fed a composite name, normalize it.
@@ -608,15 +631,18 @@ namespace Mono.CSharp {
}
parent = RootContext.Tree.LookupByNamespace (ns, name);
- if (parent == null)
+ if (parent == null) {
+ dh.Insert (ns, name, null);
return null;
+ }
t = parent.DefineType ();
- dh.Insert (ns, name, t);
if (t == null){
error = true;
return null;
}
+
+ dh.Insert (ns, name, t);
return t;
}
@@ -654,7 +680,7 @@ namespace Mono.CSharp {
Type container_type = containing_ds.TypeBuilder;
Type current_type = container_type;
- while (current_type != null) {
+ while (current_type != null && current_type != TypeManager.object_type) {
string pre = current_type.FullName;
t = LookupInterfaceOrClass (pre, name, out error);
@@ -1047,7 +1073,8 @@ namespace Mono.CSharp {
public readonly IMemberContainer Container;
protected Hashtable member_hash;
protected Hashtable method_hash;
- protected Hashtable interface_hash;
+
+ Hashtable interface_hash;
/// <summary>
/// Create a new MemberCache for the given IMemberContainer `container'.
@@ -1059,12 +1086,14 @@ namespace Mono.CSharp {
Timer.IncrementCounter (CounterType.MemberCache);
Timer.StartTimer (TimerType.CacheInit);
- interface_hash = new Hashtable ();
+
// If we have a parent class (we have a parent class unless we're
// TypeManager.object_type), we deep-copy its MemberCache here.
if (Container.IsInterface) {
MemberCache parent;
+ interface_hash = new Hashtable ();
+
if (Container.Parent != null)
parent = Container.Parent.MemberCache;
else
@@ -1104,13 +1133,6 @@ namespace Mono.CSharp {
return hash;
}
- void AddInterfaces (MemberCache parent)
- {
- foreach (Type iface in parent.interface_hash.Keys) {
- if (!interface_hash.Contains (iface))
- interface_hash.Add (iface, true);
- }
- }
/// <summary>
/// Add the contents of `new_hash' to `hash'.
@@ -1142,7 +1164,8 @@ namespace Mono.CSharp {
if (interface_hash.Contains (itype))
continue;
- interface_hash.Add (itype, true);
+
+ interface_hash [itype] = null;
IMemberContainer iface_container =
TypeManager.LookupMemberContainer (itype);
@@ -1150,7 +1173,12 @@ namespace Mono.CSharp {
MemberCache iface_cache = iface_container.MemberCache;
AddHashtable (hash, iface_cache.member_hash);
- AddInterfaces (iface_cache);
+
+ if (iface_cache.interface_hash == null)
+ continue;
+
+ foreach (Type parent_contains in iface_cache.interface_hash.Keys)
+ interface_hash [parent_contains] = null;
}
return hash;
@@ -1191,8 +1219,6 @@ namespace Mono.CSharp {
void AddMembers (MemberTypes mt, BindingFlags bf, IMemberContainer container)
{
MemberList members = container.GetMembers (mt, bf);
- BindingFlags new_bf = (container == Container) ?
- bf | BindingFlags.DeclaredOnly : bf;
foreach (MemberInfo member in members) {
string name = member.Name;
diff --git a/mcs/gmcs/delegate.cs b/mcs/gmcs/delegate.cs
index 35a9e43a0b5..024d5da673a 100644
--- a/mcs/gmcs/delegate.cs
+++ b/mcs/gmcs/delegate.cs
@@ -25,7 +25,6 @@ namespace Mono.CSharp {
public class Delegate : DeclSpace {
public Expression ReturnType;
public Parameters Parameters;
- public Attributes OptAttributes;
public ConstructorBuilder ConstructorBuilder;
public MethodBuilder InvokeBuilder;
@@ -49,15 +48,14 @@ namespace Mono.CSharp {
public Delegate (NamespaceEntry ns, TypeContainer parent, Expression type,
int mod_flags, string name, Parameters param_list,
Attributes attrs, Location l)
- : base (ns, parent, name, l)
+ : base (ns, parent, name, attrs, l)
+
{
this.ReturnType = type;
ModFlags = Modifiers.Check (AllowedModifiers, mod_flags,
IsTopLevel ? Modifiers.INTERNAL :
Modifiers.PRIVATE, l);
- Parameters = param_list;
- OptAttributes = attrs;
- }
+ Parameters = param_list; }
public override TypeBuilder DefineType ()
{
@@ -350,6 +348,7 @@ namespace Mono.CSharp {
new InternalParameters (container, end_parameters),
end_param_types);
+ Attribute.ApplyAttributes (ec, TypeBuilder, this, OptAttributes);
return true;
}
@@ -571,57 +570,64 @@ namespace Mono.CSharp {
}
- public class NewDelegate : Expression {
-
- public ArrayList Arguments;
+ //
+ // Base class for `NewDelegate' and `ImplicitDelegateCreation'
+ //
+ public abstract class DelegateCreation : Expression {
+ protected MethodBase constructor_method;
+ protected MethodBase delegate_method;
+ protected Expression delegate_instance_expr;
- MethodBase constructor_method;
- MethodBase delegate_method;
- Expression delegate_instance_expr;
+ public DelegateCreation () {}
- public NewDelegate (Type type, ArrayList Arguments, Location loc)
+ public static void Error_NoMatchingMethodForDelegate (MethodGroupExpr mg, Type t, MethodBase method, Location loc)
{
- this.type = type;
- this.Arguments = Arguments;
- this.loc = loc;
+ string method_desc;
+
+ if (mg.Methods.Length > 1)
+ method_desc = mg.Methods [0].Name;
+ else
+ method_desc = Invocation.FullMethodDesc (mg.Methods [0]);
+
+ ParameterData param = Invocation.GetParameterData (method);
+ string delegate_desc = Delegate.FullDelegateDesc (t, method, param);
+
+ Report.Error (123, loc, "Method '" + method_desc + "' does not " +
+ "match delegate '" + delegate_desc + "'");
}
- public override Expression DoResolve (EmitContext ec)
+ public override void Emit (EmitContext ec)
{
- if (Arguments == null || Arguments.Count != 1) {
- Report.Error (149, loc,
- "Method name expected");
- return null;
- }
+ if (delegate_instance_expr == null ||
+ delegate_method.IsStatic)
+ ec.ig.Emit (OpCodes.Ldnull);
+ else
+ delegate_instance_expr.Emit (ec);
+
+ if (delegate_method.IsVirtual) {
+ ec.ig.Emit (OpCodes.Dup);
+ ec.ig.Emit (OpCodes.Ldvirtftn, (MethodInfo) delegate_method);
+ } else
+ ec.ig.Emit (OpCodes.Ldftn, (MethodInfo) delegate_method);
+ ec.ig.Emit (OpCodes.Newobj, (ConstructorInfo) constructor_method);
+ }
+ protected bool ResolveConstructorMethod (EmitContext ec)
+ {
Expression ml = Expression.MemberLookup (
ec, type, ".ctor", loc);
if (!(ml is MethodGroupExpr)) {
Report.Error (-100, loc, "Internal error: Could not find delegate constructor!");
- return null;
+ return false;
}
constructor_method = ((MethodGroupExpr) ml).Methods [0];
- Argument a = (Argument) Arguments [0];
-
- if (!a.ResolveMethodGroup (ec, Location))
- return null;
-
- Expression e = a.Expr;
-
- Expression invoke_method = Expression.MemberLookup (
- ec, type, "Invoke", MemberTypes.Method,
- Expression.AllBindingFlags, loc);
-
- if (invoke_method == null) {
- Report.Error (-200, loc, "Internal error ! Could not find Invoke method!");
- return null;
- }
-
- if (e is MethodGroupExpr) {
- MethodGroupExpr mg = (MethodGroupExpr) e;
+ return true;
+ }
+ protected Expression ResolveMethodGroupExpr (EmitContext ec, MethodGroupExpr mg)
+ {
foreach (MethodInfo mi in mg.Methods){
delegate_method = Delegate.VerifyMethod (ec, type, mi, loc);
@@ -630,19 +636,7 @@ namespace Mono.CSharp {
}
if (delegate_method == null) {
- string method_desc;
- if (mg.Methods.Length > 1)
- method_desc = mg.Methods [0].Name;
- else
- method_desc = Invocation.FullMethodDesc (mg.Methods [0]);
-
- MethodBase dm = ((MethodGroupExpr) invoke_method).Methods [0];
- ParameterData param = Invocation.GetParameterData (dm);
- string delegate_desc = Delegate.FullDelegateDesc (type, dm, param);
-
- Report.Error (123, loc, "Method '" + method_desc + "' does not " +
- "match delegate '" + delegate_desc + "'");
-
+ Error_NoMatchingMethodForDelegate (mg, type, delegate_method, loc);
return null;
}
@@ -683,6 +677,80 @@ namespace Mono.CSharp {
eclass = ExprClass.Value;
return this;
}
+ }
+
+ //
+ // Created from the conversion code
+ //
+ public class ImplicitDelegateCreation : DelegateCreation {
+
+ ImplicitDelegateCreation (Type t, Location l)
+ {
+ type = t;
+ loc = l;
+ }
+
+ public override Expression DoResolve (EmitContext ec)
+ {
+ return this;
+ }
+
+ static public Expression Create (EmitContext ec, MethodGroupExpr mge, Type target_type, Location loc)
+ {
+ ImplicitDelegateCreation d = new ImplicitDelegateCreation (target_type, loc);
+ if (d.ResolveConstructorMethod (ec))
+ return d.ResolveMethodGroupExpr (ec, mge);
+ else
+ return null;
+ }
+ }
+
+ //
+ // A delegate-creation-expression, invoked from the `New' class
+ //
+ public class NewDelegate : DelegateCreation {
+ public ArrayList Arguments;
+
+ //
+ // This constructor is invoked from the `New' expression
+ //
+ public NewDelegate (Type type, ArrayList Arguments, Location loc)
+ {
+ this.type = type;
+ this.Arguments = Arguments;
+ this.loc = loc;
+ }
+
+ public override Expression DoResolve (EmitContext ec)
+ {
+ if (Arguments == null || Arguments.Count != 1) {
+ Report.Error (149, loc,
+ "Method name expected");
+ return null;
+ }
+
+ if (!ResolveConstructorMethod (ec))
+ return null;
+
+ Argument a = (Argument) Arguments [0];
+
+ Expression invoke_method = Expression.MemberLookup (
+ ec, type, "Invoke", MemberTypes.Method,
+ Expression.AllBindingFlags, loc);
+
+ if (invoke_method == null) {
+ Report.Error (-200, loc, "Internal error ! Could not find Invoke method!");
+ return null;
+ }
+
+ if (!a.ResolveMethodGroup (ec, loc))
+ return null;
+
+ Expression e = a.Expr;
+
+ MethodGroupExpr mg = e as MethodGroupExpr;
+ if (mg != null)
+ return ResolveMethodGroupExpr (ec, mg);
Type e_type = e.Type;
@@ -709,8 +777,7 @@ namespace Mono.CSharp {
public override void Emit (EmitContext ec)
{
- if (delegate_instance_expr == null ||
- delegate_method.IsStatic)
+ if (delegate_instance_expr == null || delegate_method.IsStatic)
ec.ig.Emit (OpCodes.Ldnull);
else
delegate_instance_expr.Emit (ec);
@@ -794,8 +861,6 @@ namespace Mono.CSharp {
public override void Emit (EmitContext ec)
{
- Delegate del = TypeManager.LookupDelegate (InstanceExpr.Type);
-
//
// Invocation on delegates call the virtual Invoke member
// so we are always `instance' calls
diff --git a/mcs/gmcs/driver.cs b/mcs/gmcs/driver.cs
index 132f873fd09..120c295f41d 100755
--- a/mcs/gmcs/driver.cs
+++ b/mcs/gmcs/driver.cs
@@ -18,7 +18,7 @@ namespace Mono.CSharp
using System.Text;
using System.Globalization;
- enum Target {
+ public enum Target {
Library, Exe, Module, WinExe
};
@@ -40,6 +40,11 @@ namespace Mono.CSharp
//
static ArrayList soft_references;
+ //
+ // Modules to be linked
+ //
+ static ArrayList modules;
+
// Lookup paths
static ArrayList link_paths;
@@ -51,9 +56,6 @@ namespace Mono.CSharp
static string first_source;
- static Target target = Target.Exe;
- static string target_ext = ".exe";
-
static bool want_debugging_support = false;
static bool parse_only = false;
@@ -74,6 +76,8 @@ namespace Mono.CSharp
//
static ArrayList resources;
static ArrayList embedded_resources;
+ static string win32ResourceFile;
+ static string win32IconFile;
//
// An array of the defines from the command line
@@ -145,7 +149,6 @@ namespace Mono.CSharp
int token, tokens = 0, errors = 0;
while ((token = lexer.token ()) != Token.EOF){
- Location l = lexer.Location;
tokens++;
if (token == Token.ERROR)
errors++;
@@ -212,13 +215,15 @@ namespace Mono.CSharp
" --timestamp Displays time stamps of various compiler events\n" +
" -unsafe[+|-] Allows unsafe code\n" +
" -warnaserror[+|-] Treat warnings as errors\n" +
- " -warn:LEVEL Sets warning level (the highest is 4, the default)\n" +
+ " -warn:LEVEL Sets warning level (the highest is 4, the default is 2)\n" +
" -v Verbose parsing (for debugging the parser)\n" +
" -2 Enables experimental C# features\n" +
"\n" +
"Resources:\n" +
" -linkresource:FILE[,ID] Links FILE as a resource\n" +
" -resource:FILE[,ID] Embed FILE as a resource\n" +
+ " -win32res:FILE Specifies Win32 resource file (.res)\n" +
+ " -win32icon:FILE Use this icon for the output\n" +
" --mcs-debug X Sets MCS debugging level to X\n" +
" @file Read response file for more options\n\n" +
"Options can be of the form -option or /option");
@@ -312,6 +317,52 @@ namespace Mono.CSharp
}
}
+ static public void LoadModule (MethodInfo adder_method, string module)
+ {
+ Module m;
+ string total_log = "";
+
+ try {
+ try {
+ m = (Module)adder_method.Invoke (CodeGen.AssemblyBuilder, new object [] { module });
+ }
+ catch (TargetInvocationException ex) {
+ throw ex.InnerException;
+ }
+ TypeManager.AddModule (m);
+
+ }
+ catch (FileNotFoundException){
+ foreach (string dir in link_paths){
+ string full_path = Path.Combine (dir, module);
+ if (!module.EndsWith (".netmodule"))
+ full_path += ".netmodule";
+
+ try {
+ try {
+ m = (Module)adder_method.Invoke (CodeGen.AssemblyBuilder, new object [] { full_path });
+ }
+ catch (TargetInvocationException ex) {
+ throw ex.InnerException;
+ }
+ TypeManager.AddModule (m);
+ return;
+ } catch (FileNotFoundException ff) {
+ total_log += ff.FusionLog;
+ continue;
+ }
+ }
+ Report.Error (6, "Cannot find module `" + module + "'" );
+ Console.WriteLine ("Log: \n" + total_log);
+ } catch (BadImageFormatException f) {
+ Report.Error(6, "Cannot load module (bad file format)" + f.FusionLog);
+ } catch (FileLoadException f){
+ Report.Error(6, "Cannot load module " + f.FusionLog);
+ } catch (ArgumentNullException){
+ Report.Error(6, "Cannot load module (null argument)");
+ }
+ }
+
/// <summary>
/// Loads all assemblies referenced on the command line
/// </summary>
@@ -390,7 +441,8 @@ namespace Mono.CSharp
foreach (Assembly a in assemblies){
string codebase = a.Location;
- if (codebase.EndsWith ("corlib.dll")){
+ string fn = System.IO.Path.GetFileName (codebase);
+ if (fn == "corlib.dll" || fn == "mscorlib.dll"){
return codebase.Substring (0, codebase.LastIndexOf (System.IO.Path.DirectorySeparatorChar));
}
}
@@ -404,7 +456,7 @@ namespace Mono.CSharp
//
static void SplitPathAndPattern (string spec, out string path, out string pattern)
{
- int p = spec.LastIndexOf ("/");
+ int p = spec.LastIndexOf ('/');
if (p != -1){
//
// Windows does not like /file.cs, switch that to:
@@ -420,7 +472,7 @@ namespace Mono.CSharp
return;
}
- p = spec.LastIndexOf ("\\");
+ p = spec.LastIndexOf ('\\');
if (p != -1){
path = spec.Substring (0, p);
pattern = spec.Substring (p + 1);
@@ -457,7 +509,7 @@ namespace Mono.CSharp
string path, pattern;
SplitPathAndPattern (spec, out path, out pattern);
- if (pattern.IndexOf ("*") == -1){
+ if (pattern.IndexOf ('*') == -1){
ProcessFile (spec);
return;
}
@@ -553,8 +605,17 @@ namespace Mono.CSharp
if (level < 0 || level > 4){
Report.Error (1900, "Warning level must be 0 to 4");
Environment.Exit (1);
- } else
- RootContext.WarningLevel = level;
+ }
+ RootContext.WarningLevel = level;
+ TestWarningConflict ();
+ }
+
+ static void TestWarningConflict ()
+ {
+ if (RootContext.WarningLevel == 0 && Report.WarningsAreErrors) {
+ Report.Error (1901, "Conflicting options specified: Warning level 0; Treat warnings as errors");
+ Environment.Exit (1);
+ }
}
static void SetupV2 ()
@@ -693,21 +754,21 @@ namespace Mono.CSharp
string type = args [++i];
switch (type){
case "library":
- target = Target.Library;
- target_ext = ".dll";
+ RootContext.Target = Target.Library;
+ RootContext.TargetExt = ".dll";
break;
case "exe":
- target = Target.Exe;
+ RootContext.Target = Target.Exe;
break;
case "winexe":
- target = Target.WinExe;
+ RootContext.Target = Target.WinExe;
break;
case "module":
- target = Target.Module;
- target_ext = ".dll";
+ RootContext.Target = Target.Module;
+ RootContext.TargetExt = ".dll";
break;
default:
TargetUsage ();
@@ -743,6 +804,7 @@ namespace Mono.CSharp
case "--werror":
Report.WarningsAreErrors = true;
+ TestWarningConflict();
return true;
case "--nowarn":
@@ -825,7 +887,7 @@ namespace Mono.CSharp
//
static bool CSCParseOption (string option, ref string [] args, ref int i)
{
- int idx = option.IndexOf (":");
+ int idx = option.IndexOf (':');
string arg, value;
if (idx == -1){
@@ -845,21 +907,21 @@ namespace Mono.CSharp
case "/target":
switch (value){
case "exe":
- target = Target.Exe;
+ RootContext.Target = Target.Exe;
break;
case "winexe":
- target = Target.WinExe;
+ RootContext.Target = Target.WinExe;
break;
case "library":
- target = Target.Library;
- target_ext = ".dll";
+ RootContext.Target = Target.Library;
+ RootContext.TargetExt = ".dll";
break;
case "module":
- target = Target.Module;
- target_ext = ".netmodule";
+ RootContext.Target = Target.Module;
+ RootContext.TargetExt = ".netmodule";
break;
default:
@@ -947,6 +1009,36 @@ namespace Mono.CSharp
}
return true;
}
+ case "/addmodule": {
+ if (value == ""){
+ Report.Error (5, arg + " requires an argument");
+ Environment.Exit (1);
+ }
+
+ string [] refs = value.Split (new char [] { ';', ',' });
+ foreach (string r in refs){
+ modules.Add (r);
+ }
+ return true;
+ }
+ case "/win32res": {
+ if (value == "") {
+ Report.Error (5, arg + " requires an argument");
+ Environment.Exit (1);
+ }
+
+ win32ResourceFile = value;
+ return true;
+ }
+ case "/win32icon": {
+ if (value == "") {
+ Report.Error (5, arg + " requires an argument");
+ Environment.Exit (1);
+ }
+
+ win32IconFile = value;
+ return true;
+ }
case "/doc": {
if (value == ""){
Report.Error (5, arg + " requires an argument");
@@ -995,6 +1087,7 @@ namespace Mono.CSharp
case "/warnaserror":
case "/warnaserror+":
Report.WarningsAreErrors = true;
+ TestWarningConflict();
return true;
case "/warnaserror-":
@@ -1015,15 +1108,16 @@ namespace Mono.CSharp
warns = value.Split (new Char [] {','});
foreach (string wc in warns){
- int warn = 0;
-
try {
- warn = Int32.Parse (wc);
+ int warn = Int32.Parse (wc);
+ if (warn < 1) {
+ throw new ArgumentOutOfRangeException("warn");
+ }
+ Report.SetIgnoreWarning (warn);
} catch {
- Usage ();
+ Report.Error (1904, String.Format("'{0}' is not a valid warning number", wc));
Environment.Exit (1);
}
- Report.SetIgnoreWarning (warn);
}
return true;
}
@@ -1064,10 +1158,6 @@ namespace Mono.CSharp
case "/fullpaths":
return true;
- case "/win32icon":
- Report.Error (5, "/win32icon is currently not supported");
- return true;
-
case "/v2":
case "/2":
SetupV2 ();
@@ -1091,22 +1181,16 @@ namespace Mono.CSharp
try {
cp = Int32.Parse (value);
- } catch { }
-
- if (cp == -1){
- Console.WriteLine ("Invalid code-page requested");
- Usage ();
- }
-
- try {
encoding = Encoding.GetEncoding (cp);
using_default_encoder = false;
} catch {
- Console.WriteLine ("Code page: {0} not supported", cp);
+ Report.Error (2016, String.Format("Code page '{0}' is invalid or not installed", cp));
+ Environment.Exit (1);
}
return true;
-
}
+ //Report.Error (2007, String.Format ("Unrecognized command-line option: '{0}'", option));
+ //Environment.Exit (1);
return false;
}
@@ -1120,7 +1204,7 @@ namespace Mono.CSharp
/// now, needs to be turned into a real driver soon.
/// </remarks>
// [MonoTODO("Change error code for unknown argument to something reasonable")]
- static bool MainDriver (string [] args)
+ internal static bool MainDriver (string [] args)
{
int i;
bool parsing_options = true;
@@ -1136,6 +1220,7 @@ namespace Mono.CSharp
references = new ArrayList ();
soft_references = new ArrayList ();
+ modules = new ArrayList ();
link_paths = new ArrayList ();
SetupDefaultDefines ();
@@ -1212,17 +1297,33 @@ namespace Mono.CSharp
if (tokenize)
return true;
+ //
+ // If we are an exe, require a source file for the entry point
+ //
+ if (RootContext.Target == Target.Exe || RootContext.Target == Target.WinExe){
if (first_source == null){
Report.Error (2008, "No files to compile were specified");
return 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){
+ Report.Error (2008, "No files to compile were specified");
+ return false;
+ }
+
if (Report.Errors > 0)
return false;
if (parse_only)
return true;
+ Tokenizer.Cleanup ();
+
//
// Load Core Library for default compilation
//
@@ -1255,21 +1356,40 @@ namespace Mono.CSharp
// Quick hack
//
if (output_file == null){
- int pos = first_source.LastIndexOf (".");
+ int pos = first_source.LastIndexOf ('.');
if (pos > 0)
- output_file = first_source.Substring (0, pos) + target_ext;
+ output_file = first_source.Substring (0, pos) + RootContext.TargetExt;
else
- output_file = first_source + target_ext;
+ output_file = first_source + RootContext.TargetExt;
}
CodeGen.Init (output_file, output_file, want_debugging_support);
+ if (RootContext.Target == Target.Module) {
+ PropertyInfo module_only = typeof (AssemblyBuilder).GetProperty ("IsModuleOnly", BindingFlags.Instance|BindingFlags.Public|BindingFlags.NonPublic);
+ if (module_only == null) {
+ Report.Error (0, new Location (-1), "Cannot use /target:module on this runtime: try the Mono runtime instead.");
+ Environment.Exit (1);
+ }
+
+ module_only.SetValue (CodeGen.AssemblyBuilder, true, null);
+ }
+
TypeManager.AddModule (CodeGen.ModuleBuilder);
- DateTime start = DateTime.Now;
+ if (modules.Count > 0) {
+ MethodInfo adder_method = typeof (AssemblyBuilder).GetMethod ("AddModule", BindingFlags.Instance|BindingFlags.NonPublic);
+ if (adder_method == null) {
+ Report.Error (0, new Location (-1), "Cannot use /addmodule on this runtime: Try the Mono runtime instead.");
+ Environment.Exit (1);
+ }
+
+ foreach (string module in modules)
+ LoadModule (adder_method, module);
+ }
+
TypeManager.ComputeNamespaces ();
- DateTime end = DateTime.Now;
//
// Before emitting, we need to get the core
@@ -1335,20 +1455,20 @@ namespace Mono.CSharp
PEFileKinds k = PEFileKinds.ConsoleApplication;
- if (target == Target.Library || target == Target.Module){
- k = PEFileKinds.Dll;
-
- if (RootContext.MainClass != null)
- Report.Error (2017, "Can not specify -main: when building module or library");
- } else if (target == Target.Exe)
- k = PEFileKinds.ConsoleApplication;
- else if (target == Target.WinExe)
- k = PEFileKinds.WindowApplication;
+ switch (RootContext.Target) {
+ case Target.Library:
+ case Target.Module:
+ k = PEFileKinds.Dll; break;
+ case Target.Exe:
+ k = PEFileKinds.ConsoleApplication; break;
+ case Target.WinExe:
+ k = PEFileKinds.WindowApplication; break;
+ }
- if (target == Target.Exe || target == Target.WinExe){
+ if (RootContext.NeedsEntryPoint) {
MethodInfo ep = RootContext.EntryPoint;
- if (ep == null){
+ if (ep == null) {
if (Report.Errors == 0)
Report.Error (5001, "Program " + output_file +
" does not have an entry point defined");
@@ -1356,6 +1476,8 @@ namespace Mono.CSharp
}
CodeGen.AssemblyBuilder.SetEntryPoint (ep, k);
+ } else if (RootContext.MainClass != null) {
+ Report.Error (2017, "Can not specify -main: when building module or library");
}
//
@@ -1381,7 +1503,8 @@ namespace Mono.CSharp
object[] margs = new object [2];
Type[] argst = new Type [2];
argst [0] = argst [1] = typeof (string);
- MethodInfo embed_res = typeof (AssemblyBuilder).GetMethod ("EmbedResourceFile", argst);
+
+ MethodInfo embed_res = typeof (AssemblyBuilder).GetMethod ("EmbedResourceFile", BindingFlags.Instance|BindingFlags.Public|BindingFlags.NonPublic, null, CallingConventions.Any, argst, null);
if (embed_res == null) {
Report.Warning (0, new Location (-1), "Cannot embed resources on this runtime: try the Mono runtime instead.");
} else {
@@ -1404,6 +1527,29 @@ namespace Mono.CSharp
}
}
+ //
+ // Add Win32 resources
+ //
+
+ CodeGen.AssemblyBuilder.DefineVersionInfoResource ();
+
+ if (win32ResourceFile != null) {
+ try {
+ CodeGen.AssemblyBuilder.DefineUnmanagedResource (win32ResourceFile);
+ }
+ catch (ArgumentException) {
+ Report.Warning (0, new Location (-1), "Cannot embed win32 resources on this runtime: try the Mono runtime instead.");
+ }
+ }
+
+ if (win32IconFile != null) {
+ MethodInfo define_icon = typeof (AssemblyBuilder).GetMethod ("DefineIconResource", BindingFlags.Instance|BindingFlags.Public|BindingFlags.NonPublic);
+ if (define_icon == null) {
+ Report.Warning (0, new Location (-1), "Cannot embed icon resource on this runtime: try the Mono runtime instead.");
+ }
+ define_icon.Invoke (CodeGen.AssemblyBuilder, new object [] { win32IconFile });
+ }
+
if (Report.Errors > 0)
return false;
@@ -1429,4 +1575,23 @@ namespace Mono.CSharp
}
}
+
+ //
+ // This is the only public entry point
+ //
+ public class CompilerCallableEntryPoint : MarshalByRefObject {
+ static bool used = false;
+
+ public bool InvokeCompiler (string [] args)
+ {
+ if (used)
+ Reset ();
+ bool ok = Driver.MainDriver (args);
+ return ok && Report.Errors == 0;
+ }
+
+ public void Reset ()
+ {
+ }
+ }
}
diff --git a/mcs/gmcs/ecore.cs b/mcs/gmcs/ecore.cs
index 6cf243f231d..26b6c6f376e 100755
--- a/mcs/gmcs/ecore.cs
+++ b/mcs/gmcs/ecore.cs
@@ -314,10 +314,12 @@ namespace Mono.CSharp {
break;
case ExprClass.MethodGroup:
+ if (!RootContext.V2){
if ((flags & ResolveFlags.MethodGroup) == 0) {
((MethodGroupExpr) e).ReportUsageError ();
return null;
}
+ }
break;
case ExprClass.Value:
@@ -405,6 +407,12 @@ namespace Mono.CSharp {
/// </remarks>
public abstract void Emit (EmitContext ec);
+ public virtual void EmitBranchable (EmitContext ec, Label target, bool onTrue)
+ {
+ Emit (ec);
+ ec.ig.Emit (onTrue ? OpCodes.Brtrue : OpCodes.Brfalse, target);
+ }
+
/// <summary>
/// Protected constructor. Only derivate types should
/// be able to be created
@@ -663,11 +671,15 @@ namespace Mono.CSharp {
Report.Error (
122, loc, "`" + TypeManager.CSharpName (qualifier_type) + "." +
name + "' is inaccessible due to its protection level");
- else
+ else if (name == ".ctor") {
+ Report.Error (143, loc, String.Format ("The type {0} has no constructors defined",
+ TypeManager.CSharpName (queried_type)));
+ } else {
Report.Error (
122, loc, "`" + name + "' is inaccessible due to its " +
"protection level");
}
+ }
static public MemberInfo GetFieldFromEvent (EventExpr event_expr)
{
@@ -820,7 +832,7 @@ namespace Mono.CSharp {
"a `" + sb.ToString () + "' was expected");
}
- static void Error_ConstantValueCannotBeConverted (Location l, string val, Type t)
+ static public void Error_ConstantValueCannotBeConverted (Location l, string val, Type t)
{
Report.Error (31, l, "Constant value `" + val + "' cannot be converted to " +
TypeManager.CSharpName (t));
@@ -1314,6 +1326,12 @@ namespace Mono.CSharp {
public class EmptyCast : Expression {
protected Expression child;
+ public Expression Child {
+ get {
+ return child;
+ }
+ }
+
public EmptyCast (Expression child, Type return_type)
{
eclass = child.eclass;
@@ -1958,19 +1976,19 @@ namespace Mono.CSharp {
alias_value = null;
if (ec.ResolvingTypeTree){
- if (alias_value != null){
- if ((t = RootContext.LookupType (ds, alias_value, true, loc)) != null)
- return new TypeExpression (t, loc);
- }
-
int errors = Report.Errors;
- Type dt = ec.DeclSpace.FindType (loc, Name);
+ Type dt = ds.FindType (loc, Name);
if (Report.Errors != errors)
return null;
if (dt != null)
return new TypeExpression (dt, loc);
+
+ if (alias_value != null){
+ if ((t = RootContext.LookupType (ds, alias_value, true, loc)) != null)
+ return new TypeExpression (t, loc);
+ }
}
//
@@ -2601,7 +2619,7 @@ namespace Mono.CSharp {
FieldBase fb = TypeManager.GetField (FieldInfo);
if (fb != null)
- fb.IsAssigned = true;
+ fb.SetAssigned ();
//
// InitOnly fields can only be assigned in constructors
@@ -2749,9 +2767,21 @@ namespace Mono.CSharp {
// Handle initonly fields specially: make a copy and then
// get the address of the copy.
//
- if (FieldInfo.IsInitOnly && !ec.IsConstructor){
+ bool need_copy;
+ if (FieldInfo.IsInitOnly){
+ need_copy = true;
+ if (ec.IsConstructor){
+ if (FieldInfo.IsStatic){
+ if (ec.IsStatic)
+ need_copy = false;
+ } else
+ need_copy = false;
+ }
+ } else
+ need_copy = false;
+
+ if (need_copy){
LocalBuilder local;
-
Emit (ec);
local = ig.DeclareLocal (type);
ig.Emit (OpCodes.Stloc, local);
@@ -2759,9 +2789,10 @@ namespace Mono.CSharp {
return;
}
- if (FieldInfo.IsStatic)
+
+ if (FieldInfo.IsStatic){
ig.Emit (OpCodes.Ldsflda, FieldInfo);
- else {
+ } else {
//
// In the case of `This', we call the AddressOf method, which will
// only load the pointer, and not perform an Ldobj immediately after
diff --git a/mcs/gmcs/enum.cs b/mcs/gmcs/enum.cs
index 06f4c9e0cf7..e8e7dd3cb76 100755
--- a/mcs/gmcs/enum.cs
+++ b/mcs/gmcs/enum.cs
@@ -23,7 +23,6 @@ namespace Mono.CSharp {
ArrayList ordered_enums;
public Expression BaseType;
- public Attributes OptAttributes;
public Type UnderlyingType;
@@ -51,12 +50,11 @@ namespace Mono.CSharp {
public Enum (NamespaceEntry ns, TypeContainer parent, Expression type, int mod_flags,
string name, Attributes attrs, Location l)
- : base (ns, parent, name, l)
+ : base (ns, parent, name, attrs, l)
{
this.BaseType = type;
ModFlags = Modifiers.Check (AllowedModifiers, mod_flags,
IsTopLevel ? Modifiers.INTERNAL : Modifiers.PRIVATE, l);
- OptAttributes = attrs;
ordered_enums = new ArrayList ();
member_to_location = new Hashtable ();
diff --git a/mcs/gmcs/expression.cs b/mcs/gmcs/expression.cs
index d9ce215371d..c1120769e72 100755
--- a/mcs/gmcs/expression.cs
+++ b/mcs/gmcs/expression.cs
@@ -565,15 +565,23 @@ namespace Mono.CSharp {
public override void Emit (EmitContext ec)
{
ILGenerator ig = ec.ig;
- Type expr_type = Expr.Type;
switch (Oper) {
case Operator.UnaryPlus:
throw new Exception ("This should be caught by Resolve");
case Operator.UnaryNegation:
+ if (ec.CheckState) {
+ ig.Emit (OpCodes.Ldc_I4_0);
+ if (type == TypeManager.int64_type)
+ ig.Emit (OpCodes.Conv_U8);
+ Expr.Emit (ec);
+ ig.Emit (OpCodes.Sub_Ovf);
+ } else {
Expr.Emit (ec);
ig.Emit (OpCodes.Neg);
+ }
+
break;
case Operator.LogicalNot:
@@ -597,16 +605,12 @@ namespace Mono.CSharp {
}
}
- /// <summary>
- /// This will emit the child expression for `ec' avoiding the logical
- /// not. The parent will take care of changing brfalse/brtrue
- /// </summary>
- public void EmitLogicalNot (EmitContext ec)
+ public override void EmitBranchable (EmitContext ec, Label target, bool onTrue)
{
- if (Oper != Operator.LogicalNot)
- throw new Exception ("EmitLogicalNot can only be called with !expr");
-
- Expr.Emit (ec);
+ if (Oper == Operator.LogicalNot)
+ Expr.EmitBranchable (ec, target, !onTrue);
+ else
+ base.EmitBranchable (ec, target, onTrue);
}
public override string ToString ()
@@ -643,14 +647,14 @@ namespace Mono.CSharp {
ILGenerator ig = ec.ig;
if (temporary != null){
- if (have_temporary){
+ if (have_temporary) {
temporary.Emit (ec);
- return;
- }
+ } else {
expr.Emit (ec);
ec.ig.Emit (OpCodes.Dup);
temporary.Store (ec);
have_temporary = true;
+ }
} else
expr.Emit (ec);
@@ -1042,6 +1046,8 @@ namespace Mono.CSharp {
ia.EmitAssign (ec, temp_storage);
break;
}
+
+ temp_storage.Release (ec);
}
public override void Emit (EmitContext ec)
@@ -1144,6 +1150,35 @@ namespace Mono.CSharp {
throw new Exception ("never reached");
}
+ public override void EmitBranchable (EmitContext ec, Label target, bool onTrue)
+ {
+ ILGenerator ig = ec.ig;
+
+ switch (action){
+ case Action.AlwaysFalse:
+ if (! onTrue)
+ ig.Emit (OpCodes.Br, target);
+
+ return;
+ case Action.AlwaysTrue:
+ if (onTrue)
+ ig.Emit (OpCodes.Br, target);
+
+ return;
+ case Action.LeaveOnStack:
+ // the `e != null' rule.
+ expr.Emit (ec);
+ ig.Emit (onTrue ? OpCodes.Brtrue : OpCodes.Brfalse, target);
+ return;
+ case Action.Probe:
+ expr.Emit (ec);
+ ig.Emit (OpCodes.Isinst, probe_type);
+ ig.Emit (onTrue ? OpCodes.Brtrue : OpCodes.Brfalse, target);
+ return;
+ }
+ throw new Exception ("never reached");
+ }
+
public override Expression DoResolve (EmitContext ec)
{
Expression e = base.DoResolve (ec);
@@ -1242,7 +1277,7 @@ namespace Mono.CSharp {
if (TypeManager.IsValueType (probe_type)){
Report.Error (77, loc, "The as operator should be used with a reference type only (" +
- TypeManager.CSharpName (probe_type) + " is a value type");
+ TypeManager.CSharpName (probe_type) + " is a value type)");
return null;
}
@@ -1720,9 +1755,9 @@ namespace Mono.CSharp {
if (real_expr is DoubleConstant){
double v = ((DoubleConstant) real_expr).Value;
- if (target_type == TypeManager.byte_type)
+ if (target_type == TypeManager.byte_type){
return new ByteConstant ((byte) v);
- if (target_type == TypeManager.sbyte_type)
+ } if (target_type == TypeManager.sbyte_type)
return new SByteConstant ((sbyte) v);
if (target_type == TypeManager.short_type)
return new ShortConstant ((short) v);
@@ -1792,8 +1827,6 @@ namespace Mono.CSharp {
if (expr == null)
return null;
- int errors = Report.Errors;
-
type = ec.DeclSpace.ResolveType (target_type, false, Location);
if (type == null)
@@ -2091,7 +2124,7 @@ namespace Mono.CSharp {
//
// If either operand is of type uint, and the other
// operand is of type sbyte, short or int, othe operands are
- // converted to type long.
+ // converted to type long (unless we have an int constant).
//
Type other = null;
@@ -2192,8 +2225,6 @@ namespace Mono.CSharp {
Expression CheckShiftArguments (EmitContext ec)
{
Expression e;
- Type l = left.Type;
- Type r = right.Type;
e = ForceConversion (ec, right, TypeManager.int32_type);
if (e == null){
@@ -2209,6 +2240,14 @@ namespace Mono.CSharp {
left = e;
type = e.Type;
+ if (type == TypeManager.int32_type || type == TypeManager.uint32_type){
+ right = new Binary (Binary.Operator.BitwiseAnd, right, new IntLiteral (31), loc);
+ right = right.DoResolve (ec);
+ } else {
+ right = new Binary (Binary.Operator.BitwiseAnd, right, new IntLiteral (63), loc);
+ right = right.DoResolve (ec);
+ }
+
return this;
}
Error_OperatorCannotBeApplied ();
@@ -2272,10 +2311,6 @@ namespace Mono.CSharp {
}
//
- // Step 2: Default operations on CLI native types.
- //
-
- //
// Step 0: String concatenation (because overloading will get this wrong)
//
if (oper == Operator.Addition){
@@ -2310,15 +2345,18 @@ namespace Mono.CSharp {
//
if (b.method == TypeManager.string_concat_string_string ||
b.method == TypeManager.string_concat_string_string_string){
- ArrayList bargs = b.Arguments;
- int count = bargs.Count;
+ int count = b.Arguments.Count;
if (count == 2){
+ ArrayList bargs = new ArrayList (3);
+ bargs.AddRange (b.Arguments);
bargs.Add (new Argument (right, Argument.AType.Expression));
return new BinaryMethod (
TypeManager.string_type,
TypeManager.string_concat_string_string_string, bargs);
} else if (count == 3){
+ ArrayList bargs = new ArrayList (4);
+ bargs.AddRange (b.Arguments);
bargs.Add (new Argument (right, Argument.AType.Expression));
return new BinaryMethod (
TypeManager.string_type,
@@ -2341,9 +2379,10 @@ namespace Mono.CSharp {
}
//
- // Cascading concats will hold up to 4 arguments
+ // Cascading concats will hold up to 2 arguments, any extras will be
+ // reallocated above.
//
- ArrayList args = new ArrayList (4);
+ ArrayList args = new ArrayList (2);
args.Add (new Argument (left, Argument.AType.Expression));
args.Add (new Argument (right, Argument.AType.Expression));
@@ -2447,8 +2486,16 @@ namespace Mono.CSharp {
// +, -, *, /, %, &, |, ^, ==, !=, <, >, <=, >=
//
if (oper == Operator.Addition || oper == Operator.Subtraction) {
- if (l.IsSubclassOf (TypeManager.delegate_type) &&
- r.IsSubclassOf (TypeManager.delegate_type)) {
+ if (l.IsSubclassOf (TypeManager.delegate_type)){
+ if (right.eclass == ExprClass.MethodGroup && RootContext.V2){
+ Expression tmp = Convert.ImplicitConversionRequired (ec, right, l, loc);
+ if (tmp == null)
+ return null;
+ right = tmp;
+ r = right.Type;
+ }
+
+ if (r.IsSubclassOf (TypeManager.delegate_type)){
MethodInfo method;
ArrayList args = new ArrayList (2);
@@ -2468,6 +2515,7 @@ namespace Mono.CSharp {
return new BinaryDelegate (l, method, args);
}
+ }
//
// Pointer arithmetic:
@@ -2512,7 +2560,8 @@ namespace Mono.CSharp {
Expression temp;
// U operator - (E e, E f)
- if (lie && rie && oper == Operator.Subtraction){
+ if (lie && rie){
+ if (oper == Operator.Subtraction){
if (l == r){
type = TypeManager.EnumToUnderlying (l);
return this;
@@ -2520,6 +2569,7 @@ namespace Mono.CSharp {
Error_OperatorCannotBeApplied ();
return null;
}
+ }
//
// operator + (E e, U x)
@@ -2529,9 +2579,18 @@ namespace Mono.CSharp {
Type enum_type = lie ? l : r;
Type other_type = lie ? r : l;
Type underlying_type = TypeManager.EnumToUnderlying (enum_type);
-;
if (underlying_type != other_type){
+ temp = Convert.ImplicitConversion (ec, lie ? right : left, underlying_type, loc);
+ if (temp != null){
+ if (lie)
+ right = temp;
+ else
+ left = temp;
+ type = enum_type;
+ return this;
+ }
+
Error_OperatorCannotBeApplied ();
return null;
}
@@ -2658,8 +2717,9 @@ namespace Mono.CSharp {
(l == TypeManager.short_type) ||
(l == TypeManager.ushort_type) ||
(l == TypeManager.int64_type) ||
- (l == TypeManager.uint64_type)))
+ (l == TypeManager.uint64_type))){
type = l;
+ }
} else {
Error_OperatorCannotBeApplied ();
return null;
@@ -2720,7 +2780,7 @@ namespace Mono.CSharp {
/// The expression's code is generated, and we will generate a branch to `target'
/// if the resulting expression value is equal to isTrue
/// </remarks>
- public bool EmitBranchable (EmitContext ec, Label target, bool onTrue)
+ public override void EmitBranchable (EmitContext ec, Label target, bool onTrue)
{
ILGenerator ig = ec.ig;
@@ -2730,130 +2790,79 @@ namespace Mono.CSharp {
// but on top of that we want for == and != to use a special path
// if we are comparing against null
//
- if (oper == Operator.Equality || oper == Operator.Inequality){
+ if (oper == Operator.Equality || oper == Operator.Inequality) {
bool my_on_true = oper == Operator.Inequality ? onTrue : !onTrue;
- if (left is NullLiteral){
+ if (left is NullLiteral || left is IntConstant && ((IntConstant) left).Value == 0) {
right.Emit (ec);
if (my_on_true)
ig.Emit (OpCodes.Brtrue, target);
else
ig.Emit (OpCodes.Brfalse, target);
- return true;
- } else if (right is NullLiteral){
+
+ return;
+ } else if (right is NullLiteral || right is IntConstant && ((IntConstant) right).Value == 0){
left.Emit (ec);
if (my_on_true)
ig.Emit (OpCodes.Brtrue, target);
else
ig.Emit (OpCodes.Brfalse, target);
- return true;
+
+ return;
} else if (left is BoolConstant){
right.Emit (ec);
if (my_on_true != ((BoolConstant) left).Value)
ig.Emit (OpCodes.Brtrue, target);
else
ig.Emit (OpCodes.Brfalse, target);
- return true;
+
+ return;
} else if (right is BoolConstant){
left.Emit (ec);
if (my_on_true != ((BoolConstant) right).Value)
ig.Emit (OpCodes.Brtrue, target);
else
ig.Emit (OpCodes.Brfalse, target);
- return true;
+
+ return;
}
- } else if (oper == Operator.LogicalAnd){
- if (left is Binary){
- Binary left_binary = (Binary) left;
+ } else if (oper == Operator.LogicalAnd) {
- if (onTrue){
+ if (onTrue) {
Label tests_end = ig.DefineLabel ();
- if (left_binary.EmitBranchable (ec, tests_end, false)){
- if (right is Binary){
- Binary right_binary = (Binary) right;
-
- if (right_binary.EmitBranchable (ec, target, true)){
- ig.MarkLabel (tests_end);
- return true;
- }
- }
- right.Emit (ec);
- ig.Emit (OpCodes.Brtrue, target);
+ left.EmitBranchable (ec, tests_end, false);
+ right.EmitBranchable (ec, target, true);
ig.MarkLabel (tests_end);
- return true;
- }
} else {
- if (left_binary.EmitBranchable (ec, target, false)){
- if (right is Binary){
- Binary right_binary = (Binary) right;
-
- if (right_binary.EmitBranchable (ec, target, false))
- return true;
- }
- right.Emit (ec);
- if (onTrue)
- ig.Emit (OpCodes.Brtrue, target);
- else
- ig.Emit (OpCodes.Brfalse, target);
- return true;
- }
+ left.EmitBranchable (ec, target, false);
+ right.EmitBranchable (ec, target, false);
}
- //
- // Give up, and let the regular Emit work, but we could
- // also optimize the left-non-Branchable, but-right-Branchable
- //
- }
- return false;
- } else if (oper == Operator.LogicalOr){
- if (left is Binary){
- Binary left_binary = (Binary) left;
- if (onTrue){
- if (left_binary.EmitBranchable (ec, target, true)){
- if (right is Binary){
- Binary right_binary = (Binary) right;
+ return;
- if (right_binary.EmitBranchable (ec, target, true))
- return true;
- }
- right.Emit (ec);
- ig.Emit (OpCodes.Brtrue, target);
- return true;
- }
+ } else if (oper == Operator.LogicalOr){
+ if (onTrue) {
+ left.EmitBranchable (ec, target, true);
+ right.EmitBranchable (ec, target, true);
- //
- // Give up, and let the regular Emit work, but we could
- // also optimize the left-non-Branchable, but-right-Branchable
- //
} else {
Label tests_end = ig.DefineLabel ();
+ left.EmitBranchable (ec, tests_end, true);
+ right.EmitBranchable (ec, target, false);
+ ig.MarkLabel (tests_end);
+ }
- if (left_binary.EmitBranchable (ec, tests_end, true)){
- if (right is Binary){
- Binary right_binary = (Binary) right;
+ return;
- if (right_binary.EmitBranchable (ec, target, false)){
- ig.MarkLabel (tests_end);
- return true;
- }
- }
- right.Emit (ec);
- ig.Emit (OpCodes.Brfalse, target);
- ig.MarkLabel (tests_end);
- return true;
- }
- }
+ } else if (!(oper == Operator.LessThan || oper == Operator.GreaterThan ||
+ oper == Operator.LessThanOrEqual || oper == Operator.GreaterThanOrEqual ||
+ oper == Operator.Equality || oper == Operator.Inequality)) {
+ base.EmitBranchable (ec, target, onTrue);
+ return;
}
- return false;
- } else if (!(oper == Operator.LessThan ||
- oper == Operator.GreaterThan ||
- oper == Operator.LessThanOrEqual ||
- oper == Operator.GreaterThanOrEqual))
- return false;
-
left.Emit (ec);
right.Emit (ec);
@@ -2932,71 +2941,42 @@ namespace Mono.CSharp {
else
ig.Emit (OpCodes.Blt, target);
break;
-
default:
- return false;
+ Console.WriteLine (oper);
+ throw new Exception ("what is THAT");
}
-
- return true;
}
public override void Emit (EmitContext ec)
{
ILGenerator ig = ec.ig;
Type l = left.Type;
- Type r = right.Type;
OpCode opcode;
//
// Handle short-circuit operators differently
// than the rest
//
- if (oper == Operator.LogicalAnd){
+ if (oper == Operator.LogicalAnd) {
Label load_zero = ig.DefineLabel ();
Label end = ig.DefineLabel ();
- bool process = true;
- if (left is Binary){
- Binary left_binary = (Binary) left;
-
- if (left_binary.EmitBranchable (ec, load_zero, false)){
+ left.EmitBranchable (ec, load_zero, false);
right.Emit (ec);
ig.Emit (OpCodes.Br, end);
- process = false;
- }
- }
- if (process){
- left.Emit (ec);
- ig.Emit (OpCodes.Brfalse, load_zero);
- right.Emit (ec);
- ig.Emit (OpCodes.Br, end);
- }
ig.MarkLabel (load_zero);
ig.Emit (OpCodes.Ldc_I4_0);
ig.MarkLabel (end);
return;
- } else if (oper == Operator.LogicalOr){
+ } else if (oper == Operator.LogicalOr) {
Label load_one = ig.DefineLabel ();
Label end = ig.DefineLabel ();
- bool process = true;
- if (left is Binary){
- Binary left_binary = (Binary) left;
-
- if (left_binary.EmitBranchable (ec, load_one, true)){
+ left.EmitBranchable (ec, load_one, true);
right.Emit (ec);
ig.Emit (OpCodes.Br, end);
- process = false;
- }
- }
- if (process){
- left.Emit (ec);
- ig.Emit (OpCodes.Brtrue, load_one);
- right.Emit (ec);
- ig.Emit (OpCodes.Br, end);
- }
ig.MarkLabel (load_one);
ig.Emit (OpCodes.Ldc_I4_1);
ig.MarkLabel (end);
@@ -3007,7 +2987,7 @@ namespace Mono.CSharp {
right.Emit (ec);
bool isUnsigned = is_unsigned (left.Type);
-
+
switch (oper){
case Operator.Multiply:
if (ec.CheckState){
@@ -3290,7 +3270,7 @@ namespace Mono.CSharp {
ig.Emit (OpCodes.Nop);
- Statement.EmitBoolExpression (ec, is_and ? op_false : op_true, false_target, false);
+ (is_and ? op_false : op_true).EmitBranchable (ec, false_target, false);
left.Emit (ec);
ig.Emit (OpCodes.Br, end_target);
ig.MarkLabel (false_target);
@@ -3494,7 +3474,7 @@ namespace Mono.CSharp {
Label false_target = ig.DefineLabel ();
Label end_target = ig.DefineLabel ();
- Statement.EmitBoolExpression (ec, expr, false_target, false);
+ expr.EmitBranchable (ec, false_target, false);
trueExpr.Emit (ec);
ig.Emit (OpCodes.Br, end_target);
ig.MarkLabel (false_target);
@@ -3555,10 +3535,8 @@ namespace Mono.CSharp {
#endif
}
- public override Expression DoResolve (EmitContext ec)
+ protected Expression DoResolve (EmitContext ec, bool is_lvalue)
{
- DoResolveBase (ec);
-
Expression e = Block.GetConstantExpression (Name);
if (e != null) {
local_info.Used = true;
@@ -3570,12 +3548,22 @@ namespace Mono.CSharp {
if ((variable_info != null) && !variable_info.IsAssigned (ec, loc))
return null;
+ if (!is_lvalue)
+ local_info.Used = true;
+
if (local_info.LocalBuilder == null)
return ec.RemapLocal (local_info);
return this;
}
+ public override Expression DoResolve (EmitContext ec)
+ {
+ DoResolveBase (ec);
+
+ return DoResolve (ec, false);
+ }
+
override public Expression DoResolveLValue (EmitContext ec, Expression right_side)
{
DoResolveBase (ec);
@@ -3584,7 +3572,7 @@ namespace Mono.CSharp {
if (variable_info != null)
variable_info.SetAssigned (ec);
- Expression e = DoResolve (ec);
+ Expression e = DoResolve (ec, true);
if (e == null)
return null;
@@ -3616,8 +3604,6 @@ namespace Mono.CSharp {
{
ILGenerator ig = ec.ig;
- local_info.Assigned = true;
-
source.Emit (ec);
ig.Emit (OpCodes.Stloc, local_info.LocalBuilder);
}
@@ -4133,6 +4119,14 @@ namespace Mono.CSharp {
// we can optimize this case: a positive int32
// always fits on a uint64
//
+
+ //
+ // This special case is needed because csc behaves like this.
+ // int -> uint is better than int -> ulong!
+ //
+ if (q == TypeManager.uint32_type)
+ return 0;
+
if (q == TypeManager.int64_type)
return 0;
else if (value >= 0)
@@ -4211,8 +4205,29 @@ namespace Mono.CSharp {
int cand_count = candidate_pd.Count;
+ //
+ // If there is no best method, than this one
+ // is better, however, if we already found a
+ // best method, we cant tell. This happens
+ // if we have:
+ //
+ //
+ // interface IFoo {
+ // void DoIt ();
+ // }
+ //
+ // interface IBar {
+ // void DoIt ();
+ // }
+ //
+ // interface IFooBar : IFoo, IBar {}
+ //
+ // We cant tell if IFoo.DoIt is better than IBar.DoIt
+ //
+ // However, we have to consider that
+ // Trim (); is better than Trim (params char[] chars);
if (cand_count == 0 && argument_count == 0)
- return 1;
+ return best == null || best_params ? 1 : 0;
if (candidate_pd.ParameterModifier (cand_count - 1) != Parameter.Modifier.PARAMS)
if (cand_count != argument_count)
@@ -4460,8 +4475,6 @@ namespace Mono.CSharp {
ParameterData pd = GetParameterData (candidate);
- int pd_count = pd.Count;
-
if (arg_count != pd.Count)
return false;
@@ -4549,7 +4562,8 @@ namespace Mono.CSharp {
}
bool found_applicable = false;
- foreach (MethodBase candidate in me.Methods) {
+
+ foreach (MethodBase candidate in me.Methods){
Type decl_type = candidate.DeclaringType;
//
@@ -4584,7 +4598,10 @@ namespace Mono.CSharp {
//
// Now we actually find the best method
//
- foreach (MethodBase candidate in candidates) {
+ int candidate_top = candidates.Count;
+ for (int ix = 0; ix < candidate_top; ix++){
+ MethodBase candidate = (MethodBase) candidates [ix];
+
bool cand_params = (bool) candidate_to_form [candidate];
bool method_params = false;
@@ -4642,7 +4659,8 @@ namespace Mono.CSharp {
//
bool best_params = (bool) candidate_to_form [method];
- foreach (MethodBase candidate in candidates){
+ for (int ix = 0; ix < candidate_top; ix++){
+ MethodBase candidate = (MethodBase) candidates [ix];
if (candidate == method)
continue;
@@ -4733,8 +4751,6 @@ namespace Mono.CSharp {
Parameter.Modifier pm = pd.ParameterModifier (j);
if (pm == Parameter.Modifier.PARAMS){
- Parameter.Modifier am = a.GetParameterModifier ();
-
if ((pm & ~Parameter.Modifier.PARAMS) != a.GetParameterModifier ()) {
if (!Location.IsNull (loc))
Error_InvalidArguments (
@@ -4814,7 +4830,8 @@ namespace Mono.CSharp {
if (expr is BaseAccess)
is_base = true;
- Expression old = expr;
+ if (expr is ConstructedType)
+ expr = ((ConstructedType) expr).GetMemberAccess (ec.TypeContainer.CurrentType);
expr = expr.Resolve (ec, ResolveFlags.VariableOrValue | ResolveFlags.MethodGroup);
if (expr == null)
@@ -5565,9 +5582,9 @@ namespace Mono.CSharp {
this.rank = rank;
loc = l;
- //this.rank = rank.Substring (0, rank.LastIndexOf ("["));
+ //this.rank = rank.Substring (0, rank.LastIndexOf ('['));
//
- //string tmp = rank.Substring (rank.LastIndexOf ("["));
+ //string tmp = rank.Substring (rank.LastIndexOf ('['));
//
//dimensions = tmp.Length - 1;
expect_initializers = true;
@@ -6166,10 +6183,7 @@ namespace Mono.CSharp {
ig.Emit (OpCodes.Ldelema, etype);
}
- ig.Emit (OpCodes.Nop);
e.Emit (ec);
- ig.Emit (OpCodes.Nop);
- ig.Emit (OpCodes.Nop);
if (dims == 1)
ArrayAccess.EmitStoreOpcode (ig, array_element_type);
@@ -6314,7 +6328,11 @@ namespace Mono.CSharp {
public bool ResolveBase (EmitContext ec)
{
eclass = ExprClass.Variable;
- type = ec.ContainerType;
+
+ if (ec.TypeContainer.CurrentType != null)
+ type = ec.TypeContainer.CurrentType.ResolveType (ec);
+ else
+ type = ec.ContainerType;
if (ec.IsStatic) {
Error (26, "Keyword this not valid in static code");
@@ -6424,13 +6442,13 @@ namespace Mono.CSharp {
ec.ig.Emit (OpCodes.Ldarg_0);
}
}
-
+
/// <summary>
/// Implements the typeof operator
/// </summary>
public class TypeOf : Expression {
public readonly Expression QueriedType;
- Type typearg;
+ protected Type typearg;
public TypeOf (Expression queried_type, Location l)
{
@@ -6470,8 +6488,8 @@ namespace Mono.CSharp {
/// <summary>
/// Implements the `typeof (void)' operator
/// </summary>
- public class TypeOfVoid : Expression {
- public TypeOfVoid (Location l)
+ public class TypeOfVoid : TypeOf {
+ public TypeOfVoid (Location l) : base (null, l)
{
loc = l;
}
@@ -6479,19 +6497,10 @@ namespace Mono.CSharp {
public override Expression DoResolve (EmitContext ec)
{
type = TypeManager.type_type;
+ typearg = TypeManager.void_type;
eclass = ExprClass.Type;
return this;
}
-
- public override void Emit (EmitContext ec)
- {
- ec.ig.Emit (OpCodes.Ldtoken, TypeManager.void_type);
- ec.ig.Emit (OpCodes.Call, TypeManager.system_type_get_type_from_handle);
- }
-
- public Type TypeArg {
- get { return TypeManager.void_type; }
- }
}
/// <summary>
@@ -6810,8 +6819,6 @@ namespace Mono.CSharp {
// it will fail to find any members at all
//
- int errors = Report.Errors;
-
Type expr_type = expr.Type;
if (expr is TypeExpr){
if (!ec.DeclSpace.CheckAccessLevel (expr_type)){
@@ -7172,9 +7179,9 @@ namespace Mono.CSharp {
public override Expression DoResolve (EmitContext ec)
{
+#if false
ExprClass eclass = ea.Expr.eclass;
-#if false
// As long as the type is valid
if (!(eclass == ExprClass.Variable || eclass == ExprClass.PropertyAccess ||
eclass == ExprClass.Value)) {
@@ -7708,8 +7715,6 @@ namespace Mono.CSharp {
if (!CommonResolve (ec))
return null;
- Type right_type = right_side.Type;
-
bool found_any = false, found_any_setters = false;
Indexers ilist = Indexers.GetIndexersForType (current_type, indexer_type, loc);
@@ -8172,7 +8177,8 @@ namespace Mono.CSharp {
return null;
}
- if (ec.InCatch || ec.InFinally){
+ if (ec.CurrentBranching.InCatch () ||
+ ec.CurrentBranching.InFinally (true)) {
Error (255,
"stackalloc can not be used in a catch or finally block");
return null;
diff --git a/mcs/gmcs/flowanalysis.cs b/mcs/gmcs/flowanalysis.cs
index cab8a5108a5..fdcbf56c745 100644
--- a/mcs/gmcs/flowanalysis.cs
+++ b/mcs/gmcs/flowanalysis.cs
@@ -25,12 +25,15 @@ namespace Mono.CSharp
// <summary>
// The type of a FlowBranching.
// </summary>
- public enum BranchingType {
+ public enum BranchingType : byte {
// Normal (conditional or toplevel) block.
Block,
+ // Conditional.
+ Conditional,
+
// A loop block.
- LoopBlock,
+ Loop,
// Try/Catch block.
Exception,
@@ -45,7 +48,8 @@ namespace Mono.CSharp
// <summary>
// The type of one sibling of a branching.
// </summary>
- public enum SiblingType {
+ public enum SiblingType : byte {
+ Block,
Conditional,
SwitchSection,
Try,
@@ -58,7 +62,7 @@ namespace Mono.CSharp
// current code block may return to its enclosing block before reaching
// its end.
// </summary>
- public enum FlowReturns {
+ public enum FlowReturns : byte {
Undefined = 0,
// It can never return.
@@ -70,25 +74,303 @@ namespace Mono.CSharp
// The code always returns, ie. there's an unconditional return / break
// statement in it.
- Always,
+ Always
+ }
- // The code always throws an exception.
- Exception,
+ public sealed class Reachability
+ {
+ FlowReturns returns, breaks, throws, barrier, reachable;
+
+ public FlowReturns Returns {
+ get { return returns; }
+ }
+ public FlowReturns Breaks {
+ get { return breaks; }
+ }
+ public FlowReturns Throws {
+ get { return throws; }
+ }
+ public FlowReturns Barrier {
+ get { return barrier; }
+ }
+ public FlowReturns Reachable {
+ get { return reachable; }
+ }
+
+ public Reachability (FlowReturns returns, FlowReturns breaks,
+ FlowReturns throws, FlowReturns barrier)
+ {
+ this.returns = returns;
+ this.breaks = breaks;
+ this.throws = throws;
+ this.barrier = barrier;
+
+ update ();
+ }
+
+ public Reachability Clone ()
+ {
+ Reachability cloned = new Reachability (returns, breaks, throws, barrier);
+ cloned.reachable = reachable;
+ return cloned;
+ }
+
+ // <summary>
+ // Performs an `And' operation on the FlowReturns status
+ // (for instance, a block only returns Always if all its siblings
+ // always return).
+ // </summary>
+ public static FlowReturns AndFlowReturns (FlowReturns a, FlowReturns b)
+ {
+ if (a == FlowReturns.Undefined)
+ return b;
+
+ switch (a) {
+ case FlowReturns.Never:
+ if (b == FlowReturns.Never)
+ return FlowReturns.Never;
+ else
+ return FlowReturns.Sometimes;
+
+ case FlowReturns.Sometimes:
+ return FlowReturns.Sometimes;
+
+ case FlowReturns.Always:
+ if (b == FlowReturns.Always)
+ return FlowReturns.Always;
+ else
+ return FlowReturns.Sometimes;
+
+ default:
+ throw new ArgumentException ();
+ }
+ }
+
+ public static FlowReturns OrFlowReturns (FlowReturns a, FlowReturns b)
+ {
+ if (a == FlowReturns.Undefined)
+ return b;
+
+ switch (a) {
+ case FlowReturns.Never:
+ return b;
+
+ case FlowReturns.Sometimes:
+ if (b == FlowReturns.Always)
+ return FlowReturns.Always;
+ else
+ return FlowReturns.Sometimes;
+
+ case FlowReturns.Always:
+ return FlowReturns.Always;
+
+ default:
+ throw new ArgumentException ();
+ }
+ }
+
+ public static void And (ref Reachability a, Reachability b, bool do_break)
+ {
+ if (a == null) {
+ a = b.Clone ();
+ return;
+ }
+
+ //
+ // `break' does not "break" in a Switch or a LoopBlock
+ //
+ bool a_breaks = do_break && a.AlwaysBreaks;
+ bool b_breaks = do_break && b.AlwaysBreaks;
+
+ bool a_has_barrier, b_has_barrier;
+ if (do_break) {
+ //
+ // This is the normal case: the code following a barrier
+ // cannot be reached.
+ //
+ a_has_barrier = a.AlwaysHasBarrier;
+ b_has_barrier = b.AlwaysHasBarrier;
+ } else {
+ //
+ // Special case for Switch and LoopBlocks: we can reach the
+ // code after the barrier via the `break'.
+ //
+ a_has_barrier = !a.AlwaysBreaks && a.AlwaysHasBarrier;
+ b_has_barrier = !b.AlwaysBreaks && b.AlwaysHasBarrier;
+ }
+
+ bool a_unreachable = a_breaks || a.AlwaysThrows || a_has_barrier;
+ bool b_unreachable = b_breaks || b.AlwaysThrows || b_has_barrier;
+
+ //
+ // Do all code paths always return ?
+ //
+ if (a.AlwaysReturns) {
+ if (b.AlwaysReturns || b_unreachable)
+ a.returns = FlowReturns.Always;
+ else
+ a.returns = FlowReturns.Sometimes;
+ } else if (b.AlwaysReturns) {
+ if (a.AlwaysReturns || a_unreachable)
+ a.returns = FlowReturns.Always;
+ else
+ a.returns = FlowReturns.Sometimes;
+ } else if (!a.MayReturn) {
+ if (b.MayReturn)
+ a.returns = FlowReturns.Sometimes;
+ else
+ a.returns = FlowReturns.Never;
+ } else if (!b.MayReturn) {
+ if (a.MayReturn)
+ a.returns = FlowReturns.Sometimes;
+ else
+ a.returns = FlowReturns.Never;
+ }
+
+ a.breaks = AndFlowReturns (a.breaks, b.breaks);
+ a.throws = AndFlowReturns (a.throws, b.throws);
+ a.barrier = AndFlowReturns (a.barrier, b.barrier);
+
+ a.reachable = AndFlowReturns (a.reachable, b.reachable);
+ }
+
+ public void Or (Reachability b)
+ {
+ returns = OrFlowReturns (returns, b.returns);
+ breaks = OrFlowReturns (breaks, b.breaks);
+ throws = OrFlowReturns (throws, b.throws);
+ barrier = OrFlowReturns (barrier, b.barrier);
+
+ update ();
+ }
+
+ public static Reachability Never ()
+ {
+ return new Reachability (
+ FlowReturns.Never, FlowReturns.Never,
+ FlowReturns.Never, FlowReturns.Never);
+ }
+
+ void update ()
+ {
+ if ((returns == FlowReturns.Always) || (breaks == FlowReturns.Always) ||
+ (throws == FlowReturns.Always) || (barrier == FlowReturns.Always))
+ reachable = FlowReturns.Never;
+ else if ((returns == FlowReturns.Never) && (breaks == FlowReturns.Never) &&
+ (throws == FlowReturns.Never) && (barrier == FlowReturns.Never))
+ reachable = FlowReturns.Always;
+ else
+ reachable = FlowReturns.Sometimes;
+ }
+
+ public bool AlwaysBreaks {
+ get { return breaks == FlowReturns.Always; }
+ }
+
+ public bool MayBreak {
+ get { return breaks != FlowReturns.Never; }
+ }
+
+ public bool AlwaysReturns {
+ get { return returns == FlowReturns.Always; }
+ }
+
+ public bool MayReturn {
+ get { return returns != FlowReturns.Never; }
+ }
- // The current code block is unreachable. This happens if it's immediately
- // following a FlowReturns.Always block.
- Unreachable
+ public bool AlwaysThrows {
+ get { return throws == FlowReturns.Always; }
+ }
+
+ public bool MayThrow {
+ get { return throws != FlowReturns.Never; }
+ }
+
+ public bool AlwaysHasBarrier {
+ get { return barrier == FlowReturns.Always; }
+ }
+
+ public bool MayHaveBarrier {
+ get { return barrier != FlowReturns.Never; }
+ }
+
+ public bool IsUnreachable {
+ get { return reachable == FlowReturns.Never; }
+ }
+
+ public void SetReturns ()
+ {
+ returns = FlowReturns.Always;
+ update ();
+ }
+
+ public void SetReturnsSometimes ()
+ {
+ returns = FlowReturns.Sometimes;
+ update ();
+ }
+
+ public void SetBreaks ()
+ {
+ breaks = FlowReturns.Always;
+ update ();
+ }
+
+ public void ResetBreaks ()
+ {
+ breaks = FlowReturns.Never;
+ update ();
+ }
+
+ public void SetThrows ()
+ {
+ throws = FlowReturns.Always;
+ update ();
+ }
+
+ public void SetBarrier ()
+ {
+ barrier = FlowReturns.Always;
+ update ();
+ }
+
+ static string ShortName (FlowReturns returns)
+ {
+ switch (returns) {
+ case FlowReturns.Never:
+ return "N";
+ case FlowReturns.Sometimes:
+ return "S";
+ default:
+ return "A";
+ }
+ }
+
+ public override string ToString ()
+ {
+ return String.Format ("[{0}:{1}:{2}:{3}:{4}]",
+ ShortName (returns), ShortName (breaks),
+ ShortName (throws), ShortName (barrier),
+ ShortName (reachable));
+ }
}
public static FlowBranching CreateBranching (FlowBranching parent, BranchingType type, Block block, Location loc)
{
switch (type) {
case BranchingType.Exception:
- return new FlowBranchingException (parent, type, block, loc);
+ return new FlowBranchingException (parent, block, loc);
case BranchingType.Switch:
return new FlowBranchingBlock (parent, type, SiblingType.SwitchSection, block, loc);
+ case BranchingType.SwitchSection:
+ return new FlowBranchingBlock (parent, type, SiblingType.Block, block, loc);
+
+ case BranchingType.Block:
+ return new FlowBranchingBlock (parent, type, SiblingType.Block, block, loc);
+
default:
return new FlowBranchingBlock (parent, type, SiblingType.Conditional, block, loc);
}
@@ -120,11 +402,6 @@ namespace Mono.CSharp
// </summary>
public bool Infinite;
- // <summary>
- // If we may leave the current loop.
- // </summary>
- public bool MayLeaveLoop;
-
//
// Private
//
@@ -134,46 +411,6 @@ namespace Mono.CSharp
int id;
// <summary>
- // Performs an `And' operation on the FlowReturns status
- // (for instance, a block only returns Always if all its siblings
- // always return).
- // </summary>
- public static FlowReturns AndFlowReturns (FlowReturns a, FlowReturns b)
- {
- if (a == FlowReturns.Undefined)
- return b;
- if (b == FlowReturns.Unreachable)
- return a;
-
- switch (a) {
- case FlowReturns.Never:
- if (b == FlowReturns.Never)
- return FlowReturns.Never;
- else
- return FlowReturns.Sometimes;
-
- case FlowReturns.Sometimes:
- return FlowReturns.Sometimes;
-
- case FlowReturns.Always:
- if ((b == FlowReturns.Always) || (b == FlowReturns.Exception))
- return FlowReturns.Always;
- else
- return FlowReturns.Sometimes;
-
- case FlowReturns.Exception:
- if (b == FlowReturns.Exception)
- return FlowReturns.Exception;
- else if (b == FlowReturns.Always)
- return FlowReturns.Always;
- else
- return FlowReturns.Sometimes;
- }
-
- return b;
- }
-
- // <summary>
// The vector contains a BitArray with information about which local variables
// and parameters are already initialized at the current code position.
// </summary>
@@ -211,12 +448,16 @@ namespace Mono.CSharp
// </summary>
public readonly UsageVector InheritsFrom;
+ // <summary>
+ // This is used to construct a list of UsageVector's.
+ // </summary>
+ public UsageVector Next;
+
//
// Private.
//
MyBitVector locals, parameters;
- FlowReturns RealReturns, RealBreaks, RealReachable;
- bool is_finally;
+ Reachability reachability;
static int next_id = 0;
int id;
@@ -231,20 +472,23 @@ namespace Mono.CSharp
this.InheritsFrom = parent;
this.CountParameters = num_params;
this.CountLocals = num_locals;
- this.RealReturns = FlowReturns.Never;
- this.RealBreaks = FlowReturns.Never;
- this.RealReachable = FlowReturns.Always;
if (parent != null) {
+ if (num_locals > 0)
locals = new MyBitVector (parent.locals, CountLocals);
+
if (num_params > 0)
parameters = new MyBitVector (parent.parameters, num_params);
- RealReturns = parent.Returns;
- RealBreaks = parent.Breaks;
+
+ reachability = parent.Reachability.Clone ();
} else {
+ if (num_locals > 0)
locals = new MyBitVector (null, CountLocals);
+
if (num_params > 0)
parameters = new MyBitVector (null, num_params);
+
+ reachability = Reachability.Never ();
}
id = ++next_id;
@@ -254,6 +498,19 @@ namespace Mono.CSharp
: this (type, parent, loc, parent.CountParameters, parent.CountLocals)
{ }
+ public UsageVector (MyBitVector parameters, MyBitVector locals,
+ Reachability reachability, Location loc)
+ {
+ this.Type = SiblingType.Block;
+ this.Location = loc;
+
+ this.reachability = reachability;
+ this.parameters = parameters;
+ this.locals = locals;
+
+ id = ++next_id;
+ }
+
// <summary>
// This does a deep copy of the usage vector.
// </summary>
@@ -261,19 +518,20 @@ namespace Mono.CSharp
{
UsageVector retval = new UsageVector (Type, null, Location, CountParameters, CountLocals);
+ if (retval.locals != null)
retval.locals = locals.Clone ();
+
if (parameters != null)
retval.parameters = parameters.Clone ();
- retval.RealReturns = RealReturns;
- retval.RealBreaks = RealBreaks;
- retval.RealReachable = RealReachable;
+
+ retval.reachability = reachability.Clone ();
return retval;
}
public bool IsAssigned (VariableInfo var)
{
- if (!var.IsParameter && AlwaysBreaks)
+ if (!var.IsParameter && Reachability.AlwaysBreaks)
return true;
return var.IsAssigned (var.IsParameter ? parameters : locals);
@@ -281,15 +539,16 @@ namespace Mono.CSharp
public void SetAssigned (VariableInfo var)
{
- if (!var.IsParameter && AlwaysBreaks)
+ if (!var.IsParameter && Reachability.AlwaysBreaks)
return;
+ IsDirty = true;
var.SetAssigned (var.IsParameter ? parameters : locals);
}
public bool IsFieldAssigned (VariableInfo var, string name)
{
- if (!var.IsParameter && AlwaysBreaks)
+ if (!var.IsParameter && Reachability.AlwaysBreaks)
return true;
return var.IsFieldAssigned (var.IsParameter ? parameters : locals, name);
@@ -297,123 +556,87 @@ namespace Mono.CSharp
public void SetFieldAssigned (VariableInfo var, string name)
{
- if (!var.IsParameter && AlwaysBreaks)
+ if (!var.IsParameter && Reachability.AlwaysBreaks)
return;
+ IsDirty = true;
var.SetFieldAssigned (var.IsParameter ? parameters : locals, name);
}
- // <summary>
- // Specifies when the current block returns.
- // If this is FlowReturns.Unreachable, then control can never reach the
- // end of the method (so that we don't need to emit a return statement).
- // The same applies for FlowReturns.Exception, but in this case the return
- // value will never be used.
- // </summary>
- public FlowReturns Returns {
- get {
- return RealReturns;
- }
- }
-
- // <summary>
- // Specifies whether control may return to our containing block
- // before reaching the end of this block. This happens if there
- // is a break/continue/goto/return in it.
- // This can also be used to find out whether the statement immediately
- // following the current block may be reached or not.
- // </summary>
- public FlowReturns Breaks {
- get {
- return RealBreaks;
- }
- }
-
- public FlowReturns Reachable {
+ public Reachability Reachability {
get {
- return RealReachable;
+ return reachability;
}
}
- public bool AlwaysBreaks {
- get {
- return (Breaks == FlowReturns.Always) ||
- (Breaks == FlowReturns.Exception) ||
- (Breaks == FlowReturns.Unreachable);
+ public void Return ()
+ {
+ if (!reachability.IsUnreachable) {
+ IsDirty = true;
+ reachability.SetReturns ();
}
}
- public bool MayBreak {
- get {
- return Breaks != FlowReturns.Never;
+ public void Break ()
+ {
+ if (!reachability.IsUnreachable) {
+ IsDirty = true;
+ reachability.SetBreaks ();
}
}
- public bool AlwaysReturns {
- get {
- return (Returns == FlowReturns.Always) ||
- (Returns == FlowReturns.Exception);
+ public void Throw ()
+ {
+ if (!reachability.IsUnreachable) {
+ IsDirty = true;
+ reachability.SetThrows ();
}
}
- public bool MayReturn {
- get {
- return (Returns == FlowReturns.Sometimes) ||
- (Returns == FlowReturns.Always);
+ public void Goto ()
+ {
+ if (!reachability.IsUnreachable) {
+ IsDirty = true;
+ reachability.SetBarrier ();
}
}
- public void Break ()
+ // <summary>
+ // Merges a child branching.
+ // </summary>
+ public UsageVector MergeChild (FlowBranching branching)
{
- RealBreaks = FlowReturns.Always;
- }
+ UsageVector result = branching.Merge ();
- public void Return ()
- {
- RealReturns = FlowReturns.Always;
- }
+ Report.Debug (2, " MERGING CHILD", this, IsDirty,
+ result.ParameterVector, result.LocalVector,
+ result.Reachability, reachability, Type);
- public bool IsUnreachable {
- get {
- return (Reachable == FlowReturns.Exception) ||
- (Reachable == FlowReturns.Unreachable);
- }
- }
+ Reachability new_r = result.Reachability;
- public void Unreachable ()
- {
- // If we're already unreachable, don't modify the reason why.
- if (!IsUnreachable)
- RealReachable = FlowReturns.Unreachable;
- }
+ if (branching.Type == BranchingType.Loop) {
+ bool may_leave_loop = new_r.MayBreak;
+ new_r.ResetBreaks ();
- public void NeverReachable ()
- {
- // If we're already unreachable, don't modify the reason why.
- if (!IsUnreachable)
- RealReachable = FlowReturns.Never;
+ if (branching.Infinite && !may_leave_loop) {
+ if (new_r.Returns == FlowReturns.Sometimes) {
+ // If we're an infinite loop and do not break,
+ // the code after the loop can never be reached.
+ // However, if we may return from the loop,
+ // then we do always return (or stay in the
+ // loop forever).
+ new_r.SetReturns ();
}
- public void Throw ()
- {
- // If we're already unreachable, don't modify the reason why.
- if (!IsUnreachable)
- RealReachable = FlowReturns.Exception;
+ new_r.SetBarrier ();
+ } else {
+ if (new_r.Returns == FlowReturns.Always) {
+ // We're either finite or we may leave the loop.
+ new_r.SetReturnsSometimes ();
}
-
- // <summary>
- // Merges a child branching.
- // </summary>
- public FlowReturns MergeChild (MyBitVector new_params, MyBitVector new_locals,
- FlowReturns new_returns, FlowReturns new_breaks,
- FlowReturns new_reachable)
- {
- Report.Debug (2, "MERGING CHILD", this, new_params, new_locals, new_returns, new_breaks,
- new_reachable);
-
- RealReturns = new_returns;
- RealBreaks = new_breaks;
- RealReachable = new_reachable;
+ }
+ } else if (branching.Type == BranchingType.Switch)
+ new_r.ResetBreaks ();
//
// We've now either reached the point after the branching or we will
@@ -424,27 +647,51 @@ namespace Mono.CSharp
// we need to look at (see above).
//
- Report.Debug (2, "MERGING CHILD #1", this, Returns, Breaks, Reachable, new_locals, new_params);
-
- if ((Reachable == FlowReturns.Always) || (Reachable == FlowReturns.Sometimes) ||
- (Reachable == FlowReturns.Never)) {
- if ((Returns == FlowReturns.Always) || (Breaks == FlowReturns.Always))
- RealReachable = FlowReturns.Never;
- if ((Type == SiblingType.SwitchSection) && (Reachable != FlowReturns.Never)) {
- Report.Error (163, Location, "Control cannot fall through from one " +
+ if ((Type == SiblingType.SwitchSection) && !new_r.IsUnreachable) {
+ Report.Error (163, Location,
+ "Control cannot fall through from one " +
"case label to another");
+ return result;
}
- if (new_locals != null)
- locals.Or (new_locals);
+ if (locals != null && result.LocalVector != null)
+ locals.Or (result.LocalVector);
+
+ if (result.ParameterVector != null)
+ parameters.Or (result.ParameterVector);
+
+ reachability.Or (new_r);
+
+ Report.Debug (2, " MERGING CHILD DONE", this, result,
+ new_r, reachability);
- if (new_params != null)
- parameters.Or (new_params);
+ IsDirty = true;
+
+ return result;
}
- Report.Debug (2, "MERGING CHILD DONE", this);
+ protected void MergeFinally (FlowBranching branching, UsageVector f_origins,
+ MyBitVector f_params)
+ {
+ for (UsageVector vector = f_origins; vector != null; vector = vector.Next) {
+ MyBitVector temp_params = f_params.Clone ();
+ temp_params.Or (vector.Parameters);
+ }
+ }
- return Returns;
+ public void MergeFinally (FlowBranching branching, UsageVector f_vector,
+ UsageVector f_origins)
+ {
+ if (parameters != null) {
+ if (f_vector != null) {
+ MergeFinally (branching, f_origins, f_vector.Parameters);
+ MyBitVector.Or (ref parameters, f_vector.ParameterVector);
+ } else
+ MergeFinally (branching, f_origins, parameters);
+ }
+
+ if (f_vector != null && f_vector.LocalVector != null)
+ MyBitVector.Or (ref locals, f_vector.LocalVector);
}
// <summary>
@@ -469,51 +716,58 @@ namespace Mono.CSharp
// </summary>
public void MergeJumpOrigins (ICollection origin_vectors)
{
- Report.Debug (1, "MERGING JUMP ORIGIN", this);
+ Report.Debug (1, " MERGING JUMP ORIGINS", this);
- RealBreaks = FlowReturns.Never;
- RealReturns = FlowReturns.Never;
- if (Reachable != FlowReturns.Always)
- RealReachable = FlowReturns.Always;
+ reachability = Reachability.Never ();
if (origin_vectors == null)
return;
+ bool first = true;
+
foreach (UsageVector vector in origin_vectors) {
Report.Debug (1, " MERGING JUMP ORIGIN", vector);
+ if (first) {
+ if (locals != null && vector.Locals != null)
+ locals.Or (vector.locals);
+
+ if (parameters != null)
+ parameters.Or (vector.parameters);
+ first = false;
+ } else {
+ if (locals != null && vector.Locals != null)
locals.And (vector.locals);
if (parameters != null)
parameters.And (vector.parameters);
- RealBreaks = AndFlowReturns (RealBreaks, vector.Breaks);
- RealReturns = AndFlowReturns (RealReturns, vector.Returns);
- RealReachable = AndFlowReturns (RealReachable, vector.Reachable);
}
- Report.Debug (1, "MERGING JUMP ORIGIN DONE", this);
+ Reachability.And (ref reachability, vector.Reachability, true);
+ }
+
+ Report.Debug (1, " MERGING JUMP ORIGINS DONE", this);
}
// <summary>
// This is used at the beginning of a finally block if there were
// any return statements in the try block or one of the catch blocks.
// </summary>
- public void MergeFinallyOrigins (ICollection finally_vectors)
+ public void MergeFinallyOrigins (UsageVector f_origins)
{
- Report.Debug (1, "MERGING FINALLY ORIGIN", this);
+ Report.Debug (1, " MERGING FINALLY ORIGIN", this);
- RealBreaks = FlowReturns.Never;
+ reachability = Reachability.Never ();
- foreach (UsageVector vector in finally_vectors) {
+ for (UsageVector vector = f_origins; vector != null; vector = vector.Next) {
Report.Debug (1, " MERGING FINALLY ORIGIN", vector);
if (parameters != null)
parameters.And (vector.parameters);
- RealBreaks = AndFlowReturns (Breaks, vector.Breaks);
- }
- is_finally = true;
+ Reachability.And (ref reachability, vector.Reachability, true);
+ }
- Report.Debug (1, "MERGING FINALLY ORIGIN DONE", this);
+ Report.Debug (1, " MERGING FINALLY ORIGIN DONE", this);
}
public void CheckOutParameters (FlowBranching branching)
@@ -527,6 +781,7 @@ namespace Mono.CSharp
// </summary>
public void Or (UsageVector new_vector)
{
+ IsDirty = true;
locals.Or (new_vector.locals);
if (parameters != null)
parameters.Or (new_vector.parameters);
@@ -537,6 +792,7 @@ namespace Mono.CSharp
// </summary>
public void AndLocals (UsageVector new_vector)
{
+ IsDirty = true;
locals.And (new_vector.locals);
}
@@ -569,7 +825,10 @@ namespace Mono.CSharp
// </summary>
public MyBitVector Locals {
get {
+ if (locals != null)
return locals.Clone ();
+ else
+ return null;
}
}
@@ -594,13 +853,13 @@ namespace Mono.CSharp
StringBuilder sb = new StringBuilder ();
sb.Append ("Vector (");
- sb.Append (id);
+ sb.Append (Type);
sb.Append (",");
- sb.Append (Returns);
+ sb.Append (id);
sb.Append (",");
- sb.Append (Breaks);
+ sb.Append (IsDirty);
sb.Append (",");
- sb.Append (Reachable);
+ sb.Append (reachability);
if (parameters != null) {
sb.Append (" - ");
sb.Append (parameters);
@@ -635,6 +894,8 @@ namespace Mono.CSharp
UsageVector parent_vector = parent != null ? parent.CurrentUsageVector : null;
vector = new UsageVector (stype, parent_vector, loc, param_map.Length, local_map.Length);
+
+
} else {
param_map = Parent.param_map;
local_map = Parent.local_map;
@@ -655,15 +916,11 @@ namespace Mono.CSharp
{
AddSibling (new UsageVector (type, Parent.CurrentUsageVector, Location));
- Report.Debug (1, "CREATED SIBLING", CurrentUsageVector);
+ Report.Debug (1, " CREATED SIBLING", CurrentUsageVector);
}
protected abstract void AddSibling (UsageVector uv);
- public abstract void Break ();
- public abstract void Return ();
- public abstract void Goto ();
- public abstract void Throw ();
public abstract void Label (ArrayList origin_vectors);
// <summary>
@@ -681,56 +938,32 @@ namespace Mono.CSharp
continue;
Report.Error (177, loc, "The out parameter `" +
- param_map.VariableNames [i] + "' must be " +
+ var.Name + "' must be " +
"assigned before control leave the current method.");
}
}
- protected class MergeResult
- {
- public MyBitVector Parameters;
- public MyBitVector Locals;
- public FlowReturns Returns;
- public FlowReturns Breaks;
- public FlowReturns Reachable;
- public bool MayLeaveLoop;
-
- public MergeResult (MyBitVector parameters, MyBitVector locals, FlowReturns returns, FlowReturns breaks,
- FlowReturns reachable, bool may_leave_loop)
+ protected UsageVector Merge (UsageVector sibling_list)
{
- this.Parameters = parameters;
- this.Locals = locals;
- this.Returns = returns;
- this.Breaks = breaks;
- this.Reachable = reachable;
- this.MayLeaveLoop = may_leave_loop;
- }
- }
+ if (sibling_list.Next == null)
+ return sibling_list;
- protected MergeResult Merge (ArrayList children)
- {
MyBitVector locals = null;
MyBitVector parameters = null;
- FlowReturns returns = FlowReturns.Undefined;
- FlowReturns breaks = FlowReturns.Undefined;
- FlowReturns reachable = FlowReturns.Undefined;
-
- Report.Debug (2, "MERGING CHILDREN", this, Type, children.Count);
-
- foreach (UsageVector child in children) {
- Report.Debug (2, " MERGING CHILD", child, child.AlwaysBreaks, child.AlwaysReturns,
- child.IsUnreachable, child.Locals, child.Parameters,
- child.Returns, child.Breaks, child.Reachable);
+ Reachability reachability = null;
- reachable = AndFlowReturns (reachable, child.Reachable);
+ Report.Debug (2, " MERGING SIBLINGS", this, Name);
- // Ignore unreachable children.
- if (child.IsUnreachable)
- continue;
+ for (UsageVector child = sibling_list; child != null; child = child.Next) {
+ bool do_break = (Type != BranchingType.Switch) &&
+ (Type != BranchingType.Loop);
+
+ Report.Debug (2, " MERGING SIBLING ", child,
+ child.ParameterVector, child.LocalVector,
+ reachability, child.Reachability, do_break);
- returns = AndFlowReturns (returns, child.Returns);
- breaks = AndFlowReturns (breaks, child.Breaks);
+ Reachability.And (ref reachability, child.Reachability, do_break);
// A local variable is initialized after a flow branching if it
// has been initialized in all its branches which do neither
@@ -767,68 +1000,53 @@ namespace Mono.CSharp
// Here, `a' is initialized in line 3 and we must not look at
// line 5 since it always returns.
//
- if (!child.AlwaysReturns && !child.AlwaysBreaks)
+ bool do_break_2 = (child.Type != SiblingType.Block) &&
+ (child.Type != SiblingType.SwitchSection);
+ bool always_throws = (child.Type != SiblingType.Try) &&
+ child.Reachability.AlwaysThrows;
+ bool unreachable = always_throws ||
+ (do_break_2 && child.Reachability.AlwaysBreaks) ||
+ child.Reachability.AlwaysReturns ||
+ child.Reachability.AlwaysHasBarrier;
+
+ Report.Debug (2, " MERGING SIBLING #1", reachability,
+ Type, child.Type, child.Reachability.IsUnreachable,
+ do_break_2, always_throws, unreachable);
+
+ if (!unreachable && (child.LocalVector != null))
MyBitVector.And (ref locals, child.LocalVector);
// An `out' parameter must be assigned in all branches which do
// not always throw an exception.
- if ((child.Type != SiblingType.Catch) &&
- (child.ParameterVector != null) && (child.Breaks != FlowReturns.Exception))
+ if ((child.ParameterVector != null) && !child.Reachability.AlwaysThrows)
MyBitVector.And (ref parameters, child.ParameterVector);
- }
-
- Report.Debug (2, "MERGING CHILDREN DONE", Type, parameters, locals, returns, breaks, reachable,
- Infinite, MayLeaveLoop, this);
- if (Infinite && !MayLeaveLoop) {
- Report.Debug (1, "INFINITE", returns, breaks, this);
-
- if (returns == FlowReturns.Never) {
- // We're actually infinite.
- breaks = FlowReturns.Unreachable;
- returns = FlowReturns.Unreachable;
- } else if ((returns == FlowReturns.Sometimes) || (returns == FlowReturns.Always)) {
- // If we're an infinite loop and do not break, the code after
- // the loop can never be reached. However, if we may return
- // from the loop, then we do always return (or stay in the loop
- // forever).
- returns = FlowReturns.Always;
- }
+ Report.Debug (2, " MERGING SIBLING #2", parameters, locals);
}
- if (returns == FlowReturns.Undefined)
- returns = FlowReturns.Never;
- if (breaks == FlowReturns.Undefined)
- breaks = FlowReturns.Never;
+ if (reachability == null)
+ reachability = Reachability.Never ();
- return new MergeResult (parameters, locals, returns, breaks, reachable, MayLeaveLoop);
+ Report.Debug (2, " MERGING SIBLINGS DONE", parameters, locals,
+ reachability, Infinite);
+
+ return new UsageVector (parameters, locals, reachability, Location);
}
- protected abstract MergeResult Merge ();
+ protected abstract UsageVector Merge ();
// <summary>
// Merge a child branching.
// </summary>
- public FlowReturns MergeChild (FlowBranching child)
+ public UsageVector MergeChild (FlowBranching child)
{
- MergeResult result = child.Merge ();
-
- CurrentUsageVector.MergeChild (
- result.Parameters, result.Locals, result.Returns, result.Breaks, result.Reachable);
-
- if ((child.Type != BranchingType.LoopBlock) && (child.Type != BranchingType.SwitchSection))
- MayLeaveLoop |= child.MayLeaveLoop;
-
- if (result.Reachable == FlowReturns.Exception)
- return FlowReturns.Exception;
- else
- return result.Returns;
+ return CurrentUsageVector.MergeChild (child);
}
// <summary>
// Does the toplevel merging.
// </summary>
- public FlowReturns MergeTopBlock ()
+ public Reachability MergeTopBlock ()
{
if ((Type != BranchingType.Block) || (Block == null))
throw new NotSupportedException ();
@@ -836,21 +1054,83 @@ namespace Mono.CSharp
UsageVector vector = new UsageVector (
SiblingType.Conditional, null, Location, param_map.Length, local_map.Length);
- MergeResult result = Merge ();
- vector.MergeChild (result.Parameters, result.Locals, result.Returns, result.Breaks, result.Reachable);
+ UsageVector result = vector.MergeChild (this);
- if (vector.Reachable != FlowReturns.Exception)
+ Report.Debug (4, "MERGE TOP BLOCK", Location, vector, result.Reachability);
+
+ if (vector.Reachability.Throws != FlowReturns.Always)
CheckOutParameters (vector.Parameters, Location);
- else
- return FlowReturns.Exception;
- return result.Returns;
+ return result.Reachability;
}
- public virtual bool InTryBlock ()
+ //
+ // Checks whether we're in a `try' block.
+ //
+ public virtual bool InTryOrCatch (bool is_return)
+ {
+ if ((Block != null) && Block.IsDestructor)
+ return true;
+ else if (!is_return &&
+ ((Type == BranchingType.Loop) || (Type == BranchingType.Switch)))
+ return false;
+ else if (Parent != null)
+ return Parent.InTryOrCatch (is_return);
+ else
+ return false;
+ }
+
+ //
+ // Checks whether we're in a `catch' block.
+ //
+ public virtual bool InCatch ()
{
if (Parent != null)
- return Parent.InTryBlock ();
+ return Parent.InCatch ();
+ else
+ return false;
+ }
+
+ //
+ // Checks whether we're in a `finally' block.
+ //
+ public virtual bool InFinally (bool is_return)
+ {
+ if (!is_return &&
+ ((Type == BranchingType.Loop) || (Type == BranchingType.Switch)))
+ return false;
+ else if (Parent != null)
+ return Parent.InFinally (is_return);
+ else
+ return false;
+ }
+
+ public virtual bool InLoop ()
+ {
+ if (Type == BranchingType.Loop)
+ return true;
+ else if (Parent != null)
+ return Parent.InLoop ();
+ else
+ return false;
+ }
+
+ public virtual bool InSwitch ()
+ {
+ if (Type == BranchingType.Switch)
+ return true;
+ else if (Parent != null)
+ return Parent.InSwitch ();
+ else
+ return false;
+ }
+
+ public virtual bool BreakCrossesTryCatchBoundary ()
+ {
+ if ((Type == BranchingType.Loop) || (Type == BranchingType.Switch))
+ return false;
+ else if (Parent != null)
+ return Parent.BreakCrossesTryCatchBoundary ();
else
return false;
}
@@ -859,7 +1139,7 @@ namespace Mono.CSharp
{
if (Parent != null)
Parent.AddFinallyVector (vector);
- else
+ else if ((Block == null) || !Block.IsDestructor)
throw new NotSupportedException ();
}
@@ -908,95 +1188,77 @@ namespace Mono.CSharp
sb.Append (")");
return sb.ToString ();
}
+
+ public string Name {
+ get {
+ return String.Format ("{0} ({1}:{2}:{3})",
+ GetType (), id, Type, Location);
+ }
+ }
}
public class FlowBranchingBlock : FlowBranching
{
- UsageVector current_vector;
- ArrayList siblings = new ArrayList ();
+ UsageVector sibling_list = null;
- public FlowBranchingBlock (FlowBranching parent, BranchingType type, SiblingType stype,
- Block block, Location loc)
+ public FlowBranchingBlock (FlowBranching parent, BranchingType type,
+ SiblingType stype, Block block, Location loc)
: base (parent, type, stype, block, loc)
{ }
public override UsageVector CurrentUsageVector {
- get { return current_vector; }
+ get { return sibling_list; }
}
protected override void AddSibling (UsageVector sibling)
{
- siblings.Add (sibling);
- current_vector = sibling;
- }
-
- public override void Break ()
- {
- if (Type == BranchingType.SwitchSection)
- CurrentUsageVector.NeverReachable ();
- else {
- if (Type == BranchingType.LoopBlock)
- MayLeaveLoop = true;
- CurrentUsageVector.Break ();
- }
- }
-
- public override void Return ()
- {
- CurrentUsageVector.Return ();
- }
-
- public override void Goto ()
- {
- CurrentUsageVector.Unreachable ();
+ sibling.Next = sibling_list;
+ sibling_list = sibling;
}
- public override void Throw ()
+ public override void Label (ArrayList origin_vectors)
{
- CurrentUsageVector.Throw ();
+ if (!CurrentUsageVector.Reachability.IsUnreachable) {
+ if (origin_vectors == null)
+ origin_vectors = new ArrayList (1);
+ origin_vectors.Add (CurrentUsageVector.Clone ());
}
- public override void Label (ArrayList origin_vectors)
- {
CurrentUsageVector.MergeJumpOrigins (origin_vectors);
}
- protected override MergeResult Merge ()
+ protected override UsageVector Merge ()
{
- MergeResult result = Merge (siblings);
- if (Type == BranchingType.LoopBlock)
- result.MayLeaveLoop = false;
- return result;
+ return Merge (sibling_list);
}
}
public class FlowBranchingException : FlowBranching
{
- ArrayList finally_vectors;
-
- bool has_params;
UsageVector current_vector;
- UsageVector try_vector;
- ArrayList catch_vectors = new ArrayList ();
+ UsageVector catch_vectors;
UsageVector finally_vector;
+ UsageVector finally_origins;
+ bool in_try;
- public FlowBranchingException (FlowBranching parent, BranchingType type, Block block, Location loc)
- : base (parent, type, SiblingType.Try, block, loc)
- {
- finally_vectors = new ArrayList ();
- has_params = current_vector.HasParameters;
- }
+ public FlowBranchingException (FlowBranching parent, Block block, Location loc)
+ : base (parent, BranchingType.Exception, SiblingType.Try, block, loc)
+ { }
protected override void AddSibling (UsageVector sibling)
{
if (sibling.Type == SiblingType.Try) {
- try_vector = sibling;
- catch_vectors.Add (sibling);
- } else if (sibling.Type == SiblingType.Catch)
- catch_vectors.Add (sibling);
- else if (sibling.Type == SiblingType.Finally) {
- // sibling.MergeFinallyOrigins (finally_vectors);
+ sibling.Next = catch_vectors;
+ catch_vectors = sibling;
+ in_try = true;
+ } else if (sibling.Type == SiblingType.Catch) {
+ sibling.Next = catch_vectors;
+ catch_vectors = sibling;
+ in_try = false;
+ } else if (sibling.Type == SiblingType.Finally) {
+ sibling.MergeFinallyOrigins (finally_origins);
finally_vector = sibling;
+ in_try = false;
} else
throw new InvalidOperationException ();
@@ -1007,34 +1269,31 @@ namespace Mono.CSharp
get { return current_vector; }
}
- public override bool InTryBlock ()
+ public override bool InTryOrCatch (bool is_return)
{
- return true;
+ return finally_vector == null;
}
- public override void AddFinallyVector (UsageVector vector)
+ public override bool InCatch ()
{
- finally_vectors.Add (vector.Clone ());
+ return !in_try && (finally_vector == null);
}
- public override void Break ()
+ public override bool InFinally (bool is_return)
{
- CurrentUsageVector.Break ();
+ return finally_vector != null;
}
- public override void Return ()
+ public override bool BreakCrossesTryCatchBoundary ()
{
- CurrentUsageVector.Return ();
- }
-
- public override void Goto ()
- {
- CurrentUsageVector.Unreachable ();
+ return true;
}
- public override void Throw ()
+ public override void AddFinallyVector (UsageVector vector)
{
- CurrentUsageVector.Throw ();
+ vector = vector.Clone ();
+ vector.Next = finally_origins;
+ finally_origins = vector;
}
public override void Label (ArrayList origin_vectors)
@@ -1042,32 +1301,13 @@ namespace Mono.CSharp
CurrentUsageVector.MergeJumpOrigins (origin_vectors);
}
- protected void MergeFinally (MyBitVector f_params, ref MergeResult result)
- {
- foreach (UsageVector vector in finally_vectors) {
- MyBitVector temp_params = f_params.Clone ();
- temp_params.Or (vector.Parameters);
-
- CheckOutParameters (temp_params, Location);
- }
- }
-
- protected override MergeResult Merge ()
+ protected override UsageVector Merge ()
{
- MergeResult result = Merge (catch_vectors);
+ UsageVector vector = Merge (catch_vectors);
- if (has_params) {
- if (finally_vector != null) {
- MergeFinally (finally_vector.Parameters, ref result);
- MyBitVector.Or (ref result.Parameters, finally_vector.ParameterVector);
- } else
- MergeFinally (result.Parameters, ref result);
- }
+ vector.MergeFinally (this, finally_vector, finally_origins);
- if (finally_vector != null)
- MyBitVector.Or (ref result.Locals, finally_vector.LocalVector);
-
- return result;
+ return vector;
}
}
@@ -1595,22 +1835,16 @@ namespace Mono.CSharp
// <summary>
public readonly int Length;
- // <summary>
- // Type and name of all the variables.
- // Note that this is null for variables for which we do not need to compute
- // assignment info.
- // </summary>
- public readonly Type[] VariableTypes;
- public readonly string[] VariableNames;
-
VariableInfo[] map;
public VariableMap (InternalParameters ip)
{
Count = ip != null ? ip.Count : 0;
- map = new VariableInfo [Count];
- VariableNames = new string [Count];
- VariableTypes = new Type [Count];
+
+ // Dont bother allocating anything!
+ if (Count == 0)
+ return;
+
Length = 0;
for (int i = 0; i < Count; i++) {
@@ -1619,10 +1853,13 @@ namespace Mono.CSharp
if ((mod & Parameter.Modifier.OUT) == 0)
continue;
- VariableNames [i] = ip.ParameterName (i);
- VariableTypes [i] = TypeManager.GetElementType (ip.ParameterType (i));
+ // Dont allocate till we find an out var.
+ if (map == null)
+ map = new VariableInfo [Count];
+
+ map [i] = new VariableInfo (ip.ParameterName (i),
+ TypeManager.GetElementType (ip.ParameterType (i)), i, Length);
- map [i] = new VariableInfo (VariableNames [i], VariableTypes [i], i, Length);
Length += map [i].Length;
}
}
@@ -1634,21 +1871,21 @@ namespace Mono.CSharp
public VariableMap (VariableMap parent, LocalInfo[] locals)
{
int offset = 0, start = 0;
- if (parent != null) {
+ if (parent != null && parent.map != null) {
offset = parent.Length;
start = parent.Count;
}
Count = locals.Length + start;
+
+ if (Count == 0)
+ return;
+
map = new VariableInfo [Count];
- VariableNames = new string [Count];
- VariableTypes = new Type [Count];
Length = offset;
- if (parent != null) {
+ if (parent != null && parent.map != null) {
parent.map.CopyTo (map, 0);
- parent.VariableNames.CopyTo (VariableNames, 0);
- parent.VariableTypes.CopyTo (VariableTypes, 0);
}
for (int i = start; i < Count; i++) {
@@ -1657,9 +1894,6 @@ namespace Mono.CSharp
if (li.VariableType == null)
continue;
- VariableNames [i] = li.Name;
- VariableTypes [i] = li.VariableType;
-
map [i] = li.VariableInfo = new VariableInfo (li, Length);
Length += map [i].Length;
}
@@ -1671,6 +1905,9 @@ namespace Mono.CSharp
// </summary>
public VariableInfo this [int index] {
get {
+ if (map == null)
+ return null;
+
return map [index];
}
}
@@ -1875,20 +2112,16 @@ namespace Mono.CSharp
public override string ToString ()
{
- StringBuilder sb = new StringBuilder ("MyBitVector (");
+ StringBuilder sb = new StringBuilder ("{");
BitArray vector = Vector;
- sb.Append (Count);
- sb.Append (",");
if (!IsDirty)
- sb.Append ("INHERITED - ");
+ sb.Append ("=");
for (int i = 0; i < vector.Count; i++) {
- if (i > 0)
- sb.Append (",");
- sb.Append (vector [i]);
+ sb.Append (vector [i] ? "1" : "0");
}
- sb.Append (")");
+ sb.Append ("}");
return sb.ToString ();
}
}
diff --git a/mcs/gmcs/gen-treedump.cs b/mcs/gmcs/gen-treedump.cs
index 8ad20e812d7..a4dbf328ae9 100755
--- a/mcs/gmcs/gen-treedump.cs
+++ b/mcs/gmcs/gen-treedump.cs
@@ -448,12 +448,12 @@ namespace Generator {
void GenerateFor (For s)
{
output ("for (");
- if (! (s.InitStatement is EmptyStatement))
+ if (! (s.InitStatement == EmptyStatement.Value))
GenerateStatement (s.InitStatement, true, true, true);
output ("; ");
output (GetExpression (s.Test, 0));
output ("; ");
- if (! (s.Increment is EmptyStatement))
+ if (! (s.Increment == EmptyStatement.Value))
GenerateStatement (s.Increment, true, true, true);
output (") ");
GenerateStatement (s.Statement, true, true, false);
@@ -589,7 +589,7 @@ namespace Generator {
output_newline ("break;");
else if (s is Continue)
output_newline ("continue;");
- else if (s is EmptyStatement)
+ else if (s == EmptyStatement.Value)
output_newline ("/* empty statement */;");
else if (s is Block)
GenerateBlock ((Block) s, doPlacement, embedded);
@@ -898,7 +898,7 @@ namespace Generator {
string ClassName (string name)
{
return name;
- //return name.Substring (1 + name.LastIndexOf ("."));
+ //return name.Substring (1 + name.LastIndexOf ('.'));
}
string GenBases (ArrayList bases)
diff --git a/mcs/gmcs/generic.cs b/mcs/gmcs/generic.cs
index 32d12c7a738..6460c192bb8 100644
--- a/mcs/gmcs/generic.cs
+++ b/mcs/gmcs/generic.cs
@@ -309,8 +309,21 @@ namespace Mono.CSharp {
loc = l;
this.name = name;
this.args = args;
+
eclass = ExprClass.Type;
+ full_name = name + "<" + args.ToString () + ">";
+ }
+
+ public ConstructedType (string name, TypeParameter[] type_params, Location l)
+ {
+ loc = l;
+ this.name = name;
+
+ args = new TypeArguments ();
+ foreach (TypeParameter type_param in type_params)
+ args.Add (new TypeParameterExpr (type_param, l));
+ eclass = ExprClass.Type;
full_name = name + "<" + args.ToString () + ">";
}
@@ -351,6 +364,9 @@ namespace Mono.CSharp {
public override TypeExpr DoResolveAsTypeStep (EmitContext ec)
{
+ if (gt != null)
+ return this;
+
//
// First, resolve the generic type.
//
@@ -371,6 +387,11 @@ namespace Mono.CSharp {
public override Type ResolveType (EmitContext ec)
{
+ if (type != null)
+ return type;
+ if (DoResolveAsTypeStep (ec) == null)
+ return null;
+
//
// Resolve the arguments.
//
@@ -402,6 +423,11 @@ namespace Mono.CSharp {
return type;
}
+ public Expression GetMemberAccess (TypeExpr current_type)
+ {
+ return new GenericMemberAccess (current_type, name, args, loc);
+ }
+
public override bool CheckAccessLevel (DeclSpace ds)
{
return ds.CheckAccessLevel (gt);
@@ -443,8 +469,9 @@ namespace Mono.CSharp {
public class GenericMethod : DeclSpace
{
- public GenericMethod (NamespaceEntry ns, TypeContainer parent, string name, Location l)
- : base (ns, parent, name, l)
+ public GenericMethod (NamespaceEntry ns, TypeContainer parent, string name,
+ Attributes attrs, Location l)
+ : base (ns, parent, name, attrs, l)
{ }
public override TypeBuilder DefineType ()
diff --git a/mcs/gmcs/interface.cs b/mcs/gmcs/interface.cs
index 2f61dba38f7..86ccb282628 100755
--- a/mcs/gmcs/interface.cs
+++ b/mcs/gmcs/interface.cs
@@ -46,7 +46,6 @@ namespace Mono.CSharp {
ArrayList property_builders;
ArrayList event_builders;
- Attributes OptAttributes;
public string IndexerName;
@@ -55,6 +54,9 @@ namespace Mono.CSharp {
bool members_defined;
+ EmitContext ec;
+ Type GenericType;
+
// These will happen after the semantic analysis
// Hashtable defined_indexers;
@@ -73,10 +75,9 @@ namespace Mono.CSharp {
public Interface (NamespaceEntry ns, TypeContainer parent, string name, int mod,
Attributes attrs, Location l)
- : base (ns, parent, name, l)
+ : base (ns, parent, name, attrs, l)
{
ModFlags = Modifiers.Check (AllowedModifiers, mod, Modifiers.PRIVATE, l);
- OptAttributes = attrs;
method_builders = new ArrayList ();
property_builders = new ArrayList ();
@@ -307,8 +308,6 @@ namespace Mono.CSharp {
Type [] arg_types = im.ParameterTypes (this);
MethodBuilder mb;
- Parameter [] p;
- int i;
if (return_type == null)
return;
@@ -734,8 +733,8 @@ namespace Mono.CSharp {
InTransit = true;
- EmitContext ec = new EmitContext (this, this, Location, null, null,
- ModFlags, false);
+ ec = new EmitContext (this, this, Location, null, null,
+ ModFlags, false);
ifaces = GetInterfaceBases (out error);
@@ -776,6 +775,9 @@ namespace Mono.CSharp {
}
if (IsGeneric) {
+ CurrentType = new ConstructedType (
+ Name, TypeParameters, Location);
+
foreach (TypeParameter type_param in TypeParameters)
type_param.Define (TypeBuilder);
@@ -865,6 +867,12 @@ namespace Mono.CSharp {
TypeBuilder.SetCustomAttribute (cb);
}
+ if (CurrentType != null) {
+ GenericType = CurrentType.ResolveType (ec);
+
+ ec.ContainerType = GenericType;
+ }
+
#if CACHE
if (TypeBuilder.BaseType != null)
parent_container = TypeManager.LookupMemberContainer (TypeBuilder.BaseType);
@@ -1009,6 +1017,12 @@ namespace Mono.CSharp {
if ((bf & BindingFlags.Public) == 0)
return MemberList.Empty;
+ BindingFlags new_bf = bf | BindingFlags.DeclaredOnly;
+
+ if (GenericType != null)
+ return TypeManager.FindMembers (GenericType, mt, new_bf,
+ null, null);
+
ArrayList members = new ArrayList ();
if ((mt & MemberTypes.Method) != 0)
diff --git a/mcs/gmcs/iterators.cs b/mcs/gmcs/iterators.cs
index a324bed8927..decfd4612b8 100644
--- a/mcs/gmcs/iterators.cs
+++ b/mcs/gmcs/iterators.cs
@@ -40,11 +40,11 @@ namespace Mono.CSharp {
public static bool CheckContext (EmitContext ec, Location loc)
{
- if (ec.InFinally){
+ if (ec.CurrentBranching.InFinally (true)){
Report.Error (-208, loc, "yield statement can not appear in finally clause");
return false;
}
- if (ec.InCatch){
+ if (ec.CurrentBranching.InCatch ()){
Report.Error (-209, loc, "yield statement can not appear in the catch clause");
return false;
}
@@ -76,11 +76,9 @@ namespace Mono.CSharp {
return true;
}
- protected override bool DoEmit (EmitContext ec)
+ protected override void DoEmit (EmitContext ec)
{
IteratorHandler.Current.MarkYield (ec, expr);
-
- return false;
}
}
@@ -96,14 +94,13 @@ namespace Mono.CSharp {
if (!Yield.CheckContext (ec, loc))
return false;
- ec.CurrentBranching.Goto ();
+ ec.CurrentBranching.CurrentUsageVector.Goto ();
return true;
}
- protected override bool DoEmit (EmitContext ec)
+ protected override void DoEmit (EmitContext ec)
{
IteratorHandler.Current.EmitYieldBreak (ec.ig, true);
- return false;
}
}
diff --git a/mcs/gmcs/location.cs b/mcs/gmcs/location.cs
index aeffec1a1d4..ea0eddc0247 100644
--- a/mcs/gmcs/location.cs
+++ b/mcs/gmcs/location.cs
@@ -53,7 +53,6 @@ namespace Mono.CSharp {
static int source_bits;
static int source_mask;
static int source_count;
- static int module_base;
static int current_source;
public readonly static Location Null;
@@ -63,7 +62,6 @@ namespace Mono.CSharp {
source_files = new Hashtable ();
source_list = new ArrayList ();
current_source = 0;
- module_base = 0;
Null.token = 0;
}
@@ -140,7 +138,6 @@ namespace Mono.CSharp {
static public void Push (SourceFile file)
{
current_source = file.Index;
- module_base = current_source << source_bits;
}
// <remarks>
diff --git a/mcs/gmcs/modifiers.cs b/mcs/gmcs/modifiers.cs
index b6f8d42aef4..3c541992249 100755
--- a/mcs/gmcs/modifiers.cs
+++ b/mcs/gmcs/modifiers.cs
@@ -35,6 +35,8 @@ namespace Mono.CSharp {
public const int Accessibility =
PUBLIC | PROTECTED | INTERNAL | PRIVATE;
+ public const int AllowedExplicitImplFlags =
+ UNSAFE | EXTERN;
static public string Name (int i)
{
diff --git a/mcs/gmcs/namespace.cs b/mcs/gmcs/namespace.cs
index 764d19c69d9..a810e9aedda 100755
--- a/mcs/gmcs/namespace.cs
+++ b/mcs/gmcs/namespace.cs
@@ -19,7 +19,7 @@ namespace Mono.CSharp {
static Hashtable namespaces_map = new Hashtable ();
Namespace parent;
- string name, fullname;
+ string fullname;
ArrayList entries;
Hashtable namespaces;
Hashtable defined_names;
@@ -31,7 +31,6 @@ namespace Mono.CSharp {
/// </summary>
public Namespace (Namespace parent, string name)
{
- this.name = name;
this.parent = parent;
string pname = parent != null ? parent.Name : "";
diff --git a/mcs/gmcs/pending.cs b/mcs/gmcs/pending.cs
index d491c88dbeb..f0858fc5f87 100755
--- a/mcs/gmcs/pending.cs
+++ b/mcs/gmcs/pending.cs
@@ -67,10 +67,8 @@ namespace Mono.CSharp {
static bool IsVirtualFilter (MemberInfo m, object filterCriteria)
{
- if (!(m is MethodInfo))
- return false;
-
- return ((MethodInfo) m).IsVirtual;
+ MethodInfo mi = m as MethodInfo;
+ return (mi == null) ? false : mi.IsVirtual;
}
/// <summary>
@@ -212,45 +210,39 @@ namespace Mono.CSharp {
// Notice that TypeBuilders will only return the interfaces that the Type
// is supposed to implement, not all the interfaces that the type implements.
//
- // Completely broken. Anyways, we take advantage of this, so we only register
- // the implementations that we need, as they are those that are listed by the
- // TypeBuilder.
+ // Even better -- on MS it returns an empty array, no matter what.
+ //
+ // Completely broken. So we do it ourselves!
//
- Type [] implementing_ifaces = type_builder.GetInterfaces ();
- int count = implementing_ifaces.Length;
+ TypeExpr [] impl = TypeManager.GetExplicitInterfaces (type_builder);
- if (implementing_ifaces.Length == 0)
+ if (impl == null || impl.Length == 0)
return EmptyMissingInterfacesInfo;
- MissingInterfacesInfo [] missing_info = new MissingInterfacesInfo [count];
+ MissingInterfacesInfo [] ret = new MissingInterfacesInfo [impl.Length];
- for (int i = 0; i < count; i++)
- missing_info [i] = new MissingInterfacesInfo (implementing_ifaces [i]);
+ for (int i = 0; i < impl.Length; i++)
+ ret [i] = new MissingInterfacesInfo (impl [i].Type);
+
+ // we really should not get here because Object doesnt implement any
+ // interfaces. But it could implement something internal, so we have
+ // to handle that case.
+ if (type_builder.BaseType == null)
+ return ret;
+ TypeExpr [] parent_impls = TypeManager.GetInterfaces (type_builder.BaseType);
- //
- // Now, we have to extract the interfaces implements by our parents, and
- // remove them from the implementing_ifaces array.
- //
- for (Type t = type_builder.BaseType; t != null; t = t.BaseType){
- Type [] base_ifaces = t.GetInterfaces ();
+ foreach (TypeExpr te in parent_impls) {
+ Type t = te.Type;
- foreach (Type base_iface in base_ifaces){
- for (int i = 0; i < count; i++){
- if (implementing_ifaces [i] == base_iface)
- missing_info [i].Optional = true;
+ for (int i = 0; i < ret.Length; i ++) {
+ if (t == ret [i].Type) {
+ ret [i].Optional = true;
+ break;
}
}
-
- //
- // When we reach a `Type' instead of `TypeBuilder', the GetInterfaces
- // call would have returned all of the parent implementations, so we can end.
- //
- if (!(t is TypeBuilder))
- break;
}
-
- return missing_info;
+ return ret;
}
//
@@ -528,21 +520,18 @@ namespace Mono.CSharp {
if (pending_implementations [i].optional)
continue;
- string extra = "";
-
- if (pending_implementations [i].found [j])
- extra = ". (method might be non-public or static)";
- Report.Error (
- 536, container.Location,
- "`" + container.Name + "' does not implement " +
- "interface member `" +
- type.FullName + "." + mi.Name + "'" + extra);
+ if (pending_implementations [i].found [j]) {
+ string[] methodLabel = TypeManager.CSharpSignature (mi).Split ('.');
+ Report.Error (536, container.Location, "'{0}' does not implement interface member '{1}'. '{2}.{3}' is either static, not public, or has the wrong return type",
+ container.Name, methodLabel, container.Name, methodLabel[methodLabel.Length - 1]);
+ }
+ else {
+ Report.Error (535, container.Location, "'{0}' does not implement interface member '{1}'",
+ container.Name, TypeManager.CSharpSignature (mi));
+ }
} else {
- Report.Error (
- 534, container.Location,
- "`" + container.Name + "' does not implement " +
- "inherited abstract member `" +
- type.FullName + "." + mi.Name + "'");
+ Report.Error (534, container.Location, "'{0}' does not implement inherited abstract member '{1}'",
+ container.Name, TypeManager.CSharpSignature (mi));
}
errors = true;
j++;
diff --git a/mcs/gmcs/report.cs b/mcs/gmcs/report.cs
index 3867550c5b8..2ffcbbfd1ed 100644
--- a/mcs/gmcs/report.cs
+++ b/mcs/gmcs/report.cs
@@ -13,6 +13,7 @@ using System;
using System.Text;
using System.Collections;
using System.Diagnostics;
+using System.Reflection;
namespace Mono.CSharp {
@@ -68,13 +69,55 @@ namespace Mono.CSharp {
}
}
+ public static string FriendlyStackTrace (Exception e)
+ {
+ return FriendlyStackTrace (new StackTrace (e, true));
+ }
+
+ static string FriendlyStackTrace (StackTrace t)
+ {
+ StringBuilder sb = new StringBuilder ();
+
+ bool foundUserCode = false;
+
+ for (int i = 0; i < t.FrameCount; i++) {
+ StackFrame f = t.GetFrame (i);
+ MethodBase mb = f.GetMethod ();
+
+ if (!foundUserCode && mb.ReflectedType == typeof (Report))
+ continue;
+
+ foundUserCode = true;
+
+ sb.Append ("\tin ");
+
+ if (f.GetFileLineNumber () > 0)
+ sb.AppendFormat ("(at {0}:{1}) ", f.GetFileName (), f.GetFileLineNumber ());
+
+ sb.AppendFormat ("{0}.{1} (", mb.ReflectedType.Name, mb.Name);
+
+ bool first = true;
+ foreach (ParameterInfo pi in mb.GetParameters ()) {
+ if (!first)
+ sb.Append (", ");
+ first = false;
+
+ sb.Append (TypeManager.CSharpName (pi.ParameterType));
+ }
+ sb.Append (")\n");
+ }
+
+ return sb.ToString ();
+ }
+
static public void RealError (string msg)
{
Errors++;
Console.WriteLine (msg);
if (Stacktrace)
- Console.WriteLine (new StackTrace ().ToString ());
+ Console.WriteLine (FriendlyStackTrace (new StackTrace (true)));
+
if (Fatal)
throw new Exception (msg);
}
diff --git a/mcs/gmcs/rootcontext.cs b/mcs/gmcs/rootcontext.cs
index 67ef6b9baf2..e3c1e323ab8 100755
--- a/mcs/gmcs/rootcontext.cs
+++ b/mcs/gmcs/rootcontext.cs
@@ -64,6 +64,9 @@ namespace Mono.CSharp {
public static int WarningLevel = 2;
+ public static Target Target = Target.Exe;
+ public static string TargetExt = ".exe";
+
//
// If set, enable C# version 2 features
//
@@ -78,6 +81,12 @@ namespace Mono.CSharp {
type_container_resolve_order = new ArrayList ();
}
+ public static bool NeedsEntryPoint {
+ get {
+ return RootContext.Target == Target.Exe || RootContext.Target == Target.WinExe;
+ }
+ }
+
static public Tree Tree {
get {
return tree;
@@ -389,8 +398,6 @@ namespace Mono.CSharp {
{
TypeContainer root = Tree.Types;
- ArrayList ifaces = root.Interfaces;
-
if (root.Enums != null)
foreach (Enum en in root.Enums)
en.CloseType ();
@@ -431,6 +438,13 @@ namespace Mono.CSharp {
foreach (TypeBuilder type_builder in helper_classes)
type_builder.CreateType ();
}
+
+ attribute_types = null;
+ interface_resolve_order = null;
+ type_container_resolve_order = null;
+ helper_classes = null;
+ tree = null;
+ TypeManager.CleanUp ();
}
/// <summary>
@@ -452,7 +466,7 @@ namespace Mono.CSharp {
//
static public string ImplicitParent (string ns)
{
- int i = ns.LastIndexOf (".");
+ int i = ns.LastIndexOf ('.');
if (i < 0)
return null;
@@ -461,8 +475,6 @@ namespace Mono.CSharp {
static Type NamespaceLookup (DeclSpace ds, string name, Location loc)
{
- Type t;
-
//
// Try in the current namespace and all its implicit parents
//
@@ -705,7 +717,7 @@ namespace Mono.CSharp {
//
if (global_attributes.Count > 0){
AssemblyBuilder ab = CodeGen.AssemblyBuilder;
- TypeContainer dummy = new TypeContainer (null, null, "", new Location (-1));
+ TypeContainer dummy = new TypeContainer ();
EmitContext temp_ec = new EmitContext (
dummy, Mono.CSharp.Location.Null, null, null, 0, false);
@@ -789,7 +801,6 @@ namespace Mono.CSharp {
static public FieldBuilder MakeStaticData (byte [] data)
{
FieldBuilder fb;
- int size = data.Length;
if (impl_details_class == null){
impl_details_class = CodeGen.ModuleBuilder.DefineType (
diff --git a/mcs/gmcs/statement.cs b/mcs/gmcs/statement.cs
index 0700e373271..b4ff47366bd 100755
--- a/mcs/gmcs/statement.cs
+++ b/mcs/gmcs/statement.cs
@@ -21,89 +21,86 @@ namespace Mono.CSharp {
public abstract class Statement {
public Location loc;
- ///
+ /// <summary>
/// Resolves the statement, true means that all sub-statements
/// did resolve ok.
- //
+ // </summary>
public virtual bool Resolve (EmitContext ec)
{
return true;
}
/// <summary>
- /// Return value indicates whether all code paths emitted return.
+ /// We already know that the statement is unreachable, but we still
+ /// need to resolve it to catch errors.
/// </summary>
- protected abstract bool DoEmit (EmitContext ec);
+ public virtual bool ResolveUnreachable (EmitContext ec, bool warn)
+ {
+ //
+ // This conflicts with csc's way of doing this, but IMHO it's
+ // the right thing to do.
+ //
+ // If something is unreachable, we still check whether it's
+ // correct. This means that you cannot use unassigned variables
+ // in unreachable code, for instance.
+ //
+
+ ec.StartFlowBranching (FlowBranching.BranchingType.Block, loc);
+ bool ok = Resolve (ec);
+ ec.KillFlowBranching ();
+ if (!ok)
+ return false;
+
+ if (warn)
+ Report.Warning (162, loc, "Unreachable code detected");
+ return true;
+ }
+
/// <summary>
/// Return value indicates whether all code paths emitted return.
/// </summary>
- public virtual bool Emit (EmitContext ec)
+ protected abstract void DoEmit (EmitContext ec);
+
+ /// <summary>
+ /// Utility wrapper routine for Error, just to beautify the code
+ /// </summary>
+ public void Error (int error, string format, params object[] args)
{
- ec.Mark (loc, true);
- return DoEmit (ec);
+ Error (error, String.Format (format, args));
}
- /// <remarks>
- /// Encapsulates the emission of a boolean test and jumping to a
- /// destination.
- ///
- /// This will emit the bool expression in `bool_expr' and if
- /// `target_is_for_true' is true, then the code will generate a
- /// brtrue to the target. Otherwise a brfalse.
- /// </remarks>
- public static void EmitBoolExpression (EmitContext ec, Expression bool_expr,
- Label target, bool target_is_for_true)
+ public void Error (int error, string s)
{
- ILGenerator ig = ec.ig;
-
- bool invert = false;
- if (bool_expr is Unary){
- Unary u = (Unary) bool_expr;
-
- if (u.Oper == Unary.Operator.LogicalNot){
- invert = true;
-
- u.EmitLogicalNot (ec);
- }
- } else if (bool_expr is Binary){
- Binary b = (Binary) bool_expr;
-
- if (b.EmitBranchable (ec, target, target_is_for_true))
- return;
- }
-
- if (!invert)
- bool_expr.Emit (ec);
-
- if (target_is_for_true){
- if (invert)
- ig.Emit (OpCodes.Brfalse, target);
+ if (!Location.IsNull (loc))
+ Report.Error (error, loc, s);
else
- ig.Emit (OpCodes.Brtrue, target);
- } else {
- if (invert)
- ig.Emit (OpCodes.Brtrue, target);
- else
- ig.Emit (OpCodes.Brfalse, target);
- }
+ Report.Error (error, s);
}
- public static void Warning_DeadCodeFound (Location loc)
+ /// <summary>
+ /// Return value indicates whether all code paths emitted return.
+ /// </summary>
+ public virtual void Emit (EmitContext ec)
{
- Report.Warning (162, loc, "Unreachable code detected");
+ ec.Mark (loc, true);
+ DoEmit (ec);
}
}
- public class EmptyStatement : Statement {
+ public sealed class EmptyStatement : Statement {
+
+ private EmptyStatement () {}
+
+ public static readonly EmptyStatement Value = new EmptyStatement ();
+
public override bool Resolve (EmitContext ec)
{
return true;
}
- protected override bool DoEmit (EmitContext ec)
+ protected override void DoEmit (EmitContext ec)
{
- return false;
}
}
@@ -112,6 +109,8 @@ namespace Mono.CSharp {
public Statement TrueStatement;
public Statement FalseStatement;
+ bool is_true_ret;
+
public If (Expression expr, Statement trueStatement, Location l)
{
this.expr = expr;
@@ -139,56 +138,75 @@ namespace Mono.CSharp {
return false;
}
- ec.StartFlowBranching (FlowBranching.BranchingType.Block, loc);
+ //
+ // Dead code elimination
+ //
+ if (expr is BoolConstant){
+ bool take = ((BoolConstant) expr).Value;
+
+ if (take){
+ if (!TrueStatement.Resolve (ec))
+ return false;
+
+ if ((FalseStatement != null) &&
+ !FalseStatement.ResolveUnreachable (ec, true))
+ return false;
+ FalseStatement = null;
+ } else {
+ if (!TrueStatement.ResolveUnreachable (ec, true))
+ return false;
+ TrueStatement = null;
- if (!TrueStatement.Resolve (ec)) {
- ec.KillFlowBranching ();
+ if ((FalseStatement != null) &&
+ !FalseStatement.Resolve (ec))
return false;
}
+ return true;
+ }
+
+ ec.StartFlowBranching (FlowBranching.BranchingType.Conditional, loc);
+
+ bool ok = TrueStatement.Resolve (ec);
+
+ is_true_ret = ec.CurrentBranching.CurrentUsageVector.Reachability.IsUnreachable;
+
ec.CurrentBranching.CreateSibling (FlowBranching.SiblingType.Conditional);
- if ((FalseStatement != null) && !FalseStatement.Resolve (ec)) {
- ec.KillFlowBranching ();
- return false;
- }
+ if ((FalseStatement != null) && !FalseStatement.Resolve (ec))
+ ok = false;
ec.EndFlowBranching ();
Report.Debug (1, "END IF BLOCK", loc);
- return true;
+ return ok;
}
- protected override bool DoEmit (EmitContext ec)
+ protected override void DoEmit (EmitContext ec)
{
ILGenerator ig = ec.ig;
Label false_target = ig.DefineLabel ();
Label end;
- bool is_true_ret, is_false_ret;
//
- // Dead code elimination
+ // If we're a boolean expression, Resolve() already
+ // eliminated dead code for us.
//
if (expr is BoolConstant){
bool take = ((BoolConstant) expr).Value;
- if (take){
- if (FalseStatement != null){
- Warning_DeadCodeFound (FalseStatement.loc);
+ if (take)
+ TrueStatement.Emit (ec);
+ else if (FalseStatement != null)
+ FalseStatement.Emit (ec);
+
+ return;
}
- return TrueStatement.Emit (ec);
- } else {
- Warning_DeadCodeFound (TrueStatement.loc);
- if (FalseStatement != null)
- return FalseStatement.Emit (ec);
- }
- }
- EmitBoolExpression (ec, expr, false_target, false);
+ expr.EmitBranchable (ec, false_target, false);
- is_true_ret = TrueStatement.Emit (ec);
- is_false_ret = is_true_ret;
+ TrueStatement.Emit (ec);
if (FalseStatement != null){
bool branch_emitted = false;
@@ -200,23 +218,20 @@ namespace Mono.CSharp {
}
ig.MarkLabel (false_target);
- is_false_ret = FalseStatement.Emit (ec);
+ FalseStatement.Emit (ec);
if (branch_emitted)
ig.MarkLabel (end);
} else {
ig.MarkLabel (false_target);
- is_false_ret = false;
}
-
- return is_true_ret && is_false_ret;
}
}
public class Do : Statement {
public Expression expr;
public readonly Statement EmbeddedStatement;
- bool infinite, may_return;
+ bool infinite;
public Do (Statement statement, Expression boolExpr, Location l)
{
@@ -229,7 +244,7 @@ namespace Mono.CSharp {
{
bool ok = true;
- ec.StartFlowBranching (FlowBranching.BranchingType.LoopBlock, loc);
+ ec.StartFlowBranching (FlowBranching.BranchingType.Loop, loc);
if (!EmbeddedStatement.Resolve (ec))
ok = false;
@@ -245,25 +260,20 @@ namespace Mono.CSharp {
}
ec.CurrentBranching.Infinite = infinite;
- FlowBranching.FlowReturns returns = ec.EndFlowBranching ();
- may_return = returns != FlowBranching.FlowReturns.Never;
+ ec.EndFlowBranching ();
return ok;
}
- protected override bool DoEmit (EmitContext ec)
+ protected override void DoEmit (EmitContext ec)
{
ILGenerator ig = ec.ig;
Label loop = ig.DefineLabel ();
Label old_begin = ec.LoopBegin;
Label old_end = ec.LoopEnd;
- bool old_inloop = ec.InLoop;
- int old_loop_begin_try_catch_level = ec.LoopBeginTryCatchLevel;
ec.LoopBegin = ig.DefineLabel ();
ec.LoopEnd = ig.DefineLabel ();
- ec.InLoop = true;
- ec.LoopBeginTryCatchLevel = ec.TryCatchLevel;
ig.MarkLabel (loop);
EmbeddedStatement.Emit (ec);
@@ -278,26 +288,19 @@ namespace Mono.CSharp {
if (res)
ec.ig.Emit (OpCodes.Br, loop);
} else
- EmitBoolExpression (ec, expr, loop, true);
+ expr.EmitBranchable (ec, loop, true);
ig.MarkLabel (ec.LoopEnd);
- ec.LoopBeginTryCatchLevel = old_loop_begin_try_catch_level;
ec.LoopBegin = old_begin;
ec.LoopEnd = old_end;
- ec.InLoop = old_inloop;
-
- if (infinite)
- return may_return == false;
- else
- return false;
}
}
public class While : Statement {
public Expression expr;
public readonly Statement Statement;
- bool may_return, empty, infinite;
+ bool infinite, empty;
public While (Expression boolExpr, Statement statement, Location l)
{
@@ -314,8 +317,6 @@ namespace Mono.CSharp {
if (expr == null)
return false;
- ec.StartFlowBranching (FlowBranching.BranchingType.LoopBlock, loc);
-
//
// Inform whether we are infinite or not
//
@@ -323,54 +324,41 @@ namespace Mono.CSharp {
BoolConstant bc = (BoolConstant) expr;
if (bc.Value == false){
- Warning_DeadCodeFound (Statement.loc);
+ if (!Statement.ResolveUnreachable (ec, true))
+ return false;
empty = true;
+ return true;
} else
infinite = true;
- } else {
- //
- // We are not infinite, so the loop may or may not be executed.
- //
- ec.CurrentBranching.CreateSibling (FlowBranching.SiblingType.Conditional);
}
+ ec.StartFlowBranching (FlowBranching.BranchingType.Loop, loc);
+
if (!Statement.Resolve (ec))
ok = false;
- if (empty)
- ec.KillFlowBranching ();
- else {
ec.CurrentBranching.Infinite = infinite;
- FlowBranching.FlowReturns returns = ec.EndFlowBranching ();
- may_return = returns != FlowBranching.FlowReturns.Never;
- }
+ ec.EndFlowBranching ();
return ok;
}
- protected override bool DoEmit (EmitContext ec)
+ protected override void DoEmit (EmitContext ec)
{
if (empty)
- return false;
+ return;
ILGenerator ig = ec.ig;
Label old_begin = ec.LoopBegin;
Label old_end = ec.LoopEnd;
- bool old_inloop = ec.InLoop;
- int old_loop_begin_try_catch_level = ec.LoopBeginTryCatchLevel;
- bool ret;
ec.LoopBegin = ig.DefineLabel ();
ec.LoopEnd = ig.DefineLabel ();
- ec.InLoop = true;
- ec.LoopBeginTryCatchLevel = ec.TryCatchLevel;
//
// Inform whether we are infinite or not
//
if (expr is BoolConstant){
- BoolConstant bc = (BoolConstant) expr;
-
ig.MarkLabel (ec.LoopBegin);
Statement.Emit (ec);
ig.Emit (OpCodes.Br, ec.LoopBegin);
@@ -379,7 +367,6 @@ namespace Mono.CSharp {
// Inform that we are infinite (ie, `we return'), only
// if we do not `break' inside the code.
//
- ret = may_return == false;
ig.MarkLabel (ec.LoopEnd);
} else {
Label while_loop = ig.DefineLabel ();
@@ -391,18 +378,13 @@ namespace Mono.CSharp {
ig.MarkLabel (ec.LoopBegin);
- EmitBoolExpression (ec, expr, while_loop, true);
+ expr.EmitBranchable (ec, while_loop, true);
+
ig.MarkLabel (ec.LoopEnd);
-
- ret = false;
}
ec.LoopBegin = old_begin;
ec.LoopEnd = old_end;
- ec.InLoop = old_inloop;
- ec.LoopBeginTryCatchLevel = old_loop_begin_try_catch_level;
-
- return ret;
}
}
@@ -411,7 +393,7 @@ namespace Mono.CSharp {
readonly Statement InitStatement;
readonly Statement Increment;
readonly Statement Statement;
- bool may_return, infinite, empty;
+ bool infinite, empty;
public For (Statement initStatement,
Expression test,
@@ -443,15 +425,20 @@ namespace Mono.CSharp {
BoolConstant bc = (BoolConstant) Test;
if (bc.Value == false){
- Warning_DeadCodeFound (Statement.loc);
+ if (!Statement.ResolveUnreachable (ec, true))
+ return false;
+ if ((Increment != null) &&
+ !Increment.ResolveUnreachable (ec, false))
+ return false;
empty = true;
+ return true;
} else
infinite = true;
}
} else
infinite = true;
- ec.StartFlowBranching (FlowBranching.BranchingType.LoopBlock, loc);
+ ec.StartFlowBranching (FlowBranching.BranchingType.Loop, loc);
if (!infinite)
ec.CurrentBranching.CreateSibling (FlowBranching.SiblingType.Conditional);
@@ -463,45 +450,35 @@ namespace Mono.CSharp {
ok = false;
}
- if (empty)
- ec.KillFlowBranching ();
- else {
ec.CurrentBranching.Infinite = infinite;
- FlowBranching.FlowReturns returns = ec.EndFlowBranching ();
- may_return = returns != FlowBranching.FlowReturns.Never;
- }
+ ec.EndFlowBranching ();
return ok;
}
- protected override bool DoEmit (EmitContext ec)
+ protected override void DoEmit (EmitContext ec)
{
if (empty)
- return false;
+ return;
ILGenerator ig = ec.ig;
Label old_begin = ec.LoopBegin;
Label old_end = ec.LoopEnd;
- bool old_inloop = ec.InLoop;
- int old_loop_begin_try_catch_level = ec.LoopBeginTryCatchLevel;
Label loop = ig.DefineLabel ();
Label test = ig.DefineLabel ();
- if (InitStatement != null)
- if (! (InitStatement is EmptyStatement))
+ if (InitStatement != null && InitStatement != EmptyStatement.Value)
InitStatement.Emit (ec);
ec.LoopBegin = ig.DefineLabel ();
ec.LoopEnd = ig.DefineLabel ();
- ec.InLoop = true;
- ec.LoopBeginTryCatchLevel = ec.TryCatchLevel;
ig.Emit (OpCodes.Br, test);
ig.MarkLabel (loop);
Statement.Emit (ec);
ig.MarkLabel (ec.LoopBegin);
- if (!(Increment is EmptyStatement))
+ if (Increment != EmptyStatement.Value)
Increment.Emit (ec);
ig.MarkLabel (test);
@@ -511,35 +488,21 @@ namespace Mono.CSharp {
//
if (Test != null){
//
- // The Resolve code already catches the case for Test == BoolConstant (false)
- // so we know that this is true
+ // The Resolve code already catches the case for
+ // Test == BoolConstant (false) so we know that
+ // this is true
//
if (Test is BoolConstant)
ig.Emit (OpCodes.Br, loop);
else
- EmitBoolExpression (ec, Test, loop, true);
+ Test.EmitBranchable (ec, loop, true);
+
} else
ig.Emit (OpCodes.Br, loop);
ig.MarkLabel (ec.LoopEnd);
ec.LoopBegin = old_begin;
ec.LoopEnd = old_end;
- ec.InLoop = old_inloop;
- ec.LoopBeginTryCatchLevel = old_loop_begin_try_catch_level;
-
- //
- // Inform whether we are infinite or not
- //
- if (Test != null){
- if (Test is BoolConstant){
- BoolConstant bc = (BoolConstant) Test;
-
- if (bc.Value)
- return may_return == false;
- }
- return false;
- } else
- return may_return == false;
}
}
@@ -558,13 +521,9 @@ namespace Mono.CSharp {
return expr != null;
}
- protected override bool DoEmit (EmitContext ec)
+ protected override void DoEmit (EmitContext ec)
{
- ILGenerator ig = ec.ig;
-
expr.EmitStatement (ec);
-
- return false;
}
public override string ToString ()
@@ -585,75 +544,77 @@ namespace Mono.CSharp {
loc = l;
}
+ bool in_exc;
+
public override bool Resolve (EmitContext ec)
{
+ if (ec.ReturnType == null){
if (Expr != null){
+ Error (127, "Return with a value not allowed here");
+ return false;
+ }
+ } else {
+ if (Expr == null){
+ Error (126, "An object of type `{0}' is expected " +
+ "for the return statement",
+ TypeManager.CSharpName (ec.ReturnType));
+ return false;
+ }
+
Expr = Expr.Resolve (ec);
if (Expr == null)
return false;
+
+ if (Expr.Type != ec.ReturnType) {
+ Expr = Convert.ImplicitConversionRequired (
+ ec, Expr, ec.ReturnType, loc);
+ if (Expr == null)
+ return false;
+ }
}
if (ec.InIterator){
- Report.Error (-206, loc, "Return statement not allowed inside iterators");
+ Error (-206, "Return statement not allowed inside iterators");
return false;
}
FlowBranching.UsageVector vector = ec.CurrentBranching.CurrentUsageVector;
- if (ec.CurrentBranching.InTryBlock ())
+ if (ec.CurrentBranching.InTryOrCatch (true)) {
ec.CurrentBranching.AddFinallyVector (vector);
- else
+ in_exc = true;
+ } else if (ec.CurrentBranching.InFinally (true)) {
+ Error (157, "Control can not leave the body of the finally block");
+ return false;
+ } else
vector.CheckOutParameters (ec.CurrentBranching);
- ec.CurrentBranching.Return ();
+ ec.CurrentBranching.CurrentUsageVector.Return ();
return true;
}
- protected override bool DoEmit (EmitContext ec)
+ protected override void DoEmit (EmitContext ec)
{
- if (ec.InFinally){
- Report.Error (157, loc, "Control can not leave the body of the finally block");
- return false;
- }
-
- if (ec.ReturnType == null){
- if (Expr != null){
- Report.Error (127, loc, "Return with a value not allowed here");
- return true;
- }
- } else {
- if (Expr == null){
- Report.Error (126, loc, "An object of type `" +
- TypeManager.CSharpName (ec.ReturnType) + "' is " +
- "expected for the return statement");
- return true;
- }
-
- if (Expr.Type != ec.ReturnType)
- Expr = Convert.ImplicitConversionRequired (
- ec, Expr, ec.ReturnType, loc);
-
- if (Expr == null)
- return true;
-
+ if (Expr != null) {
Expr.Emit (ec);
- if (ec.InTry || ec.InCatch)
+ if (in_exc || !ec.IsLastStatement)
ec.ig.Emit (OpCodes.Stloc, ec.TemporaryReturn ());
}
- if (ec.InTry || ec.InCatch) {
- if (!ec.HasReturnLabel) {
- ec.ReturnLabel = ec.ig.DefineLabel ();
- ec.HasReturnLabel = true;
- }
+ if (in_exc) {
+ ec.NeedReturnLabel ();
ec.ig.Emit (OpCodes.Leave, ec.ReturnLabel);
- } else {
+ } else if (ec.IsLastStatement) {
+ // If we are the last statement in a top-level block, simply
+ // emit a `ret'.
ec.ig.Emit (OpCodes.Ret);
- ec.NeedExplicitReturn = false;
+ } else {
+ // Otherwise, we always create a return label and jump to
+ // it.
+ ec.NeedReturnLabel ();
+ ec.ig.Emit (OpCodes.Br, ec.ReturnLabel);
}
-
- return true;
}
}
@@ -676,7 +637,7 @@ namespace Mono.CSharp {
if (!label.IsDefined)
label.AddUsageVector (ec.CurrentBranching.CurrentUsageVector);
- ec.CurrentBranching.Goto ();
+ ec.CurrentBranching.CurrentUsageVector.Goto ();
return true;
}
@@ -694,18 +655,15 @@ namespace Mono.CSharp {
}
}
- protected override bool DoEmit (EmitContext ec)
+ protected override void DoEmit (EmitContext ec)
{
Label l = label.LabelTarget (ec);
ec.ig.Emit (OpCodes.Br, l);
-
- return false;
}
}
public class LabeledStatement : Statement {
public readonly Location Location;
- string label_name;
bool defined;
bool referenced;
Label label;
@@ -714,7 +672,6 @@ namespace Mono.CSharp {
public LabeledStatement (string label_name, Location l)
{
- this.label_name = label_name;
this.Location = l;
}
@@ -757,12 +714,10 @@ namespace Mono.CSharp {
return true;
}
- protected override bool DoEmit (EmitContext ec)
+ protected override void DoEmit (EmitContext ec)
{
LabelTarget (ec);
ec.ig.MarkLabel (label);
-
- return false;
}
}
@@ -779,23 +734,22 @@ namespace Mono.CSharp {
public override bool Resolve (EmitContext ec)
{
- ec.CurrentBranching.Goto ();
+ ec.CurrentBranching.CurrentUsageVector.Goto ();
return true;
}
- protected override bool DoEmit (EmitContext ec)
+ protected override void DoEmit (EmitContext ec)
{
if (ec.Switch == null){
Report.Error (153, loc, "goto default is only valid in a switch statement");
- return false;
+ return;
}
if (!ec.Switch.GotDefault){
Report.Error (159, loc, "No default target on switch statement");
- return false;
+ return;
}
ec.ig.Emit (OpCodes.Br, ec.Switch.DefaultTarget);
- return false;
}
}
@@ -845,14 +799,13 @@ namespace Mono.CSharp {
label = sl.ILLabelCode;
- ec.CurrentBranching.Goto ();
+ ec.CurrentBranching.CurrentUsageVector.Goto ();
return true;
}
- protected override bool DoEmit (EmitContext ec)
+ protected override void DoEmit (EmitContext ec)
{
ec.ig.Emit (OpCodes.Br, label);
- return true;
}
}
@@ -867,6 +820,9 @@ namespace Mono.CSharp {
public override bool Resolve (EmitContext ec)
{
+ bool in_catch = ec.CurrentBranching.InCatch ();
+ ec.CurrentBranching.CurrentUsageVector.Throw ();
+
if (expr != null){
expr = expr.Resolve (ec);
if (expr == null)
@@ -885,38 +841,32 @@ namespace Mono.CSharp {
if ((t != TypeManager.exception_type) &&
!t.IsSubclassOf (TypeManager.exception_type) &&
!(expr is NullLiteral)) {
- Report.Error (155, loc,
+ Error (155,
"The type caught or thrown must be derived " +
"from System.Exception");
return false;
}
+ } else if (!in_catch) {
+ Error (156,
+ "A throw statement with no argument is only " +
+ "allowed in a catch clause");
+ return false;
}
- ec.CurrentBranching.Throw ();
return true;
}
- protected override bool DoEmit (EmitContext ec)
+ protected override void DoEmit (EmitContext ec)
{
- if (expr == null){
- if (ec.InCatch)
+ if (expr == null)
ec.ig.Emit (OpCodes.Rethrow);
else {
- Report.Error (
- 156, loc,
- "A throw statement with no argument is only " +
- "allowed in a catch clause");
- }
- return false;
- }
-
expr.Emit (ec);
ec.ig.Emit (OpCodes.Throw);
-
- return true;
}
}
+ }
public class Break : Statement {
@@ -925,30 +875,37 @@ namespace Mono.CSharp {
loc = l;
}
+ bool crossing_exc;
+
public override bool Resolve (EmitContext ec)
{
- ec.CurrentBranching.MayLeaveLoop = true;
- ec.CurrentBranching.Break ();
+ if (!ec.CurrentBranching.InLoop () && !ec.CurrentBranching.InSwitch ()){
+ Error (139, "No enclosing loop or switch to continue to");
+ return false;
+ } else if (ec.CurrentBranching.InFinally (false)) {
+ Error (157, "Control can not leave the body of the finally block");
+ return false;
+ } else if (ec.CurrentBranching.InTryOrCatch (false))
+ ec.CurrentBranching.AddFinallyVector (ec.CurrentBranching.CurrentUsageVector);
+
+ crossing_exc = ec.CurrentBranching.BreakCrossesTryCatchBoundary ();
+
+ ec.CurrentBranching.CurrentUsageVector.Break ();
return true;
}
- protected override bool DoEmit (EmitContext ec)
+ protected override void DoEmit (EmitContext ec)
{
ILGenerator ig = ec.ig;
- if (ec.InLoop == false && ec.Switch == null){
- Report.Error (139, loc, "No enclosing loop or switch to continue to");
- return false;
- }
-
- if (ec.InTry || ec.InCatch)
+ if (crossing_exc)
ig.Emit (OpCodes.Leave, ec.LoopEnd);
- else
+ else {
+ ec.NeedReturnLabel ();
ig.Emit (OpCodes.Br, ec.LoopEnd);
-
- return false;
}
}
+ }
public class Continue : Statement {
@@ -957,39 +914,33 @@ namespace Mono.CSharp {
loc = l;
}
+ bool crossing_exc;
+
public override bool Resolve (EmitContext ec)
{
- ec.CurrentBranching.Goto ();
+ if (!ec.CurrentBranching.InLoop () && !ec.CurrentBranching.InSwitch ()){
+ Error (139, "No enclosing loop to continue to");
+ return false;
+ } else if (ec.CurrentBranching.InFinally (false)) {
+ Error (157, "Control can not leave the body of the finally block");
+ return false;
+ } else if (ec.CurrentBranching.InTryOrCatch (false))
+ ec.CurrentBranching.AddFinallyVector (ec.CurrentBranching.CurrentUsageVector);
+
+ crossing_exc = ec.CurrentBranching.BreakCrossesTryCatchBoundary ();
+
+ ec.CurrentBranching.CurrentUsageVector.Goto ();
return true;
}
- protected override bool DoEmit (EmitContext ec)
+ protected override void DoEmit (EmitContext ec)
{
Label begin = ec.LoopBegin;
- if (!ec.InLoop){
- Report.Error (139, loc, "No enclosing loop to continue to");
- return false;
- }
-
- //
- // UGH: Non trivial. This Br might cross a try/catch boundary
- // How can we tell?
- //
- // while () {
- // try { ... } catch { continue; }
- // }
- //
- // From:
- // try {} catch { while () { continue; }}
- //
- if (ec.TryCatchLevel > ec.LoopBeginTryCatchLevel)
+ if (crossing_exc)
ec.ig.Emit (OpCodes.Leave, begin);
- else if (ec.TryCatchLevel < ec.LoopBeginTryCatchLevel)
- throw new Exception ("Should never happen");
else
ec.ig.Emit (OpCodes.Br, begin);
- return false;
}
}
@@ -1015,9 +966,8 @@ namespace Mono.CSharp {
enum Flags : byte {
Used = 1,
- Assigned = 2,
- ReadOnly = 4,
- Fixed = 8
+ ReadOnly = 2,
+ Fixed = 4
}
Flags flags;
@@ -1048,6 +998,14 @@ namespace Mono.CSharp {
return VariableInfo.TypeInfo.IsFullyInitialized (ec.CurrentBranching, VariableInfo, loc);
}
+ public bool IsAssigned (EmitContext ec)
+ {
+ if (VariableInfo == null)
+ throw new Exception ();
+
+ return !ec.DoFlowAnalysis || ec.CurrentBranching.IsAssigned (VariableInfo);
+ }
+
public bool Resolve (DeclSpace decl)
{
if (VariableType == null)
@@ -1089,15 +1047,6 @@ namespace Mono.CSharp {
}
}
- public bool Assigned {
- get {
- return (flags & Flags.Assigned) != 0;
- }
- set {
- flags = value ? (flags | Flags.Assigned) : (flags & ~Flags.Assigned);
- }
- }
-
public bool ReadOnly {
get {
return (flags & Flags.ReadOnly) != 0;
@@ -1121,6 +1070,9 @@ namespace Mono.CSharp {
///
/// Implicit blocks are used as labels or to introduce variable
/// declarations.
+ ///
+ /// Top-level blocks derive from Block, and they are called ToplevelBlock
+ /// they contain extra information that is not necessary on normal blocks.
/// </remarks>
public class Block : Statement {
public readonly Block Parent;
@@ -1133,7 +1085,8 @@ namespace Mono.CSharp {
Unchecked = 2,
BlockUsed = 4,
VariablesInitialized = 8,
- HasRet = 16
+ HasRet = 16,
+ IsDestructor = 32
}
Flags flags;
@@ -1156,6 +1109,7 @@ namespace Mono.CSharp {
// The statements in this block
//
ArrayList statements;
+ int num_statements;
//
// An array of Blocks. We keep track of children just
@@ -1280,16 +1234,39 @@ namespace Mono.CSharp {
public LabeledStatement LookupLabel (string name)
{
+ Hashtable l = new Hashtable ();
+
+ return LookupLabel (name, l);
+ }
+
+ //
+ // Lookups a label in the current block, parents and children.
+ // It skips during child recurssion on `source'
+ //
+ LabeledStatement LookupLabel (string name, Hashtable seen)
+ {
if (switch_block != null)
- return switch_block.LookupLabel (name);
+ return switch_block.LookupLabel (name, seen);
+
+ if (seen [this] != null)
+ return null;
- if (labels != null){
+ seen [this] = this;
+
+ if (labels != null)
if (labels.Contains (name))
return ((LabeledStatement) labels [name]);
+
+ if (children != null){
+ foreach (Block b in children){
+ LabeledStatement s = b.LookupLabel (name, seen);
+ if (s != null)
+ return s;
+ }
}
if (Parent != null)
- return Parent.LookupLabel (name);
+ return Parent.LookupLabel (name, seen);
return null;
}
@@ -1376,6 +1353,7 @@ namespace Mono.CSharp {
variables = new Hashtable ();
this_variable = new LocalInfo (tc, this, l);
+ this_variable.Used = true;
variables.Add ("this", this_variable);
@@ -1411,7 +1389,7 @@ namespace Mono.CSharp {
}
if (pars != null) {
- int idx = 0;
+ int idx;
Parameter p = pars.GetParameterByName (name, out idx);
if (p != null) {
Report.Error (136, l, "A local variable named `" + name + "' " +
@@ -1454,18 +1432,13 @@ namespace Mono.CSharp {
public LocalInfo GetLocalInfo (string name)
{
- if (variables != null) {
- object temp;
- temp = variables [name];
-
- if (temp != null){
- return (LocalInfo) temp;
+ for (Block b = this; b != null; b = b.Parent) {
+ if (b.variables != null) {
+ LocalInfo ret = b.variables [name] as LocalInfo;
+ if (ret != null)
+ return ret;
}
}
-
- if (Parent != null)
- return Parent.GetLocalInfo (name);
-
return null;
}
@@ -1481,17 +1454,13 @@ namespace Mono.CSharp {
public Expression GetConstantExpression (string name)
{
- if (constants != null) {
- object temp;
- temp = constants [name];
-
- if (temp != null)
- return (Expression) temp;
+ for (Block b = this; b != null; b = b.Parent) {
+ if (b.constants != null) {
+ Expression ret = b.constants [name] as Expression;
+ if (ret != null)
+ return ret;
+ }
}
-
- if (Parent != null)
- return Parent.GetConstantExpression (name);
-
return null;
}
@@ -1519,10 +1488,10 @@ namespace Mono.CSharp {
Parameters parameters = null;
public Parameters Parameters {
get {
- if (Parent != null)
- return Parent.Parameters;
-
- return parameters;
+ Block b = this;
+ while (b.Parent != null)
+ b = b.Parent;
+ return b.parameters;
}
}
@@ -1552,6 +1521,23 @@ namespace Mono.CSharp {
flags |= Flags.BlockUsed;
}
+ public bool HasRet {
+ get {
+ return (flags & Flags.HasRet) != 0;
+ }
+ }
+
+ public bool IsDestructor {
+ get {
+ return (flags & Flags.IsDestructor) != 0;
+ }
+ }
+
+ public void SetDestructor ()
+ {
+ flags |= Flags.IsDestructor;
+ }
+
VariableMap param_map, local_map;
public VariableMap ParameterMap {
@@ -1586,7 +1572,6 @@ namespace Mono.CSharp {
/// </remarks>
public void EmitMeta (EmitContext ec, InternalParameters ip)
{
- DeclSpace ds = ec.DeclSpace;
ILGenerator ig = ec.ig;
//
@@ -1688,7 +1673,7 @@ namespace Mono.CSharp {
}
}
- public void UsageWarning ()
+ void UsageWarning (FlowBranching.UsageVector vector)
{
string name;
@@ -1701,7 +1686,7 @@ namespace Mono.CSharp {
name = (string) de.Key;
- if (vi.Assigned){
+ if (vector.IsAssigned (vi.VariableInfo)){
Report.Warning (
219, vi.Location, "The variable `" + name +
"' is assigned but its value is never used");
@@ -1713,10 +1698,6 @@ namespace Mono.CSharp {
}
}
}
-
- if (children != null)
- foreach (Block b in children)
- b.UsageWarning ();
}
public override bool Resolve (EmitContext ec)
@@ -1724,47 +1705,56 @@ namespace Mono.CSharp {
Block prev_block = ec.CurrentBlock;
bool ok = true;
+ int errors = Report.Errors;
+
ec.CurrentBlock = this;
ec.StartFlowBranching (this);
- Report.Debug (1, "RESOLVE BLOCK", StartLocation, ec.CurrentBranching);
+ Report.Debug (4, "RESOLVE BLOCK", StartLocation, ec.CurrentBranching);
- ArrayList new_statements = new ArrayList ();
bool unreachable = false, warning_shown = false;
- foreach (Statement s in statements){
+ int statement_count = statements.Count;
+ for (int ix = 0; ix < statement_count; ix++){
+ Statement s = (Statement) statements [ix];
+
if (unreachable && !(s is LabeledStatement)) {
- if (!warning_shown && !(s is EmptyStatement)) {
+ if (!s.ResolveUnreachable (ec, !warning_shown))
+ ok = false;
+
+ if (s != EmptyStatement.Value)
warning_shown = true;
- Warning_DeadCodeFound (s.loc);
- }
+ statements [ix] = EmptyStatement.Value;
continue;
}
if (s.Resolve (ec) == false) {
ok = false;
+ statements [ix] = EmptyStatement.Value;
continue;
}
+ num_statements = ix + 1;
+
if (s is LabeledStatement)
unreachable = false;
else
- unreachable = ec.CurrentBranching.CurrentUsageVector.IsUnreachable;
-
- new_statements.Add (s);
+ unreachable = ec.CurrentBranching.CurrentUsageVector.Reachability.IsUnreachable;
}
- statements = new_statements;
+ Report.Debug (4, "RESOLVE BLOCK DONE", StartLocation,
+ ec.CurrentBranching, statement_count, num_statements);
+
- Report.Debug (1, "RESOLVE BLOCK DONE", StartLocation, ec.CurrentBranching);
+ FlowBranching.UsageVector vector = ec.DoEndFlowBranching ();
- FlowBranching.FlowReturns returns = ec.EndFlowBranching ();
ec.CurrentBlock = prev_block;
// If we're a non-static `struct' constructor which doesn't have an
// initializer, then we must initialize all of the struct's fields.
- if ((this_variable != null) && (returns != FlowBranching.FlowReturns.Exception) &&
+ if ((this_variable != null) &&
+ (vector.Reachability.Throws != FlowBranching.FlowReturns.Always) &&
!this_variable.IsThisAssigned (ec, loc))
ok = false;
@@ -1775,25 +1765,39 @@ namespace Mono.CSharp {
"This label has not been referenced");
}
- Report.Debug (1, "RESOLVE BLOCK DONE #2", StartLocation, returns);
+ Report.Debug (4, "RESOLVE BLOCK DONE #2", StartLocation, vector);
- if ((returns == FlowBranching.FlowReturns.Always) ||
- (returns == FlowBranching.FlowReturns.Exception) ||
- (returns == FlowBranching.FlowReturns.Unreachable))
+ if ((vector.Reachability.Returns == FlowBranching.FlowReturns.Always) ||
+ (vector.Reachability.Throws == FlowBranching.FlowReturns.Always) ||
+ (vector.Reachability.Reachable == FlowBranching.FlowReturns.Never))
flags |= Flags.HasRet;
+ if (ok && (errors == Report.Errors)) {
+ if (RootContext.WarningLevel >= 3)
+ UsageWarning (vector);
+ }
+
return ok;
}
- protected override bool DoEmit (EmitContext ec)
+ protected override void DoEmit (EmitContext ec)
{
- foreach (Statement s in statements)
- s.Emit (ec);
+ for (int ix = 0; ix < num_statements; ix++){
+ Statement s = (Statement) statements [ix];
- return (flags & Flags.HasRet) != 0;
+ // Check whether we are the last statement in a
+ // top-level block.
+
+ if ((Parent == null) && (ix+1 == num_statements))
+ ec.IsLastStatement = true;
+ else
+ ec.IsLastStatement = false;
+
+ s.Emit (ec);
+ }
}
- public override bool Emit (EmitContext ec)
+ public override void Emit (EmitContext ec)
{
Block prev_block = ec.CurrentBlock;
@@ -1820,18 +1824,30 @@ namespace Mono.CSharp {
}
ec.Mark (StartLocation, true);
- bool retval = DoEmit (ec);
+ DoEmit (ec);
ec.Mark (EndLocation, true);
if (emit_debug_info && is_lexical_block)
ec.ig.EndScope ();
ec.CurrentBlock = prev_block;
-
- return retval;
}
}
+ //
+ //
+ public class ToplevelBlock : Block {
+ public ToplevelBlock (Parameters parameters, Location start) :
+ base (null, parameters, start, Location.Null)
+ {
+ }
+
+ public ToplevelBlock (Flags flags, Parameters parameters, Location start) :
+ base (null, flags, parameters, start, Location.Null)
+ {
+ }
+ }
+
public class SwitchLabel {
Expression label;
object converted;
@@ -2260,7 +2276,7 @@ namespace Mono.CSharp {
/// <param name="ec"></param>
/// <param name="val"></param>
/// <returns></returns>
- bool TableSwitchEmit (EmitContext ec, LocalBuilder val)
+ void TableSwitchEmit (EmitContext ec, LocalBuilder val)
{
int cElements = Elements.Count;
object [] rgKeys = new object [cElements];
@@ -2428,7 +2444,6 @@ namespace Mono.CSharp {
// now emit the code for the sections
bool fFoundDefault = false;
- bool fAllReturn = true;
foreach (SwitchSection ss in Sections)
{
foreach (SwitchLabel sl in ss.Labels)
@@ -2441,18 +2456,14 @@ namespace Mono.CSharp {
fFoundDefault = true;
}
}
- bool returns = ss.Block.Emit (ec);
- fAllReturn &= returns;
+ ss.Block.Emit (ec);
//ig.Emit (OpCodes.Br, lblEnd);
}
if (!fFoundDefault) {
ig.MarkLabel (lblDefault);
- fAllReturn = false;
}
ig.MarkLabel (lblEnd);
-
- return fAllReturn;
}
//
// This simple emit switch works, but does not take advantage of the
@@ -2460,7 +2471,7 @@ namespace Mono.CSharp {
// TODO: remove non-string logic from here
// TODO: binary search strings?
//
- bool SimpleSwitchEmit (EmitContext ec, LocalBuilder val)
+ void SimpleSwitchEmit (EmitContext ec, LocalBuilder val)
{
ILGenerator ig = ec.ig;
Label end_of_switch = ig.DefineLabel ();
@@ -2469,7 +2480,6 @@ namespace Mono.CSharp {
bool default_found = false;
bool first_test = true;
bool pending_goto_end = false;
- bool all_return = true;
bool null_found;
ig.Emit (OpCodes.Ldloc, val);
@@ -2537,23 +2547,15 @@ namespace Mono.CSharp {
foreach (SwitchLabel sl in ss.Labels)
ig.MarkLabel (sl.ILLabelCode);
- bool returns = ss.Block.Emit (ec);
- if (returns)
- pending_goto_end = false;
- else {
- all_return = false;
- pending_goto_end = true;
- }
+ ss.Block.Emit (ec);
+ pending_goto_end = !ss.Block.HasRet;
first_test = false;
}
if (!default_found){
ig.MarkLabel (default_target);
- all_return = false;
}
ig.MarkLabel (next_test);
ig.MarkLabel (end_of_switch);
-
- return all_return;
}
public override bool Resolve (EmitContext ec)
@@ -2578,6 +2580,7 @@ namespace Mono.CSharp {
ec.Switch = this;
ec.Switch.SwitchType = SwitchType;
+ Report.Debug (1, "START OF SWITCH BLOCK", loc, ec.CurrentBranching);
ec.StartFlowBranching (FlowBranching.BranchingType.Switch, loc);
bool first = true;
@@ -2595,13 +2598,16 @@ namespace Mono.CSharp {
if (!got_default)
ec.CurrentBranching.CreateSibling (FlowBranching.SiblingType.SwitchSection);
- ec.EndFlowBranching ();
+ FlowBranching.Reachability reachability = ec.EndFlowBranching ();
ec.Switch = old_switch;
+ Report.Debug (1, "END OF SWITCH BLOCK", loc, ec.CurrentBranching,
+ reachability);
+
return true;
}
- protected override bool DoEmit (EmitContext ec)
+ protected override void DoEmit (EmitContext ec)
{
// Store variable for comparission purposes
LocalBuilder value = ec.ig.DeclareLocal (SwitchType);
@@ -2622,11 +2628,10 @@ namespace Mono.CSharp {
ec.Switch = this;
// Emit Code.
- bool all_return;
if (SwitchType == TypeManager.string_type)
- all_return = SimpleSwitchEmit (ec, value);
+ SimpleSwitchEmit (ec, value);
else
- all_return = TableSwitchEmit (ec, value);
+ TableSwitchEmit (ec, value);
// Restore context state.
ig.MarkLabel (ec.LoopEnd);
@@ -2636,8 +2641,6 @@ namespace Mono.CSharp {
//
ec.LoopEnd = old_end;
ec.Switch = old_switch;
-
- return all_return;
}
}
@@ -2655,21 +2658,27 @@ namespace Mono.CSharp {
public override bool Resolve (EmitContext ec)
{
expr = expr.Resolve (ec);
- return Statement.Resolve (ec) && expr != null;
+ if (expr == null)
+ return false;
+
+ if (expr.Type.IsValueType){
+ Error (185, "lock statement requires the expression to be " +
+ " a reference type (type is: `{0}'",
+ TypeManager.CSharpName (expr.Type));
+ return false;
+ }
+
+ ec.StartFlowBranching (FlowBranching.BranchingType.Exception, loc);
+ bool ok = Statement.Resolve (ec);
+ ec.EndFlowBranching ();
+
+ return ok;
}
- protected override bool DoEmit (EmitContext ec)
+ protected override void DoEmit (EmitContext ec)
{
Type type = expr.Type;
- bool val;
- if (type.IsValueType){
- Report.Error (185, loc, "lock statement requires the expression to be " +
- " a reference type (type is: `" +
- TypeManager.CSharpName (type) + "'");
- return false;
- }
-
ILGenerator ig = ec.ig;
LocalBuilder temp = ig.DeclareLocal (type);
@@ -2679,12 +2688,9 @@ namespace Mono.CSharp {
ig.Emit (OpCodes.Call, TypeManager.void_monitor_enter_object);
// try
- Label end = ig.BeginExceptionBlock ();
- bool old_in_try = ec.InTry;
- ec.InTry = true;
+ ig.BeginExceptionBlock ();
Label finish = ig.DefineLabel ();
- val = Statement.Emit (ec);
- ec.InTry = old_in_try;
+ Statement.Emit (ec);
// ig.Emit (OpCodes.Leave, finish);
ig.MarkLabel (finish);
@@ -2694,8 +2700,6 @@ namespace Mono.CSharp {
ig.Emit (OpCodes.Ldloc, temp);
ig.Emit (OpCodes.Call, TypeManager.void_monitor_exit_object);
ig.EndExceptionBlock ();
-
- return val;
}
}
@@ -2722,19 +2726,16 @@ namespace Mono.CSharp {
return ret;
}
- protected override bool DoEmit (EmitContext ec)
+ protected override void DoEmit (EmitContext ec)
{
bool previous_state = ec.CheckState;
bool previous_state_const = ec.ConstantCheckState;
- bool val;
ec.CheckState = false;
ec.ConstantCheckState = false;
- val = Block.Emit (ec);
+ Block.Emit (ec);
ec.CheckState = previous_state;
ec.ConstantCheckState = previous_state_const;
-
- return val;
}
}
@@ -2761,19 +2762,16 @@ namespace Mono.CSharp {
return ret;
}
- protected override bool DoEmit (EmitContext ec)
+ protected override void DoEmit (EmitContext ec)
{
bool previous_state = ec.CheckState;
bool previous_state_const = ec.ConstantCheckState;
- bool val;
ec.CheckState = true;
ec.ConstantCheckState = true;
- val = Block.Emit (ec);
+ Block.Emit (ec);
ec.CheckState = previous_state;
ec.ConstantCheckState = previous_state_const;
-
- return val;
}
}
@@ -2797,16 +2795,13 @@ namespace Mono.CSharp {
return val;
}
- protected override bool DoEmit (EmitContext ec)
+ protected override void DoEmit (EmitContext ec)
{
bool previous_state = ec.InUnsafe;
- bool val;
ec.InUnsafe = true;
- val = Block.Emit (ec);
+ Block.Emit (ec);
ec.InUnsafe = previous_state;
-
- return val;
}
}
@@ -2819,6 +2814,7 @@ namespace Mono.CSharp {
Statement statement;
Type expr_type;
FixedData[] data;
+ bool has_ret;
struct FixedData {
public bool is_object;
@@ -2877,6 +2873,11 @@ namespace Mono.CSharp {
// is present, so we need to test for this particular case.
//
+ if (e is Cast){
+ Report.Error (254, loc, "Cast expression not allowed as right hand expression in fixed statement");
+ return false;
+ }
+
//
// Case 1: & object.
//
@@ -2961,17 +2962,40 @@ namespace Mono.CSharp {
data [i].converted = null;
data [i].vi = vi;
i++;
+ continue;
}
+
+ //
+ // For other cases, flag a `this is already fixed expression'
+ //
+ if (e is LocalVariableReference || e is ParameterReference ||
+ Convert.ImplicitConversionExists (ec, e, vi.VariableType)){
+
+ Report.Error (245, loc, "right hand expression is already fixed, no need to use fixed statement ");
+ return false;
+ }
+
+ Report.Error (245, loc, "Fixed statement only allowed on strings, arrays or address-of expressions");
+ return false;
+ }
+
+ ec.StartFlowBranching (FlowBranching.BranchingType.Conditional, loc);
+
+ if (!statement.Resolve (ec)) {
+ ec.KillFlowBranching ();
+ return false;
}
- return statement.Resolve (ec);
+ FlowBranching.Reachability reachability = ec.EndFlowBranching ();
+ has_ret = reachability.IsUnreachable;
+
+ return true;
}
- protected override bool DoEmit (EmitContext ec)
+ protected override void DoEmit (EmitContext ec)
{
ILGenerator ig = ec.ig;
- bool is_ret = false;
LocalBuilder [] clear_list = new LocalBuilder [data.Length];
for (int i = 0; i < data.Length; i++) {
@@ -3027,16 +3051,15 @@ namespace Mono.CSharp {
}
}
- is_ret = statement.Emit (ec);
+ statement.Emit (ec);
+
+ if (has_ret)
+ return;
- if (is_ret)
- return is_ret;
//
// Clear the pinned variable
//
for (int i = 0; i < data.Length; i++) {
- LocalInfo vi = data [i].vi;
-
if (data [i].is_object || data [i].expr.Type.IsArray) {
ig.Emit (OpCodes.Ldc_I4_0);
ig.Emit (OpCodes.Conv_U);
@@ -3046,8 +3069,6 @@ namespace Mono.CSharp {
ig.Emit (OpCodes.Stloc, clear_list [i]);
}
}
-
- return is_ret;
}
}
@@ -3131,14 +3152,9 @@ namespace Mono.CSharp {
Report.Debug (1, "START OF TRY BLOCK", Block.StartLocation);
- bool old_in_try = ec.InTry;
- ec.InTry = true;
-
if (!Block.Resolve (ec))
ok = false;
- ec.InTry = old_in_try;
-
FlowBranching.UsageVector vector = ec.CurrentBranching.CurrentUsageVector;
Report.Debug (1, "START OF CATCH BLOCKS", vector);
@@ -3155,13 +3171,8 @@ namespace Mono.CSharp {
vi.VariableInfo = null;
}
- bool old_in_catch = ec.InCatch;
- ec.InCatch = true;
-
if (!c.Resolve (ec))
ok = false;
-
- ec.InCatch = old_in_catch;
}
Report.Debug (1, "END OF CATCH BLOCKS", ec.CurrentBranching);
@@ -3170,13 +3181,8 @@ namespace Mono.CSharp {
ec.CurrentBranching.CreateSibling (FlowBranching.SiblingType.Catch);
Report.Debug (1, "STARTED SIBLING FOR GENERAL", ec.CurrentBranching);
- bool old_in_catch = ec.InCatch;
- ec.InCatch = true;
-
if (!General.Resolve (ec))
ok = false;
-
- ec.InCatch = old_in_catch;
}
Report.Debug (1, "END OF GENERAL CATCH BLOCKS", ec.CurrentBranching);
@@ -3186,54 +3192,39 @@ namespace Mono.CSharp {
ec.CurrentBranching.CreateSibling (FlowBranching.SiblingType.Finally);
Report.Debug (1, "STARTED SIBLING FOR FINALLY", ec.CurrentBranching, vector);
- bool old_in_finally = ec.InFinally;
- ec.InFinally = true;
-
if (!Fini.Resolve (ec))
ok = false;
-
- ec.InFinally = old_in_finally;
}
- FlowBranching.FlowReturns returns = ec.EndFlowBranching ();
+ FlowBranching.Reachability reachability = ec.EndFlowBranching ();
FlowBranching.UsageVector f_vector = ec.CurrentBranching.CurrentUsageVector;
- Report.Debug (1, "END OF TRY", ec.CurrentBranching, returns, vector, f_vector);
+ Report.Debug (1, "END OF TRY", ec.CurrentBranching, reachability, vector, f_vector);
- if (returns != FlowBranching.FlowReturns.Always) {
+ if (reachability.Returns != FlowBranching.FlowReturns.Always) {
// Unfortunately, System.Reflection.Emit automatically emits a leave
// to the end of the finally block. This is a problem if `returns'
// is true since we may jump to a point after the end of the method.
// As a workaround, emit an explicit ret here.
- ec.NeedExplicitReturn = true;
+ ec.NeedReturnLabel ();
}
return ok;
}
- protected override bool DoEmit (EmitContext ec)
+ protected override void DoEmit (EmitContext ec)
{
ILGenerator ig = ec.ig;
- Label end;
Label finish = ig.DefineLabel ();;
- bool returns;
- ec.TryCatchLevel++;
- end = ig.BeginExceptionBlock ();
- bool old_in_try = ec.InTry;
- ec.InTry = true;
- returns = Block.Emit (ec);
- ec.InTry = old_in_try;
+ ig.BeginExceptionBlock ();
+ Block.Emit (ec);
//
// System.Reflection.Emit provides this automatically:
// ig.Emit (OpCodes.Leave, finish);
- bool old_in_catch = ec.InCatch;
- ec.InCatch = true;
- DeclSpace ds = ec.DeclSpace;
-
foreach (Catch c in Specific){
LocalInfo vi;
@@ -3248,31 +3239,22 @@ namespace Mono.CSharp {
} else
ig.Emit (OpCodes.Pop);
- if (!c.Block.Emit (ec))
- returns = false;
+ c.Block.Emit (ec);
}
if (General != null){
ig.BeginCatchBlock (TypeManager.object_type);
ig.Emit (OpCodes.Pop);
- if (!General.Block.Emit (ec))
- returns = false;
+ General.Block.Emit (ec);
}
- ec.InCatch = old_in_catch;
ig.MarkLabel (finish);
if (Fini != null){
ig.BeginFinallyBlock ();
- bool old_in_finally = ec.InFinally;
- ec.InFinally = true;
Fini.Emit (ec);
- ec.InFinally = old_in_finally;
}
ig.EndExceptionBlock ();
- ec.TryCatchLevel--;
-
- return returns;
}
}
@@ -3370,18 +3352,13 @@ namespace Mono.CSharp {
ILGenerator ig = ec.ig;
int i = 0;
- bool old_in_try = ec.InTry;
- ec.InTry = true;
for (i = 0; i < assign.Length; i++) {
assign [i].EmitStatement (ec);
ig.BeginExceptionBlock ();
}
Statement.Emit (ec);
- ec.InTry = old_in_try;
- bool old_in_finally = ec.InFinally;
- ec.InFinally = true;
var_list.Reverse ();
foreach (DictionaryEntry e in var_list){
LocalVariableReference var = (LocalVariableReference) e.Key;
@@ -3390,14 +3367,41 @@ namespace Mono.CSharp {
ig.BeginFinallyBlock ();
+ if (!var.Type.IsValueType) {
var.Emit (ec);
ig.Emit (OpCodes.Brfalse, skip);
converted_vars [i].Emit (ec);
ig.Emit (OpCodes.Callvirt, TypeManager.void_dispose_void);
+ } else {
+ Expression ml = Expression.MemberLookup(ec, typeof(IDisposable), var.Type, "Dispose", Mono.CSharp.Location.Null);
+
+ if (!(ml is MethodGroupExpr)) {
+ var.Emit (ec);
+ ig.Emit (OpCodes.Box, var.Type);
+ ig.Emit (OpCodes.Callvirt, TypeManager.void_dispose_void);
+ } else {
+ MethodInfo mi = null;
+
+ foreach (MethodInfo mk in ((MethodGroupExpr) ml).Methods) {
+ if (mk.GetParameters().Length == 0) {
+ mi = mk;
+ break;
+ }
+ }
+
+ if (mi == null) {
+ Report.Error(-100, Mono.CSharp.Location.Null, "Internal error: No Dispose method which takes 0 parameters.");
+ return false;
+ }
+
+ var.AddressOf (ec, AddressOp.Load);
+ ig.Emit (OpCodes.Call, mi);
+ }
+ }
+
ig.MarkLabel (skip);
ig.EndExceptionBlock ();
}
- ec.InFinally = old_in_finally;
return false;
}
@@ -3415,21 +3419,16 @@ namespace Mono.CSharp {
expr.Emit (ec);
ig.Emit (OpCodes.Stloc, local_copy);
- bool old_in_try = ec.InTry;
- ec.InTry = true;
ig.BeginExceptionBlock ();
Statement.Emit (ec);
- ec.InTry = old_in_try;
Label skip = ig.DefineLabel ();
- bool old_in_finally = ec.InFinally;
ig.BeginFinallyBlock ();
ig.Emit (OpCodes.Ldloc, local_copy);
ig.Emit (OpCodes.Brfalse, skip);
ig.Emit (OpCodes.Ldloc, local_copy);
ig.Emit (OpCodes.Callvirt, TypeManager.void_dispose_void);
ig.MarkLabel (skip);
- ec.InFinally = old_in_finally;
ig.EndExceptionBlock ();
return false;
@@ -3457,7 +3456,7 @@ namespace Mono.CSharp {
return false;
}
- ec.StartFlowBranching (FlowBranching.BranchingType.Block, loc);
+ ec.StartFlowBranching (FlowBranching.BranchingType.Exception, loc);
bool ok = Statement.Resolve (ec);
@@ -3466,27 +3465,25 @@ namespace Mono.CSharp {
return false;
}
- FlowBranching.FlowReturns returns = ec.EndFlowBranching ();
+ FlowBranching.Reachability reachability = ec.EndFlowBranching ();
- if (returns != FlowBranching.FlowReturns.Always) {
+ if (reachability.Returns != FlowBranching.FlowReturns.Always) {
// Unfortunately, System.Reflection.Emit automatically emits a leave
// to the end of the finally block. This is a problem if `returns'
// is true since we may jump to a point after the end of the method.
// As a workaround, emit an explicit ret here.
- ec.NeedExplicitReturn = true;
+ ec.NeedReturnLabel ();
}
return true;
}
- protected override bool DoEmit (EmitContext ec)
+ protected override void DoEmit (EmitContext ec)
{
if (expression_or_block is DictionaryEntry)
- return EmitLocalVariableDecls (ec);
+ EmitLocalVariableDecls (ec);
else if (expression_or_block is Expression)
- return EmitExpression (ec);
-
- return false;
+ EmitExpression (ec);
}
}
@@ -3554,7 +3551,9 @@ namespace Mono.CSharp {
empty = new EmptyExpression (hm.element_type);
}
- ec.StartFlowBranching (FlowBranching.BranchingType.LoopBlock, loc);
+ bool ok = true;
+
+ ec.StartFlowBranching (FlowBranching.BranchingType.Loop, loc);
ec.CurrentBranching.CreateSibling (FlowBranching.SiblingType.Conditional);
//
@@ -3567,18 +3566,25 @@ namespace Mono.CSharp {
//
conv = Convert.ExplicitConversion (ec, empty, var_type, loc);
if (conv == null)
- return false;
+ ok = false;
variable = variable.ResolveLValue (ec, empty);
if (variable == null)
- return false;
+ ok = false;
+
+ bool disposable = (hm != null) && hm.is_disposable;
+ if (disposable)
+ ec.StartFlowBranching (FlowBranching.BranchingType.Exception, loc);
if (!statement.Resolve (ec))
- return false;
+ ok = false;
- FlowBranching.FlowReturns returns = ec.EndFlowBranching ();
+ if (disposable)
+ ec.EndFlowBranching ();
- return true;
+ ec.EndFlowBranching ();
+
+ return ok;
}
//
@@ -3613,16 +3619,16 @@ namespace Mono.CSharp {
//
static MethodInfo FetchMethodGetCurrent (Type t)
{
- MemberList move_next_list;
-
- move_next_list = TypeContainer.FindMembers (
+ MemberList get_current_list;
+
+ get_current_list = TypeContainer.FindMembers (
t, MemberTypes.Method,
BindingFlags.Public | BindingFlags.Instance,
Type.FilterName, "get_Current");
- if (move_next_list.Count == 0)
+ if (get_current_list.Count == 0)
return null;
- foreach (MemberInfo m in move_next_list){
+ foreach (MemberInfo m in get_current_list){
MethodInfo mi = (MethodInfo) m;
Type [] args;
@@ -3776,7 +3782,7 @@ namespace Mono.CSharp {
mi = TypeContainer.FindMembers (t, MemberTypes.Method,
BindingFlags.Public | BindingFlags.NonPublic |
- BindingFlags.Instance,
+ BindingFlags.Instance | BindingFlags.DeclaredOnly,
FilterEnumerator, hm);
if (mi.Count == 0)
@@ -3794,8 +3800,11 @@ namespace Mono.CSharp {
{
ForeachHelperMethods hm = new ForeachHelperMethods (ec);
- if (TryType (t, hm))
- return hm;
+ for (Type tt = t; tt != null && tt != TypeManager.object_type;){
+ if (TryType (tt, hm))
+ return hm;
+ tt = tt.BaseType;
+ }
//
// Now try to find the method in the interfaces
@@ -3861,13 +3870,8 @@ namespace Mono.CSharp {
// Protect the code in a try/finalize block, so that
// if the beast implement IDisposable, we get rid of it
//
- Label l;
- bool old_in_try = ec.InTry;
-
- if (hm.is_disposable) {
- l = ig.BeginExceptionBlock ();
- ec.InTry = true;
- }
+ if (hm.is_disposable)
+ ig.BeginExceptionBlock ();
Label end_try = ig.DefineLabel ();
@@ -3890,7 +3894,6 @@ namespace Mono.CSharp {
statement.Emit (ec);
ig.Emit (OpCodes.Br, ec.LoopBegin);
ig.MarkLabel (end_try);
- ec.InTry = old_in_try;
// The runtime provides this for us.
// ig.Emit (OpCodes.Leave, end);
@@ -3900,8 +3903,6 @@ namespace Mono.CSharp {
//
if (hm.is_disposable) {
Label end_finally = ig.DefineLabel ();
- bool old_in_finally = ec.InFinally;
- ec.InFinally = true;
ig.BeginFinallyBlock ();
disposable.EmitThis ();
@@ -3915,7 +3916,6 @@ namespace Mono.CSharp {
disposable.EmitLoad ();
ig.Emit (OpCodes.Callvirt, TypeManager.void_dispose_void);
ig.MarkLabel (end_finally);
- ec.InFinally = old_in_finally;
// The runtime generates this anyways.
// ig.Emit (OpCodes.Endfinally);
@@ -4080,31 +4080,21 @@ namespace Mono.CSharp {
return false;
}
- protected override bool DoEmit (EmitContext ec)
+ protected override void DoEmit (EmitContext ec)
{
- bool ret_val;
-
ILGenerator ig = ec.ig;
Label old_begin = ec.LoopBegin, old_end = ec.LoopEnd;
- bool old_inloop = ec.InLoop;
- int old_loop_begin_try_catch_level = ec.LoopBeginTryCatchLevel;
ec.LoopBegin = ig.DefineLabel ();
ec.LoopEnd = ig.DefineLabel ();
- ec.InLoop = true;
- ec.LoopBeginTryCatchLevel = ec.TryCatchLevel;
if (hm != null)
- ret_val = EmitCollectionForeach (ec);
+ EmitCollectionForeach (ec);
else
- ret_val = EmitArrayForeach (ec);
+ EmitArrayForeach (ec);
ec.LoopBegin = old_begin;
ec.LoopEnd = old_end;
- ec.InLoop = old_inloop;
- ec.LoopBeginTryCatchLevel = old_loop_begin_try_catch_level;
-
- return ret_val;
}
}
}
diff --git a/mcs/gmcs/support.cs b/mcs/gmcs/support.cs
index 43d7e746302..5315fcf7b99 100755
--- a/mcs/gmcs/support.cs
+++ b/mcs/gmcs/support.cs
@@ -206,7 +206,11 @@ namespace Mono.CSharp {
}
class PtrHashtable : Hashtable {
- class PtrComparer : IComparer {
+ sealed class PtrComparer : IComparer {
+ private PtrComparer () {}
+
+ public static PtrComparer Instance = new PtrComparer ();
+
public int Compare (object x, object y)
{
if (x == y)
@@ -218,7 +222,50 @@ namespace Mono.CSharp {
public PtrHashtable ()
{
- comparer = new PtrComparer ();
+ comparer = PtrComparer.Instance;
+ }
+ }
+
+ /*
+ * Hashtable whose keys are character arrays with the same length
+ */
+ class CharArrayHashtable : Hashtable {
+ sealed class ArrComparer : IComparer {
+ private int len;
+
+ public ArrComparer (int len) {
+ this.len = len;
+ }
+
+ public int Compare (object x, object y)
+ {
+ char[] a = (char[])x;
+ char[] b = (char[])y;
+
+ for (int i = 0; i < len; ++i)
+ if (a [i] != b [i])
+ return 1;
+ return 0;
+ }
+ }
+
+ private int len;
+
+ protected override int GetHash (Object key)
+ {
+ char[] arr = (char[])key;
+ int h = 0;
+
+ for (int i = 0; i < len; ++i)
+ h = (h << 5) - h + arr [i];
+
+ return h;
+ }
+
+ public CharArrayHashtable (int len)
+ {
+ this.len = len;
+ comparer = new ArrComparer (len);
}
}
@@ -236,12 +283,12 @@ namespace Mono.CSharp {
}
if (a is string)
- return String.Compare ((string) a, ((MemberInfo)b).Name);
+ return String.Compare ((string) a, ((MemberInfo)b).Name, false, CultureInfo.InvariantCulture);
if (b is string)
- return String.Compare (((MemberInfo)a).Name, (string) b);
+ return String.Compare (((MemberInfo)a).Name, (string) b, false, CultureInfo.InvariantCulture);
- return String.Compare (((MemberInfo)a).Name, ((MemberInfo)b).Name);
+ return String.Compare (((MemberInfo)a).Name, ((MemberInfo)b).Name, false, CultureInfo.InvariantCulture);
}
}
@@ -330,23 +377,46 @@ namespace Mono.CSharp {
}
public class DoubleHash {
- Hashtable l = new Hashtable ();
+ const int DEFAULT_INITIAL_BUCKETS = 100;
- public DoubleHash ()
+ public DoubleHash () : this (DEFAULT_INITIAL_BUCKETS) {}
+
+ public DoubleHash (int size)
{
+ count = size;
+ buckets = new Entry [size];
+ }
+
+ int count;
+ Entry [] buckets;
+ int size = 0;
+
+ class Entry {
+ public object key1;
+ public object key2;
+ public int hash;
+ public object value;
+ public Entry next;
+
+ public Entry (object key1, object key2, int hash, object value, Entry next)
+ {
+ this.key1 = key1;
+ this.key2 = key2;
+ this.hash = hash;
+ this.next = next;
+ this.value = value;
+ }
}
public bool Lookup (object a, object b, out object res)
{
- object r = l [a];
- if (r == null){
- res = null;
- return false;
+ int h = (a.GetHashCode () ^ b.GetHashCode ()) & 0x7FFFFFFF;
+
+ for (Entry e = buckets [h % count]; e != null; e = e.next) {
+ if (e.hash == h && e.key1.Equals (a) && e.key2.Equals (b)) {
+ res = e.value;
+ return true;
}
- Hashtable ht = (Hashtable) r;
- if (ht.Contains (b)){
- res = ht [b];
- return true;
}
res = null;
return false;
@@ -354,16 +424,37 @@ namespace Mono.CSharp {
public void Insert (object a, object b, object value)
{
- Hashtable ht;
- object r = l [a];
- if (r == null){
- ht = new Hashtable ();
- l [a] = ht;
- ht [b] = value;
- return;
+ // Is it an existing one?
+
+ int h = (a.GetHashCode () ^ b.GetHashCode ()) & 0x7FFFFFFF;
+
+ for (Entry e = buckets [h % count]; e != null; e = e.next) {
+ if (e.hash == h && e.key1.Equals (a) && e.key2.Equals (b))
+ e.value = value;
+ }
+
+ int bucket = h % count;
+ buckets [bucket] = new Entry (a, b, h, value, buckets [bucket]);
+
+ // Grow whenever we double in size
+ if (size++ == count) {
+ count <<= 1;
+ count ++;
+
+ Entry [] newBuckets = new Entry [count];
+ foreach (Entry root in buckets) {
+ Entry e = root;
+ while (e != null) {
+ int newLoc = e.hash % count;
+ Entry n = e.next;
+ e.next = newBuckets [newLoc];
+ newBuckets [newLoc] = e;
+ e = n;
+ }
+ }
+
+ buckets = newBuckets;
}
- ht = (Hashtable) r;
- ht [b] = value;
}
}
}
diff --git a/mcs/gmcs/tree.cs b/mcs/gmcs/tree.cs
index 0f3a2d9244a..17059c13658 100755
--- a/mcs/gmcs/tree.cs
+++ b/mcs/gmcs/tree.cs
@@ -45,7 +45,7 @@ namespace Mono.CSharp
public Tree ()
{
- root_types = new TypeContainer (null, null, "", new Location (-1));
+ root_types = new TypeContainer ();
decls = new Hashtable ();
namespaces = new Hashtable ();
diff --git a/mcs/gmcs/typemanager.cs b/mcs/gmcs/typemanager.cs
index 0f9bdb4d5bd..9516f42f6ce 100755
--- a/mcs/gmcs/typemanager.cs
+++ b/mcs/gmcs/typemanager.cs
@@ -175,10 +175,10 @@ public class TypeManager {
static Assembly [] assemblies;
// <remarks>
- // Keeps a list of module builders. We used this to do lookups
- // on the modulebuilder using GetType -- needed for arrays
+ // Keeps a list of modules. We used this to do lookups
+ // on the module using GetType -- needed for arrays
// </remarks>
- static ModuleBuilder [] modules;
+ static Module [] modules;
// <remarks>
// This is the type_cache from the assemblies to avoid
@@ -241,6 +241,35 @@ public class TypeManager {
public Type [] args;
}
+ public static void CleanUp ()
+ {
+ // Lets get everything clean so that we can collect before generating code
+ assemblies = null;
+ modules = null;
+ types = null;
+ typecontainers = null;
+ user_types = null;
+ builder_to_declspace = null;
+ builder_to_ifaces = null;
+ method_arguments = null;
+ indexer_arguments = null;
+ method_internal_params = null;
+ builder_to_attr = null;
+ builder_to_method = null;
+
+ fields = null;
+ references = null;
+ negative_hits = null;
+ attr_to_allowmult = null;
+ builder_to_constant = null;
+ fieldbuilders_to_fields = null;
+ events = null;
+ priv_fields_events = null;
+ properties = null;
+
+ TypeHandle.CleanUp ();
+ }
+
/// <summary>
/// A filter for Findmembers that uses the Signature object to
/// extract objects
@@ -348,7 +377,6 @@ public class TypeManager {
return;
}
- Location l;
tc = builder_to_declspace [t] as TypeContainer;
if (tc != null){
Report.Warning (
@@ -485,6 +513,11 @@ public class TypeManager {
/// </summary>
public static void AddAssembly (Assembly a)
{
+ foreach (Assembly assembly in assemblies) {
+ if (a == assembly)
+ return;
+ }
+
int top = assemblies.Length;
Assembly [] n = new Assembly [top + 1];
@@ -497,10 +530,10 @@ public class TypeManager {
/// <summary>
/// Registers a module builder to lookup types from
/// </summary>
- public static void AddModule (ModuleBuilder mb)
+ public static void AddModule (Module mb)
{
int top = modules != null ? modules.Length : 0;
- ModuleBuilder [] n = new ModuleBuilder [top + 1];
+ Module [] n = new Module [top + 1];
if (modules != null)
modules.CopyTo (n, 0);
@@ -578,7 +611,7 @@ public class TypeManager {
} while (t != null);
}
- foreach (ModuleBuilder mb in modules) {
+ foreach (Module mb in modules) {
t = mb.GetType (name);
if (t != null)
return t;
@@ -611,6 +644,8 @@ public class TypeManager {
return t;
}
+ static readonly char [] dot_array = { '.' };
+
/// <summary>
/// Returns the Type associated with @name, takes care of the fact that
/// reflection expects nested types to be separated from the main type
@@ -632,7 +667,8 @@ public class TypeManager {
if (negative_hits.Contains (name))
return null;
- string [] elements = name.Split ('.');
+ // Sadly, split takes a param array, so this ends up allocating *EVERY TIME*
+ string [] elements = name.Split (dot_array);
int count = elements.Length;
for (int n = 1; n <= count; n++){
@@ -646,7 +682,7 @@ public class TypeManager {
if (t == null){
t = LookupTypeReflection (top_level_type);
if (t == null){
- negative_hits [top_level_type] = true;
+ negative_hits [top_level_type] = null;
continue;
}
}
@@ -667,12 +703,12 @@ public class TypeManager {
//Console.WriteLine ("Looking up: " + newt + " " + name);
t = LookupTypeReflection (newt);
if (t == null)
- negative_hits [name] = true;
+ negative_hits [name] = null;
else
types [name] = t;
return t;
}
- negative_hits [name] = true;
+ negative_hits [name] = null;
return null;
}
@@ -681,14 +717,13 @@ public class TypeManager {
/// </summary>
public static void ComputeNamespaces ()
{
- MethodInfo assembly_get_namespaces = typeof (Assembly).GetMethod ("GetNamespaces");
+ MethodInfo assembly_get_namespaces = typeof (Assembly).GetMethod ("GetNamespaces", BindingFlags.Instance|BindingFlags.NonPublic);
//
// First add the assembly namespaces
//
if (assembly_get_namespaces != null){
int count = assemblies.Length;
- int total;
for (int i = 0; i < count; i++){
Assembly a = assemblies [i];
@@ -752,6 +787,29 @@ public class TypeManager {
}
/// <summary>
+ /// Returns the signature of the method with full namespace classification
+ /// </summary>
+ static public string GetFullNameSignature (MemberInfo mi)
+ {
+ return mi.DeclaringType.FullName.Replace ('+', '.') + '.' + mi.Name;
+ }
+
+ /// <summary>
+ /// Returns the signature of the property and indexer
+ /// </summary>
+ static public string CSharpSignature (PropertyBuilder pb, bool is_indexer)
+ {
+ if (!is_indexer) {
+ return GetFullNameSignature (pb);
+ }
+
+ MethodBase mb = pb.GetSetMethod (true) != null ? pb.GetSetMethod (true) : pb.GetGetMethod (true);
+ string signature = GetFullNameSignature (mb);
+ string arg = TypeManager.LookupParametersByBuilder (mb).ParameterDesc (0);
+ return String.Format ("{0}.this[{1}]", signature.Substring (0, signature.LastIndexOf ('.')), arg);
+ }
+
+ /// <summary>
/// Returns the signature of the method
/// </summary>
static public string CSharpSignature (MethodBase mb)
@@ -777,7 +835,7 @@ public class TypeManager {
}
sig += ")";
- return mb.DeclaringType.Name + "." + mb.Name + sig;
+ return GetFullNameSignature (mb) + sig;
}
/// <summary>
@@ -800,16 +858,19 @@ public class TypeManager {
/// Returns the MethodInfo for a method named `name' defined
/// in type `t' which takes arguments of types `args'
/// </summary>
- static MethodInfo GetMethod (Type t, string name, Type [] args, bool report_errors)
+ static MethodInfo GetMethod (Type t, string name, Type [] args, bool is_private, bool report_errors)
{
MemberList list;
Signature sig;
+ BindingFlags flags = instance_and_static | BindingFlags.Public;
sig.name = name;
sig.args = args;
- list = FindMembers (t, MemberTypes.Method, instance_and_static | BindingFlags.Public,
- signature_filter, sig);
+ if (is_private)
+ flags |= BindingFlags.NonPublic;
+
+ list = FindMembers (t, MemberTypes.Method, flags, signature_filter, sig);
if (list.Count == 0) {
if (report_errors)
Report.Error (-19, "Can not find the core function `" + name + "'");
@@ -826,6 +887,11 @@ public class TypeManager {
return mi;
}
+ static MethodInfo GetMethod (Type t, string name, Type [] args, bool report_errors)
+ {
+ return GetMethod (t, name, args, false, report_errors);
+ }
+
static MethodInfo GetMethod (Type t, string name, Type [] args)
{
return GetMethod (t, name, args, true);
@@ -979,7 +1045,7 @@ public class TypeManager {
MethodInfo set_corlib_type_builders = GetMethod (
system_assemblybuilder_type, "SetCorlibTypeBuilders",
- system_4_type_arg, false);
+ system_4_type_arg, true, false);
if (set_corlib_type_builders != null) {
object[] args = new object [4];
@@ -993,7 +1059,7 @@ public class TypeManager {
// Compatibility for an older version of the class libs.
set_corlib_type_builders = GetMethod (
system_assemblybuilder_type, "SetCorlibTypeBuilders",
- system_3_type_arg, true);
+ system_3_type_arg, true, true);
if (set_corlib_type_builders == null) {
Report.Error (-26, "Corlib compilation is not supported in Microsoft.NET due to bugs in it");
@@ -1158,8 +1224,6 @@ public class TypeManager {
const BindingFlags instance_and_static = BindingFlags.Static | BindingFlags.Instance;
- static Hashtable type_hash = new Hashtable ();
-
/// <remarks>
/// This is the "old", non-cache based FindMembers() function. We cannot use
/// the cache here because there is no member name argument.
@@ -1235,8 +1299,6 @@ public class TypeManager {
private static MemberList MemberLookup_FindMembers (Type t, MemberTypes mt, BindingFlags bf,
string name, out bool used_cache)
{
- bool not_loaded_corlib = (t.Assembly == CodeGen.AssemblyBuilder);
-
//
// We have to take care of arrays specially, because GetType on
// a TypeBuilder array will return a Type, not a TypeBuilder,
@@ -1441,6 +1503,14 @@ public class TypeManager {
return false;
}
+ public static bool IsEqual (Type a, Type b)
+ {
+ if (a.Equals (b))
+ return true;
+ else
+ return IsEqualGenericType (a, b);
+ }
+
//
// Checks whether `type' is a subclass or nested child of `parent'.
//
@@ -1798,12 +1868,19 @@ public class TypeManager {
return ret;
}
+ static PtrHashtable iface_cache = new PtrHashtable ();
+
/// <summary>
/// This function returns the interfaces in the type `t'. Works with
/// both types and TypeBuilders.
/// </summary>
public static TypeExpr [] GetInterfaces (Type t)
{
+
+ TypeExpr [] cached = iface_cache [t] as TypeExpr [];
+ if (cached != null)
+ return cached;
+
//
// The reason for catching the Array case is that Reflection.Emit
// will not return a TypeBuilder for Array types of TypeBuilder types,
@@ -1833,17 +1910,30 @@ public class TypeManager {
parent_ifaces.CopyTo (result, 0);
type_ifaces.CopyTo (result, parent_count);
+ iface_cache [t] = result;
return result;
} else {
Type [] ifaces = t.GetInterfaces ();
+ if (ifaces.Length == 0)
+ return NoTypeExprs;
TypeExpr [] result = new TypeExpr [ifaces.Length];
for (int i = 0; i < ifaces.Length; i++)
result [i] = new TypeExpression (ifaces [i], Location.Null);
+
+ iface_cache [t] = result;
return result;
}
}
+ //
+ // gets the interfaces that are declared explicitly on t
+ //
+ public static TypeExpr [] GetExplicitInterfaces (TypeBuilder t)
+ {
+ return (TypeExpr []) builder_to_ifaces [t];
+ }
+
/// <remarks>
/// The following is used to check if a given type implements an interface.
/// The cache helps us reduce the expense of hitting Type.GetInterfaces everytime.
@@ -2259,11 +2349,6 @@ public class TypeManager {
#region MemberLookup implementation
//
- // Name of the member
- //
- static string closure_name;
-
- //
// Whether we allow private members in the result (since FindMembers
// uses NonPublic for both protected and private), we need to distinguish.
//
@@ -2273,7 +2358,6 @@ public class TypeManager {
// Who is invoking us and which type is being queried currently.
//
static Type closure_invocation_type;
- static Type closure_queried_type;
static Type closure_qualifier_type;
//
@@ -2301,7 +2385,7 @@ public class TypeManager {
return false;
if (((closure_qualifier_type == null) || (closure_qualifier_type == closure_invocation_type)) &&
- (m.DeclaringType == closure_invocation_type))
+ IsEqual (m.DeclaringType, closure_invocation_type))
return true;
//
@@ -2313,7 +2397,8 @@ public class TypeManager {
MethodAttributes ma = mb.Attributes & MethodAttributes.MemberAccessMask;
if (ma == MethodAttributes.Private)
- return closure_private_ok || (closure_invocation_type == m.DeclaringType) ||
+ return closure_private_ok ||
+ IsEqual (closure_invocation_type, m.DeclaringType) ||
IsNestedChildOf (closure_invocation_type, m.DeclaringType);
//
@@ -2362,7 +2447,8 @@ public class TypeManager {
FieldAttributes fa = fi.Attributes & FieldAttributes.FieldAccessMask;
if (fa == FieldAttributes.Private)
- return closure_private_ok || (closure_invocation_type == m.DeclaringType) ||
+ return closure_private_ok ||
+ IsEqual (closure_invocation_type, m.DeclaringType) ||
IsNestedChildOf (closure_invocation_type, m.DeclaringType);
//
@@ -2470,7 +2556,6 @@ public class TypeManager {
bool skip_iface_check = true, used_cache = false;
bool always_ok_flag = false;
- closure_name = name;
closure_invocation_type = invocation_type;
closure_invocation_assembly = invocation_type != null ? invocation_type.Assembly : null;
closure_qualifier_type = qualifier_type;
@@ -2515,7 +2600,6 @@ public class TypeManager {
bf = original_bf;
closure_private_ok = (original_bf & BindingFlags.NonPublic) != 0;
- closure_queried_type = current_type;
Timer.StopTimer (TimerType.MemberLookup);
@@ -2735,6 +2819,11 @@ public sealed class TypeHandle : IMemberContainer {
type_hash.Add (t, handle);
return handle;
}
+
+ public static void CleanUp ()
+ {
+ type_hash = null;
+ }
/// <summary>
/// Returns the TypeHandle for TypeManager.object_type.
diff --git a/mcs/jtests/ChangeLog b/mcs/jtests/ChangeLog
new file mode 100644
index 00000000000..fdb8d1c06d6
--- /dev/null
+++ b/mcs/jtests/ChangeLog
@@ -0,0 +1,4 @@
+2004-01-25 Cesar Lopez Nataren <cesar@ciencias.unam.mx>
+
+ * Added tests for relational operators.
+
diff --git a/mcs/jtests/Makefile b/mcs/jtests/Makefile
new file mode 100644
index 00000000000..ace842ef784
--- /dev/null
+++ b/mcs/jtests/Makefile
@@ -0,0 +1,47 @@
+thisdir = jtests
+SUBDIRS =
+INTERNAL_MJS = $(TEST_RUNTIME) $(topdir)/class/Microsoft.JScript/Microsoft.JScript/mjs.exe
+all: test-compiler-jit
+include ../build/rules.make
+include Test.Sources
+
+all-local install-local:
+
+test-local:
+
+run-test-local: test-compiler-jit
+
+test-compiler-jit: test-compiler-jit-real
+
+test-compiler-jit-real:
+ @rm -f *.exe *.out; \
+ /bin/echo "*** Tests ***" > results.out; \
+ /bin/echo "*** Tests ***"; \
+ for i in $(TEST_SOURCES) ; do \
+ /bin/echo -n -e "===\n$$i: " >> results.out; \
+ /bin/echo -n "$$i: "; \
+ if $(INTERNAL_MJS) $$i.js 1>output ; then \
+ /bin/echo -n "COMPILED OK : " >> results.out; \
+ /bin/echo -n "COMPILED OK : " ; \
+ true; \
+ else \
+ /bin/echo -n -e "FAILED COMPILATION\n---\n" >> results.out; \
+ cat output >> results.out; \
+ /bin/echo "FAILED COMPILATION" ; \
+ continue; \
+ fi ; \
+ if $(TEST_RUNTIME) ./$$i.exe 1>output ; then \
+ /bin/echo "EXECUTED OK" >> results.out; \
+ /bin/echo "EXECUTED OK"; \
+ else \
+ /bin/echo -n -e "$$i : FAILED AT RUNTIME\n---\n" >> results.out; \
+ cat output >> results.out; \
+ /bin/echo "$$i : FAILED AT RUNTIME" ; \
+ fi ; \
+ rm -f ./$$i.exe output; \
+ done; \
+ /bin/echo "===" >> results.out
+
+clean-local:
+ rm *~
+
diff --git a/mcs/jtests/Test.Sources b/mcs/jtests/Test.Sources
new file mode 100644
index 00000000000..017e6b4f15c
--- /dev/null
+++ b/mcs/jtests/Test.Sources
@@ -0,0 +1,5 @@
+TEST_SOURCES = \
+ var-decl init-var-num init-var-string simple-assign-num simple-assign-vars \
+ simple-assign-bool global-bool-lits global-id global-num global-sum \
+ global-assign-sum empty-func func-form-params func-total-locals func-nested \
+ greater-than less-than greater-than-eq less-than-eq assign-less-than-eq
diff --git a/mcs/jtests/assign-less-than-eq.js b/mcs/jtests/assign-less-than-eq.js
new file mode 100644
index 00000000000..4026a6fcc0d
--- /dev/null
+++ b/mcs/jtests/assign-less-than-eq.js
@@ -0,0 +1,3 @@
+var x, y, z;
+
+z = x <= y;
diff --git a/mcs/jtests/empty-func.js b/mcs/jtests/empty-func.js
new file mode 100644
index 00000000000..ec46c08c398
--- /dev/null
+++ b/mcs/jtests/empty-func.js
@@ -0,0 +1,7 @@
+function f ()
+{
+}
+
+function g ()
+{
+}
diff --git a/mcs/jtests/func-form-params.js b/mcs/jtests/func-form-params.js
new file mode 100644
index 00000000000..2ca1518a0a8
--- /dev/null
+++ b/mcs/jtests/func-form-params.js
@@ -0,0 +1,3 @@
+function f (i, j)
+{
+}
diff --git a/mcs/jtests/func-nested.js b/mcs/jtests/func-nested.js
new file mode 100644
index 00000000000..562e3b482f1
--- /dev/null
+++ b/mcs/jtests/func-nested.js
@@ -0,0 +1,19 @@
+var global;
+
+function f (i, j)
+{
+ var x = 1, y = 2, z;
+ z = x + y;
+
+ function g (k, l, m)
+ {
+ var z;
+ z = 1;
+
+ function h ()
+ {
+ var w;
+ w + 45;
+ }
+ }
+}
diff --git a/mcs/jtests/func-total-locals.js b/mcs/jtests/func-total-locals.js
new file mode 100644
index 00000000000..b7d6f2c8f2a
--- /dev/null
+++ b/mcs/jtests/func-total-locals.js
@@ -0,0 +1,5 @@
+function f (i, j, k)
+{
+ var x;
+ var y;
+}
diff --git a/mcs/jtests/global-assign-sum.js b/mcs/jtests/global-assign-sum.js
new file mode 100644
index 00000000000..61216bb3c30
--- /dev/null
+++ b/mcs/jtests/global-assign-sum.js
@@ -0,0 +1,4 @@
+var a, b, c, d, e, f, g, h, i, j, k, l;
+var x;
+
+x = a + b + c + d + e + f + g + h + i + j + k + l;
diff --git a/mcs/jtests/global-bool-lits.js b/mcs/jtests/global-bool-lits.js
new file mode 100644
index 00000000000..0c99ce8f3b1
--- /dev/null
+++ b/mcs/jtests/global-bool-lits.js
@@ -0,0 +1,2 @@
+true;
+false;
diff --git a/mcs/jtests/global-id.js b/mcs/jtests/global-id.js
new file mode 100644
index 00000000000..49f471ed4f0
--- /dev/null
+++ b/mcs/jtests/global-id.js
@@ -0,0 +1,3 @@
+var x;
+
+x;
diff --git a/mcs/jtests/global-num.js b/mcs/jtests/global-num.js
new file mode 100644
index 00000000000..0afc6045cfe
--- /dev/null
+++ b/mcs/jtests/global-num.js
@@ -0,0 +1 @@
+1;
diff --git a/mcs/jtests/global-sum.js b/mcs/jtests/global-sum.js
new file mode 100644
index 00000000000..d67f01505d1
--- /dev/null
+++ b/mcs/jtests/global-sum.js
@@ -0,0 +1,3 @@
+var a, b, c, d, e, f, g, h, i, j, k, l;
+
+a + b + c + d + e + f + g + h + i + j + k + l;
diff --git a/mcs/jtests/greater-than-eq.js b/mcs/jtests/greater-than-eq.js
new file mode 100644
index 00000000000..fa8f3b27252
--- /dev/null
+++ b/mcs/jtests/greater-than-eq.js
@@ -0,0 +1,3 @@
+var x, y;
+
+x >= y;
diff --git a/mcs/jtests/greater-than.js b/mcs/jtests/greater-than.js
new file mode 100644
index 00000000000..91f9586c6bb
--- /dev/null
+++ b/mcs/jtests/greater-than.js
@@ -0,0 +1,3 @@
+var x, y;
+
+x > y;
diff --git a/mcs/jtests/init-var-num.js b/mcs/jtests/init-var-num.js
new file mode 100644
index 00000000000..b506100a909
--- /dev/null
+++ b/mcs/jtests/init-var-num.js
@@ -0,0 +1 @@
+var x = 1;
diff --git a/mcs/jtests/init-var-string.js b/mcs/jtests/init-var-string.js
new file mode 100644
index 00000000000..b980842ad75
--- /dev/null
+++ b/mcs/jtests/init-var-string.js
@@ -0,0 +1 @@
+var x = "string";
diff --git a/mcs/jtests/less-than-eq.js b/mcs/jtests/less-than-eq.js
new file mode 100644
index 00000000000..a92f5c49d21
--- /dev/null
+++ b/mcs/jtests/less-than-eq.js
@@ -0,0 +1,3 @@
+var x, y;
+
+x <= y;
diff --git a/mcs/jtests/less-than.js b/mcs/jtests/less-than.js
new file mode 100644
index 00000000000..509c2f58801
--- /dev/null
+++ b/mcs/jtests/less-than.js
@@ -0,0 +1,3 @@
+var x, y;
+
+x < y;
diff --git a/mcs/jtests/simple-assign-bool.js b/mcs/jtests/simple-assign-bool.js
new file mode 100644
index 00000000000..3b74c700ad7
--- /dev/null
+++ b/mcs/jtests/simple-assign-bool.js
@@ -0,0 +1,3 @@
+var x;
+
+x = true;
diff --git a/mcs/jtests/simple-assign-num.js b/mcs/jtests/simple-assign-num.js
new file mode 100644
index 00000000000..c84769e7d41
--- /dev/null
+++ b/mcs/jtests/simple-assign-num.js
@@ -0,0 +1,3 @@
+var x;
+
+x = 1;
diff --git a/mcs/jtests/simple-assign-vars.js b/mcs/jtests/simple-assign-vars.js
new file mode 100644
index 00000000000..7d440244361
--- /dev/null
+++ b/mcs/jtests/simple-assign-vars.js
@@ -0,0 +1,3 @@
+var x, y;
+
+x = y;
diff --git a/mcs/jtests/var-decl.js b/mcs/jtests/var-decl.js
new file mode 100644
index 00000000000..65d5d360ddc
--- /dev/null
+++ b/mcs/jtests/var-decl.js
@@ -0,0 +1 @@
+var y;
diff --git a/mcs/mbas/ChangeLog b/mcs/mbas/ChangeLog
index 4fdb80b238b..d42d97c4633 100644
--- a/mcs/mbas/ChangeLog
+++ b/mcs/mbas/ChangeLog
@@ -1,3 +1,20 @@
+2004-01-07 Nick Drochak <ndrochak@ieee.org>
+
+ * genericparser.cs:
+ * mb-tokenizer.cs:
+ * row.cs: Eliminate warnings about unused variables.
+
+2004/01/06 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
+ * typemanager.cs : correcting translation of System types to language types,
+ also temporarily circunventing a exception in ModuleBuilder.GetType inside LookupTypeReflection,
+ corrected many ` characters to ' in error messages
+ * testmbas/WriteOK.vb : testing newly implemented IsNumeric global function
+
+2004-01-04 David Sheldon <dave-mono@earth.li>
+
+ * expression.cs: Added matching ")" to error message for
+ CS0077
+
2003/12/23 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
* driver.cs : added stubs for options "/netcf /sdkpath:path"
* namespace.cs, decl.cs, rootcontext.cs : use hashtable to avoid duplicate importation of namespaces
@@ -200,14 +217,14 @@
2002-06-15 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
* merged assign.cs, attribute.cs, enum.cs and namespace.cs from mcs/mcs, to resync
- * namespace.cs needed some fixing, because CSharpParser isnŽt available
+ * namespace.cs needed some fixing, because CSharpParser isn?t available
2002-06-15 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
* merged delegate.cs, ecore.cs, typemanager.cs and rootcontext.cs from mcs/mcs, to resolve expression.cs blues
2002-06-15 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
* oops merged expression.cs from mcs/mcs is breaking my make
- * driver.cs, assemblyinfo.cs wasnŽt ready for prime time (offending lines were commented out)
+ * driver.cs, assemblyinfo.cs wasn?t ready for prime time (offending lines were commented out)
2002-06-15 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
* merged expression.cs from mcs/mcs
@@ -249,7 +266,7 @@
- old-fashioned comments syntax (REM Blah-Blah)
2002-05-31 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
- * modified mbas.ico to be a small version of monoŽs logo (see mcs\MonoIcon.png)
+ * modified mbas.ico to be a small version of mono?s logo (see mcs\MonoIcon.png)
2002-05-31 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
* squashed some reduce/reduce conflicts out of mb-parser.jay
diff --git a/mcs/mbas/expression.cs b/mcs/mbas/expression.cs
index 91f86df2170..ca8746b7a97 100644
--- a/mcs/mbas/expression.cs
+++ b/mcs/mbas/expression.cs
@@ -1130,7 +1130,7 @@ namespace Mono.MonoBASIC {
if (TypeManager.IsValueType (probe_type)){
Report.Error (77, loc, "The as operator should be used with a reference type only (" +
- TypeManager.MonoBASIC_Name (probe_type) + " is a value type");
+ TypeManager.MonoBASIC_Name (probe_type) + " is a value type)");
return null;
}
diff --git a/mcs/mbas/genericparser.cs b/mcs/mbas/genericparser.cs
index 074f1428e76..817cd33c319 100644
--- a/mcs/mbas/genericparser.cs
+++ b/mcs/mbas/genericparser.cs
@@ -226,12 +226,12 @@ namespace Mono.Languages
{
errors = parser.ParseFile(fileName);
}
- catch (FileNotFoundException ex)
+ catch (FileNotFoundException)
{
Report.Error(2001, "Source file \'" + fileName + "\' could not be found!!!");
return 1;
}
- catch (DirectoryNotFoundException ex)
+ catch (DirectoryNotFoundException)
{
Report.Error(2001, "Source file \'" + fileName + "\' could not be found!!!");
return 1;
diff --git a/mcs/mbas/mb-tokenizer.cs b/mcs/mbas/mb-tokenizer.cs
index e1b826a6020..6018586d8e4 100644
--- a/mcs/mbas/mb-tokenizer.cs
+++ b/mcs/mbas/mb-tokenizer.cs
@@ -1,4 +1,4 @@
-//
+//
// Mono.MonoBASIC.Tokenizer.cs: The Tokenizer for the MonoBASIC compiler
//
// Author: A Rafael D Teixeira (rafaelteixeirabr@hotmail.com)
@@ -1067,11 +1067,11 @@ namespace Mono.MonoBASIC
enUSculture,
DateTimeStyles.NoCurrentDateDefault | DateTimeStyles.AllowWhiteSpaces);
}
- catch (FormatException fe)
+ catch (FormatException)
{
Report.Error (1, Location, "Invalid date literal"); //TODO: What is the correct error number and message?
}
- catch (Exception e)
+ catch (Exception)
{
Report.Error (1, Location, "Error parsing date literal"); //TODO: What is the correct error number and message?
}
diff --git a/mcs/mbas/report.cs b/mcs/mbas/report.cs
index 55d0f04d28d..95a1fc25c88 100644
--- a/mcs/mbas/report.cs
+++ b/mcs/mbas/report.cs
@@ -119,8 +119,6 @@ namespace Mono.MonoBASIC {
if (WarningsAreErrors)
Error (code, l, text);
else {
- string row;
-
if (Location.IsNull (l))
Console.WriteLine(String.Format("{0} warning BC{2:0000}: {3}",
l.Name, code, text));
diff --git a/mcs/mbas/testmbas/WriteOK.vb b/mcs/mbas/testmbas/WriteOK.vb
index e8e9755cb3d..fbec1dffc14 100644
--- a/mcs/mbas/testmbas/WriteOK.vb
+++ b/mcs/mbas/testmbas/WriteOK.vb
@@ -2,7 +2,7 @@
Option Strict Off
Option Compare Text
-Imports System, IO = System.Console
+Imports System, IO = System.Console, INFO = Microsoft.VisualBasic.Information
Module WriteOK
@@ -41,6 +41,19 @@ Module WriteOK
Console.WriteLine(Strings.ChrW(64))
+ Console.Write("Positive cases for IsNumeric: ")
+ if (INFO.IsNumeric(octalLit) And INFO.IsNumeric(hexLit) And INFO.IsNumeric(singleLit) And INFO.IsNumeric(doubleLit) And INFO.IsNumeric(decimalLit) And INFO.IsNumeric("123")) then
+ Console.WriteLine("OK")
+ else
+ Console.WriteLine("FAILED")
+ end if
+
+ Console.Write("Negative cases for IsNumeric: ")
+ if not (INFO.IsNumeric(nothing) Or INFO.IsNumeric(charLit) or INFO.IsNumeric(dateLit) or INFO.IsNumeric("123 ABC")) then
+ Console.WriteLine("OK")
+ else
+ Console.WriteLine("FAILED")
+ end if
End Sub
End Module
diff --git a/mcs/mbas/testsuite/testmbas.sh b/mcs/mbas/testsuite/testmbas.sh
index 2fa7dc4c79f..66fee8d8e90 100755
--- a/mcs/mbas/testsuite/testmbas.sh
+++ b/mcs/mbas/testsuite/testmbas.sh
@@ -1,8 +1,8 @@
-#!/bin/bash
+#!/bin/sh
TESTSUITEDIR=d:/cygwin/home/Administrator/mcs/mbas/testsuite
-MBAS=d:/cygwin/home/Administrator/mcs/mbas/mbas.exe
-MONO=
+MBAS=mbas
+MONO=mono
REFS=--reference=./TestUtils.dll
NUMTESTS=0
diff --git a/mcs/mbas/typemanager.cs b/mcs/mbas/typemanager.cs
index 18e1c041805..a59542dbee3 100644
--- a/mcs/mbas/typemanager.cs
+++ b/mcs/mbas/typemanager.cs
@@ -201,7 +201,7 @@ public class TypeManager {
static Hashtable indexer_arguments;
// <remarks>
- // Maybe `method_arguments' should be replaced and only
+ // Maybe 'method_arguments' should be replaced and only
// method_internal_params should be kept?
// <remarks>
static Hashtable method_internal_params;
@@ -328,14 +328,14 @@ public class TypeManager {
//
// This probably never happens, as we catch this before
//
- Report.Error (-17, "The type `" + name + "' has already been defined.");
+ Report.Error (-17, "The type '" + name + "' has already been defined.");
return;
}
tc = builder_to_declspace [t] as TypeContainer;
Report.Warning (
- 1595, "The type `" + name + "' is defined in an existing assembly;"+
+ 1595, "The type '" + name + "' is defined in an existing assembly;"+
" Using the new definition from: " + tc.Location);
Report.Warning (1595, "Previously defined in: " + prev.Assembly.FullName);
@@ -393,8 +393,8 @@ public class TypeManager {
}
/// <summary>
- /// Returns the TypeContainer whose Type is `t' or null if there is no
- /// TypeContainer for `t' (ie, the Type comes from a library)
+ /// Returns the TypeContainer whose Type is 't' or null if there is no
+ /// TypeContainer for 't' (ie, the Type comes from a library)
/// </summary>
public static TypeContainer LookupTypeContainer (Type t)
{
@@ -467,17 +467,21 @@ public class TypeManager {
{
Type t;
- foreach (Assembly a in assemblies){
- t = a.GetType (name, false, true);
- if (t != null)
- return t;
- }
+ try {
+ foreach (Assembly a in assemblies){
+ t = a.GetType (name, false, true);
+ if (t != null)
+ return t;
+ }
- foreach (ModuleBuilder mb in modules) {
- t = mb.GetType (name, false, true);
- if (t != null){
- return t;
+ foreach (ModuleBuilder mb in modules) {
+ t = mb.GetType (name, false, true);
+ if (t != null){
+ return t;
+ }
}
+ } catch (Exception e) {
+ System.Console.WriteLine("\nERROR: " + e.ToString() + "WHILE EXECUTING LookupTypeReflection(\"" + name + "\")\n");
}
return null;
}
@@ -589,9 +593,7 @@ public class TypeManager {
{
return Regex.Replace (t.FullName,
@"^System\." +
- @"(Int32|UInt32|Int16|Uint16|Int64|UInt64|" +
- @"Single|Double|Char|Decimal|Byte|SByte|Object|" +
- @"Boolean|String|Void|DateTime)" +
+ @"(Int32|Int16|Int64|Single|Double|Char|Decimal|Byte|Object|Boolean|String|DateTime)" +
@"(\W+|\b)",
new MatchEvaluator (MonoBASIC_NameMatch));
}
@@ -600,14 +602,9 @@ public class TypeManager {
{
string s = match.Groups [1].Captures [0].Value;
return s.ToLower ().
- Replace ("int32", "int").
- Replace ("uint32", "uint").
+ Replace ("int32", "integer").
Replace ("int16", "short").
- Replace ("uint16", "ushort").
Replace ("int64", "long").
- Replace ("uint64", "ulong").
- Replace ("single", "float").
- Replace ("boolean", "bool").
Replace ("datetime", "date")
+ match.Groups [2].Captures [0].Value;
}
@@ -650,7 +647,7 @@ public class TypeManager {
Type t = LookupType (name);
if (t == null){
- Report.Error (518, "The predefined type `" + name + "' is not defined or imported");
+ Report.Error (518, "The predefined type '" + name + "' is not defined or imported");
Environment.Exit (0);
}
@@ -658,8 +655,8 @@ public class TypeManager {
}
/// <summary>
- /// Returns the MethodInfo for a method named `name' defined
- /// in type `t' which takes arguments of types `args'
+ /// Returns the MethodInfo for a method named 'name' defined
+ /// in type 't' which takes arguments of types 'args'
/// </summary>
static MethodInfo GetMethod (Type t, string name, Type [] args)
{
@@ -672,13 +669,13 @@ public class TypeManager {
list = FindMembers (t, MemberTypes.Method, instance_and_static | BindingFlags.Public| BindingFlags.IgnoreCase,
signature_filter, sig);
if (list.Count == 0) {
- Report.Error (-19, "Can not find the core function `" + name + "'");
+ Report.Error (-19, "Can not find the core function '" + name + "'");
return null;
}
MethodInfo mi = list [0] as MethodInfo;
if (mi == null) {
- Report.Error (-19, "Can not find the core function `" + name + "'");
+ Report.Error (-19, "Can not find the core function '" + name + "'");
return null;
}
@@ -700,13 +697,13 @@ public class TypeManager {
instance_and_static | BindingFlags.Public | BindingFlags.DeclaredOnly | BindingFlags.IgnoreCase,
signature_filter, sig);
if (list.Count == 0){
- Report.Error (-19, "Can not find the core constructor for type `" + t.Name + "'");
+ Report.Error (-19, "Can not find the core constructor for type '" + t.Name + "'");
return null;
}
ConstructorInfo ci = list [0] as ConstructorInfo;
if (ci == null){
- Report.Error (-19, "Can not find the core constructor for type `" + t.Name + "'");
+ Report.Error (-19, "Can not find the core constructor for type '" + t.Name + "'");
return null;
}
@@ -960,7 +957,7 @@ public class TypeManager {
DeclSpace decl = (DeclSpace) builder_to_declspace [t];
bf |= BindingFlags.IgnoreCase;
//
- // `builder_to_declspace' contains all dynamic types.
+ // 'builder_to_declspace' contains all dynamic types.
//
if (decl != null) {
MemberList list;
@@ -1017,7 +1014,7 @@ public class TypeManager {
/// <summary>
/// This method is only called from within MemberLookup. It tries to use the member
- /// cache if possible and falls back to the normal FindMembers if not. The `used_cache'
+ /// cache if possible and falls back to the normal FindMembers if not. The 'used_cache'
/// flag tells the caller whether we used the cache or not. If we used the cache, then
/// our return value will already contain all inherited members and the caller don't need
/// to check base classes and interfaces anymore.
@@ -1037,7 +1034,7 @@ public class TypeManager {
}
//
- // If this is a dynamic type, it's always in the `builder_to_declspace' hash table
+ // If this is a dynamic type, it's always in the 'builder_to_declspace' hash table
// and we can ask the DeclSpace for the MemberCache.
//
if (t is TypeBuilder) {
@@ -1163,7 +1160,7 @@ public class TypeManager {
}
//
- // Checks whether `type' is a subclass or nested child of `parent'.
+ // Checks whether 'type' is a subclass or nested child of 'parent'.
//
public static bool IsSubclassOrNestedChildOf (Type type, Type parent)
{
@@ -1179,7 +1176,7 @@ public class TypeManager {
}
//
- // Checks whether `type' is a nested child of `parent'.
+ // Checks whether 'type' is a nested child of 'parent'.
//
public static bool IsNestedChildOf (Type type, Type parent)
{
@@ -1293,7 +1290,7 @@ public class TypeManager {
return (Type []) indexer_arguments [indexer];
else if (indexer is PropertyBuilder)
// If we're a PropertyBuilder and not in the
- // `indexer_arguments' hash, then we're a property and
+ // 'indexer_arguments' hash, then we're a property and
// not an indexer.
return NoTypes;
else {
@@ -1477,7 +1474,7 @@ public class TypeManager {
}
/// <summary>
- /// This function returns the interfaces in the type `t'. Works with
+ /// This function returns the interfaces in the type 't'. Works with
/// both types and TypeBuilders.
/// </summary>
public static Type [] GetInterfaces (Type t)
@@ -1527,7 +1524,7 @@ public class TypeManager {
//
// FIXME OPTIMIZATION:
// as soon as we hit a non-TypeBuiler in the interface
- // chain, we could return, as the `Type.GetInterfaces'
+ // chain, we could return, as the 'Type.GetInterfaces'
// will return all the interfaces implement by the type
// or its parents.
//
@@ -1559,7 +1556,7 @@ public class TypeManager {
NumberFormatInfo provider = ci.NumberFormat;
//
- // We must use Type.Equals() here since `conversionType' is
+ // We must use Type.Equals() here since 'conversionType' is
// the TypeBuilder created version of a system type and not
// the system type itself. You cannot use Type.GetTypeCode()
// on such a type - it'd always return TypeCode.Object.
@@ -1734,10 +1731,10 @@ public class TypeManager {
/// Returns the name of the indexer in a given type.
/// </summary>
/// <remarks>
- /// The default is not always `Item'. The user can change this behaviour by
+ /// The default is not always 'Item'. The user can change this behaviour by
/// using the DefaultMemberAttribute in the class.
///
- /// For example, the String class indexer is named `Chars' not `Item'
+ /// For example, the String class indexer is named 'Chars' not 'Item'
/// </remarks>
public static string IndexerPropertyName (Type t)
{
@@ -1809,7 +1806,7 @@ public class TypeManager {
}
//
- // We copy methods from `new_members' into `target_list' if the signature
+ // We copy methods from 'new_members' into 'target_list' if the signature
// for the method from in the new list does not exist in the target_list
//
// The name is assumed to be the same.
@@ -1878,12 +1875,12 @@ public class TypeManager {
string method_desc = TypeManager.MonoBASIC_Signature (mb);
if (oa.IsError) {
- Report.Error (619, loc, "Method `" + method_desc +
- "' is obsolete: `" + oa.Message + "'");
+ Report.Error (619, loc, "Method '" + method_desc +
+ "' is obsolete: '" + oa.Message + "'");
return MethodFlags.IsObsoleteError;
} else
- Report.Warning (618, loc, "Method `" + method_desc +
- "' is obsolete: `" + oa.Message + "'");
+ Report.Warning (618, loc, "Method '" + method_desc +
+ "' is obsolete: '" + oa.Message + "'");
flags |= MethodFlags.IsObsolete;
@@ -1936,7 +1933,7 @@ public class TypeManager {
static internal bool FilterWithClosure (MemberInfo m, object filter_criteria)
{
//
- // Hack: we know that the filter criteria will always be in the `closure'
+ // Hack: we know that the filter criteria will always be in the 'closure'
// fields.
//
@@ -1948,7 +1945,7 @@ public class TypeManager {
return true;
//
- // Ugly: we need to find out the type of `m', and depending
+ // Ugly: we need to find out the type of 'm', and depending
// on this, tell whether we accept or not
//
if (m is MethodBase){
@@ -2048,10 +2045,10 @@ public class TypeManager {
static MemberFilter FilterWithClosure_delegate = new MemberFilter (FilterWithClosure);
//
- // Looks up a member called `name' in the `queried_type'. This lookup
- // is done by code that is contained in the definition for `invocation_type'.
+ // Looks up a member called 'name' in the 'queried_type'. This lookup
+ // is done by code that is contained in the definition for 'invocation_type'.
//
- // The binding flags are `bf' and the kind of members being looked up are `mt'
+ // The binding flags are 'bf' and the kind of members being looked up are 'mt'
//
// Returns an array of a single element for everything but Methods/Constructors
// that might return multiple matches.
@@ -2109,7 +2106,7 @@ public class TypeManager {
MemberList list;
//
- // `NonPublic' is lame, because it includes both protected and
+ // 'NonPublic' is lame, because it includes both protected and
// private methods, so we need to control this behavior by
// explicitly tracking if a private method is ok or not.
//
@@ -2173,7 +2170,7 @@ bf |= BindingFlags.IgnoreCase;
continue;
//
- // Events and types are returned by both `static' and `instance'
+ // Events and types are returned by both 'static' and 'instance'
// searches, which means that our above FindMembers will
// return two copies of the same.
//
diff --git a/mcs/mcs/ChangeLog b/mcs/mcs/ChangeLog
index 05db04185a2..6b14c8eb7f6 100755
--- a/mcs/mcs/ChangeLog
+++ b/mcs/mcs/ChangeLog
@@ -1,3 +1,349 @@
+2004-01-31 Miguel de Icaza <miguel@ximian.com>
+
+ * cs-tokenizer.cs: Applied patch from Marek Safar to fix bug 53386
+
+2004-01-26 Miguel de Icaza <miguel@ximian.com>
+
+ * cs-tokenizer.cs: Handle #line hidden from PDC bits.
+
+2004-01-25 Miguel de Icaza <miguel@ximian.com>
+
+ * cs-parser.jay: Remove YIELD token, instead use the new grammar
+ changes that treat `yield' specially when present before `break'
+ or `return' tokens.
+
+ * cs-tokenizer.cs: yield is no longer a keyword.
+
+2004-01-23 Marek Safar <marek.safar@seznam.cz>
+
+ * cs-parser.jay, class.cs (DefineDefaultConstructor): Fixed ModFlags
+ setting for default constructors.
+
+2004-01-22 Martin Baulig <martin@ximian.com>
+
+ * cs-parser.jay (namespace_or_type_name): Return an Expression,
+ not a QualifiedIdentifier. This is what `type_name_expression'
+ was previously doing.
+ (type_name_expression): Removed; the code is now in
+ `namespace_or_type_name'.
+ (qualified_identifier): Removed, use `namespace_or_type_name'
+ instead.
+ (QualifiedIdentifier): Removed this class.
+
+2004-01-22 Martin Baulig <martin@ximian.com>
+
+ * namespace.cs (NamespaceEntry.UsingAlias): Take an Expression,
+ not a string as alias name.
+
+2004-01-21 Miguel de Icaza <miguel@ximian.com>
+
+ * ecore.cs (FieldInfo.AddressOf): Revert patch from previous
+ #52730 bug, and instead compute correctly the need to use a
+ temporary variable when requesting an address based on the
+ static/instace modified of the field and the constructor.
+
+2004-01-21 Martin Baulig <martin@ximian.com>
+
+ * ecore.cs (SimpleName.ResolveAsTypeStep): Lookup in the current
+ class and namespace before looking up aliases. Fixes #52517.
+
+2004-01-21 Martin Baulig <martin@ximian.com>
+
+ * flowanalysis.cs (UsageVector.Merge): Allow variables being
+ assinged in a 'try'; fixes exception4.cs.
+
+2004-01-21 Marek Safar <marek.safar@seznam.cz>
+ * class.cs : Implemented parameter-less constructor for TypeContainer
+
+ * decl.cs: Attributes are now stored here. New property OptAttributes
+
+ * delegate.cs, enum.cs, interface.cs: Removed attribute member.
+
+ * rootcontext.cs, tree.cs: Now use parameter-less constructor of TypeContainer
+
+2004-01-21 Marek Safar <marek.safar@seznam.cz>
+
+ * typemanager.cs (CSharpSignature): Now reports also inner class name.
+ (CSharpSignature): New method for indexer and property signature.
+
+2004-01-21 Marek Safar <marek.safar@seznam.cz>
+
+ * pending.cs (IsVirtualFilter): Faster implementation.
+
+2004-01-21 Marek Safar <marek.safar@seznam.cz>
+
+ * typemanager.cs: Avoid inclusion of same assembly more than once.
+
+2004-01-21 Marek Safar <marek.safar@seznam.cz>
+
+ * cs-parser.jay: Fixed problem where the last assembly attribute
+ has been applied also to following declaration (class, struct, etc.)
+
+2004-01-21 Marek Safar <marek.safar@seznam.cz>
+
+ * class.cs: Added error CS0538, CS0539 reporting.
+ Fixed crash on Microsoft runtime when field type is void.
+
+ * cs-parser.jay: Added error CS0537 reporting.
+
+ * pending.cs: Added error CS0535 reporting.
+ Improved error report for errors CS0536, CS0534.
+
+2004-01-20 Miguel de Icaza <miguel@ximian.com>
+
+ Merge a few bits from the Anonymous Method MCS tree.
+
+ * statement.cs (ToplevelBlock): New class for toplevel methods,
+ will hold anonymous methods, lifted variables.
+
+ * cs-parser.jay: Create toplevel blocks for delegates and for
+ regular blocks of code.
+
+2004-01-20 Martin Baulig <martin@ximian.com>
+
+ * codegen.cs (EmitContext): Removed `InTry', `InCatch',
+ `InFinally', `InLoop', `TryCatchLevel', `LoopBeginTryCatchLevel'
+ and `NeedExplicitReturn'; added `IsLastStatement'.
+ (EmitContext.EmitTopBlock): Emit the explicit "ret" if we either
+ have a `ReturnLabel' or we're not unreachable.
+
+ * flowanalysis.cs (FlowBranching.MergeChild): Actually merge the
+ child's reachability; don't just override ours with it. Fixes
+ #58058 (lluis's example).
+ (FlowBranching): Added public InTryOrCatch(), InCatch(),
+ InFinally(), InLoop(), InSwitch() and
+ BreakCrossesTryCatchBoundary() methods.
+
+ * statement.cs (Return): Do all error checking in Resolve().
+ Unless we are the last statement in a top-level block, always
+ create a return label and jump to it.
+ (Break, Continue): Do all error checking in Resolve(); also make
+ sure we aren't leaving a `finally'.
+ (Block.DoEmit): Set `ec.IsLastStatement' when emitting the last
+ statement in a top-level block.
+ (Block.Flags): Added `IsDestructor'.
+ (Block.IsDestructor): New public property.
+
+2004-01-20 Martin Baulig <martin@ximian.com>
+
+ * statement.cs (Break.DoEmit): Set ec.NeedExplicitReturn; fixes #52427.
+
+2004-01-20 Martin Baulig <martin@ximian.com>
+
+ * statement.cs (Statement.ResolveUnreachable): New public method.
+ (If, While): Do the dead-code elimination in Resolve(), not in Emit().
+ (Block.Resolve): Resolve unreachable statements.
+
+2004-01-19 Ben Maurer <bmaurer@users.sourceforge.net>
+
+ * expression.cs: We need to fix the case where we do
+ not have a temp variable here.
+
+ * assign.cs: Only expression compound assignments need
+ temporary variables.
+
+2004-01-19 Ben Maurer <bmaurer@users.sourceforge.net>
+
+ * flowanalysis.cs: Reduce memory allocation in a few ways:
+ - A block with no variables should not allocate a bit
+ vector for itself.
+ - A method with no out parameters does not need any tracking
+ for assignment of the parameters, so we need not allocate
+ any data for it.
+ - The arrays:
+ public readonly Type[] VariableTypes;
+ public readonly string[] VariableNames;
+ Are redundant. The data is already stored in the variable
+ map, so we need not allocate another array for it.
+ - We need to add alot of checks for if (params | locals) == null
+ due to the first two changes.
+
+2004-01-18 Miguel de Icaza <miguel@ximian.com>
+
+ * ecore.cs (FieldExpr.AddressOf): For ValueTypes that do not
+ implement IMemoryLocation, we store a copy on a local variable and
+ take the address of it. Patch from Benjamin Jemlich
+
+ * cs-parser.jay: Applied patch from Ben Maurer to the "type" rule
+ to use a special "type_name_expression" rule which reduces the
+ number of "QualifiedIdentifier" classes created, and instead
+ directly creates MemberAccess expressions.
+
+2004-01-17 Miguel de Icaza <miguel@ximian.com>
+
+ * convert.cs: Applied patch from Benjamin Jemlich (pcgod@gmx.net)
+ that fixes #52853. Null literal assignment to ValueType
+
+ * class.cs (MethodData.Emit): Instead of checking the name of the
+ method to determine if its a destructor, create a new derived
+ class from Method called Destructor, and test for that.
+
+ * cs-parser.jay: Create a Destructor object instead of a Method.
+
+ Based on a fix from Benjamin Jemlich (pcgod@gmx.net)
+
+ Fixes: 52933
+
+2004-01-16 Miguel de Icaza <miguel@ximian.com>
+
+ * expression.cs (Binary.ResolveOperator): Perform an implicit
+ conversion from MethodGroups to their delegate types on the
+ Addition operation.
+
+ * delegate.cs: Introduce a new class DelegateCreation that is the
+ base class for `NewDelegate' and `ImplicitDelegateCreation',
+ factor some code in here.
+
+ * convert.cs (Convert.ImplicitConversionStandard): Add an implicit
+ conversion from MethodGroups to compatible delegate types.
+
+ * ecore.cs (Expression.Resolve): Do not flag error 654
+ (Methodgroupd needs parenthesis) if running on the V2 compiler, as
+ we allow conversions from MethodGroups to delegate types now.
+
+ * assign.cs (Assign.DoResolve): Do not flag errors on methodgroup
+ assignments in v2 either.
+
+2004-01-10 Miguel de Icaza <miguel@ximian.com>
+
+ * ecore.cs (FieldExpr.AddressOf): Fix generated IL for accessing
+ static read-only fields in ctors.
+
+ Applied patch from Benjamin Jemlich
+
+ * expression.cs (UnaryMutator): Avoid leaking local variables.
+
+2004-01-09 Miguel de Icaza <miguel@ximian.com>
+
+ * cs-tokenizer.cs (IsCastToken): Allow the various native types
+ here to return true, as they can be used like this:
+
+ (XXX) int.MEMBER ()
+
+ Fixed 49836 and all the other dups
+
+2004-01-09 Zoltan Varga <vargaz@freemail.hu>
+
+ * driver.cs: Implement /win32res and /win32icon.
+
+2004-01-08 Miguel de Icaza <miguel@ximian.com>
+
+ * cs-parser.jay: Add a rule to improve error handling for the
+ common mistake of placing modifiers after the type.
+
+2004-01-07 Miguel de Icaza <miguel@ximian.com>
+
+ * cs-parser.jay (interface_event_declaration): Catch
+ initialization of events on interfaces, and report cs0068
+
+ * cs-parser.jay (interface_event_declaration): Catch
+ initialization of events.
+
+ * ecore.cs: Better report missing constructors.
+
+ * expression.cs (Binary.ResolveOperator): My previous bug fix had
+ the error reporting done in the wrong place. Fix.
+
+ * expression.cs (Binary.ResolveOperator): Catch the
+ operator + (E x, E y) error earlier, and later allow for implicit
+ conversions in operator +/- (E e, U x) from U to the underlying
+ type of E.
+
+ * class.cs (TypeContainer.DefineDefaultConstructor): Fix bug
+ 52596, if the container class is abstract, the default constructor
+ is protected otherwise its public (before, we were always public).
+
+ * statement.cs (Fixed.Resolve): Catch a couple more errors in the
+ fixed statement.
+
+ (Using.EmitLocalVariableDecls): Applied patch from Benjamin
+ Jemlich that fixes bug #52597, MCS was generating invalid code for
+ idisposable structs. Thanks to Ben for following up with this
+ bug as well.
+
+2004-01-06 Miguel de Icaza <miguel@ximian.com>
+
+ * driver.cs: Allow assemblies without code to be generated, fixes
+ 52230.
+
+2004-01-07 Nick Drochak <ndrochak@gol.com>
+
+ * attribute.cs: Remove unneeded catch variables. Eliminates a warning.
+
+2004-01-05 Miguel de Icaza <miguel@ximian.com>
+
+ * cs-parser.jay: Add rules to improve error reporting if fields or
+ methods are declared at the namespace level (error 116)
+
+ * Add rules to catch event add/remove
+
+2004-01-04 David Sheldon <dave-mono@earth.li>
+
+ * expression.cs: Added matching ")" to error message for
+ CS0077
+
+2004-01-03 Todd Berman <tberman@gentoo.org>
+
+ * ecore.cs, attribute.cs:
+ Applying fix from #52429.
+
+2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
+
+ * ecore.cs, expression.cs, statement.cs:
+ Total rewrite of how we handle branching. We
+ now handle complex boolean expressions with fewer
+ jumps. As well if (x == 0) no longer emits a ceq.
+
+ if (x is Foo) is much faster now, because we generate
+ better code.
+
+ Overall, we get a pretty big improvement on our benchmark
+ tests. The code we generate is smaller and more readable.
+
+ I did a full two-stage bootstrap. The patch was reviewed
+ by Martin and Miguel.
+
+2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
+
+ * cs-parser.jay: Make primary_expression not take a QI.
+ we dont need this because the member_access rule covers
+ us here. So we replace the rule with just IDENTIFIER.
+
+ This has two good effects. First, we remove a s/r conflict.
+ Second, we allocate many fewer QualifiedIdentifier objects.
+
+2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
+
+ * attribute.cs: Handle MarshalAs attributes as pseudo, and
+ set the correct information via SRE. This prevents
+ hanging on the MS runtime. Fixes #29374.
+
+2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
+
+ * convert.cs: correctly handle conversions to value types
+ from Enum and ValueType as unboxing conversions.
+
+ Fixes bug #52569. Patch by Benjamin Jemlich.
+
+2004-01-02 Ravi Pratap <ravi@ximian.com>
+
+ * expression.cs (BetterConversion): Prefer int -> uint
+ over int -> ulong (csc's behaviour). This fixed bug #52046.
+
+2004-01-02 Ben Maurer <bmaurer@users.sourceforge.net>
+
+ * decl.cs (MemberCache.FindMembers): now returns a
+ MemberInfo [].
+
+ * typemanager.cs: In general, go with with ^^.
+ (CopyNewMethods): take an IList.
+ (RealMemberLookup): Only allocate an arraylist
+ if we copy from two sets of methods.
+
+ This change basically does two things:
+ 1) Fewer array lists allocated due to CopyNewMethods.
+ 2) the explicit cast in MemberList costed ALOT.
+
2004-01-02 Zoltan Varga <vargaz@freemail.hu>
* cs-tokenizer.cs (consume_identifier) driver.cs: Cache identifiers in
diff --git a/mcs/mcs/Makefile b/mcs/mcs/Makefile
index e2264c3a838..098a1a0a7e9 100644
--- a/mcs/mcs/Makefile
+++ b/mcs/mcs/Makefile
@@ -89,6 +89,9 @@ mcs2.exe: mcs.exe
mcs3.exe: mcs2.exe
$(TIME) $(RUNTIME) ./mcs2.exe $(USE_MCS_FLAGS) /target:exe /out:$@ $(all_sources)
+wc:
+ wc -l $(all_sources)
+
ctest:
-rm mcs2.exe mcs3.exe
make btest USE_MCS_FLAGS=
@@ -105,6 +108,11 @@ do-time : mcs.exe
@ rm -f ../class/lib/mscorlib.dll
@ (cd ../class/corlib ; make BOOTSTRAP_MCS="$(FRIENDLY_TIME) mono ../../mcs/mcs.exe" > /dev/null ) || (echo FAILED; exit 1)
+do-corlib:
+ @ echo -n "corlib: "
+ @ rm -f ../class/lib/mscorlib.dll
+ @ (cd ../class/corlib ; make BOOTSTRAP_MCS="$(FRIENDLY_TIME) mono ../../mcs/mcs.exe" > /dev/null ) || (echo FAILED; exit 1)
+
PROFILER=default
profile : mcs.exe
diff --git a/mcs/mcs/TODO b/mcs/mcs/TODO
index c29bf22e03d..44626258a9d 100644
--- a/mcs/mcs/TODO
+++ b/mcs/mcs/TODO
@@ -1,11 +1,12 @@
Iterators
---------
+ * `yield' is no longer a keyword, it only has special
+ meaning before a return or break keywords.
- * Fix simple case (foreach)
* Study side effects with assign
* Study TemporaryStorage/LocalStorage -> Merge/rename
- Big issues: try/finally in iterators.
+ * Reset should throw not implemented now.
Instance idea
-------------
@@ -54,12 +55,7 @@ Anonymous Methods
* Before Emit, create proxy classes with proper depth.
* Emit.
- Return Type:
- During Resolve, track all the return types.
- Allow for ec.ReturnType to be null, indicating `Pending Return Evaluation'
-
-
- Open question:
+Open question:
Create a toplevel block for anonymous methods?
EmitContext.ResolveTypeTree
@@ -103,6 +99,8 @@ Large project:
Notes on memory allocation
--------------------------
+ Outdated:
+
A run of the AllocationProfile shows that the compiler allocates roughly
30 megabytes of strings. From those, 20 megabytes come from
LookupType.
@@ -190,6 +188,8 @@ The use of DottedName
The problem is that we would still need to construct the name to pass to
GetType.
+ This has been now implemented, its called "QualifiedIdentifier"
+
current_container/current_namespace and the DeclSpace
-----------------------------------------------------
diff --git a/mcs/mcs/assign.cs b/mcs/mcs/assign.cs
index dae00366584..da59dbc3355 100755
--- a/mcs/mcs/assign.cs
+++ b/mcs/mcs/assign.cs
@@ -262,11 +262,12 @@ namespace Mono.CSharp {
if ((source.eclass == ExprClass.Type) && (source is TypeExpr)) {
source.Error_UnexpectedKind ("variable or value");
return null;
- } else if (source is MethodGroupExpr){
+ } else if (!RootContext.V2 && (source is MethodGroupExpr)){
((MethodGroupExpr) source).ReportUsageError ();
return null;
- }
+ }
+
if (target_type == source_type)
return this;
@@ -378,10 +379,8 @@ namespace Mono.CSharp {
//
IAssignMethod am = (IAssignMethod) target;
- if (this is CompoundAssign){
+ if (this is CompoundAssign)
am.CacheTemporaries (ec);
- use_temporaries = true;
- }
if (!is_statement)
use_temporaries = true;
diff --git a/mcs/mcs/attribute.cs b/mcs/mcs/attribute.cs
index f6112a924e2..d6aa2a2fbda 100644
--- a/mcs/mcs/attribute.cs
+++ b/mcs/mcs/attribute.cs
@@ -144,7 +144,13 @@ namespace Mono.CSharp {
result = ((ArrayCreation) e).EncodeAsAttribute ();
if (result != null)
return true;
- }
+ } else if (e is EmptyCast) {
+ result = e;
+ if (((EmptyCast) e).Child is Constant) {
+ result = ((Constant) ((EmptyCast)e).Child).GetValue();
+ }
+ return true;
+ }
result = null;
Error_AttributeArgumentNotValid (loc);
@@ -295,6 +301,8 @@ namespace Mono.CSharp {
} else if (e is TypeOf) {
prop_values.Add (((TypeOf) e).TypeArg);
+ } else if (e is ArrayCreation) {
+ prop_values.Add (((ArrayCreation) e).EncodeAsAttribute());
} else {
Error_AttributeArgumentNotValid (Location);
return null;
@@ -764,28 +772,39 @@ namespace Mono.CSharp {
}
static UnmanagedMarshal GetMarshal (Attribute a)
- {
- UnmanagedMarshal marshal;
-
- if (a.UnmanagedType == UnmanagedType.CustomMarshaler) {
- MethodInfo define_custom = typeof (UnmanagedMarshal).GetMethod ("DefineCustom",
- BindingFlags.Static | BindingFlags.Public);
- if (define_custom == null) {
- return null;
- }
- object[] args = new object [4];
- args [0] = GetFieldValue (a, "MarshalTypeRef");
- args [1] = GetFieldValue (a, "MarshalCookie");
- args [2] = GetFieldValue (a, "MarshalType");
- args [3] = Guid.Empty;
- marshal = (UnmanagedMarshal) define_custom.Invoke (null, args);
- /*
- * need to special case other special marshal types
- */
- } else {
- marshal = UnmanagedMarshal.DefineUnmanagedMarshal (a.UnmanagedType);
+ {
+ object o = GetFieldValue (a, "ArraySubType");
+ UnmanagedType array_sub_type = o == null ? UnmanagedType.I4 : (UnmanagedType) o;
+
+ switch (a.UnmanagedType) {
+ case UnmanagedType.CustomMarshaler:
+ MethodInfo define_custom = typeof (UnmanagedMarshal).GetMethod ("DefineCustom",
+ BindingFlags.Static | BindingFlags.Public);
+ if (define_custom == null)
+ return null;
+
+ object [] args = new object [4];
+ args [0] = GetFieldValue (a, "MarshalTypeRef");
+ args [1] = GetFieldValue (a, "MarshalCookie");
+ args [2] = GetFieldValue (a, "MarshalType");
+ args [3] = Guid.Empty;
+ return (UnmanagedMarshal) define_custom.Invoke (null, args);
+
+ case UnmanagedType.LPArray:
+ return UnmanagedMarshal.DefineLPArray (array_sub_type);
+
+ case UnmanagedType.SafeArray:
+ return UnmanagedMarshal.DefineSafeArray (array_sub_type);
+
+ case UnmanagedType.ByValArray:
+ return UnmanagedMarshal.DefineByValArray ((int) GetFieldValue (a, "SizeConst"));
+
+ case UnmanagedType.ByValTStr:
+ return UnmanagedMarshal.DefineByValTStr ((int) GetFieldValue (a, "SizeConst"));
+
+ default:
+ return UnmanagedMarshal.DefineUnmanagedMarshal (a.UnmanagedType);
}
- return marshal;
}
/// <summary>
@@ -855,8 +874,19 @@ namespace Mono.CSharp {
}
} else if (kind is Constructor) {
((ConstructorBuilder) builder).SetCustomAttribute (cb);
- } else if (kind is Field) {
- ((FieldBuilder) builder).SetCustomAttribute (cb);
+ } else if (kind is Field) {
+ if (attr_type == TypeManager.marshal_as_attr_type) {
+ UnmanagedMarshal marshal = GetMarshal (a);
+ if (marshal == null) {
+ Report.Warning (-24, loc,
+ "The Microsoft Runtime cannot set this marshal info. " +
+ "Please use the Mono runtime instead.");
+ } else {
+ ((FieldBuilder) builder).SetMarshal (marshal);
+ }
+ } else {
+ ((FieldBuilder) builder).SetCustomAttribute (cb);
+ }
} else if (kind is Property || kind is Indexer ||
kind is InterfaceProperty || kind is InterfaceIndexer) {
((PropertyBuilder) builder).SetCustomAttribute (cb);
@@ -916,7 +946,7 @@ namespace Mono.CSharp {
try {
((TypeBuilder) builder).SetCustomAttribute (cb);
- } catch (System.ArgumentException e) {
+ } catch (System.ArgumentException) {
Report.Warning (
-21, loc,
"The CharSet named property on StructLayout\n"+
@@ -932,7 +962,7 @@ namespace Mono.CSharp {
}
try {
((TypeBuilder) builder).SetCustomAttribute (cb);
- } catch (System.ArgumentException e) {
+ } catch (System.ArgumentException) {
Report.Warning (
-21, loc,
"The CharSet named property on StructLayout\n"+
diff --git a/mcs/mcs/class.cs b/mcs/mcs/class.cs
index 522d77af1bf..7d22ae46c2c 100755
--- a/mcs/mcs/class.cs
+++ b/mcs/mcs/class.cs
@@ -113,9 +113,6 @@ namespace Mono.CSharp {
ArrayList type_bases;
- // Attributes for this type
- protected Attributes attributes;
-
// Information in the case we are an attribute type
public AttributeTargets Targets = AttributeTargets.All;
@@ -134,8 +131,12 @@ namespace Mono.CSharp {
//
public string IndexerName;
- public TypeContainer (NamespaceEntry ns, TypeContainer parent, string name, Location l)
- : base (ns, parent, name, l)
+ public TypeContainer ():
+ this (null, null, "", null, new Location (-1)) {
+ }
+
+ public TypeContainer (NamespaceEntry ns, TypeContainer parent, string name, Attributes attrs, Location l)
+ : base (ns, parent, name, attrs, l)
{
types = new ArrayList ();
@@ -499,12 +500,6 @@ namespace Mono.CSharp {
}
}
- public Attributes OptAttributes {
- get {
- return attributes;
- }
- }
-
public bool HaveStaticConstructor {
get {
return have_static_constructor;
@@ -562,22 +557,26 @@ namespace Mono.CSharp {
void DefineDefaultConstructor (bool is_static)
{
Constructor c;
- int mods = 0;
- c = new Constructor (this, Basename, Parameters.EmptyReadOnlyParameters,
+ // The default constructor is public
+ // If the class is abstract, the default constructor is protected
+ // The default static constructor is private
+
+ int mods = Modifiers.PUBLIC;
+ if (is_static)
+ mods = Modifiers.STATIC | Modifiers.PRIVATE;
+ else if ((ModFlags & Modifiers.ABSTRACT) != 0)
+ mods = Modifiers.PROTECTED;
+
+ c = new Constructor (this, Basename, mods, Parameters.EmptyReadOnlyParameters,
new ConstructorBaseInitializer (
null, Parameters.EmptyReadOnlyParameters,
Location),
Location);
- if (is_static)
- mods = Modifiers.STATIC;
-
- c.ModFlags = mods;
-
AddConstructor (c);
- c.Block = new Block (null);
+ c.Block = new ToplevelBlock (null, Location);
}
@@ -1747,7 +1746,7 @@ namespace Mono.CSharp {
default_constructor = null;
default_static_constructor = null;
type_bases = null;
- attributes = null;
+ OptAttributes = null;
ifaces = null;
parent_container = null;
member_cache = null;
@@ -1904,11 +1903,6 @@ namespace Mono.CSharp {
return true;
}
- public static void Error_ExplicitInterfaceNotMemberInterface (Location loc, string name)
- {
- Report.Error (539, loc, "Explicit implementation: `" + name + "' is not a member of the interface");
- }
-
//
// IMemberContainer
//
@@ -2138,7 +2132,7 @@ namespace Mono.CSharp {
Modifiers.UNSAFE;
public Class (NamespaceEntry ns, TypeContainer parent, string name, int mod, Attributes attrs, Location l)
- : base (ns, parent, name, l)
+ : base (ns, parent, name, attrs, l)
{
int accmods;
@@ -2148,7 +2142,6 @@ namespace Mono.CSharp {
accmods = Modifiers.PRIVATE;
this.ModFlags = Modifiers.Check (AllowedModifiers, mod, accmods, l);
- this.attributes = attrs;
}
//
@@ -2175,7 +2168,7 @@ namespace Mono.CSharp {
Modifiers.PRIVATE;
public Struct (NamespaceEntry ns, TypeContainer parent, string name, int mod, Attributes attrs, Location l)
- : base (ns, parent, name, l)
+ : base (ns, parent, name, attrs, l)
{
int accmods;
@@ -2187,8 +2180,6 @@ namespace Mono.CSharp {
this.ModFlags = Modifiers.Check (AllowedModifiers, mod, accmods, l);
this.ModFlags |= Modifiers.SEALED;
- this.attributes = attrs;
-
}
//
@@ -2674,7 +2665,7 @@ namespace Mono.CSharp {
Expression parent_constructor_group;
Type t;
- ec.CurrentBlock = new Block (null, Block.Flags.Implicit, parameters);
+ ec.CurrentBlock = new ToplevelBlock (Block.Flags.Implicit, parameters, loc);
if (argument_list != null){
foreach (Argument a in argument_list){
@@ -2750,7 +2741,6 @@ namespace Mono.CSharp {
public class Constructor : MethodCore {
public ConstructorBuilder ConstructorBuilder;
public ConstructorInitializer Initializer;
- new public Attributes OptAttributes;
// <summary>
// Modifiers allowed for a constructor.
@@ -2768,9 +2758,9 @@ namespace Mono.CSharp {
// The spec claims that static is not permitted, but
// my very own code has static constructors.
//
- public Constructor (DeclSpace ds, string name, Parameters args,
+ public Constructor (DeclSpace ds, string name, int mod, Parameters args,
ConstructorInitializer init, Location l)
- : base (ds, null, 0, AllowedModifiers, name, null, args, l)
+ : base (ds, null, mod, AllowedModifiers, name, null, args, l)
{
Initializer = init;
}
@@ -3218,8 +3208,7 @@ namespace Mono.CSharp {
member.InterfaceType, name, ReturnType, ParameterTypes);
if (member.InterfaceType != null && implementing == null){
- TypeContainer.Error_ExplicitInterfaceNotMemberInterface (
- Location, name);
+ Report.Error (539, Location, "'{0}' in explicit interface declaration is not an interface", method_name);
return false;
}
}
@@ -3432,7 +3421,7 @@ namespace Mono.CSharp {
//
// FIXME: This code generates buggy code
//
- if (member.Name == "Finalize" && ReturnType == TypeManager.void_type)
+ if (member is Destructor)
EmitDestructor (ec, block);
else {
SymbolWriter sw = CodeGen.SymbolWriter;
@@ -3454,18 +3443,15 @@ namespace Mono.CSharp {
ILGenerator ig = ec.ig;
Label finish = ig.DefineLabel ();
- bool old_in_try = ec.InTry;
+
+ block.SetDestructor ();
ig.BeginExceptionBlock ();
- ec.InTry = true;
ec.ReturnLabel = finish;
ec.HasReturnLabel = true;
ec.EmitTopBlock (block, null, Location);
- ec.InTry = old_in_try;
// ig.MarkLabel (finish);
- bool old_in_finally = ec.InFinally;
- ec.InFinally = true;
ig.BeginFinallyBlock ();
if (ec.ContainerType.BaseType != null) {
@@ -3480,7 +3466,6 @@ namespace Mono.CSharp {
ig.Emit (OpCodes.Call, (MethodInfo) parent_destructor.Methods [0]);
}
}
- ec.InFinally = old_in_finally;
ig.EndExceptionBlock ();
//ig.MarkLabel (ec.ReturnLabel);
@@ -3488,9 +3473,17 @@ namespace Mono.CSharp {
}
}
+ public class Destructor : Method {
+
+ public Destructor (DeclSpace ds, Expression return_type, int mod, string name,
+ Parameters parameters, Attributes attrs, Location l)
+ : base (ds, return_type, mod, name, parameters, attrs, l)
+ { }
+
+ }
+
abstract public class MemberBase : MemberCore {
public Expression Type;
- public readonly Attributes OptAttributes;
protected MethodAttributes flags;
@@ -3537,12 +3530,11 @@ namespace Mono.CSharp {
//
protected MemberBase (Expression type, int mod, int allowed_mod, int def_mod, string name,
Attributes attrs, Location loc)
- : base (name, loc)
+ : base (name, attrs, loc)
{
explicit_mod_flags = mod;
Type = type;
ModFlags = Modifiers.Check (allowed_mod, mod, def_mod, loc);
- OptAttributes = attrs;
}
protected virtual bool CheckBase (TypeContainer container)
@@ -3815,6 +3807,11 @@ namespace Mono.CSharp {
if (InterfaceType == null)
return false;
+ if (InterfaceType.IsClass) {
+ Report.Error (538, Location, "'{0}' in explicit interface declaration is not an interface", ExplicitInterfaceName);
+ return false;
+ }
+
// Compute the full name that we need to export.
Name = InterfaceType.FullName + "." + ShortName;
@@ -3996,10 +3993,17 @@ namespace Mono.CSharp {
return false;
}
- FieldBuilder = container.TypeBuilder.DefineField (
- Name, t, Modifiers.FieldAttr (ModFlags));
+ try {
+ FieldBuilder = container.TypeBuilder.DefineField (
+ Name, t, Modifiers.FieldAttr (ModFlags));
+
+ TypeManager.RegisterFieldBase (FieldBuilder, this);
+ }
+ catch (ArgumentException) {
+ Report.Warning (-24, Location, "The Microsoft runtime is unable to use [void|void*] as a field type, try using the Mono runtime.");
+ return false;
+ }
- TypeManager.RegisterFieldBase (FieldBuilder, this);
return true;
}
diff --git a/mcs/mcs/codegen.cs b/mcs/mcs/codegen.cs
index e90672f21f8..4e6c2f74992 100755
--- a/mcs/mcs/codegen.cs
+++ b/mcs/mcs/codegen.cs
@@ -254,25 +254,12 @@ namespace Mono.CSharp {
public bool HasReturnLabel;
/// <summary>
- /// Whether we are in a Finally block
- /// </summary>
- public bool InFinally;
-
- /// <summary>
- /// Whether we are in a Try block
- /// </summary>
- public bool InTry;
-
- /// <summary>
/// Whether we are inside an iterator block.
/// </summary>
public bool InIterator;
- /// <summary>
- /// Whether we need an explicit return statement at the end of the method.
- /// </summary>
- public bool NeedExplicitReturn;
-
+ public bool IsLastStatement;
+
/// <summary>
/// Whether remapping of locals, parameters and fields is turned on.
/// Used by iterators and anonymous methods.
@@ -280,11 +267,6 @@ namespace Mono.CSharp {
public bool RemapToProxy;
/// <summary>
- /// Whether we are in a Catch block
- /// </summary>
- public bool InCatch;
-
- /// <summary>
/// Whether we are inside an unsafe block
/// </summary>
public bool InUnsafe;
@@ -433,7 +415,7 @@ namespace Mono.CSharp {
public void EmitTopBlock (Block block, InternalParameters ip, Location loc)
{
- bool has_ret = false;
+ bool unreachable = false;
if (!Location.IsNull (loc))
CurrentFile = loc.File;
@@ -456,7 +438,7 @@ namespace Mono.CSharp {
DoFlowAnalysis = old_do_flow_analysis;
return;
}
-
+
FlowBranching.Reachability reachability = current_flow_branching.MergeTopBlock ();
current_flow_branching = null;
@@ -464,10 +446,10 @@ namespace Mono.CSharp {
block.Emit (this);
- if ((reachability.Returns == FlowBranching.FlowReturns.Always) ||
- (reachability.Throws == FlowBranching.FlowReturns.Always) ||
- (reachability.Reachable == FlowBranching.FlowReturns.Never))
- has_ret = true;
+ if (reachability.AlwaysReturns ||
+ reachability.AlwaysThrows ||
+ reachability.IsUnreachable)
+ unreachable = true;
}
} catch (Exception e) {
Console.WriteLine ("Exception caught by the compiler while compiling:");
@@ -477,7 +459,6 @@ namespace Mono.CSharp {
Console.WriteLine (" Block being compiled: [{0},{1}]",
CurrentBlock.StartLocation, CurrentBlock.EndLocation);
}
-
Console.WriteLine (e.GetType ().FullName + ": " + e.Message);
Console.WriteLine (Report.FriendlyStackTrace (e));
@@ -485,12 +466,7 @@ namespace Mono.CSharp {
}
}
- if (ReturnType != null && !has_ret){
- //
- // FIXME: we need full flow analysis to implement this
- // correctly and emit an error instead of a warning.
- //
- //
+ if (ReturnType != null && !unreachable){
if (!InIterator){
Report.Error (161, loc, "Not all code paths return a value");
return;
@@ -503,22 +479,22 @@ namespace Mono.CSharp {
ig.Emit (OpCodes.Ldloc, return_value);
ig.Emit (OpCodes.Ret);
} else {
- if (!InTry){
- if (InIterator)
- has_ret = true;
-
- if (!has_ret || HasReturnLabel) {
- ig.Emit (OpCodes.Ret);
- NeedExplicitReturn = false;
- }
- }
-
- // Unfortunately, System.Reflection.Emit automatically emits a leave
- // to the end of a finally block. This is a problem if no code is
- // following the try/finally block since we may jump to a point after
- // the end of the method. As a workaround, emit an explicit ret here.
+ //
+ // If `HasReturnLabel' is set, then we already emitted a
+ // jump to the end of the method, so we must emit a `ret'
+ // there.
+ //
+ // Unfortunately, System.Reflection.Emit automatically emits
+ // a leave to the end of a finally block. This is a problem
+ // if no code is following the try/finally block since we may
+ // jump to a point after the end of the method.
+ // As a workaround, we're always creating a return label in
+ // this case.
+ //
- if (NeedExplicitReturn) {
+ if ((block != null) && block.IsDestructor) {
+ // Nothing to do; S.R.E automatically emits a leave.
+ } else if (HasReturnLabel || (!unreachable && !InIterator)) {
if (ReturnType != null)
ig.Emit (OpCodes.Ldloc, TemporaryReturn ());
ig.Emit (OpCodes.Ret);
@@ -607,22 +583,6 @@ namespace Mono.CSharp {
public Label LoopBegin, LoopEnd;
/// <summary>
- /// Whether we are inside a loop and break/continue are possible.
- /// </summary>
- public bool InLoop;
-
- /// <summary>
- /// This is incremented each time we enter a try/catch block and
- /// decremented if we leave it.
- /// </summary>
- public int TryCatchLevel;
-
- /// <summary>
- /// The TryCatchLevel at the begin of the current loop.
- /// </summary>
- public int LoopBeginTryCatchLevel;
-
- /// <summary>
/// Default target in a switch statement. Only valid if
/// InSwitch is true
/// </summary>
@@ -650,6 +610,14 @@ namespace Mono.CSharp {
return return_value;
}
+ public void NeedReturnLabel ()
+ {
+ if (!HasReturnLabel) {
+ ReturnLabel = ig.DefineLabel ();
+ HasReturnLabel = true;
+ }
+ }
+
//
// Creates a field `name' with the type `t' on the proxy class
//
diff --git a/mcs/mcs/const.cs b/mcs/mcs/const.cs
index 47fc56ec5af..97f1e5a76d5 100755
--- a/mcs/mcs/const.cs
+++ b/mcs/mcs/const.cs
@@ -192,6 +192,12 @@ namespace Mono.CSharp {
in_transit = true;
int errors = Report.Errors;
+ //
+ // We might have cleared Expr ourselves in a recursive definition
+ //
+ if (Expr == null)
+ return null;
+
Expr = Expr.Resolve (const_ec);
in_transit = false;
diff --git a/mcs/mcs/convert.cs b/mcs/mcs/convert.cs
index b372f94ffc4..facbb258c41 100644
--- a/mcs/mcs/convert.cs
+++ b/mcs/mcs/convert.cs
@@ -59,7 +59,7 @@ namespace Mono.CSharp {
if (expr_type.IsValueType)
return new BoxedCast (expr);
if (expr is NullLiteral)
- return new BoxedCast (expr);
+ return new NullCast (expr, target_type);
} else if (expr_type.IsSubclassOf (target_type)) {
//
// Special case: enumeration to System.Enum.
@@ -991,7 +991,7 @@ namespace Mono.CSharp {
/// in a context that expects a `target_type'.
/// </summary>
static public Expression ImplicitConversion (EmitContext ec, Expression expr,
- Type target_type, Location loc)
+ Type target_type, Location loc)
{
Expression e;
@@ -1026,6 +1026,18 @@ namespace Mono.CSharp {
Type expr_type = expr.Type;
Expression e;
+ if (expr.eclass == ExprClass.MethodGroup){
+ if (!TypeManager.IsDelegateType (target_type)){
+ Report.Error (428, loc,
+ String.Format (
+ "Cannot convert method group to `{0}', since it is not a delegate",
+ TypeManager.CSharpName (target_type)));
+ return null;
+ }
+
+ return ImplicitDelegateCreation.Create (ec, (MethodGroupExpr) expr, target_type, loc);
+ }
+
if (expr_type == target_type && !(expr is NullLiteral))
return expr;
@@ -1492,6 +1504,13 @@ namespace Mono.CSharp {
if (source_type == TypeManager.object_type && !target_is_value_type)
return new ClassCast (source, target_type);
+ //
+ // Unboxing conversion.
+ //
+ if (((source_type == TypeManager.enum_type &&
+ !(source is EmptyCast)) ||
+ source_type == TypeManager.value_type) && target_is_value_type)
+ return new UnboxCast (source, target_type);
//
// From any class S to any class-type T, provided S is a base class of T
diff --git a/mcs/mcs/cs-parser.jay b/mcs/mcs/cs-parser.jay
index 600bec7b058..c5696a4a92c 100755
--- a/mcs/mcs/cs-parser.jay
+++ b/mcs/mcs/cs-parser.jay
@@ -36,53 +36,59 @@ namespace Mono.CSharp
IIteratorContainer iterator_container;
- // <summary>
- // Current block is used to add statements as we find
- // them.
- // </summary>
-
+ /// <summary>
+ /// Current block is used to add statements as we find
+ /// them.
+ /// </summary>
Block current_block;
- // <summary>
- // Current interface is used by the various declaration
- // productions in the interface declaration to "add"
- // the interfaces as we find them.
- // </summary>
+ /// <summary>
+ /// If true, creates a toplevel block in the block production
+ /// This is flagged by the delegate creation
+ /// </summary>
+ bool create_toplevel_block;
+
+ /// <summary>
+ /// <summary>
+ /// Current interface is used by the various declaration
+ /// productions in the interface declaration to "add"
+ /// the interfaces as we find them.
+ /// </summary>
Interface current_interface;
- // <summary>
- // This is used by the unary_expression code to resolve
- // a name against a parameter.
- // </summary>
+ /// <summary>
+ /// This is used by the unary_expression code to resolve
+ /// a name against a parameter.
+ /// </summary>
Parameters current_local_parameters;
- // <summary>
- // Using during property parsing to describe the implicit
- // value parameter that is passed to the "set" and "get"accesor
- // methods (properties and indexers).
- // </summary>
+ /// <summary>
+ /// Using during property parsing to describe the implicit
+ /// value parameter that is passed to the "set" and "get"accesor
+ /// methods (properties and indexers).
+ /// </summary>
Expression implicit_value_parameter_type;
Parameters indexer_parameters;
- // <summary>
- // Used to determine if we are parsing the get/set pair
- // of an indexer or a property
- // </summmary>
+ /// <summary>
+ /// Used to determine if we are parsing the get/set pair
+ /// of an indexer or a property
+ /// </summmary>
bool parsing_indexer;
- //
- // An out-of-band stack.
- //
+ ///
+ /// An out-of-band stack.
+ ///
Stack oob_stack;
- //
- // Switch stack.
- //
+ ///
+ /// Switch stack.
+ ///
Stack switch_stack;
- //
- // The current file.
- //
+ ///
+ /// The current file.
+ ///
SourceFile file;
%}
@@ -176,9 +182,6 @@ namespace Mono.CSharp
%token VOLATILE
%token WHILE
-/* v2 tokens */
-%token YIELD
-
/* C# keywords which are not really keywords */
%token GET "get"
%token SET "set"
@@ -307,7 +310,7 @@ using_alias_directive
: USING IDENTIFIER ASSIGN
namespace_or_type_name SEMICOLON
{
- current_namespace.UsingAlias ((string) $2, (string) ($4).ToString (), lexer.Location);
+ current_namespace.UsingAlias ((string) $2, (Expression) $4, lexer.Location);
}
| USING error {
CheckIdentifierToken (yyToken);
@@ -327,7 +330,7 @@ using_namespace_directive
// detach them
//
namespace_declaration
- : opt_attributes NAMESPACE qualified_identifier
+ : opt_attributes NAMESPACE namespace_or_type_name
{
Attributes attrs = (Attributes) $1;
@@ -341,7 +344,7 @@ namespace_declaration
+ " Expected class, delegate, enum, interface, or struct");
}
- current_namespace = RootContext.Tree.RecordNamespace (current_namespace, file, (string) ($3).ToString (), lexer.Location);
+ current_namespace = RootContext.Tree.RecordNamespace (current_namespace, file, $3.ToString (), lexer.Location);
}
namespace_body opt_semicolon
{
@@ -359,14 +362,6 @@ opt_comma
| COMMA
;
-qualified_identifier
- : IDENTIFIER { $$ = new QualifiedIdentifier ((string) $1); }
- | qualified_identifier DOT IDENTIFIER {
- $$ = new QualifiedIdentifier ((QualifiedIdentifier) $1, (string) $3);
- }
- ;
-
-
namespace_name
: namespace_or_type_name { $$ = ($1).ToString (); }
;
@@ -423,6 +418,13 @@ namespace_member_declaration
| namespace_declaration {
current_namespace.DeclarationFound = true;
}
+
+ | field_declaration {
+ Report.Error (116, lexer.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");
+ }
;
type_declaration
@@ -454,22 +456,24 @@ attribute_sections
{
AttributeSection sect = (AttributeSection) $1;
- if (sect.Target == "assembly")
+ if (sect.Target == "assembly") {
RootContext.AddGlobalAttributeSection (current_container, sect);
-
-
- $$ = new Attributes ((AttributeSection) $1);
+ $$ = null;
+ }
+ else
+ $$ = new Attributes (sect);
}
| attribute_sections attribute_section
{
- Attributes attrs = null;
+ Attributes attrs = $1 as Attributes;
AttributeSection sect = (AttributeSection) $2;
- if (sect.Target == "assembly")
+ if (sect.Target == "assembly") {
RootContext.AddGlobalAttributeSection (current_container, sect);
-
- if ($1 != null) {
- attrs = (Attributes) $1;
+ } else {
+ if (attrs == null)
+ attrs = new Attributes (sect);
+ else
attrs.AddAttributeSection (sect);
}
@@ -914,6 +918,21 @@ method_header
current_local_parameters = (Parameters) $6;
$$ = method;
}
+ | opt_attributes
+ opt_modifiers
+ type
+ modifiers member_name OPEN_PARENS opt_formal_parameter_list CLOSE_PARENS
+ {
+ Report.Error (1585, lexer.Location,
+ String.Format ("Modifier {0} should appear before type",
+ Modifiers.Name ((int) $4)));
+ Method method = new Method (current_container, TypeManager.system_void_expr, 0,
+ (string) $5, (Parameters) $7, (Attributes) $1,
+ lexer.Location);
+
+ current_local_parameters = (Parameters) $7;
+ $$ = method;
+ }
;
method_body
@@ -1008,7 +1027,7 @@ parameter_array
;
member_name
- : qualified_identifier { $$ = ($1).ToString (); }
+ : namespace_or_type_name { $$ = ($1).ToString (); }
;
property_declaration
@@ -1215,9 +1234,10 @@ interface_member_declaration
}
| interface_event_declaration
{
- InterfaceEvent e = (InterfaceEvent) $1;
-
- CheckDef (current_interface.AddEvent (e), e.Name, lexer.Location);
+ if ($1 != null){
+ InterfaceEvent e = (InterfaceEvent) $1;
+ CheckDef (current_interface.AddEvent (e), e.Name, lexer.Location);
+ }
}
| interface_indexer_declaration
{
@@ -1298,6 +1318,14 @@ interface_event_declaration
CheckIdentifierToken (yyToken);
$$ = null;
}
+ | opt_attributes opt_new EVENT type IDENTIFIER ASSIGN {
+ Report.Error (68, lexer.Location, "Event declarations on interfaces can not be initialized.");
+ $$ = null;
+ }
+ | opt_attributes opt_new EVENT type IDENTIFIER OPEN_BRACE event_accessor_declarations CLOSE_BRACE {
+ Report.Error (69, lexer.Location, "Event accessors not valid on interfaces");
+ $$ = null;
+ }
;
interface_indexer_declaration
@@ -1501,7 +1529,7 @@ constructor_declarator
opt_constructor_initializer
{
Location l = (Location) oob_stack.Pop ();
- $$ = new Constructor (current_container, (string) $1, (Parameters) $3,
+ $$ = new Constructor (current_container, (string) $1, 0, (Parameters) $3,
(ConstructorInitializer) $6, l);
}
;
@@ -1561,7 +1589,7 @@ destructor_declaration
}
}
- Method d = new Method (
+ Method d = new Destructor (
current_container, TypeManager.system_void_expr, m, "Finalize",
new Parameters (null, null, l), (Attributes) $1, l);
@@ -1603,20 +1631,25 @@ event_declaration
{
Location loc = (Location) oob_stack.Pop ();
- Pair pair = (Pair) $8;
- Accessor add_accessor = null;
- Accessor rem_accessor = null;
-
- if (pair.First != null)
- add_accessor = (Accessor) pair.First;
- if (pair.Second != null)
- rem_accessor = (Accessor) pair.Second;
-
- Event e = new Event ((Expression) $4, (string) $5, null, (int) $2, add_accessor, rem_accessor,
- (Attributes) $1, loc);
-
- CheckDef (current_container.AddEvent (e), e.Name, loc);
- implicit_value_parameter_type = null;
+ if ($8 == null){
+ Report.Error (65, lexer.Location, "Event must have both add and remove accesors");
+ $$ = null;
+ } else {
+ Pair pair = (Pair) $8;
+ Accessor add_accessor = null;
+ Accessor rem_accessor = null;
+
+ if (pair.First != null)
+ add_accessor = (Accessor) pair.First;
+ if (pair.Second != null)
+ rem_accessor = (Accessor) pair.Second;
+
+ Event e = new Event ((Expression) $4, (string) $5, null, (int) $2, add_accessor, rem_accessor,
+ (Attributes) $1, loc);
+
+ CheckDef (current_container.AddEvent (e), e.Name, loc);
+ implicit_value_parameter_type = null;
+ }
}
;
@@ -1629,6 +1662,8 @@ event_accessor_declarations
{
$$ = new Pair ($2, $1);
}
+ | add_accessor_declaration { $$ = null; }
+ | remove_accessor_declaration { $$ = null; }
;
add_accessor_declaration
@@ -1734,14 +1769,14 @@ indexer_declarator
$$ = new IndexerDeclaration ((Expression) $1, null, pars);
}
- | type qualified_identifier DOT THIS OPEN_BRACKET opt_formal_parameter_list CLOSE_BRACKET
+ | type namespace_or_type_name DOT THIS OPEN_BRACKET opt_formal_parameter_list CLOSE_BRACKET
{
Parameters pars = (Parameters) $6;
if (pars.FixedParameters == null && pars.ArrayParameter == null){
Report.Error (1551, lexer.Location, "Indexers must have at least one parameter");
}
- $$ = new IndexerDeclaration ((Expression) $1, (string) ($2).ToString (), pars);
+ $$ = new IndexerDeclaration ((Expression) $1, $2.ToString (), pars);
}
;
@@ -1863,7 +1898,10 @@ type_name
;
namespace_or_type_name
- : qualified_identifier
+ : IDENTIFIER { $$ = new SimpleName ((string) $1, lexer.Location);}
+ | namespace_or_type_name DOT IDENTIFIER {
+ $$ = new MemberAccess ((Expression) $1, (string) $3, lexer.Location);
+ }
;
/*
@@ -1878,7 +1916,6 @@ type
This does interfaces, delegates, struct_types, class_types,
parent classes, and more! 4.2
*/
- $$ = DecomposeQI ((QualifiedIdentifier) $1, lexer.Location);
}
| builtin_types
| array_type
@@ -1995,10 +2032,7 @@ primary_expression
// 7.5.1: Literals
}
- | qualified_identifier
- {
- $$ = DecomposeQI ((QualifiedIdentifier) $1, lexer.Location);
- }
+ | IDENTIFIER { $$ = new SimpleName ((string) $1, lexer.Location); }
| parenthesized_expression
| member_access
| invocation_expression
@@ -2403,7 +2437,9 @@ anonymous_method_expression
: DELEGATE opt_anonymous_method_signature {
oob_stack.Push (current_local_parameters);
current_local_parameters = (Parameters)$2;
+ create_toplevel_block = true;
} block {
+ create_toplevel_block = false;
if (!RootContext.V2){
Report.Error (-213, lexer.Location, "Anonymous methods are only supported in V2");
$$ = null;
@@ -2800,8 +2836,12 @@ class_declaration
{
Class new_class = (Class) current_container;
- if ($6 != null)
+ if ($6 != null) {
+ if (new_class.Name == "System.Object") {
+ Report.Error (537, new_class.Location, "The class System.Object cannot have a base class or implement an interface.");
+ }
new_class.Bases = (ArrayList) $6;
+ }
current_container = current_container.Parent;
CheckDef (current_container.AddClass (new_class), new_class.Name, new_class.Location);
@@ -2872,8 +2912,12 @@ class_base
block
: OPEN_BRACE
{
- current_block = new Block (current_block, current_local_parameters,
- lexer.Location, Location.Null);
+ if (current_block == null || create_toplevel_block){
+ current_block = new ToplevelBlock (current_local_parameters, lexer.Location);
+ } else {
+ current_block = new Block (current_block, current_local_parameters,
+ lexer.Location, Location.Null);
+ }
}
opt_statement_list CLOSE_BRACE
{
@@ -2981,7 +3025,7 @@ local_variable_type
// Ok, the above "primary_expression" is there to get rid of
// both reduce/reduce and shift/reduces in the grammar, it should
// really just be "type_name". If you use type_name, a reduce/reduce
- // creeps up. If you use qualified_identifier (which is all we need
+ // creeps up. If you use namespace_or_type_name (which is all we need
// really) two shift/reduces appear.
//
@@ -3483,8 +3527,17 @@ throw_statement
;
yield_statement
- : YIELD RETURN expression SEMICOLON
+ : IDENTIFIER RETURN expression SEMICOLON
{
+ string s = (string) $1;
+ if (s != "yield"){
+ Report.Error (1003, lexer.Location, "; expected");
+ $$ = null;
+ }
+ if (RootContext.V2){
+ Report.Error (-222, lexer.Location, "yield statement only available in C# 2.0 mode");
+ $$ = null;
+ }
if (iterator_container == null){
Report.Error (204, lexer.Location, "yield statement can only be used within a method, operator or property");
$$ = null;
@@ -3493,18 +3546,17 @@ yield_statement
$$ = new Yield ((Expression) $3, lexer.Location);
}
}
- | YIELD expression SEMICOLON
+ | IDENTIFIER BREAK SEMICOLON
{
- if (iterator_container == null){
- Report.Error (204, lexer.Location, "yield statement can only be used within a method, operator or property");
+ string s = (string) $1;
+ if (s != "yield"){
+ Report.Error (1003, lexer.Location, "; expected");
+ $$ = null;
+ }
+ if (!RootContext.V2){
+ Report.Error (-222, lexer.Location, "yield statement only available in C# 2.0 mode");
$$ = null;
- } else {
- iterator_container.SetYields ();
- $$ = new Yield ((Expression) $2, lexer.Location);
}
- }
- | YIELD BREAK SEMICOLON
- {
if (iterator_container == null){
Report.Error (204, lexer.Location, "yield statement can only be used within a method, operator or property");
$$ = null;
@@ -3871,51 +3923,6 @@ public class OperatorDeclaration {
}
-public class QualifiedIdentifier {
- public string s;
- public QualifiedIdentifier prev;
-
- public QualifiedIdentifier (string s)
- {
- this.s = s;
- prev = null;
- }
-
- public QualifiedIdentifier (QualifiedIdentifier prev, string s)
- {
- this.s = s;
- this.prev = prev;
- }
-
- public override string ToString ()
- {
- if (prev == null)
- return s;
-
- // Common cases
-
- if (prev.prev == null)
- return prev.s + "." + s;
- if (prev.prev.prev == null)
- return prev.prev.s + "." + prev.s + "." + s;
-
- // Uncommon cases.
- QualifiedIdentifier ptr = this.prev;
- int count = 1;
- while (ptr != null){
- count++;
- ptr = ptr.prev;
- }
- string [] ss = new string [count];
- ptr = this;
- for (int i = count; i-- > 0;){
- ss [i] = ptr.s;
- ptr = ptr.prev;
- }
- return String.Join (".", ss, 0, ss.Length);
- }
-}
-
void Error_ExpectingTypeName (Location l, Expression expr)
{
if (expr is Invocation){
@@ -3995,37 +4002,6 @@ CheckDef (bool result, string name, Location l)
CheckDef (DeclSpace.AdditionResult.NameExists, name, l);
}
-Expression DecomposeQI (QualifiedIdentifier qi, Location loc)
-{
- Expression o;
-
- if (qi.prev == null)
- return new SimpleName (qi.s, loc);
- else {
- o = DecomposeQI (qi.prev, loc);
- return new MemberAccess (o, qi.s, loc);
- }
-}
-
-// <summary>
-// This method is used to get at the complete string representation of
-// a fully-qualified type name, hiding inside a MemberAccess ;-)
-// This is necessary because local_variable_type admits primary_expression
-// as the type of the variable. So we do some extra checking
-// </summary>
-#if false
-string GetQualifiedIdentifier (Expression expr)
-{
- if (expr is SimpleName)
- return ((SimpleName)expr).Name;
- else if (expr is MemberAccess)
- return GetQualifiedIdentifier (((MemberAccess)expr).Expr) + "." + ((MemberAccess) expr).Identifier;
- else
- throw new Exception ("Expr has to be either SimpleName or MemberAccess! (" + expr + ")");
-
-}
-#endif
-
Block declare_local_variables (Expression type, ArrayList variable_declarators, Location loc)
{
Block implicit_block;
diff --git a/mcs/mcs/cs-tokenizer.cs b/mcs/mcs/cs-tokenizer.cs
index efe33ebae94..26e28307e21 100755
--- a/mcs/mcs/cs-tokenizer.cs
+++ b/mcs/mcs/cs-tokenizer.cs
@@ -289,11 +289,6 @@ namespace Mono.CSharp
AddKeyword ("void", Token.VOID);
AddKeyword ("volatile", Token.VOLATILE);
AddKeyword ("while", Token.WHILE);
-
- if (RootContext.V2){
- AddKeyword ("__yield", Token.YIELD);
- AddKeyword ("yield", Token.YIELD);
- }
}
//
@@ -1075,6 +1070,19 @@ namespace Mono.CSharp
case Token.TYPEOF:
case Token.UNCHECKED:
case Token.UNSAFE:
+
+ //
+ // These can be part of a member access
+ //
+ case Token.INT:
+ case Token.UINT:
+ case Token.SHORT:
+ case Token.USHORT:
+ case Token.LONG:
+ case Token.ULONG:
+ case Token.DOUBLE:
+ case Token.FLOAT:
+ case Token.CHAR:
return true;
default:
@@ -1152,6 +1160,11 @@ namespace Mono.CSharp
ref_name = file_name;
Location.Push (ref_name);
return true;
+ } else if (arg == "hidden"){
+ //
+ // We ignore #line hidden
+ //
+ return true;
}
try {
@@ -1699,10 +1712,26 @@ namespace Mono.CSharp
val = null;
// optimization: eliminate col and implement #directive semantic correctly.
for (;(c = getChar ()) != -1; col++) {
- if (c == ' ' || c == '\t' || c == '\f' || c == '\v' || c == '\r' || c == 0xa0){
-
- if (c == '\t')
- col = (((col + 8) / 8) * 8) - 1;
+ if (c == ' ')
+ continue;
+
+ if (c == '\t') {
+ col = (((col + 8) / 8) * 8) - 1;
+ continue;
+ }
+
+ if (c == ' ' || c == '\f' || c == '\v' || c == 0xa0)
+ continue;
+
+ if (c == '\r') {
+ if (peekChar () == '\n')
+ getChar ();
+
+ line++;
+ ref_line++;
+ col = 0;
+ any_token_seen |= tokens_seen;
+ tokens_seen = false;
continue;
}
diff --git a/mcs/mcs/decl.cs b/mcs/mcs/decl.cs
index 88ded36c0c8..646b3c9e3b6 100755
--- a/mcs/mcs/decl.cs
+++ b/mcs/mcs/decl.cs
@@ -37,14 +37,30 @@ namespace Mono.CSharp {
/// </summary>
public readonly Location Location;
- public MemberCore (string name, Location loc)
+ /// <summary>
+ /// Attributes for this type
+ /// </summary>
+ Attributes attributes;
+
+ public MemberCore (string name, Attributes attrs, Location loc)
{
Name = name;
Location = loc;
+ attributes = attrs;
}
public abstract bool Define (TypeContainer parent);
+ public Attributes OptAttributes
+ {
+ get {
+ return attributes;
+ }
+ set {
+ attributes = value;
+ }
+ }
+
//
// Whehter is it ok to use an unsafe pointer in this type container
//
@@ -101,8 +117,8 @@ namespace Mono.CSharp {
TypeContainer parent;
- public DeclSpace (NamespaceEntry ns, TypeContainer parent, string name, Location l)
- : base (name, l)
+ public DeclSpace (NamespaceEntry ns, TypeContainer parent, string name, Attributes attrs, Location l)
+ : base (name, attrs, l)
{
NamespaceEntry = ns;
Basename = name.Substring (1 + name.LastIndexOf ('.'));
diff --git a/mcs/mcs/delegate.cs b/mcs/mcs/delegate.cs
index 68cb107d821..bfd128268da 100644
--- a/mcs/mcs/delegate.cs
+++ b/mcs/mcs/delegate.cs
@@ -25,8 +25,7 @@ namespace Mono.CSharp {
public class Delegate : DeclSpace {
public Expression ReturnType;
public Parameters Parameters;
- public Attributes OptAttributes;
-
+
public ConstructorBuilder ConstructorBuilder;
public MethodBuilder InvokeBuilder;
public MethodBuilder BeginInvokeBuilder;
@@ -49,15 +48,14 @@ namespace Mono.CSharp {
public Delegate (NamespaceEntry ns, TypeContainer parent, Expression type,
int mod_flags, string name, Parameters param_list,
Attributes attrs, Location l)
- : base (ns, parent, name, l)
+ : base (ns, parent, name, attrs, l)
+
{
this.ReturnType = type;
ModFlags = Modifiers.Check (AllowedModifiers, mod_flags,
IsTopLevel ? Modifiers.INTERNAL :
Modifiers.PRIVATE, l);
- Parameters = param_list;
- OptAttributes = attrs;
- }
+ Parameters = param_list; }
public override TypeBuilder DefineType ()
{
@@ -572,14 +570,150 @@ namespace Mono.CSharp {
}
- public class NewDelegate : Expression {
+ //
+ // Base class for `NewDelegate' and `ImplicitDelegateCreation'
+ //
+ public abstract class DelegateCreation : Expression {
+ protected MethodBase constructor_method;
+ protected MethodBase delegate_method;
+ protected Expression delegate_instance_expr;
- public ArrayList Arguments;
+ public DelegateCreation () {}
- MethodBase constructor_method;
- MethodBase delegate_method;
- Expression delegate_instance_expr;
+ public static void Error_NoMatchingMethodForDelegate (MethodGroupExpr mg, Type t, MethodBase method, Location loc)
+ {
+ string method_desc;
+
+ if (mg.Methods.Length > 1)
+ method_desc = mg.Methods [0].Name;
+ else
+ method_desc = Invocation.FullMethodDesc (mg.Methods [0]);
+
+ ParameterData param = Invocation.GetParameterData (method);
+ string delegate_desc = Delegate.FullDelegateDesc (t, method, param);
+
+ Report.Error (123, loc, "Method '" + method_desc + "' does not " +
+ "match delegate '" + delegate_desc + "'");
+ }
+
+ public override void Emit (EmitContext ec)
+ {
+ if (delegate_instance_expr == null ||
+ delegate_method.IsStatic)
+ ec.ig.Emit (OpCodes.Ldnull);
+ else
+ delegate_instance_expr.Emit (ec);
+
+ if (delegate_method.IsVirtual) {
+ ec.ig.Emit (OpCodes.Dup);
+ ec.ig.Emit (OpCodes.Ldvirtftn, (MethodInfo) delegate_method);
+ } else
+ ec.ig.Emit (OpCodes.Ldftn, (MethodInfo) delegate_method);
+ ec.ig.Emit (OpCodes.Newobj, (ConstructorInfo) constructor_method);
+ }
+
+ protected bool ResolveConstructorMethod (EmitContext ec)
+ {
+ Expression ml = Expression.MemberLookup (
+ ec, type, ".ctor", loc);
+
+ if (!(ml is MethodGroupExpr)) {
+ Report.Error (-100, loc, "Internal error: Could not find delegate constructor!");
+ return false;
+ }
+
+ constructor_method = ((MethodGroupExpr) ml).Methods [0];
+ return true;
+ }
+
+ protected Expression ResolveMethodGroupExpr (EmitContext ec, MethodGroupExpr mg)
+ {
+ foreach (MethodInfo mi in mg.Methods){
+ delegate_method = Delegate.VerifyMethod (ec, type, mi, loc);
+
+ if (delegate_method != null)
+ break;
+ }
+
+ if (delegate_method == null) {
+ Error_NoMatchingMethodForDelegate (mg, type, delegate_method, loc);
+ return null;
+ }
+
+ //
+ // Check safe/unsafe of the delegate
+ //
+ if (!ec.InUnsafe){
+ ParameterData param = Invocation.GetParameterData (delegate_method);
+ int count = param.Count;
+
+ for (int i = 0; i < count; i++){
+ if (param.ParameterType (i).IsPointer){
+ Expression.UnsafeError (loc);
+ return null;
+ }
+ }
+ }
+
+ if (mg.InstanceExpression != null)
+ delegate_instance_expr = mg.InstanceExpression.Resolve (ec);
+ else {
+ if (ec.IsStatic){
+ if (!delegate_method.IsStatic){
+ Report.Error (120, loc,
+ "An object reference is required for the non-static method " +
+ delegate_method.Name);
+ return null;
+ }
+ delegate_instance_expr = null;
+ } else
+ delegate_instance_expr = ec.GetThis (loc);
+ }
+
+ if (delegate_instance_expr != null)
+ if (delegate_instance_expr.Type.IsValueType)
+ delegate_instance_expr = new BoxedCast (delegate_instance_expr);
+
+ eclass = ExprClass.Value;
+ return this;
+ }
+ }
+
+ //
+ // Created from the conversion code
+ //
+ public class ImplicitDelegateCreation : DelegateCreation {
+ ImplicitDelegateCreation (Type t, Location l)
+ {
+ type = t;
+ loc = l;
+ }
+
+ public override Expression DoResolve (EmitContext ec)
+ {
+ return this;
+ }
+
+ static public Expression Create (EmitContext ec, MethodGroupExpr mge, Type target_type, Location loc)
+ {
+ ImplicitDelegateCreation d = new ImplicitDelegateCreation (target_type, loc);
+ if (d.ResolveConstructorMethod (ec))
+ return d.ResolveMethodGroupExpr (ec, mge);
+ else
+ return null;
+ }
+ }
+
+ //
+ // A delegate-creation-expression, invoked from the `New' class
+ //
+ public class NewDelegate : DelegateCreation {
+ public ArrayList Arguments;
+
+ //
+ // This constructor is invoked from the `New' expression
+ //
public NewDelegate (Type type, ArrayList Arguments, Location loc)
{
this.type = type;
@@ -595,22 +729,11 @@ namespace Mono.CSharp {
return null;
}
- Expression ml = Expression.MemberLookup (
- ec, type, ".ctor", loc);
-
- if (!(ml is MethodGroupExpr)) {
- Report.Error (-100, loc, "Internal error: Could not find delegate constructor!");
+ if (!ResolveConstructorMethod (ec))
return null;
- }
- constructor_method = ((MethodGroupExpr) ml).Methods [0];
Argument a = (Argument) Arguments [0];
- if (!a.ResolveMethodGroup (ec, Location))
- return null;
-
- Expression e = a.Expr;
-
Expression invoke_method = Expression.MemberLookup (
ec, type, "Invoke", MemberTypes.Method,
Expression.AllBindingFlags, loc);
@@ -620,70 +743,14 @@ namespace Mono.CSharp {
return null;
}
- if (e is MethodGroupExpr) {
- MethodGroupExpr mg = (MethodGroupExpr) e;
-
- foreach (MethodInfo mi in mg.Methods){
- delegate_method = Delegate.VerifyMethod (ec, type, mi, loc);
-
- if (delegate_method != null)
- break;
- }
-
- if (delegate_method == null) {
- string method_desc;
- if (mg.Methods.Length > 1)
- method_desc = mg.Methods [0].Name;
- else
- method_desc = Invocation.FullMethodDesc (mg.Methods [0]);
-
- MethodBase dm = ((MethodGroupExpr) invoke_method).Methods [0];
- ParameterData param = Invocation.GetParameterData (dm);
- string delegate_desc = Delegate.FullDelegateDesc (type, dm, param);
-
- Report.Error (123, loc, "Method '" + method_desc + "' does not " +
- "match delegate '" + delegate_desc + "'");
-
- return null;
- }
-
- //
- // Check safe/unsafe of the delegate
- //
- if (!ec.InUnsafe){
- ParameterData param = Invocation.GetParameterData (delegate_method);
- int count = param.Count;
-
- for (int i = 0; i < count; i++){
- if (param.ParameterType (i).IsPointer){
- Expression.UnsafeError (loc);
- return null;
- }
- }
- }
-
- if (mg.InstanceExpression != null)
- delegate_instance_expr = mg.InstanceExpression.Resolve (ec);
- else {
- if (ec.IsStatic){
- if (!delegate_method.IsStatic){
- Report.Error (120, loc,
- "An object reference is required for the non-static method " +
- delegate_method.Name);
- return null;
- }
- delegate_instance_expr = null;
- } else
- delegate_instance_expr = ec.GetThis (loc);
- }
+ if (!a.ResolveMethodGroup (ec, loc))
+ return null;
+
+ Expression e = a.Expr;
- if (delegate_instance_expr != null)
- if (delegate_instance_expr.Type.IsValueType)
- delegate_instance_expr = new BoxedCast (delegate_instance_expr);
-
- eclass = ExprClass.Value;
- return this;
- }
+ MethodGroupExpr mg = e as MethodGroupExpr;
+ if (mg != null)
+ return ResolveMethodGroupExpr (ec, mg);
Type e_type = e.Type;
@@ -710,8 +777,7 @@ namespace Mono.CSharp {
public override void Emit (EmitContext ec)
{
- if (delegate_instance_expr == null ||
- delegate_method.IsStatic)
+ if (delegate_instance_expr == null || delegate_method.IsStatic)
ec.ig.Emit (OpCodes.Ldnull);
else
delegate_instance_expr.Emit (ec);
diff --git a/mcs/mcs/driver.cs b/mcs/mcs/driver.cs
index dbd3fc8cdea..adf64d4fb49 100755
--- a/mcs/mcs/driver.cs
+++ b/mcs/mcs/driver.cs
@@ -77,7 +77,9 @@ namespace Mono.CSharp
//
static ArrayList resources;
static ArrayList embedded_resources;
-
+ static string win32ResourceFile;
+ static string win32IconFile;
+
//
// An array of the defines from the command line
//
@@ -221,6 +223,8 @@ namespace Mono.CSharp
"Resources:\n" +
" -linkresource:FILE[,ID] Links FILE as a resource\n" +
" -resource:FILE[,ID] Embed FILE as a resource\n" +
+ " -win32res:FILE Specifies Win32 resource file (.res)\n" +
+ " -win32icon:FILE Use this icon for the output\n" +
" --mcs-debug X Sets MCS debugging level to X\n" +
" @file Read response file for more options\n\n" +
"Options can be of the form -option or /option");
@@ -1017,6 +1021,24 @@ namespace Mono.CSharp
}
return true;
}
+ case "/win32res": {
+ if (value == "") {
+ Report.Error (5, arg + " requires an argument");
+ Environment.Exit (1);
+ }
+
+ win32ResourceFile = value;
+ return true;
+ }
+ case "/win32icon": {
+ if (value == "") {
+ Report.Error (5, arg + " requires an argument");
+ Environment.Exit (1);
+ }
+
+ win32IconFile = value;
+ return true;
+ }
case "/doc": {
if (value == ""){
Report.Error (5, arg + " requires an argument");
@@ -1136,10 +1158,6 @@ namespace Mono.CSharp
case "/fullpaths":
return true;
- case "/win32icon":
- Report.Error (5, "/win32icon is currently not supported");
- return true;
-
case "/v2":
case "/2":
SetupV2 ();
@@ -1276,10 +1294,24 @@ namespace Mono.CSharp
if (tokenize)
return true;
-
- if (first_source == null){
- Report.Error (2008, "No files to compile were specified");
- return false;
+
+ //
+ // If we are an exe, require a source file for the entry point
+ //
+ if (RootContext.Target == Target.Exe || RootContext.Target == Target.WinExe){
+ if (first_source == null){
+ Report.Error (2008, "No files to compile were specified");
+ return 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){
+ Report.Error (2008, "No files to compile were specified");
+ return false;
}
if (Report.Errors > 0)
@@ -1440,7 +1472,7 @@ namespace Mono.CSharp
" does not have an entry point defined");
return false;
}
-
+
CodeGen.AssemblyBuilder.SetEntryPoint (ep, k);
} else if (RootContext.MainClass != null) {
Report.Error (2017, "Can not specify -main: when building module or library");
@@ -1493,6 +1525,29 @@ namespace Mono.CSharp
}
}
+ //
+ // Add Win32 resources
+ //
+
+ CodeGen.AssemblyBuilder.DefineVersionInfoResource ();
+
+ if (win32ResourceFile != null) {
+ try {
+ CodeGen.AssemblyBuilder.DefineUnmanagedResource (win32ResourceFile);
+ }
+ catch (ArgumentException) {
+ Report.Warning (0, new Location (-1), "Cannot embed win32 resources on this runtime: try the Mono runtime instead.");
+ }
+ }
+
+ if (win32IconFile != null) {
+ MethodInfo define_icon = typeof (AssemblyBuilder).GetMethod ("DefineIconResource", BindingFlags.Instance|BindingFlags.Public|BindingFlags.NonPublic);
+ if (define_icon == null) {
+ Report.Warning (0, new Location (-1), "Cannot embed icon resource on this runtime: try the Mono runtime instead.");
+ }
+ define_icon.Invoke (CodeGen.AssemblyBuilder, new object [] { win32IconFile });
+ }
+
if (Report.Errors > 0)
return false;
diff --git a/mcs/mcs/ecore.cs b/mcs/mcs/ecore.cs
index 58b76628b75..b1c5ee5349b 100755
--- a/mcs/mcs/ecore.cs
+++ b/mcs/mcs/ecore.cs
@@ -314,9 +314,11 @@ namespace Mono.CSharp {
break;
case ExprClass.MethodGroup:
- if ((flags & ResolveFlags.MethodGroup) == 0) {
- ((MethodGroupExpr) e).ReportUsageError ();
- return null;
+ if (!RootContext.V2){
+ if ((flags & ResolveFlags.MethodGroup) == 0) {
+ ((MethodGroupExpr) e).ReportUsageError ();
+ return null;
+ }
}
break;
@@ -405,6 +407,12 @@ namespace Mono.CSharp {
/// </remarks>
public abstract void Emit (EmitContext ec);
+ public virtual void EmitBranchable (EmitContext ec, Label target, bool onTrue)
+ {
+ Emit (ec);
+ ec.ig.Emit (onTrue ? OpCodes.Brtrue : OpCodes.Brfalse, target);
+ }
+
/// <summary>
/// Protected constructor. Only derivate types should
/// be able to be created
@@ -663,10 +671,14 @@ namespace Mono.CSharp {
Report.Error (
122, loc, "`" + TypeManager.CSharpName (qualifier_type) + "." +
name + "' is inaccessible due to its protection level");
- else
+ else if (name == ".ctor") {
+ Report.Error (143, loc, String.Format ("The type {0} has no constructors defined",
+ TypeManager.CSharpName (queried_type)));
+ } else {
Report.Error (
122, loc, "`" + name + "' is inaccessible due to its " +
"protection level");
+ }
}
static public MemberInfo GetFieldFromEvent (EventExpr event_expr)
@@ -1313,7 +1325,13 @@ namespace Mono.CSharp {
/// </summary>
public class EmptyCast : Expression {
protected Expression child;
-
+
+ public Expression Child {
+ get {
+ return child;
+ }
+ }
+
public EmptyCast (Expression child, Type return_type)
{
eclass = child.eclass;
@@ -1958,19 +1976,19 @@ namespace Mono.CSharp {
alias_value = null;
if (ec.ResolvingTypeTree){
- if (alias_value != null){
- if ((t = RootContext.LookupType (ds, alias_value, true, loc)) != null)
- return new TypeExpression (t, loc);
- }
-
int errors = Report.Errors;
- Type dt = ec.DeclSpace.FindType (loc, Name);
-
+ Type dt = ds.FindType (loc, Name);
+
if (Report.Errors != errors)
return null;
if (dt != null)
return new TypeExpression (dt, loc);
+
+ if (alias_value != null){
+ if ((t = RootContext.LookupType (ds, alias_value, true, loc)) != null)
+ return new TypeExpression (t, loc);
+ }
}
//
@@ -2744,9 +2762,21 @@ namespace Mono.CSharp {
// Handle initonly fields specially: make a copy and then
// get the address of the copy.
//
- if (FieldInfo.IsInitOnly && !ec.IsConstructor){
+ bool need_copy;
+ if (FieldInfo.IsInitOnly){
+ need_copy = true;
+ if (ec.IsConstructor){
+ if (FieldInfo.IsStatic){
+ if (ec.IsStatic)
+ need_copy = false;
+ } else
+ need_copy = false;
+ }
+ } else
+ need_copy = false;
+
+ if (need_copy){
LocalBuilder local;
-
Emit (ec);
local = ig.DeclareLocal (type);
ig.Emit (OpCodes.Stloc, local);
@@ -2754,9 +2784,10 @@ namespace Mono.CSharp {
return;
}
- if (FieldInfo.IsStatic)
+
+ if (FieldInfo.IsStatic){
ig.Emit (OpCodes.Ldsflda, FieldInfo);
- else {
+ } else {
//
// In the case of `This', we call the AddressOf method, which will
// only load the pointer, and not perform an Ldobj immediately after
diff --git a/mcs/mcs/enum.cs b/mcs/mcs/enum.cs
index 06f4c9e0cf7..e8e7dd3cb76 100755
--- a/mcs/mcs/enum.cs
+++ b/mcs/mcs/enum.cs
@@ -23,7 +23,6 @@ namespace Mono.CSharp {
ArrayList ordered_enums;
public Expression BaseType;
- public Attributes OptAttributes;
public Type UnderlyingType;
@@ -51,12 +50,11 @@ namespace Mono.CSharp {
public Enum (NamespaceEntry ns, TypeContainer parent, Expression type, int mod_flags,
string name, Attributes attrs, Location l)
- : base (ns, parent, name, l)
+ : base (ns, parent, name, attrs, l)
{
this.BaseType = type;
ModFlags = Modifiers.Check (AllowedModifiers, mod_flags,
IsTopLevel ? Modifiers.INTERNAL : Modifiers.PRIVATE, l);
- OptAttributes = attrs;
ordered_enums = new ArrayList ();
member_to_location = new Hashtable ();
diff --git a/mcs/mcs/expression.cs b/mcs/mcs/expression.cs
index 8ce02127ed3..a61b2cfd866 100755
--- a/mcs/mcs/expression.cs
+++ b/mcs/mcs/expression.cs
@@ -4,8 +4,8 @@
// Author:
// Miguel de Icaza (miguel@ximian.com)
//
-// (C) 2001 Ximian, Inc.
-//
+// (C) 2001, 2002, 2003 Ximian, Inc.
+// (C) 2003, 2004 Novell, Inc.
//
#define USE_OLD
@@ -605,16 +605,12 @@ namespace Mono.CSharp {
}
}
- /// <summary>
- /// This will emit the child expression for `ec' avoiding the logical
- /// not. The parent will take care of changing brfalse/brtrue
- /// </summary>
- public void EmitLogicalNot (EmitContext ec)
+ public override void EmitBranchable (EmitContext ec, Label target, bool onTrue)
{
- if (Oper != Operator.LogicalNot)
- throw new Exception ("EmitLogicalNot can only be called with !expr");
-
- Expr.Emit (ec);
+ if (Oper == Operator.LogicalNot)
+ Expr.EmitBranchable (ec, target, !onTrue);
+ else
+ base.EmitBranchable (ec, target, onTrue);
}
public override string ToString ()
@@ -651,14 +647,14 @@ namespace Mono.CSharp {
ILGenerator ig = ec.ig;
if (temporary != null){
- if (have_temporary){
+ if (have_temporary) {
temporary.Emit (ec);
- return;
+ } else {
+ expr.Emit (ec);
+ ec.ig.Emit (OpCodes.Dup);
+ temporary.Store (ec);
+ have_temporary = true;
}
- expr.Emit (ec);
- ec.ig.Emit (OpCodes.Dup);
- temporary.Store (ec);
- have_temporary = true;
} else
expr.Emit (ec);
@@ -1050,6 +1046,8 @@ namespace Mono.CSharp {
ia.EmitAssign (ec, temp_storage);
break;
}
+
+ temp_storage.Release (ec);
}
public override void Emit (EmitContext ec)
@@ -1151,6 +1149,35 @@ namespace Mono.CSharp {
}
throw new Exception ("never reached");
}
+
+ public override void EmitBranchable (EmitContext ec, Label target, bool onTrue)
+ {
+ ILGenerator ig = ec.ig;
+
+ switch (action){
+ case Action.AlwaysFalse:
+ if (! onTrue)
+ ig.Emit (OpCodes.Br, target);
+
+ return;
+ case Action.AlwaysTrue:
+ if (onTrue)
+ ig.Emit (OpCodes.Br, target);
+
+ return;
+ case Action.LeaveOnStack:
+ // the `e != null' rule.
+ expr.Emit (ec);
+ ig.Emit (onTrue ? OpCodes.Brtrue : OpCodes.Brfalse, target);
+ return;
+ case Action.Probe:
+ expr.Emit (ec);
+ ig.Emit (OpCodes.Isinst, probe_type);
+ ig.Emit (onTrue ? OpCodes.Brtrue : OpCodes.Brfalse, target);
+ return;
+ }
+ throw new Exception ("never reached");
+ }
public override Expression DoResolve (EmitContext ec)
{
@@ -1250,7 +1277,7 @@ namespace Mono.CSharp {
if (TypeManager.IsValueType (probe_type)){
Report.Error (77, loc, "The as operator should be used with a reference type only (" +
- TypeManager.CSharpName (probe_type) + " is a value type");
+ TypeManager.CSharpName (probe_type) + " is a value type)");
return null;
}
@@ -2284,10 +2311,6 @@ namespace Mono.CSharp {
}
//
- // Step 2: Default operations on CLI native types.
- //
-
- //
// Step 0: String concatenation (because overloading will get this wrong)
//
if (oper == Operator.Addition){
@@ -2463,28 +2486,37 @@ namespace Mono.CSharp {
// +, -, *, /, %, &, |, ^, ==, !=, <, >, <=, >=
//
if (oper == Operator.Addition || oper == Operator.Subtraction) {
- if (l.IsSubclassOf (TypeManager.delegate_type) &&
- r.IsSubclassOf (TypeManager.delegate_type)) {
- MethodInfo method;
- ArrayList args = new ArrayList (2);
-
- args = new ArrayList (2);
- args.Add (new Argument (left, Argument.AType.Expression));
- args.Add (new Argument (right, Argument.AType.Expression));
-
- if (oper == Operator.Addition)
- method = TypeManager.delegate_combine_delegate_delegate;
- else
- method = TypeManager.delegate_remove_delegate_delegate;
-
- if (l != r) {
- Error_OperatorCannotBeApplied ();
- return null;
+ if (l.IsSubclassOf (TypeManager.delegate_type)){
+ if (right.eclass == ExprClass.MethodGroup && RootContext.V2){
+ Expression tmp = Convert.ImplicitConversionRequired (ec, right, l, loc);
+ if (tmp == null)
+ return null;
+ right = tmp;
+ r = right.Type;
+ }
+
+ if (r.IsSubclassOf (TypeManager.delegate_type)){
+ MethodInfo method;
+ ArrayList args = new ArrayList (2);
+
+ args = new ArrayList (2);
+ args.Add (new Argument (left, Argument.AType.Expression));
+ args.Add (new Argument (right, Argument.AType.Expression));
+
+ if (oper == Operator.Addition)
+ method = TypeManager.delegate_combine_delegate_delegate;
+ else
+ method = TypeManager.delegate_remove_delegate_delegate;
+
+ if (l != r) {
+ Error_OperatorCannotBeApplied ();
+ return null;
+ }
+
+ return new BinaryDelegate (l, method, args);
}
-
- return new BinaryDelegate (l, method, args);
}
-
+
//
// Pointer arithmetic:
//
@@ -2528,13 +2560,15 @@ namespace Mono.CSharp {
Expression temp;
// U operator - (E e, E f)
- if (lie && rie && oper == Operator.Subtraction){
- if (l == r){
- type = TypeManager.EnumToUnderlying (l);
- return this;
- }
- Error_OperatorCannotBeApplied ();
- return null;
+ if (lie && rie){
+ if (oper == Operator.Subtraction){
+ if (l == r){
+ type = TypeManager.EnumToUnderlying (l);
+ return this;
+ }
+ Error_OperatorCannotBeApplied ();
+ return null;
+ }
}
//
@@ -2545,9 +2579,18 @@ namespace Mono.CSharp {
Type enum_type = lie ? l : r;
Type other_type = lie ? r : l;
Type underlying_type = TypeManager.EnumToUnderlying (enum_type);
-;
if (underlying_type != other_type){
+ temp = Convert.ImplicitConversion (ec, lie ? right : left, underlying_type, loc);
+ if (temp != null){
+ if (lie)
+ right = temp;
+ else
+ left = temp;
+ type = enum_type;
+ return this;
+ }
+
Error_OperatorCannotBeApplied ();
return null;
}
@@ -2737,7 +2780,7 @@ namespace Mono.CSharp {
/// The expression's code is generated, and we will generate a branch to `target'
/// if the resulting expression value is equal to isTrue
/// </remarks>
- public bool EmitBranchable (EmitContext ec, Label target, bool onTrue)
+ public override void EmitBranchable (EmitContext ec, Label target, bool onTrue)
{
ILGenerator ig = ec.ig;
@@ -2747,129 +2790,78 @@ namespace Mono.CSharp {
// but on top of that we want for == and != to use a special path
// if we are comparing against null
//
- if (oper == Operator.Equality || oper == Operator.Inequality){
+ if (oper == Operator.Equality || oper == Operator.Inequality) {
bool my_on_true = oper == Operator.Inequality ? onTrue : !onTrue;
- if (left is NullLiteral){
+ if (left is NullLiteral || left is IntConstant && ((IntConstant) left).Value == 0) {
right.Emit (ec);
if (my_on_true)
ig.Emit (OpCodes.Brtrue, target);
else
ig.Emit (OpCodes.Brfalse, target);
- return true;
- } else if (right is NullLiteral){
+
+ return;
+ } else if (right is NullLiteral || right is IntConstant && ((IntConstant) right).Value == 0){
left.Emit (ec);
if (my_on_true)
ig.Emit (OpCodes.Brtrue, target);
else
ig.Emit (OpCodes.Brfalse, target);
- return true;
+
+ return;
} else if (left is BoolConstant){
right.Emit (ec);
if (my_on_true != ((BoolConstant) left).Value)
ig.Emit (OpCodes.Brtrue, target);
else
ig.Emit (OpCodes.Brfalse, target);
- return true;
+
+ return;
} else if (right is BoolConstant){
left.Emit (ec);
if (my_on_true != ((BoolConstant) right).Value)
ig.Emit (OpCodes.Brtrue, target);
else
ig.Emit (OpCodes.Brfalse, target);
- return true;
+
+ return;
}
- } else if (oper == Operator.LogicalAnd){
- if (left is Binary){
- Binary left_binary = (Binary) left;
-
- if (onTrue){
- Label tests_end = ig.DefineLabel ();
-
- if (left_binary.EmitBranchable (ec, tests_end, false)){
- if (right is Binary){
- Binary right_binary = (Binary) right;
+ } else if (oper == Operator.LogicalAnd) {
- if (right_binary.EmitBranchable (ec, target, true)){
- ig.MarkLabel (tests_end);
- return true;
- }
- }
- right.Emit (ec);
- ig.Emit (OpCodes.Brtrue, target);
- ig.MarkLabel (tests_end);
- return true;
- }
- } else {
- if (left_binary.EmitBranchable (ec, target, false)){
- if (right is Binary){
- Binary right_binary = (Binary) right;
-
- if (right_binary.EmitBranchable (ec, target, false))
- return true;
- }
- right.Emit (ec);
- if (onTrue)
- ig.Emit (OpCodes.Brtrue, target);
- else
- ig.Emit (OpCodes.Brfalse, target);
- return true;
- }
- }
- //
- // Give up, and let the regular Emit work, but we could
- // also optimize the left-non-Branchable, but-right-Branchable
- //
+ if (onTrue) {
+ Label tests_end = ig.DefineLabel ();
+
+ left.EmitBranchable (ec, tests_end, false);
+ right.EmitBranchable (ec, target, true);
+ ig.MarkLabel (tests_end);
+ } else {
+ left.EmitBranchable (ec, target, false);
+ right.EmitBranchable (ec, target, false);
}
- return false;
+
+ return;
+
} else if (oper == Operator.LogicalOr){
- if (left is Binary){
- Binary left_binary = (Binary) left;
-
- if (onTrue){
- if (left_binary.EmitBranchable (ec, target, true)){
- if (right is Binary){
- Binary right_binary = (Binary) right;
-
- if (right_binary.EmitBranchable (ec, target, true))
- return true;
- }
- right.Emit (ec);
- ig.Emit (OpCodes.Brtrue, target);
- return true;
- }
-
- //
- // Give up, and let the regular Emit work, but we could
- // also optimize the left-non-Branchable, but-right-Branchable
- //
- } else {
- Label tests_end = ig.DefineLabel ();
-
- if (left_binary.EmitBranchable (ec, tests_end, true)){
- if (right is Binary){
- Binary right_binary = (Binary) right;
-
- if (right_binary.EmitBranchable (ec, target, false)){
- ig.MarkLabel (tests_end);
- return true;
- }
- }
- right.Emit (ec);
- ig.Emit (OpCodes.Brfalse, target);
- ig.MarkLabel (tests_end);
- return true;
- }
- }
+ if (onTrue) {
+ left.EmitBranchable (ec, target, true);
+ right.EmitBranchable (ec, target, true);
+
+ } else {
+ Label tests_end = ig.DefineLabel ();
+ left.EmitBranchable (ec, tests_end, true);
+ right.EmitBranchable (ec, target, false);
+ ig.MarkLabel (tests_end);
}
- return false;
- } else if (!(oper == Operator.LessThan ||
- oper == Operator.GreaterThan ||
- oper == Operator.LessThanOrEqual ||
- oper == Operator.GreaterThanOrEqual))
- return false;
+ return;
+
+ } else if (!(oper == Operator.LessThan || oper == Operator.GreaterThan ||
+ oper == Operator.LessThanOrEqual || oper == Operator.GreaterThanOrEqual ||
+ oper == Operator.Equality || oper == Operator.Inequality)) {
+ base.EmitBranchable (ec, target, onTrue);
+ return;
+ }
left.Emit (ec);
right.Emit (ec);
@@ -2949,12 +2941,10 @@ namespace Mono.CSharp {
else
ig.Emit (OpCodes.Blt, target);
break;
-
default:
- return false;
+ Console.WriteLine (oper);
+ throw new Exception ("what is THAT");
}
-
- return true;
}
public override void Emit (EmitContext ec)
@@ -2967,52 +2957,26 @@ namespace Mono.CSharp {
// Handle short-circuit operators differently
// than the rest
//
- if (oper == Operator.LogicalAnd){
+ if (oper == Operator.LogicalAnd) {
Label load_zero = ig.DefineLabel ();
Label end = ig.DefineLabel ();
- bool process = true;
-
- if (left is Binary){
- Binary left_binary = (Binary) left;
-
- if (left_binary.EmitBranchable (ec, load_zero, false)){
- right.Emit (ec);
- ig.Emit (OpCodes.Br, end);
- process = false;
- }
- }
-
- if (process){
- left.Emit (ec);
- ig.Emit (OpCodes.Brfalse, load_zero);
- right.Emit (ec);
- ig.Emit (OpCodes.Br, end);
- }
+
+ left.EmitBranchable (ec, load_zero, false);
+ right.Emit (ec);
+ ig.Emit (OpCodes.Br, end);
+
ig.MarkLabel (load_zero);
ig.Emit (OpCodes.Ldc_I4_0);
ig.MarkLabel (end);
return;
- } else if (oper == Operator.LogicalOr){
+ } else if (oper == Operator.LogicalOr) {
Label load_one = ig.DefineLabel ();
Label end = ig.DefineLabel ();
- bool process = true;
-
- if (left is Binary){
- Binary left_binary = (Binary) left;
-
- if (left_binary.EmitBranchable (ec, load_one, true)){
- right.Emit (ec);
- ig.Emit (OpCodes.Br, end);
- process = false;
- }
- }
- if (process){
- left.Emit (ec);
- ig.Emit (OpCodes.Brtrue, load_one);
- right.Emit (ec);
- ig.Emit (OpCodes.Br, end);
- }
+ left.EmitBranchable (ec, load_one, true);
+ right.Emit (ec);
+ ig.Emit (OpCodes.Br, end);
+
ig.MarkLabel (load_one);
ig.Emit (OpCodes.Ldc_I4_1);
ig.MarkLabel (end);
@@ -3306,7 +3270,7 @@ namespace Mono.CSharp {
ig.Emit (OpCodes.Nop);
- Statement.EmitBoolExpression (ec, is_and ? op_false : op_true, false_target, false);
+ (is_and ? op_false : op_true).EmitBranchable (ec, false_target, false);
left.Emit (ec);
ig.Emit (OpCodes.Br, end_target);
ig.MarkLabel (false_target);
@@ -3510,7 +3474,7 @@ namespace Mono.CSharp {
Label false_target = ig.DefineLabel ();
Label end_target = ig.DefineLabel ();
- Statement.EmitBoolExpression (ec, expr, false_target, false);
+ expr.EmitBranchable (ec, false_target, false);
trueExpr.Emit (ec);
ig.Emit (OpCodes.Br, end_target);
ig.MarkLabel (false_target);
@@ -4155,6 +4119,14 @@ namespace Mono.CSharp {
// we can optimize this case: a positive int32
// always fits on a uint64
//
+
+ //
+ // This special case is needed because csc behaves like this.
+ // int -> uint is better than int -> ulong!
+ //
+ if (q == TypeManager.uint32_type)
+ return 0;
+
if (q == TypeManager.int64_type)
return 0;
else if (value >= 0)
@@ -4630,7 +4602,7 @@ namespace Mono.CSharp {
int candidate_top = candidates.Count;
for (int ix = 0; ix < candidate_top; ix++){
MethodBase candidate = (MethodBase) candidates [ix];
-
+
bool cand_params = (bool) candidate_to_form [candidate];
bool method_params = false;
@@ -8158,9 +8130,10 @@ namespace Mono.CSharp {
return null;
}
- if (ec.InCatch || ec.InFinally){
+ if (ec.CurrentBranching.InCatch () ||
+ ec.CurrentBranching.InFinally (true)) {
Error (255,
- "stackalloc can not be used in a catch or finally block");
+ "stackalloc can not be used in a catch or finally block");
return null;
}
diff --git a/mcs/mcs/flowanalysis.cs b/mcs/mcs/flowanalysis.cs
index ca7c6614a0e..1befce3ea87 100644
--- a/mcs/mcs/flowanalysis.cs
+++ b/mcs/mcs/flowanalysis.cs
@@ -33,7 +33,7 @@ namespace Mono.CSharp
Conditional,
// A loop block.
- LoopBlock,
+ Loop,
// Try/Catch block.
Exception,
@@ -115,6 +115,60 @@ namespace Mono.CSharp
return cloned;
}
+ // <summary>
+ // Performs an `And' operation on the FlowReturns status
+ // (for instance, a block only returns Always if all its siblings
+ // always return).
+ // </summary>
+ public static FlowReturns AndFlowReturns (FlowReturns a, FlowReturns b)
+ {
+ if (a == FlowReturns.Undefined)
+ return b;
+
+ switch (a) {
+ case FlowReturns.Never:
+ if (b == FlowReturns.Never)
+ return FlowReturns.Never;
+ else
+ return FlowReturns.Sometimes;
+
+ case FlowReturns.Sometimes:
+ return FlowReturns.Sometimes;
+
+ case FlowReturns.Always:
+ if (b == FlowReturns.Always)
+ return FlowReturns.Always;
+ else
+ return FlowReturns.Sometimes;
+
+ default:
+ throw new ArgumentException ();
+ }
+ }
+
+ public static FlowReturns OrFlowReturns (FlowReturns a, FlowReturns b)
+ {
+ if (a == FlowReturns.Undefined)
+ return b;
+
+ switch (a) {
+ case FlowReturns.Never:
+ return b;
+
+ case FlowReturns.Sometimes:
+ if (b == FlowReturns.Always)
+ return FlowReturns.Always;
+ else
+ return FlowReturns.Sometimes;
+
+ case FlowReturns.Always:
+ return FlowReturns.Always;
+
+ default:
+ throw new ArgumentException ();
+ }
+ }
+
public static void And (ref Reachability a, Reachability b, bool do_break)
{
if (a == null) {
@@ -180,6 +234,16 @@ namespace Mono.CSharp
a.reachable = AndFlowReturns (a.reachable, b.reachable);
}
+ public void Or (Reachability b)
+ {
+ returns = OrFlowReturns (returns, b.returns);
+ breaks = OrFlowReturns (breaks, b.breaks);
+ throws = OrFlowReturns (throws, b.throws);
+ barrier = OrFlowReturns (barrier, b.barrier);
+
+ update ();
+ }
+
public static Reachability Never ()
{
return new Reachability (
@@ -296,7 +360,7 @@ namespace Mono.CSharp
{
switch (type) {
case BranchingType.Exception:
- return new FlowBranchingException (parent, type, block, loc);
+ return new FlowBranchingException (parent, block, loc);
case BranchingType.Switch:
return new FlowBranchingBlock (parent, type, SiblingType.SwitchSection, block, loc);
@@ -347,37 +411,6 @@ namespace Mono.CSharp
int id;
// <summary>
- // Performs an `And' operation on the FlowReturns status
- // (for instance, a block only returns Always if all its siblings
- // always return).
- // </summary>
- public static FlowReturns AndFlowReturns (FlowReturns a, FlowReturns b)
- {
- if (a == FlowReturns.Undefined)
- return b;
-
- switch (a) {
- case FlowReturns.Never:
- if (b == FlowReturns.Never)
- return FlowReturns.Never;
- else
- return FlowReturns.Sometimes;
-
- case FlowReturns.Sometimes:
- return FlowReturns.Sometimes;
-
- case FlowReturns.Always:
- if (b == FlowReturns.Always)
- return FlowReturns.Always;
- else
- return FlowReturns.Sometimes;
-
- default:
- throw new ArgumentException ();
- }
- }
-
- // <summary>
// The vector contains a BitArray with information about which local variables
// and parameters are already initialized at the current code position.
// </summary>
@@ -441,13 +474,17 @@ namespace Mono.CSharp
this.CountLocals = num_locals;
if (parent != null) {
- locals = new MyBitVector (parent.locals, CountLocals);
+ if (num_locals > 0)
+ locals = new MyBitVector (parent.locals, CountLocals);
+
if (num_params > 0)
parameters = new MyBitVector (parent.parameters, num_params);
reachability = parent.Reachability.Clone ();
} else {
- locals = new MyBitVector (null, CountLocals);
+ if (num_locals > 0)
+ locals = new MyBitVector (null, CountLocals);
+
if (num_params > 0)
parameters = new MyBitVector (null, num_params);
@@ -481,9 +518,12 @@ namespace Mono.CSharp
{
UsageVector retval = new UsageVector (Type, null, Location, CountParameters, CountLocals);
- retval.locals = locals.Clone ();
+ if (retval.locals != null)
+ retval.locals = locals.Clone ();
+
if (parameters != null)
retval.parameters = parameters.Clone ();
+
retval.reachability = reachability.Clone ();
return retval;
@@ -570,33 +610,33 @@ namespace Mono.CSharp
Report.Debug (2, " MERGING CHILD", this, IsDirty,
result.ParameterVector, result.LocalVector,
- result.Reachability, Type);
+ result.Reachability, reachability, Type);
- reachability = result.Reachability;
+ Reachability new_r = result.Reachability;
- if (branching.Type == BranchingType.LoopBlock) {
- bool may_leave_loop = reachability.MayBreak;
- reachability.ResetBreaks ();
+ if (branching.Type == BranchingType.Loop) {
+ bool may_leave_loop = new_r.MayBreak;
+ new_r.ResetBreaks ();
if (branching.Infinite && !may_leave_loop) {
- if (reachability.Returns == FlowReturns.Sometimes) {
+ if (new_r.Returns == FlowReturns.Sometimes) {
// If we're an infinite loop and do not break,
// the code after the loop can never be reached.
// However, if we may return from the loop,
// then we do always return (or stay in the
// loop forever).
- reachability.SetReturns ();
+ new_r.SetReturns ();
}
- reachability.SetBarrier ();
+ new_r.SetBarrier ();
} else {
- if (reachability.Returns == FlowReturns.Always) {
+ if (new_r.Returns == FlowReturns.Always) {
// We're either finite or we may leave the loop.
- reachability.SetReturnsSometimes ();
+ new_r.SetReturnsSometimes ();
}
}
} else if (branching.Type == BranchingType.Switch)
- reachability.ResetBreaks ();
+ new_r.ResetBreaks ();
//
// We've now either reached the point after the branching or we will
@@ -607,20 +647,23 @@ namespace Mono.CSharp
// we need to look at (see above).
//
- if ((Type == SiblingType.SwitchSection) && !reachability.IsUnreachable) {
+ if ((Type == SiblingType.SwitchSection) && !new_r.IsUnreachable) {
Report.Error (163, Location,
"Control cannot fall through from one " +
"case label to another");
return result;
}
- if (result.LocalVector != null)
+ if (locals != null && result.LocalVector != null)
locals.Or (result.LocalVector);
if (result.ParameterVector != null)
parameters.Or (result.ParameterVector);
- Report.Debug (2, " MERGING CHILD DONE", this, result);
+ reachability.Or (new_r);
+
+ Report.Debug (2, " MERGING CHILD DONE", this, result,
+ new_r, reachability);
IsDirty = true;
@@ -647,7 +690,7 @@ namespace Mono.CSharp
MergeFinally (branching, f_origins, parameters);
}
- if (f_vector != null)
+ if (f_vector != null && f_vector.LocalVector != null)
MyBitVector.Or (ref locals, f_vector.LocalVector);
}
@@ -686,12 +729,15 @@ namespace Mono.CSharp
Report.Debug (1, " MERGING JUMP ORIGIN", vector);
if (first) {
- locals.Or (vector.locals);
+ if (locals != null && vector.Locals != null)
+ locals.Or (vector.locals);
+
if (parameters != null)
parameters.Or (vector.parameters);
first = false;
} else {
- locals.And (vector.locals);
+ if (locals != null && vector.Locals != null)
+ locals.And (vector.locals);
if (parameters != null)
parameters.And (vector.parameters);
}
@@ -779,7 +825,10 @@ namespace Mono.CSharp
// </summary>
public MyBitVector Locals {
get {
- return locals.Clone ();
+ if (locals != null)
+ return locals.Clone ();
+ else
+ return null;
}
}
@@ -804,6 +853,8 @@ namespace Mono.CSharp
StringBuilder sb = new StringBuilder ();
sb.Append ("Vector (");
+ sb.Append (Type);
+ sb.Append (",");
sb.Append (id);
sb.Append (",");
sb.Append (IsDirty);
@@ -843,6 +894,8 @@ namespace Mono.CSharp
UsageVector parent_vector = parent != null ? parent.CurrentUsageVector : null;
vector = new UsageVector (stype, parent_vector, loc, param_map.Length, local_map.Length);
+
+
} else {
param_map = Parent.param_map;
local_map = Parent.local_map;
@@ -885,7 +938,7 @@ namespace Mono.CSharp
continue;
Report.Error (177, loc, "The out parameter `" +
- param_map.VariableNames [i] + "' must be " +
+ var.Name + "' must be " +
"assigned before control leave the current method.");
}
}
@@ -904,10 +957,10 @@ namespace Mono.CSharp
for (UsageVector child = sibling_list; child != null; child = child.Next) {
bool do_break = (Type != BranchingType.Switch) &&
- (Type != BranchingType.LoopBlock);
+ (Type != BranchingType.Loop);
Report.Debug (2, " MERGING SIBLING ", child,
- child.Parameters, child.Locals,
+ child.ParameterVector, child.LocalVector,
reachability, child.Reachability, do_break);
Reachability.And (ref reachability, child.Reachability, do_break);
@@ -949,16 +1002,18 @@ namespace Mono.CSharp
//
bool do_break_2 = (child.Type != SiblingType.Block) &&
(child.Type != SiblingType.SwitchSection);
- bool unreachable = (do_break_2 && child.Reachability.AlwaysBreaks) ||
- child.Reachability.AlwaysThrows ||
+ bool always_throws = (child.Type != SiblingType.Try) &&
+ child.Reachability.AlwaysThrows;
+ bool unreachable = always_throws ||
+ (do_break_2 && child.Reachability.AlwaysBreaks) ||
child.Reachability.AlwaysReturns ||
child.Reachability.AlwaysHasBarrier;
Report.Debug (2, " MERGING SIBLING #1", reachability,
Type, child.Type, child.Reachability.IsUnreachable,
- do_break_2, unreachable);
+ do_break_2, always_throws, unreachable);
- if (!unreachable)
+ if (!unreachable && (child.LocalVector != null))
MyBitVector.And (ref locals, child.LocalVector);
// An `out' parameter must be assigned in all branches which do
@@ -1009,10 +1064,73 @@ namespace Mono.CSharp
return result.Reachability;
}
- public virtual bool InTryBlock ()
+ //
+ // Checks whether we're in a `try' block.
+ //
+ public virtual bool InTryOrCatch (bool is_return)
+ {
+ if ((Block != null) && Block.IsDestructor)
+ return true;
+ else if (!is_return &&
+ ((Type == BranchingType.Loop) || (Type == BranchingType.Switch)))
+ return false;
+ else if (Parent != null)
+ return Parent.InTryOrCatch (is_return);
+ else
+ return false;
+ }
+
+ //
+ // Checks whether we're in a `catch' block.
+ //
+ public virtual bool InCatch ()
{
if (Parent != null)
- return Parent.InTryBlock ();
+ return Parent.InCatch ();
+ else
+ return false;
+ }
+
+ //
+ // Checks whether we're in a `finally' block.
+ //
+ public virtual bool InFinally (bool is_return)
+ {
+ if (!is_return &&
+ ((Type == BranchingType.Loop) || (Type == BranchingType.Switch)))
+ return false;
+ else if (Parent != null)
+ return Parent.InFinally (is_return);
+ else
+ return false;
+ }
+
+ public virtual bool InLoop ()
+ {
+ if (Type == BranchingType.Loop)
+ return true;
+ else if (Parent != null)
+ return Parent.InLoop ();
+ else
+ return false;
+ }
+
+ public virtual bool InSwitch ()
+ {
+ if (Type == BranchingType.Switch)
+ return true;
+ else if (Parent != null)
+ return Parent.InSwitch ();
+ else
+ return false;
+ }
+
+ public virtual bool BreakCrossesTryCatchBoundary ()
+ {
+ if ((Type == BranchingType.Loop) || (Type == BranchingType.Switch))
+ return false;
+ else if (Parent != null)
+ return Parent.BreakCrossesTryCatchBoundary ();
else
return false;
}
@@ -1021,7 +1139,7 @@ namespace Mono.CSharp
{
if (Parent != null)
Parent.AddFinallyVector (vector);
- else
+ else if ((Block == null) || !Block.IsDestructor)
throw new NotSupportedException ();
}
@@ -1083,8 +1201,8 @@ namespace Mono.CSharp
{
UsageVector sibling_list = null;
- public FlowBranchingBlock (FlowBranching parent, BranchingType type, SiblingType stype,
- Block block, Location loc)
+ public FlowBranchingBlock (FlowBranching parent, BranchingType type,
+ SiblingType stype, Block block, Location loc)
: base (parent, type, stype, block, loc)
{ }
@@ -1121,9 +1239,10 @@ namespace Mono.CSharp
UsageVector catch_vectors;
UsageVector finally_vector;
UsageVector finally_origins;
+ bool in_try;
- public FlowBranchingException (FlowBranching parent, BranchingType type, Block block, Location loc)
- : base (parent, type, SiblingType.Try, block, loc)
+ public FlowBranchingException (FlowBranching parent, Block block, Location loc)
+ : base (parent, BranchingType.Exception, SiblingType.Try, block, loc)
{ }
protected override void AddSibling (UsageVector sibling)
@@ -1131,12 +1250,15 @@ namespace Mono.CSharp
if (sibling.Type == SiblingType.Try) {
sibling.Next = catch_vectors;
catch_vectors = sibling;
+ in_try = true;
} else if (sibling.Type == SiblingType.Catch) {
sibling.Next = catch_vectors;
catch_vectors = sibling;
+ in_try = false;
} else if (sibling.Type == SiblingType.Finally) {
sibling.MergeFinallyOrigins (finally_origins);
finally_vector = sibling;
+ in_try = false;
} else
throw new InvalidOperationException ();
@@ -1147,7 +1269,22 @@ namespace Mono.CSharp
get { return current_vector; }
}
- public override bool InTryBlock ()
+ public override bool InTryOrCatch (bool is_return)
+ {
+ return finally_vector == null;
+ }
+
+ public override bool InCatch ()
+ {
+ return !in_try && (finally_vector == null);
+ }
+
+ public override bool InFinally (bool is_return)
+ {
+ return finally_vector != null;
+ }
+
+ public override bool BreakCrossesTryCatchBoundary ()
{
return true;
}
@@ -1698,22 +1835,16 @@ namespace Mono.CSharp
// <summary>
public readonly int Length;
- // <summary>
- // Type and name of all the variables.
- // Note that this is null for variables for which we do not need to compute
- // assignment info.
- // </summary>
- public readonly Type[] VariableTypes;
- public readonly string[] VariableNames;
-
VariableInfo[] map;
public VariableMap (InternalParameters ip)
{
Count = ip != null ? ip.Count : 0;
- map = new VariableInfo [Count];
- VariableNames = new string [Count];
- VariableTypes = new Type [Count];
+
+ // Dont bother allocating anything!
+ if (Count == 0)
+ return;
+
Length = 0;
for (int i = 0; i < Count; i++) {
@@ -1721,11 +1852,14 @@ namespace Mono.CSharp
if ((mod & Parameter.Modifier.OUT) == 0)
continue;
-
- VariableNames [i] = ip.ParameterName (i);
- VariableTypes [i] = TypeManager.GetElementType (ip.ParameterType (i));
-
- map [i] = new VariableInfo (VariableNames [i], VariableTypes [i], i, Length);
+
+ // Dont allocate till we find an out var.
+ if (map == null)
+ map = new VariableInfo [Count];
+
+ map [i] = new VariableInfo (ip.ParameterName (i),
+ TypeManager.GetElementType (ip.ParameterType (i)), i, Length);
+
Length += map [i].Length;
}
}
@@ -1737,21 +1871,21 @@ namespace Mono.CSharp
public VariableMap (VariableMap parent, LocalInfo[] locals)
{
int offset = 0, start = 0;
- if (parent != null) {
+ if (parent != null && parent.map != null) {
offset = parent.Length;
start = parent.Count;
}
Count = locals.Length + start;
+
+ if (Count == 0)
+ return;
+
map = new VariableInfo [Count];
- VariableNames = new string [Count];
- VariableTypes = new Type [Count];
Length = offset;
- if (parent != null) {
+ if (parent != null && parent.map != null) {
parent.map.CopyTo (map, 0);
- parent.VariableNames.CopyTo (VariableNames, 0);
- parent.VariableTypes.CopyTo (VariableTypes, 0);
}
for (int i = start; i < Count; i++) {
@@ -1760,9 +1894,6 @@ namespace Mono.CSharp
if (li.VariableType == null)
continue;
- VariableNames [i] = li.Name;
- VariableTypes [i] = li.VariableType;
-
map [i] = li.VariableInfo = new VariableInfo (li, Length);
Length += map [i].Length;
}
@@ -1774,6 +1905,9 @@ namespace Mono.CSharp
// </summary>
public VariableInfo this [int index] {
get {
+ if (map == null)
+ return null;
+
return map [index];
}
}
@@ -1968,7 +2102,7 @@ namespace Mono.CSharp
{
if (vector != null)
return;
-
+
vector = new BitArray (Count, false);
if (InheritsFrom != null)
Vector = InheritsFrom.Vector;
diff --git a/mcs/mcs/interface.cs b/mcs/mcs/interface.cs
index b50f14641c7..fc589126747 100755
--- a/mcs/mcs/interface.cs
+++ b/mcs/mcs/interface.cs
@@ -46,7 +46,6 @@ namespace Mono.CSharp {
ArrayList property_builders;
ArrayList event_builders;
- Attributes OptAttributes;
public string IndexerName;
@@ -73,10 +72,9 @@ namespace Mono.CSharp {
public Interface (NamespaceEntry ns, TypeContainer parent, string name, int mod,
Attributes attrs, Location l)
- : base (ns, parent, name, l)
+ : base (ns, parent, name, attrs, l)
{
ModFlags = Modifiers.Check (AllowedModifiers, mod, Modifiers.PRIVATE, l);
- OptAttributes = attrs;
method_builders = new ArrayList ();
property_builders = new ArrayList ();
diff --git a/mcs/mcs/iterators.cs b/mcs/mcs/iterators.cs
index 5fc7523640e..decfd4612b8 100644
--- a/mcs/mcs/iterators.cs
+++ b/mcs/mcs/iterators.cs
@@ -40,11 +40,11 @@ namespace Mono.CSharp {
public static bool CheckContext (EmitContext ec, Location loc)
{
- if (ec.InFinally){
+ if (ec.CurrentBranching.InFinally (true)){
Report.Error (-208, loc, "yield statement can not appear in finally clause");
return false;
}
- if (ec.InCatch){
+ if (ec.CurrentBranching.InCatch ()){
Report.Error (-209, loc, "yield statement can not appear in the catch clause");
return false;
}
diff --git a/mcs/mcs/namespace.cs b/mcs/mcs/namespace.cs
index aae1afefaa8..be7dfa6146b 100755
--- a/mcs/mcs/namespace.cs
+++ b/mcs/mcs/namespace.cs
@@ -8,7 +8,6 @@
//
using System;
using System.Collections;
-using Mono.Languages;
namespace Mono.CSharp {
@@ -232,11 +231,11 @@ namespace Mono.CSharp {
public class AliasEntry {
public readonly string Name;
- public readonly string Alias;
+ public readonly Expression Alias;
public readonly NamespaceEntry NamespaceEntry;
public readonly Location Location;
- public AliasEntry (NamespaceEntry entry, string name, string alias, Location loc)
+ public AliasEntry (NamespaceEntry entry, string name, Expression alias, Location loc)
{
Name = name;
Alias = alias;
@@ -252,8 +251,10 @@ namespace Mono.CSharp {
return resolved;
NamespaceEntry curr_ns = NamespaceEntry;
+
+ string alias = Alias.ToString ();
while ((curr_ns != null) && (resolved == null)) {
- resolved = curr_ns.Lookup (null, Alias, Location);
+ resolved = curr_ns.Lookup (null, alias, Location);
if (resolved == null)
curr_ns = curr_ns.Parent;
@@ -346,7 +347,7 @@ namespace Mono.CSharp {
using_clauses.Add (ue);
}
- public void UsingAlias (string alias, string namespace_or_type, Location loc)
+ public void UsingAlias (string alias, Expression namespace_or_type, Location loc)
{
if (aliases == null)
aliases = new Hashtable ();
@@ -575,7 +576,7 @@ namespace Mono.CSharp {
if (alias.Resolve () != null)
continue;
- error246 (alias.Location, alias.Alias);
+ error246 (alias.Location, alias.Alias.ToString ());
}
}
}
diff --git a/mcs/mcs/parameter.cs b/mcs/mcs/parameter.cs
index c220b951512..bbe5e526314 100755
--- a/mcs/mcs/parameter.cs
+++ b/mcs/mcs/parameter.cs
@@ -35,7 +35,7 @@ namespace Mono.CSharp {
public readonly Modifier ModFlags;
public Attributes OptAttributes;
public readonly string Name;
- public Type parameter_type;
+ Type parameter_type;
public Parameter (Expression type, string name, Modifier mod, Attributes attrs)
{
diff --git a/mcs/mcs/pending.cs b/mcs/mcs/pending.cs
index 9c5c258a097..8151c159397 100755
--- a/mcs/mcs/pending.cs
+++ b/mcs/mcs/pending.cs
@@ -67,10 +67,8 @@ namespace Mono.CSharp {
static bool IsVirtualFilter (MemberInfo m, object filterCriteria)
{
- if (!(m is MethodInfo))
- return false;
-
- return ((MethodInfo) m).IsVirtual;
+ MethodInfo mi = m as MethodInfo;
+ return (mi == null) ? false : mi.IsVirtual;
}
/// <summary>
@@ -522,21 +520,18 @@ namespace Mono.CSharp {
if (pending_implementations [i].optional)
continue;
- string extra = "";
-
- if (pending_implementations [i].found [j])
- extra = ". (method might be non-public or static)";
- Report.Error (
- 536, container.Location,
- "`" + container.Name + "' does not implement " +
- "interface member `" +
- type.FullName + "." + mi.Name + "'" + extra);
+ if (pending_implementations [i].found [j]) {
+ string[] methodLabel = TypeManager.CSharpSignature (mi).Split ('.');
+ Report.Error (536, container.Location, "'{0}' does not implement interface member '{1}'. '{2}.{3}' is either static, not public, or has the wrong return type",
+ container.Name, methodLabel, container.Name, methodLabel[methodLabel.Length - 1]);
+ }
+ else {
+ Report.Error (535, container.Location, "'{0}' does not implement interface member '{1}'",
+ container.Name, TypeManager.CSharpSignature (mi));
+ }
} else {
- Report.Error (
- 534, container.Location,
- "`" + container.Name + "' does not implement " +
- "inherited abstract member `" +
- type.FullName + "." + mi.Name + "'");
+ Report.Error (534, container.Location, "'{0}' does not implement inherited abstract member '{1}'",
+ container.Name, TypeManager.CSharpSignature (mi));
}
errors = true;
j++;
diff --git a/mcs/mcs/rootcontext.cs b/mcs/mcs/rootcontext.cs
index 11ee1664cc9..cec20b172e2 100755
--- a/mcs/mcs/rootcontext.cs
+++ b/mcs/mcs/rootcontext.cs
@@ -717,7 +717,7 @@ namespace Mono.CSharp {
//
if (global_attributes.Count > 0){
AssemblyBuilder ab = CodeGen.AssemblyBuilder;
- TypeContainer dummy = new TypeContainer (null, null, "", new Location (-1));
+ TypeContainer dummy = new TypeContainer ();
EmitContext temp_ec = new EmitContext (
dummy, Mono.CSharp.Location.Null, null, null, 0, false);
diff --git a/mcs/mcs/statement.cs b/mcs/mcs/statement.cs
index 7ab327dd645..ac17cc34935 100755
--- a/mcs/mcs/statement.cs
+++ b/mcs/mcs/statement.cs
@@ -21,14 +21,41 @@ namespace Mono.CSharp {
public abstract class Statement {
public Location loc;
- ///
- /// Resolves the statement, true means that all sub-statements
- /// did resolve ok.
- //
+ /// <summary>
+ /// Resolves the statement, true means that all sub-statements
+ /// did resolve ok.
+ // </summary>
public virtual bool Resolve (EmitContext ec)
{
return true;
}
+
+ /// <summary>
+ /// We already know that the statement is unreachable, but we still
+ /// need to resolve it to catch errors.
+ /// </summary>
+ public virtual bool ResolveUnreachable (EmitContext ec, bool warn)
+ {
+ //
+ // This conflicts with csc's way of doing this, but IMHO it's
+ // the right thing to do.
+ //
+ // If something is unreachable, we still check whether it's
+ // correct. This means that you cannot use unassigned variables
+ // in unreachable code, for instance.
+ //
+
+ ec.StartFlowBranching (FlowBranching.BranchingType.Block, loc);
+ bool ok = Resolve (ec);
+ ec.KillFlowBranching ();
+
+ if (!ok)
+ return false;
+
+ if (warn)
+ Report.Warning (162, loc, "Unreachable code detected");
+ return true;
+ }
/// <summary>
/// Return value indicates whether all code paths emitted return.
@@ -36,63 +63,29 @@ namespace Mono.CSharp {
protected abstract void DoEmit (EmitContext ec);
/// <summary>
- /// Return value indicates whether all code paths emitted return.
+ /// Utility wrapper routine for Error, just to beautify the code
/// </summary>
- public virtual void Emit (EmitContext ec)
+ public void Error (int error, string format, params object[] args)
{
- ec.Mark (loc, true);
- DoEmit (ec);
+ Error (error, String.Format (format, args));
}
-
- /// <remarks>
- /// Encapsulates the emission of a boolean test and jumping to a
- /// destination.
- ///
- /// This will emit the bool expression in `bool_expr' and if
- /// `target_is_for_true' is true, then the code will generate a
- /// brtrue to the target. Otherwise a brfalse.
- /// </remarks>
- public static void EmitBoolExpression (EmitContext ec, Expression bool_expr,
- Label target, bool target_is_for_true)
- {
- ILGenerator ig = ec.ig;
-
- bool invert = false;
- if (bool_expr is Unary){
- Unary u = (Unary) bool_expr;
-
- if (u.Oper == Unary.Operator.LogicalNot){
- invert = true;
- u.EmitLogicalNot (ec);
- }
- } else if (bool_expr is Binary){
- Binary b = (Binary) bool_expr;
-
- if (b.EmitBranchable (ec, target, target_is_for_true))
- return;
- }
-
- if (!invert)
- bool_expr.Emit (ec);
-
- if (target_is_for_true){
- if (invert)
- ig.Emit (OpCodes.Brfalse, target);
- else
- ig.Emit (OpCodes.Brtrue, target);
- } else {
- if (invert)
- ig.Emit (OpCodes.Brtrue, target);
- else
- ig.Emit (OpCodes.Brfalse, target);
- }
+ public void Error (int error, string s)
+ {
+ if (!Location.IsNull (loc))
+ Report.Error (error, loc, s);
+ else
+ Report.Error (error, s);
}
- public static void Warning_DeadCodeFound (Location loc)
+ /// <summary>
+ /// Return value indicates whether all code paths emitted return.
+ /// </summary>
+ public virtual void Emit (EmitContext ec)
{
- Report.Warning (162, loc, "Unreachable code detected");
- }
+ ec.Mark (loc, true);
+ DoEmit (ec);
+ }
}
public sealed class EmptyStatement : Statement {
@@ -144,28 +137,50 @@ namespace Mono.CSharp {
if (expr == null){
return false;
}
+
+ //
+ // Dead code elimination
+ //
+ if (expr is BoolConstant){
+ bool take = ((BoolConstant) expr).Value;
+
+ if (take){
+ if (!TrueStatement.Resolve (ec))
+ return false;
+
+ if ((FalseStatement != null) &&
+ !FalseStatement.ResolveUnreachable (ec, true))
+ return false;
+ FalseStatement = null;
+ } else {
+ if (!TrueStatement.ResolveUnreachable (ec, true))
+ return false;
+ TrueStatement = null;
+
+ if ((FalseStatement != null) &&
+ !FalseStatement.Resolve (ec))
+ return false;
+ }
+
+ return true;
+ }
ec.StartFlowBranching (FlowBranching.BranchingType.Conditional, loc);
- if (!TrueStatement.Resolve (ec)) {
- ec.KillFlowBranching ();
- return false;
- }
+ bool ok = TrueStatement.Resolve (ec);
is_true_ret = ec.CurrentBranching.CurrentUsageVector.Reachability.IsUnreachable;
ec.CurrentBranching.CreateSibling (FlowBranching.SiblingType.Conditional);
- if ((FalseStatement != null) && !FalseStatement.Resolve (ec)) {
- ec.KillFlowBranching ();
- return false;
- }
+ if ((FalseStatement != null) && !FalseStatement.Resolve (ec))
+ ok = false;
ec.EndFlowBranching ();
Report.Debug (1, "END IF BLOCK", loc);
- return true;
+ return ok;
}
protected override void DoEmit (EmitContext ec)
@@ -175,28 +190,22 @@ namespace Mono.CSharp {
Label end;
//
- // Dead code elimination
+ // If we're a boolean expression, Resolve() already
+ // eliminated dead code for us.
//
if (expr is BoolConstant){
bool take = ((BoolConstant) expr).Value;
- if (take){
- if (FalseStatement != null){
- Warning_DeadCodeFound (FalseStatement.loc);
- }
+ if (take)
TrueStatement.Emit (ec);
- return;
- } else {
- Warning_DeadCodeFound (TrueStatement.loc);
- if (FalseStatement != null) {
- FalseStatement.Emit (ec);
- return;
- }
- }
+ else if (FalseStatement != null)
+ FalseStatement.Emit (ec);
+
+ return;
}
- EmitBoolExpression (ec, expr, false_target, false);
-
+ expr.EmitBranchable (ec, false_target, false);
+
TrueStatement.Emit (ec);
if (FalseStatement != null){
@@ -235,7 +244,7 @@ namespace Mono.CSharp {
{
bool ok = true;
- ec.StartFlowBranching (FlowBranching.BranchingType.LoopBlock, loc);
+ ec.StartFlowBranching (FlowBranching.BranchingType.Loop, loc);
if (!EmbeddedStatement.Resolve (ec))
ok = false;
@@ -262,13 +271,9 @@ namespace Mono.CSharp {
Label loop = ig.DefineLabel ();
Label old_begin = ec.LoopBegin;
Label old_end = ec.LoopEnd;
- bool old_inloop = ec.InLoop;
- int old_loop_begin_try_catch_level = ec.LoopBeginTryCatchLevel;
ec.LoopBegin = ig.DefineLabel ();
ec.LoopEnd = ig.DefineLabel ();
- ec.InLoop = true;
- ec.LoopBeginTryCatchLevel = ec.TryCatchLevel;
ig.MarkLabel (loop);
EmbeddedStatement.Emit (ec);
@@ -283,21 +288,19 @@ namespace Mono.CSharp {
if (res)
ec.ig.Emit (OpCodes.Br, loop);
} else
- EmitBoolExpression (ec, expr, loop, true);
+ expr.EmitBranchable (ec, loop, true);
ig.MarkLabel (ec.LoopEnd);
- ec.LoopBeginTryCatchLevel = old_loop_begin_try_catch_level;
ec.LoopBegin = old_begin;
ec.LoopEnd = old_end;
- ec.InLoop = old_inloop;
}
}
public class While : Statement {
public Expression expr;
public readonly Statement Statement;
- bool empty, infinite;
+ bool infinite, empty;
public While (Expression boolExpr, Statement statement, Location l)
{
@@ -314,8 +317,6 @@ namespace Mono.CSharp {
if (expr == null)
return false;
- ec.StartFlowBranching (FlowBranching.BranchingType.LoopBlock, loc);
-
//
// Inform whether we are infinite or not
//
@@ -323,26 +324,21 @@ namespace Mono.CSharp {
BoolConstant bc = (BoolConstant) expr;
if (bc.Value == false){
- Warning_DeadCodeFound (Statement.loc);
+ if (!Statement.ResolveUnreachable (ec, true))
+ return false;
empty = true;
+ return true;
} else
infinite = true;
- } else {
- //
- // We are not infinite, so the loop may or may not be executed.
- //
- ec.CurrentBranching.CreateSibling (FlowBranching.SiblingType.Conditional);
}
+ ec.StartFlowBranching (FlowBranching.BranchingType.Loop, loc);
+
if (!Statement.Resolve (ec))
ok = false;
- if (empty)
- ec.KillFlowBranching ();
- else {
- ec.CurrentBranching.Infinite = infinite;
- ec.EndFlowBranching ();
- }
+ ec.CurrentBranching.Infinite = infinite;
+ ec.EndFlowBranching ();
return ok;
}
@@ -355,13 +351,9 @@ namespace Mono.CSharp {
ILGenerator ig = ec.ig;
Label old_begin = ec.LoopBegin;
Label old_end = ec.LoopEnd;
- bool old_inloop = ec.InLoop;
- int old_loop_begin_try_catch_level = ec.LoopBeginTryCatchLevel;
ec.LoopBegin = ig.DefineLabel ();
ec.LoopEnd = ig.DefineLabel ();
- ec.InLoop = true;
- ec.LoopBeginTryCatchLevel = ec.TryCatchLevel;
//
// Inform whether we are infinite or not
@@ -386,14 +378,13 @@ namespace Mono.CSharp {
ig.MarkLabel (ec.LoopBegin);
- EmitBoolExpression (ec, expr, while_loop, true);
+ expr.EmitBranchable (ec, while_loop, true);
+
ig.MarkLabel (ec.LoopEnd);
}
ec.LoopBegin = old_begin;
ec.LoopEnd = old_end;
- ec.InLoop = old_inloop;
- ec.LoopBeginTryCatchLevel = old_loop_begin_try_catch_level;
}
}
@@ -434,15 +425,20 @@ namespace Mono.CSharp {
BoolConstant bc = (BoolConstant) Test;
if (bc.Value == false){
- Warning_DeadCodeFound (Statement.loc);
+ if (!Statement.ResolveUnreachable (ec, true))
+ return false;
+ if ((Increment != null) &&
+ !Increment.ResolveUnreachable (ec, false))
+ return false;
empty = true;
+ return true;
} else
infinite = true;
}
} else
infinite = true;
- ec.StartFlowBranching (FlowBranching.BranchingType.LoopBlock, loc);
+ ec.StartFlowBranching (FlowBranching.BranchingType.Loop, loc);
if (!infinite)
ec.CurrentBranching.CreateSibling (FlowBranching.SiblingType.Conditional);
@@ -454,12 +450,8 @@ namespace Mono.CSharp {
ok = false;
}
- if (empty)
- ec.KillFlowBranching ();
- else {
- ec.CurrentBranching.Infinite = infinite;
- ec.EndFlowBranching ();
- }
+ ec.CurrentBranching.Infinite = infinite;
+ ec.EndFlowBranching ();
return ok;
}
@@ -472,8 +464,6 @@ namespace Mono.CSharp {
ILGenerator ig = ec.ig;
Label old_begin = ec.LoopBegin;
Label old_end = ec.LoopEnd;
- bool old_inloop = ec.InLoop;
- int old_loop_begin_try_catch_level = ec.LoopBeginTryCatchLevel;
Label loop = ig.DefineLabel ();
Label test = ig.DefineLabel ();
@@ -482,8 +472,6 @@ namespace Mono.CSharp {
ec.LoopBegin = ig.DefineLabel ();
ec.LoopEnd = ig.DefineLabel ();
- ec.InLoop = true;
- ec.LoopBeginTryCatchLevel = ec.TryCatchLevel;
ig.Emit (OpCodes.Br, test);
ig.MarkLabel (loop);
@@ -500,21 +488,21 @@ namespace Mono.CSharp {
//
if (Test != null){
//
- // The Resolve code already catches the case for Test == BoolConstant (false)
- // so we know that this is true
+ // The Resolve code already catches the case for
+ // Test == BoolConstant (false) so we know that
+ // this is true
//
if (Test is BoolConstant)
ig.Emit (OpCodes.Br, loop);
else
- EmitBoolExpression (ec, Test, loop, true);
+ Test.EmitBranchable (ec, loop, true);
+
} else
ig.Emit (OpCodes.Br, loop);
ig.MarkLabel (ec.LoopEnd);
ec.LoopBegin = old_begin;
ec.LoopEnd = old_end;
- ec.InLoop = old_inloop;
- ec.LoopBeginTryCatchLevel = old_loop_begin_try_catch_level;
}
}
@@ -556,24 +544,49 @@ namespace Mono.CSharp {
loc = l;
}
+ bool in_exc;
+
public override bool Resolve (EmitContext ec)
{
- if (Expr != null){
+ if (ec.ReturnType == null){
+ if (Expr != null){
+ Error (127, "Return with a value not allowed here");
+ return false;
+ }
+ } else {
+ if (Expr == null){
+ Error (126, "An object of type `{0}' is expected " +
+ "for the return statement",
+ TypeManager.CSharpName (ec.ReturnType));
+ return false;
+ }
+
Expr = Expr.Resolve (ec);
if (Expr == null)
return false;
+
+ if (Expr.Type != ec.ReturnType) {
+ Expr = Convert.ImplicitConversionRequired (
+ ec, Expr, ec.ReturnType, loc);
+ if (Expr == null)
+ return false;
+ }
}
if (ec.InIterator){
- Report.Error (-206, loc, "Return statement not allowed inside iterators");
+ Error (-206, "Return statement not allowed inside iterators");
return false;
}
FlowBranching.UsageVector vector = ec.CurrentBranching.CurrentUsageVector;
- if (ec.CurrentBranching.InTryBlock ())
+ if (ec.CurrentBranching.InTryOrCatch (true)) {
ec.CurrentBranching.AddFinallyVector (vector);
- else
+ in_exc = true;
+ } else if (ec.CurrentBranching.InFinally (true)) {
+ Error (157, "Control can not leave the body of the finally block");
+ return false;
+ } else
vector.CheckOutParameters (ec.CurrentBranching);
ec.CurrentBranching.CurrentUsageVector.Return ();
@@ -582,46 +595,25 @@ namespace Mono.CSharp {
protected override void DoEmit (EmitContext ec)
{
- if (ec.InFinally){
- Report.Error (157, loc, "Control can not leave the body of the finally block");
- return;
- }
-
- if (ec.ReturnType == null){
- if (Expr != null){
- Report.Error (127, loc, "Return with a value not allowed here");
- return;
- }
- } else {
- if (Expr == null){
- Report.Error (126, loc, "An object of type `" +
- TypeManager.CSharpName (ec.ReturnType) + "' is " +
- "expected for the return statement");
- return;
- }
-
- if (Expr.Type != ec.ReturnType)
- Expr = Convert.ImplicitConversionRequired (
- ec, Expr, ec.ReturnType, loc);
-
- if (Expr == null)
- return;
-
+ if (Expr != null) {
Expr.Emit (ec);
- if (ec.InTry || ec.InCatch)
+ if (in_exc || !ec.IsLastStatement)
ec.ig.Emit (OpCodes.Stloc, ec.TemporaryReturn ());
}
- if (ec.InTry || ec.InCatch) {
- if (!ec.HasReturnLabel) {
- ec.ReturnLabel = ec.ig.DefineLabel ();
- ec.HasReturnLabel = true;
- }
+ if (in_exc) {
+ ec.NeedReturnLabel ();
ec.ig.Emit (OpCodes.Leave, ec.ReturnLabel);
- } else {
+ } else if (ec.IsLastStatement) {
+ // If we are the last statement in a top-level block, simply
+ // emit a `ret'.
ec.ig.Emit (OpCodes.Ret);
- ec.NeedExplicitReturn = false;
+ } else {
+ // Otherwise, we always create a return label and jump to
+ // it.
+ ec.NeedReturnLabel ();
+ ec.ig.Emit (OpCodes.Br, ec.ReturnLabel);
}
}
}
@@ -828,6 +820,9 @@ namespace Mono.CSharp {
public override bool Resolve (EmitContext ec)
{
+ bool in_catch = ec.CurrentBranching.InCatch ();
+ ec.CurrentBranching.CurrentUsageVector.Throw ();
+
if (expr != null){
expr = expr.Resolve (ec);
if (expr == null)
@@ -846,34 +841,30 @@ namespace Mono.CSharp {
if ((t != TypeManager.exception_type) &&
!t.IsSubclassOf (TypeManager.exception_type) &&
!(expr is NullLiteral)) {
- Report.Error (155, loc,
- "The type caught or thrown must be derived " +
- "from System.Exception");
+ Error (155,
+ "The type caught or thrown must be derived " +
+ "from System.Exception");
return false;
}
+ } else if (!in_catch) {
+ Error (156,
+ "A throw statement with no argument is only " +
+ "allowed in a catch clause");
+ return false;
}
- ec.CurrentBranching.CurrentUsageVector.Throw ();
return true;
}
protected override void DoEmit (EmitContext ec)
{
- if (expr == null){
- if (ec.InCatch)
- ec.ig.Emit (OpCodes.Rethrow);
- else {
- Report.Error (
- 156, loc,
- "A throw statement with no argument is only " +
- "allowed in a catch clause");
- }
- return;
- }
-
- expr.Emit (ec);
+ if (expr == null)
+ ec.ig.Emit (OpCodes.Rethrow);
+ else {
+ expr.Emit (ec);
- ec.ig.Emit (OpCodes.Throw);
+ ec.ig.Emit (OpCodes.Throw);
+ }
}
}
@@ -884,8 +875,21 @@ namespace Mono.CSharp {
loc = l;
}
+ bool crossing_exc;
+
public override bool Resolve (EmitContext ec)
{
+ if (!ec.CurrentBranching.InLoop () && !ec.CurrentBranching.InSwitch ()){
+ Error (139, "No enclosing loop or switch to continue to");
+ return false;
+ } else if (ec.CurrentBranching.InFinally (false)) {
+ Error (157, "Control can not leave the body of the finally block");
+ return false;
+ } else if (ec.CurrentBranching.InTryOrCatch (false))
+ ec.CurrentBranching.AddFinallyVector (ec.CurrentBranching.CurrentUsageVector);
+
+ crossing_exc = ec.CurrentBranching.BreakCrossesTryCatchBoundary ();
+
ec.CurrentBranching.CurrentUsageVector.Break ();
return true;
}
@@ -894,15 +898,12 @@ namespace Mono.CSharp {
{
ILGenerator ig = ec.ig;
- if (ec.InLoop == false && ec.Switch == null){
- Report.Error (139, loc, "No enclosing loop or switch to continue to");
- return;
- }
-
- if (ec.InTry || ec.InCatch)
+ if (crossing_exc)
ig.Emit (OpCodes.Leave, ec.LoopEnd);
- else
+ else {
+ ec.NeedReturnLabel ();
ig.Emit (OpCodes.Br, ec.LoopEnd);
+ }
}
}
@@ -913,8 +914,21 @@ namespace Mono.CSharp {
loc = l;
}
+ bool crossing_exc;
+
public override bool Resolve (EmitContext ec)
{
+ if (!ec.CurrentBranching.InLoop () && !ec.CurrentBranching.InSwitch ()){
+ Error (139, "No enclosing loop to continue to");
+ return false;
+ } else if (ec.CurrentBranching.InFinally (false)) {
+ Error (157, "Control can not leave the body of the finally block");
+ return false;
+ } else if (ec.CurrentBranching.InTryOrCatch (false))
+ ec.CurrentBranching.AddFinallyVector (ec.CurrentBranching.CurrentUsageVector);
+
+ crossing_exc = ec.CurrentBranching.BreakCrossesTryCatchBoundary ();
+
ec.CurrentBranching.CurrentUsageVector.Goto ();
return true;
}
@@ -923,26 +937,8 @@ namespace Mono.CSharp {
{
Label begin = ec.LoopBegin;
- if (!ec.InLoop){
- Report.Error (139, loc, "No enclosing loop to continue to");
- return;
- }
-
- //
- // UGH: Non trivial. This Br might cross a try/catch boundary
- // How can we tell?
- //
- // while () {
- // try { ... } catch { continue; }
- // }
- //
- // From:
- // try {} catch { while () { continue; }}
- //
- if (ec.TryCatchLevel > ec.LoopBeginTryCatchLevel)
+ if (crossing_exc)
ec.ig.Emit (OpCodes.Leave, begin);
- else if (ec.TryCatchLevel < ec.LoopBeginTryCatchLevel)
- throw new Exception ("Should never happen");
else
ec.ig.Emit (OpCodes.Br, begin);
}
@@ -1074,6 +1070,9 @@ namespace Mono.CSharp {
///
/// Implicit blocks are used as labels or to introduce variable
/// declarations.
+ ///
+ /// Top-level blocks derive from Block, and they are called ToplevelBlock
+ /// they contain extra information that is not necessary on normal blocks.
/// </remarks>
public class Block : Statement {
public readonly Block Parent;
@@ -1086,7 +1085,8 @@ namespace Mono.CSharp {
Unchecked = 2,
BlockUsed = 4,
VariablesInitialized = 8,
- HasRet = 16
+ HasRet = 16,
+ IsDestructor = 32
}
Flags flags;
@@ -1109,6 +1109,7 @@ namespace Mono.CSharp {
// The statements in this block
//
ArrayList statements;
+ int num_statements;
//
// An array of Blocks. We keep track of children just
@@ -1526,6 +1527,17 @@ namespace Mono.CSharp {
}
}
+ public bool IsDestructor {
+ get {
+ return (flags & Flags.IsDestructor) != 0;
+ }
+ }
+
+ public void SetDestructor ()
+ {
+ flags |= Flags.IsDestructor;
+ }
+
VariableMap param_map, local_map;
public VariableMap ParameterMap {
@@ -1705,12 +1717,13 @@ namespace Mono.CSharp {
int statement_count = statements.Count;
for (int ix = 0; ix < statement_count; ix++){
Statement s = (Statement) statements [ix];
-
+
if (unreachable && !(s is LabeledStatement)) {
- if (!warning_shown && s != EmptyStatement.Value) {
+ if (!s.ResolveUnreachable (ec, !warning_shown))
+ ok = false;
+
+ if (s != EmptyStatement.Value)
warning_shown = true;
- Warning_DeadCodeFound (s.loc);
- }
statements [ix] = EmptyStatement.Value;
continue;
@@ -1722,13 +1735,16 @@ namespace Mono.CSharp {
continue;
}
+ num_statements = ix + 1;
+
if (s is LabeledStatement)
unreachable = false;
else
unreachable = ec.CurrentBranching.CurrentUsageVector.Reachability.IsUnreachable;
}
- Report.Debug (4, "RESOLVE BLOCK DONE", StartLocation, ec.CurrentBranching);
+ Report.Debug (4, "RESOLVE BLOCK DONE", StartLocation,
+ ec.CurrentBranching, statement_count, num_statements);
FlowBranching.UsageVector vector = ec.DoEndFlowBranching ();
@@ -1766,9 +1782,17 @@ namespace Mono.CSharp {
protected override void DoEmit (EmitContext ec)
{
- int statement_count = statements.Count;
- for (int ix = 0; ix < statement_count; ix++){
+ for (int ix = 0; ix < num_statements; ix++){
Statement s = (Statement) statements [ix];
+
+ // Check whether we are the last statement in a
+ // top-level block.
+
+ if ((Parent == null) && (ix+1 == num_statements))
+ ec.IsLastStatement = true;
+ else
+ ec.IsLastStatement = false;
+
s.Emit (ec);
}
}
@@ -1810,6 +1834,20 @@ namespace Mono.CSharp {
}
}
+ //
+ //
+ public class ToplevelBlock : Block {
+ public ToplevelBlock (Parameters parameters, Location start) :
+ base (null, parameters, start, Location.Null)
+ {
+ }
+
+ public ToplevelBlock (Flags flags, Parameters parameters, Location start) :
+ base (null, flags, parameters, start, Location.Null)
+ {
+ }
+ }
+
public class SwitchLabel {
Expression label;
object converted;
@@ -2542,6 +2580,7 @@ namespace Mono.CSharp {
ec.Switch = this;
ec.Switch.SwitchType = SwitchType;
+ Report.Debug (1, "START OF SWITCH BLOCK", loc, ec.CurrentBranching);
ec.StartFlowBranching (FlowBranching.BranchingType.Switch, loc);
bool first = true;
@@ -2559,9 +2598,12 @@ namespace Mono.CSharp {
if (!got_default)
ec.CurrentBranching.CreateSibling (FlowBranching.SiblingType.SwitchSection);
- ec.EndFlowBranching ();
+ FlowBranching.Reachability reachability = ec.EndFlowBranching ();
ec.Switch = old_switch;
+ Report.Debug (1, "END OF SWITCH BLOCK", loc, ec.CurrentBranching,
+ reachability);
+
return true;
}
@@ -2616,20 +2658,27 @@ namespace Mono.CSharp {
public override bool Resolve (EmitContext ec)
{
expr = expr.Resolve (ec);
- return Statement.Resolve (ec) && expr != null;
+ if (expr == null)
+ return false;
+
+ if (expr.Type.IsValueType){
+ Error (185, "lock statement requires the expression to be " +
+ " a reference type (type is: `{0}'",
+ TypeManager.CSharpName (expr.Type));
+ return false;
+ }
+
+ ec.StartFlowBranching (FlowBranching.BranchingType.Exception, loc);
+ bool ok = Statement.Resolve (ec);
+ ec.EndFlowBranching ();
+
+ return ok;
}
protected override void DoEmit (EmitContext ec)
{
Type type = expr.Type;
- if (type.IsValueType){
- Report.Error (185, loc, "lock statement requires the expression to be " +
- " a reference type (type is: `" +
- TypeManager.CSharpName (type) + "'");
- return;
- }
-
ILGenerator ig = ec.ig;
LocalBuilder temp = ig.DeclareLocal (type);
@@ -2640,11 +2689,8 @@ namespace Mono.CSharp {
// try
ig.BeginExceptionBlock ();
- bool old_in_try = ec.InTry;
- ec.InTry = true;
Label finish = ig.DefineLabel ();
Statement.Emit (ec);
- ec.InTry = old_in_try;
// ig.Emit (OpCodes.Leave, finish);
ig.MarkLabel (finish);
@@ -2827,6 +2873,11 @@ namespace Mono.CSharp {
// is present, so we need to test for this particular case.
//
+ if (e is Cast){
+ Report.Error (254, loc, "Cast expression not allowed as right hand expression in fixed statement");
+ return false;
+ }
+
//
// Case 1: & object.
//
@@ -2911,7 +2962,21 @@ namespace Mono.CSharp {
data [i].converted = null;
data [i].vi = vi;
i++;
+ continue;
+ }
+
+ //
+ // For other cases, flag a `this is already fixed expression'
+ //
+ if (e is LocalVariableReference || e is ParameterReference ||
+ Convert.ImplicitConversionExists (ec, e, vi.VariableType)){
+
+ Report.Error (245, loc, "right hand expression is already fixed, no need to use fixed statement ");
+ return false;
}
+
+ Report.Error (245, loc, "Fixed statement only allowed on strings, arrays or address-of expressions");
+ return false;
}
ec.StartFlowBranching (FlowBranching.BranchingType.Conditional, loc);
@@ -3087,14 +3152,9 @@ namespace Mono.CSharp {
Report.Debug (1, "START OF TRY BLOCK", Block.StartLocation);
- bool old_in_try = ec.InTry;
- ec.InTry = true;
-
if (!Block.Resolve (ec))
ok = false;
- ec.InTry = old_in_try;
-
FlowBranching.UsageVector vector = ec.CurrentBranching.CurrentUsageVector;
Report.Debug (1, "START OF CATCH BLOCKS", vector);
@@ -3111,13 +3171,8 @@ namespace Mono.CSharp {
vi.VariableInfo = null;
}
- bool old_in_catch = ec.InCatch;
- ec.InCatch = true;
-
if (!c.Resolve (ec))
ok = false;
-
- ec.InCatch = old_in_catch;
}
Report.Debug (1, "END OF CATCH BLOCKS", ec.CurrentBranching);
@@ -3126,13 +3181,8 @@ namespace Mono.CSharp {
ec.CurrentBranching.CreateSibling (FlowBranching.SiblingType.Catch);
Report.Debug (1, "STARTED SIBLING FOR GENERAL", ec.CurrentBranching);
- bool old_in_catch = ec.InCatch;
- ec.InCatch = true;
-
if (!General.Resolve (ec))
ok = false;
-
- ec.InCatch = old_in_catch;
}
Report.Debug (1, "END OF GENERAL CATCH BLOCKS", ec.CurrentBranching);
@@ -3142,13 +3192,8 @@ namespace Mono.CSharp {
ec.CurrentBranching.CreateSibling (FlowBranching.SiblingType.Finally);
Report.Debug (1, "STARTED SIBLING FOR FINALLY", ec.CurrentBranching, vector);
- bool old_in_finally = ec.InFinally;
- ec.InFinally = true;
-
if (!Fini.Resolve (ec))
ok = false;
-
- ec.InFinally = old_in_finally;
}
FlowBranching.Reachability reachability = ec.EndFlowBranching ();
@@ -3162,7 +3207,7 @@ namespace Mono.CSharp {
// to the end of the finally block. This is a problem if `returns'
// is true since we may jump to a point after the end of the method.
// As a workaround, emit an explicit ret here.
- ec.NeedExplicitReturn = true;
+ ec.NeedReturnLabel ();
}
return ok;
@@ -3173,20 +3218,13 @@ namespace Mono.CSharp {
ILGenerator ig = ec.ig;
Label finish = ig.DefineLabel ();;
- ec.TryCatchLevel++;
ig.BeginExceptionBlock ();
- bool old_in_try = ec.InTry;
- ec.InTry = true;
Block.Emit (ec);
- ec.InTry = old_in_try;
//
// System.Reflection.Emit provides this automatically:
// ig.Emit (OpCodes.Leave, finish);
- bool old_in_catch = ec.InCatch;
- ec.InCatch = true;
-
foreach (Catch c in Specific){
LocalInfo vi;
@@ -3209,19 +3247,14 @@ namespace Mono.CSharp {
ig.Emit (OpCodes.Pop);
General.Block.Emit (ec);
}
- ec.InCatch = old_in_catch;
ig.MarkLabel (finish);
if (Fini != null){
ig.BeginFinallyBlock ();
- bool old_in_finally = ec.InFinally;
- ec.InFinally = true;
Fini.Emit (ec);
- ec.InFinally = old_in_finally;
}
ig.EndExceptionBlock ();
- ec.TryCatchLevel--;
}
}
@@ -3319,18 +3352,13 @@ namespace Mono.CSharp {
ILGenerator ig = ec.ig;
int i = 0;
- bool old_in_try = ec.InTry;
- ec.InTry = true;
for (i = 0; i < assign.Length; i++) {
assign [i].EmitStatement (ec);
ig.BeginExceptionBlock ();
}
Statement.Emit (ec);
- ec.InTry = old_in_try;
- bool old_in_finally = ec.InFinally;
- ec.InFinally = true;
var_list.Reverse ();
foreach (DictionaryEntry e in var_list){
LocalVariableReference var = (LocalVariableReference) e.Key;
@@ -3338,15 +3366,42 @@ namespace Mono.CSharp {
i--;
ig.BeginFinallyBlock ();
-
- var.Emit (ec);
- ig.Emit (OpCodes.Brfalse, skip);
- converted_vars [i].Emit (ec);
- ig.Emit (OpCodes.Callvirt, TypeManager.void_dispose_void);
+
+ if (!var.Type.IsValueType) {
+ var.Emit (ec);
+ ig.Emit (OpCodes.Brfalse, skip);
+ converted_vars [i].Emit (ec);
+ ig.Emit (OpCodes.Callvirt, TypeManager.void_dispose_void);
+ } else {
+ Expression ml = Expression.MemberLookup(ec, typeof(IDisposable), var.Type, "Dispose", Mono.CSharp.Location.Null);
+
+ if (!(ml is MethodGroupExpr)) {
+ var.Emit (ec);
+ ig.Emit (OpCodes.Box, var.Type);
+ ig.Emit (OpCodes.Callvirt, TypeManager.void_dispose_void);
+ } else {
+ MethodInfo mi = null;
+
+ foreach (MethodInfo mk in ((MethodGroupExpr) ml).Methods) {
+ if (mk.GetParameters().Length == 0) {
+ mi = mk;
+ break;
+ }
+ }
+
+ if (mi == null) {
+ Report.Error(-100, Mono.CSharp.Location.Null, "Internal error: No Dispose method which takes 0 parameters.");
+ return false;
+ }
+
+ var.AddressOf (ec, AddressOp.Load);
+ ig.Emit (OpCodes.Call, mi);
+ }
+ }
+
ig.MarkLabel (skip);
ig.EndExceptionBlock ();
}
- ec.InFinally = old_in_finally;
return false;
}
@@ -3364,21 +3419,16 @@ namespace Mono.CSharp {
expr.Emit (ec);
ig.Emit (OpCodes.Stloc, local_copy);
- bool old_in_try = ec.InTry;
- ec.InTry = true;
ig.BeginExceptionBlock ();
Statement.Emit (ec);
- ec.InTry = old_in_try;
Label skip = ig.DefineLabel ();
- bool old_in_finally = ec.InFinally;
ig.BeginFinallyBlock ();
ig.Emit (OpCodes.Ldloc, local_copy);
ig.Emit (OpCodes.Brfalse, skip);
ig.Emit (OpCodes.Ldloc, local_copy);
ig.Emit (OpCodes.Callvirt, TypeManager.void_dispose_void);
ig.MarkLabel (skip);
- ec.InFinally = old_in_finally;
ig.EndExceptionBlock ();
return false;
@@ -3406,7 +3456,7 @@ namespace Mono.CSharp {
return false;
}
- ec.StartFlowBranching (FlowBranching.BranchingType.Block, loc);
+ ec.StartFlowBranching (FlowBranching.BranchingType.Exception, loc);
bool ok = Statement.Resolve (ec);
@@ -3422,7 +3472,7 @@ namespace Mono.CSharp {
// to the end of the finally block. This is a problem if `returns'
// is true since we may jump to a point after the end of the method.
// As a workaround, emit an explicit ret here.
- ec.NeedExplicitReturn = true;
+ ec.NeedReturnLabel ();
}
return true;
@@ -3501,7 +3551,9 @@ namespace Mono.CSharp {
empty = new EmptyExpression (hm.element_type);
}
- ec.StartFlowBranching (FlowBranching.BranchingType.LoopBlock, loc);
+ bool ok = true;
+
+ ec.StartFlowBranching (FlowBranching.BranchingType.Loop, loc);
ec.CurrentBranching.CreateSibling (FlowBranching.SiblingType.Conditional);
//
@@ -3514,18 +3566,25 @@ namespace Mono.CSharp {
//
conv = Convert.ExplicitConversion (ec, empty, var_type, loc);
if (conv == null)
- return false;
+ ok = false;
variable = variable.ResolveLValue (ec, empty);
if (variable == null)
- return false;
+ ok = false;
+
+ bool disposable = (hm != null) && hm.is_disposable;
+ if (disposable)
+ ec.StartFlowBranching (FlowBranching.BranchingType.Exception, loc);
if (!statement.Resolve (ec))
- return false;
+ ok = false;
+
+ if (disposable)
+ ec.EndFlowBranching ();
ec.EndFlowBranching ();
- return true;
+ return ok;
}
//
@@ -3811,12 +3870,8 @@ namespace Mono.CSharp {
// Protect the code in a try/finalize block, so that
// if the beast implement IDisposable, we get rid of it
//
- bool old_in_try = ec.InTry;
-
- if (hm.is_disposable) {
+ if (hm.is_disposable)
ig.BeginExceptionBlock ();
- ec.InTry = true;
- }
Label end_try = ig.DefineLabel ();
@@ -3839,7 +3894,6 @@ namespace Mono.CSharp {
statement.Emit (ec);
ig.Emit (OpCodes.Br, ec.LoopBegin);
ig.MarkLabel (end_try);
- ec.InTry = old_in_try;
// The runtime provides this for us.
// ig.Emit (OpCodes.Leave, end);
@@ -3849,8 +3903,6 @@ namespace Mono.CSharp {
//
if (hm.is_disposable) {
Label end_finally = ig.DefineLabel ();
- bool old_in_finally = ec.InFinally;
- ec.InFinally = true;
ig.BeginFinallyBlock ();
disposable.EmitThis ();
@@ -3864,7 +3916,6 @@ namespace Mono.CSharp {
disposable.EmitLoad ();
ig.Emit (OpCodes.Callvirt, TypeManager.void_dispose_void);
ig.MarkLabel (end_finally);
- ec.InFinally = old_in_finally;
// The runtime generates this anyways.
// ig.Emit (OpCodes.Endfinally);
@@ -4034,12 +4085,8 @@ namespace Mono.CSharp {
ILGenerator ig = ec.ig;
Label old_begin = ec.LoopBegin, old_end = ec.LoopEnd;
- bool old_inloop = ec.InLoop;
- int old_loop_begin_try_catch_level = ec.LoopBeginTryCatchLevel;
ec.LoopBegin = ig.DefineLabel ();
ec.LoopEnd = ig.DefineLabel ();
- ec.InLoop = true;
- ec.LoopBeginTryCatchLevel = ec.TryCatchLevel;
if (hm != null)
EmitCollectionForeach (ec);
@@ -4048,8 +4095,6 @@ namespace Mono.CSharp {
ec.LoopBegin = old_begin;
ec.LoopEnd = old_end;
- ec.InLoop = old_inloop;
- ec.LoopBeginTryCatchLevel = old_loop_begin_try_catch_level;
}
}
}
diff --git a/mcs/mcs/tree.cs b/mcs/mcs/tree.cs
index 0f3a2d9244a..17059c13658 100755
--- a/mcs/mcs/tree.cs
+++ b/mcs/mcs/tree.cs
@@ -45,7 +45,7 @@ namespace Mono.CSharp
public Tree ()
{
- root_types = new TypeContainer (null, null, "", new Location (-1));
+ root_types = new TypeContainer ();
decls = new Hashtable ();
namespaces = new Hashtable ();
diff --git a/mcs/mcs/typemanager.cs b/mcs/mcs/typemanager.cs
index 1423a2ce643..b48a70ebfeb 100755
--- a/mcs/mcs/typemanager.cs
+++ b/mcs/mcs/typemanager.cs
@@ -513,6 +513,11 @@ public class TypeManager {
/// </summary>
public static void AddAssembly (Assembly a)
{
+ foreach (Assembly assembly in assemblies) {
+ if (a == assembly)
+ return;
+ }
+
int top = assemblies.Length;
Assembly [] n = new Assembly [top + 1];
@@ -797,6 +802,29 @@ public class TypeManager {
}
/// <summary>
+ /// Returns the signature of the method with full namespace classification
+ /// </summary>
+ static public string GetFullNameSignature (MemberInfo mi)
+ {
+ return mi.DeclaringType.FullName.Replace ('+', '.') + '.' + mi.Name;
+ }
+
+ /// <summary>
+ /// Returns the signature of the property and indexer
+ /// </summary>
+ static public string CSharpSignature (PropertyBuilder pb, bool is_indexer)
+ {
+ if (!is_indexer) {
+ return GetFullNameSignature (pb);
+ }
+
+ MethodBase mb = pb.GetSetMethod (true) != null ? pb.GetSetMethod (true) : pb.GetGetMethod (true);
+ string signature = GetFullNameSignature (mb);
+ string arg = TypeManager.LookupParametersByBuilder (mb).ParameterDesc (0);
+ return String.Format ("{0}.this[{1}]", signature.Substring (0, signature.LastIndexOf ('.')), arg);
+ }
+
+ /// <summary>
/// Returns the signature of the method
/// </summary>
static public string CSharpSignature (MethodBase mb)
@@ -822,7 +850,7 @@ public class TypeManager {
}
sig += ")";
- return mb.DeclaringType.Name + "." + mb.Name + sig;
+ return GetFullNameSignature (mb) + sig;
}
/// <summary>
@@ -1979,15 +2007,15 @@ public class TypeManager {
if (t is TypeBuilder) {
// slow path needed to compile corlib
if (t == TypeManager.bool_type ||
- t == TypeManager.byte_type ||
- t == TypeManager.sbyte_type ||
- t == TypeManager.char_type ||
- t == TypeManager.short_type ||
- t == TypeManager.ushort_type ||
- t == TypeManager.int32_type ||
- t == TypeManager.uint32_type ||
- t == TypeManager.int64_type ||
- t == TypeManager.uint64_type)
+ t == TypeManager.byte_type ||
+ t == TypeManager.sbyte_type ||
+ t == TypeManager.char_type ||
+ t == TypeManager.short_type ||
+ t == TypeManager.ushort_type ||
+ t == TypeManager.int32_type ||
+ t == TypeManager.uint32_type ||
+ t == TypeManager.int64_type ||
+ t == TypeManager.uint64_type)
return t;
throw new Exception ("Unhandled typecode in enum " + " from " + t.AssemblyQualifiedName);
}
diff --git a/mcs/monoresgen/.cvsignore b/mcs/monoresgen/.cvsignore
new file mode 100755
index 00000000000..a5044e196b9
--- /dev/null
+++ b/mcs/monoresgen/.cvsignore
@@ -0,0 +1 @@
+monoresgen.pdb
diff --git a/mcs/monoresgen/ChangeLog b/mcs/monoresgen/ChangeLog
index bd0c5bfc3e0..ec51c922397 100755
--- a/mcs/monoresgen/ChangeLog
+++ b/mcs/monoresgen/ChangeLog
@@ -1,3 +1,8 @@
+2004-01-12 Miguel de Icaza <miguel@ximian.com>
+
+ * monoresgen.cs (PoResourceWriter.AddResource): Escape strings,
+ fixes #52105
+
2003-12-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* monoresgen.cs: ignore entries marked as 'fuzzy' in .po files.
diff --git a/mcs/monoresgen/monoresgen.cs b/mcs/monoresgen/monoresgen.cs
index 6f126392f30..85078b6497e 100755
--- a/mcs/monoresgen/monoresgen.cs
+++ b/mcs/monoresgen/monoresgen.cs
@@ -15,6 +15,7 @@
*/
using System;
+using System.Text;
using System.IO;
using System.Collections;
using System.Resources;
@@ -406,6 +407,36 @@ class PoResourceWriter : IResourceWriter
}
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)
{
@@ -414,9 +445,9 @@ class PoResourceWriter : IResourceWriter
WriteHeader ();
}
- s.WriteLine ("msgid \"{0}\"", name);
- s.WriteLine ("msgstr \"{0}\"", value);
- s.WriteLine ();
+ s.WriteLine ("msgid \"{0}\"", Escape (name));
+ s.WriteLine ("msgstr \"{0}\"", Escape (value));
+ s.WriteLine ("");
}
void WriteHeader ()
diff --git a/mcs/tests/2test-5.cs b/mcs/tests/2test-5.cs
new file mode 100644
index 00000000000..e7c77f74c8b
--- /dev/null
+++ b/mcs/tests/2test-5.cs
@@ -0,0 +1,22 @@
+//
+// Anonymous method group conversions
+//
+
+class X {
+ delegate void T ();
+ static event T Click;
+
+ static void Method ()
+ {
+ }
+
+ static void Main ()
+ {
+ T t;
+
+ // Method group assignment
+ t = Method;
+
+ Click += Method;
+ }
+}
diff --git a/mcs/tests/ChangeLog b/mcs/tests/ChangeLog
index 55789d7cd87..e6ec3c87da9 100755
--- a/mcs/tests/ChangeLog
+++ b/mcs/tests/ChangeLog
@@ -1,3 +1,48 @@
+2004-01-26 Martin Baulig <martin@ximian.com>
+
+ * gen-37.cs: New generics test.
+
+2004-01-21 Martin Baulig <martin@ximian.com>
+
+ * test-227.cs: New test for #52517.
+
+2004-01-20 Martin Baulig <martin@ximian.com>
+
+ * test-154.cs: Added testcase for bug #46640.
+
+2004-01-20 Martin Baulig <martin@ximian.com>
+
+ * test-226.cs: New test for #53058.
+
+2004-01-20 Martin Baulig <martin@ximian.com>
+
+ * verify-8.cs: New test for #52707.
+
+2004-01-05 Marek Safar <marek.safar@seznam.cz>
+
+ * cls-test-0.cs, cls-test-1.cs, cls-test-2.cs, cls-test-3.cs,
+ cls-test-5.cs, cls-test-6.cs, cls-test-7.cs, cls-test-10.cs,
+ cls-test-11.cs, cls-test-14.cs, cls-test-15.cs, cls-test-16.cs:
+ New tests for CLS-compliant
+
+2004-01-03 Todd Berman <tberman@gentoo.org>
+
+ * test-224.cs: new test for #52429
+
+2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
+
+ * test-205.cs: remove from the build. This does
+ not compile under csc.
+
+2004-01-03 Ben Maurer <bmaurer@users.sourceforge.net>
+
+ * test-223.cs: test for #52569.
+
+2004-01-02 Ravi Pratap <ravi@ximian.com>
+
+ * test-222.cs: Overload resolution test for bugzilla
+ bug #52046.
+
2003-12-25 Ben Maurer <bmaurer@users.sourceforge.net>
* test-141.cs: add tests for #38674.
diff --git a/mcs/tests/Makefile b/mcs/tests/Makefile
index 6064dbfea35..42172e8d273 100644
--- a/mcs/tests/Makefile
+++ b/mcs/tests/Makefile
@@ -23,7 +23,7 @@ TEST_SOURCES = \
test-71 test-72 test-73 test-74 test-75 test-76 test-77 test-78 test-79 test-80 \
test-81 test-82 test-83 test-84 test-85 test-86 test-87 test-88 test-89 test-90 \
test-91 test-92 test-93 test-94 test-95 test-96 test-97 test-98 test-99 test-100\
- test-101 test-102 test-103 test-104 test-105 test-106 test-107 test-108 test-109 test-110\
+ test-101 test-102 test-103 test-104 test-106 test-107 test-108 test-109 test-110\
test-111 test-112 test-113 test-114 test-115 test-116 test-117 test-118 test-119 \
test-121 test-122 test-123 test-125 test-126 test-127 test-128 test-129 test-130 \
test-131 test-134 test-135 test-136 test-137 test-138 test-139 test-140 \
@@ -35,13 +35,15 @@ TEST_SOURCES = \
test-191 test-192 test-193 test-194 test-195 test-196 test-197 test-198 test-199 test-200 \
test-201 test-202 test-203 test-204 test-205 test-206 test-207 test-208 test-209 test-210 \
test-211 test-212 test-213 test-214 test-215 test-216 test-217 test-218 test-219 test-220 \
- test-221
+ test-221 test-222 test-223 test-224 test-225 test-226 test-227 \
+ cls-test-0 cls-test-1 cls-test-2 cls-test-3 cls-test-5 cls-test-6 cls-test-7 cls-test-10 \
+ cls-test-11 cls-test-14 cls-test-15 cls-test-16
#
# C# 2.0 tests
#
TEST2_SOURCES = \
- 2test-1 2test-2 2test-3 2test-4
+ 2test-1 2test-2 2test-3 2test-4 2test-5
UNSAFE_SOURCES = \
unsafe-1 unsafe-2 unsafe-3 test-58 test-171 unsafe-5 unsafe-6
@@ -85,7 +87,7 @@ test-casts: boot-casts.out mcs-casts.out
test-local:
-run-test-local: test-compiler-jit test-unsafe-compiler-jit test-casts
+run-test-local: test-compiler-jit test-unsafe-compiler-jit test-casts test-2
clean-local:
rm -f *.exe *.netmodule *.out *.pdb casts.cs
diff --git a/mcs/tests/README.tests b/mcs/tests/README.tests
index 422fb7c3508..4b2910c4f53 100644
--- a/mcs/tests/README.tests
+++ b/mcs/tests/README.tests
@@ -35,7 +35,7 @@ Test cases listed by Category:
* Invocation and Casts
- test-153.cs test-163.c test-207.cs test-210.cs test-211.cs
+ test-153.cs test-163.c test-207.cs test-210.cs test-211.cs test-223.cs
* Flow Analysis
@@ -68,6 +68,11 @@ Test cases listed by Category:
Test cases listed by Number:
============================
+test-91.cs
+----------
+
+Tests various permissions sets based on the visiblity flags.
+
test-146.cs
-----------
Test for Binary.EmitBrancheable() to ensure we're emitting correct
@@ -408,6 +413,20 @@ test-221.cs:
------------
Test for correct scanning for base properties.
+test-222.cs:
+------------
+Compilation test to check overload resolution. We should prefer int->uint over int->ulong.
+
+test-223.cs:
+------------
+This tests that conversions from Enum and ValueType to structs
+are treated as unboxing conversions, and the `unbox' opcode
+is emitted. #52569.
+
+test-224.cs:
+------------
+This tests the compilation of attributes with array parameters.
+
verify-1.cs
-----------
Test whether we do not jump out of the method in a Try/Finally block.
@@ -490,3 +509,23 @@ gen-15.cs:
----------
Generic methods.
+
+2test-1.cs
+----------
+C# 2.0 Iterators: Enumerator and Enumerable with foreach
+
+2test-2.cs
+----------
+C# 2.0 Iterators: Obtaining the enumerator manually
+
+2test-3.cs
+----------
+C# 2.0 Iterators: Multi-dimensional arrays as arguments to iterator method
+
+2test-4.cs
+----------
+C# 2.0 Iterators: Use of a local variable in an enumerator.
+
+2test-5.cs
+----------
+Method group conversions for C# 2.0 \ No newline at end of file
diff --git a/mcs/tests/cls-test-0.cs b/mcs/tests/cls-test-0.cs
new file mode 100644
index 00000000000..b4b21ecbdce
--- /dev/null
+++ b/mcs/tests/cls-test-0.cs
@@ -0,0 +1,108 @@
+using System;
+using System.Reflection;
+using System.ComponentModel;
+
+[assembly: CLSCompliant(true)]
+[assembly: AssemblyTitle("")]
+
+public class CLSCLass_6 {
+ private object disposedEvent = new object ();
+ public EventHandlerList event_handlers;
+
+ public event Delegate Disposed {
+ add { event_handlers.AddHandler (disposedEvent, value); }
+ remove { event_handlers.RemoveHandler (disposedEvent, value); }
+ }
+}
+
+public delegate CLSDelegate Delegate ();
+
+[Serializable]
+public class CLSDelegate {
+}
+
+internal class CLSClass_5 {
+ [CLSCompliant (true)]
+ public uint Test () {
+ return 1;
+ }
+}
+
+[CLSCompliant (true)]
+public class CLSClass_4 {
+ [CLSCompliant (false)]
+ public uint Test () {
+ return 1;
+ }
+}
+
+public class CLSClass_3 {
+ [CLSCompliant (false)]
+ public uint Test_3 () {
+ return 6;
+ }
+}
+
+[CLSCompliant(false)]
+public class CLSClass_2 {
+ public sbyte XX {
+ get { return -1; }
+ }
+}
+
+class CLSClass_1 {
+ public UInt32 Valid() {
+ return 5;
+ }
+}
+
+[CLSCompliant(true)]
+public class CLSClass {
+
+ private class C1 {
+
+ [CLSCompliant(true)]
+ public class C11 {
+ protected ulong Foo3() {
+ return 1;
+ }
+ }
+
+ protected long Foo2() {
+ return 1;
+ }
+ }
+
+ [CLSCompliant(false)]
+ protected internal class CLSClass_2 {
+ public sbyte XX {
+ get { return -1; }
+ }
+ }
+
+
+ [CLSCompliant(true)]
+ private ulong Valid() {
+ return 1;
+ }
+
+ [CLSCompliant(true)]
+ public byte XX {
+ get { return 5; }
+ }
+
+// protected internal sbyte FooProtectedInternal() {
+// return -4;
+// }
+
+ internal UInt32 FooInternal() {
+ return 1;
+ }
+
+ private ulong Foo() {
+ return 1;
+ }
+
+
+ public static void Main() {}
+} \ No newline at end of file
diff --git a/mcs/tests/cls-test-1.cs b/mcs/tests/cls-test-1.cs
new file mode 100644
index 00000000000..a3bda41a260
--- /dev/null
+++ b/mcs/tests/cls-test-1.cs
@@ -0,0 +1,10 @@
+using System;
+
+public class CLSClass {
+
+ public byte XX {
+ get { return 5; }
+ }
+
+ public static void Main() {}
+} \ No newline at end of file
diff --git a/mcs/tests/cls-test-10.cs b/mcs/tests/cls-test-10.cs
new file mode 100644
index 00000000000..f919ec6341a
--- /dev/null
+++ b/mcs/tests/cls-test-10.cs
@@ -0,0 +1,20 @@
+using System;
+[assembly:CLSCompliant (true)]
+
+[CLSCompliant (false)]
+public interface I {
+ [CLSCompliant (false)]
+ void Error (ulong arg);
+}
+
+[CLSCompliant (false)]
+public interface I2 {
+ [CLSCompliant (true)]
+ void Error (long arg);
+}
+
+
+public class MainClass {
+ public static void Main () {
+ }
+} \ No newline at end of file
diff --git a/mcs/tests/cls-test-11.cs b/mcs/tests/cls-test-11.cs
new file mode 100644
index 00000000000..e7e47e743e1
--- /dev/null
+++ b/mcs/tests/cls-test-11.cs
@@ -0,0 +1,17 @@
+using System;
+[assembly:CLSCompliant (true)]
+
+[CLSCompliant (true)]
+public abstract class CLSClass {
+ [CLSCompliant (true)]
+ public abstract void Test (IComparable arg);
+}
+
+public abstract class CLSCLass_2 {
+ public abstract void Test ();
+}
+
+public class MainClass {
+ public static void Main () {
+ }
+} \ No newline at end of file
diff --git a/mcs/tests/cls-test-14.cs b/mcs/tests/cls-test-14.cs
new file mode 100644
index 00000000000..4d408c56a21
--- /dev/null
+++ b/mcs/tests/cls-test-14.cs
@@ -0,0 +1,17 @@
+using System;
+
+public class CLSClass {
+ [CLSCompliant (false)]
+ static public implicit operator CLSClass(byte value) {
+ return new CLSClass();
+ }
+
+ [CLSCompliant (true)]
+ private void Error (bool arg) {
+ }
+}
+
+public class MainClass {
+ public static void Main () {
+ }
+} \ No newline at end of file
diff --git a/mcs/tests/cls-test-15.cs b/mcs/tests/cls-test-15.cs
new file mode 100644
index 00000000000..7f93f9e4381
--- /dev/null
+++ b/mcs/tests/cls-test-15.cs
@@ -0,0 +1,31 @@
+using System;
+[assembly:CLSCompliant (true)]
+
+public class CLSAttribute_1: Attribute {
+ public CLSAttribute_1(int[] array) {
+ }
+
+ public CLSAttribute_1(int array) {
+ }
+}
+
+[CLSCompliant (false)]
+public class CLSAttribute_2: Attribute {
+ private CLSAttribute_2(int arg) {
+ }
+}
+
+internal class CLSAttribute_3: Attribute {
+ public CLSAttribute_3(int[] array) {
+ }
+}
+
+[CLSCompliant (false)]
+public class CLSAttribute_4: Attribute {
+ private CLSAttribute_4(int[] args) {
+ }
+}
+
+public class ClassMain {
+ public static void Main () {}
+} \ No newline at end of file
diff --git a/mcs/tests/cls-test-16.cs b/mcs/tests/cls-test-16.cs
new file mode 100644
index 00000000000..5929b442e4e
--- /dev/null
+++ b/mcs/tests/cls-test-16.cs
@@ -0,0 +1,13 @@
+using System;
+[assembly:CLSCompliant (true)]
+
+[CLSCompliant (false)]
+[CLSAttribute (new bool [] {true, false})]
+public class CLSAttribute: Attribute {
+ public CLSAttribute(bool[] array) {
+ }
+}
+
+public class ClassMain {
+ public static void Main () {}
+} \ No newline at end of file
diff --git a/mcs/tests/cls-test-2.cs b/mcs/tests/cls-test-2.cs
new file mode 100644
index 00000000000..f6bd20ac5fa
--- /dev/null
+++ b/mcs/tests/cls-test-2.cs
@@ -0,0 +1,28 @@
+using System;
+using System.Reflection;
+
+[assembly: CLSCompliant (true)]
+
+public class CLSClass {
+ [CLSCompliant(false)]
+ public CLSClass(ulong l) {}
+ internal CLSClass(uint i) {}
+
+ [CLSCompliant(false)]
+ public ulong X_0 {
+ set {}
+ }
+
+ [CLSCompliant(false)]
+ protected ulong this[ulong i] {
+ set {}
+ }
+
+ [CLSCompliant(false)]
+ public ulong X_1;
+
+ internal ulong X_2;
+
+ public static void Main() {
+ }
+} \ No newline at end of file
diff --git a/mcs/tests/cls-test-3.cs b/mcs/tests/cls-test-3.cs
new file mode 100644
index 00000000000..483b00dd880
--- /dev/null
+++ b/mcs/tests/cls-test-3.cs
@@ -0,0 +1,13 @@
+using System;
+[assembly:CLSCompliant(true)]
+
+public interface I1 {
+}
+
+public class CLSClass {
+ protected internal I1 Foo() {
+ return null;
+ }
+
+ static void Main() {}
+} \ No newline at end of file
diff --git a/mcs/tests/cls-test-5.cs b/mcs/tests/cls-test-5.cs
new file mode 100644
index 00000000000..27001fb7f53
--- /dev/null
+++ b/mcs/tests/cls-test-5.cs
@@ -0,0 +1,70 @@
+using System;
+
+[assembly:CLSCompliant(true)]
+
+class X1 {
+ public bool AA;
+ internal bool aa;
+}
+
+class X2: X1 {
+ public bool aA;
+}
+
+public class X3 {
+ internal void bb(bool arg) {}
+ internal bool bB;
+ public void BB() {}
+}
+
+class X4 {
+ public void method(int arg) {}
+ public void method(bool arg) {}
+ public bool method() { return false; }
+}
+
+
+public class BaseClass {
+ //protected internal bool mEthod() { return false; }
+}
+
+public class CLSClass: BaseClass {
+ public CLSClass() {}
+ public CLSClass(int arg) {}
+
+ //public int this[int index] { set {} }
+ //protected int this[bool index] { set {} }
+
+ public bool setItem;
+ static public implicit operator CLSClass(bool value) {
+ return new CLSClass(2);
+ }
+
+ static public implicit operator CLSClass(int value) {
+ return new CLSClass(2);
+ }
+
+ [CLSCompliant(false)]
+ public void Method() {}
+
+ internal int Method(bool arg) { return 1; }
+ internal void methoD() {}
+
+ public static void Main() {}
+}
+
+public class oBject: Object {
+}
+
+namespace A {
+ public class C1 {
+ }
+}
+
+namespace B {
+ public class c1 {
+ }
+}
+
+public class c1 {
+} \ No newline at end of file
diff --git a/mcs/tests/cls-test-6.cs b/mcs/tests/cls-test-6.cs
new file mode 100644
index 00000000000..f8500486106
--- /dev/null
+++ b/mcs/tests/cls-test-6.cs
@@ -0,0 +1,38 @@
+using System;
+
+[assembly:CLSCompliant(true)]
+
+[CLSCompliant(false)]
+public delegate uint MyDelegate();
+
+[CLSCompliant(false)]
+public interface IFake {
+ [CLSCompliant(true)]
+ long AA(long arg);
+ [CLSCompliant(false)]
+ ulong BB { get; }
+ //[CLSCompliant(false)]
+ //sbyte this[ulong I] { set; }
+ [CLSCompliant(false)]
+ event MyDelegate MyEvent;
+}
+
+[CLSCompliant(false)]
+internal interface I {
+ [CLSCompliant(false)]
+ void Foo();
+
+ [CLSCompliant(true)]
+ ulong this[int indexA] { set; }
+}
+
+interface I2 {
+ int Test(int arg1, bool arg2);
+}
+
+public class CLSClass {
+ [CLSCompliant(false)]
+ public delegate uint MyDelegate();
+
+ public static void Main() {}
+} \ No newline at end of file
diff --git a/mcs/tests/cls-test-7.cs b/mcs/tests/cls-test-7.cs
new file mode 100644
index 00000000000..6084e411775
--- /dev/null
+++ b/mcs/tests/cls-test-7.cs
@@ -0,0 +1,17 @@
+using System;
+
+[assembly:CLSCompliant(true)]
+
+namespace aa {
+ public class I1 {
+ }
+}
+
+namespace bb {
+ public interface i1 {
+ }
+}
+
+public class CLSClass {
+ public static void Main() {}
+} \ No newline at end of file
diff --git a/mcs/tests/gen-37.cs b/mcs/tests/gen-37.cs
new file mode 100644
index 00000000000..58798fce56a
--- /dev/null
+++ b/mcs/tests/gen-37.cs
@@ -0,0 +1,33 @@
+public class Foo<T,U>
+{
+ public void Hello (Foo<T,U> foo)
+ {
+ }
+
+ public virtual void Test ()
+ {
+ Hello (this);
+ }
+}
+
+public class Bar<T> : Foo<T,long>
+{
+ public void Test (Foo<T,long> foo)
+ {
+ Hello (foo);
+ }
+}
+
+public class Baz<T> : Foo<T,string>
+{
+ public override void Test ()
+ {
+ Hello (this);
+ }
+}
+
+class X
+{
+ static void Main ()
+ { }
+}
diff --git a/mcs/tests/gen-test.pl b/mcs/tests/gen-test.pl
index 5e738dc8a87..1d6e6f0cb47 100755
--- a/mcs/tests/gen-test.pl
+++ b/mcs/tests/gen-test.pl
@@ -6,7 +6,7 @@ my $mono = "mono";
my @normal = qw[gen-1 gen-2 gen-3 gen-4 gen-5 gen-6 gen-7 gen-8 gen-9 gen-10 gen-11 gen-12
gen-14 gen-15 gen-16 gen-18 gen-19 gen-20 gen-21 gen-22 gen-23 gen-24 gen-25
- gen-26 gen-27 gen-28 gen-29 gen-30 gen-32 gen-33 gen-34 gen-35 gen-36];
+ gen-26 gen-27 gen-28 gen-29 gen-30 gen-32 gen-33 gen-34 gen-35 gen-36 gen-37];
my @library = qw[gen-13 gen-17 gen-31];
sub RunTest
@@ -57,10 +57,15 @@ sub LibraryTest
RunTest (0, $mono, $exe) or return 0;
}
+my @verify;
+push @verify, "sidney";
+push @verify, 'bin/peverify.sh';
+
foreach my $file (@normal) {
print "RUNNING TEST: $file\n";
if (NormalTest ($file)) {
print STDERR "TEST SUCCEEDED: $file\n";
+ push @verify, qq[$file.exe];
} else {
print STDERR "TEST FAILED: $file\n";
}
@@ -70,7 +75,17 @@ foreach my $file (@library) {
print "RUNNING LIBRARY TEST: $file\n";
if (LibraryTest ($file)) {
print STDERR "TEST SUCCEEDED: $file\n";
+ push @verify, qq[$file-dll.dll];
+ push @verify, qq[$file-exe.exe];
} else {
print STDERR "TEST FAILED: $file\n";
}
}
+
+my $hostname = `hostname --fqdn`;
+chop $hostname;
+
+if ($hostname eq 'gondor.martin.baulig') {
+ print STDERR "VERIFYING TESTS\n";
+ RunTest (0, "ssh", @verify);
+}
diff --git a/mcs/tests/test-102.cs b/mcs/tests/test-102.cs
index 9787fa75795..1c82586d353 100644
--- a/mcs/tests/test-102.cs
+++ b/mcs/tests/test-102.cs
@@ -28,9 +28,8 @@ namespace N1 {
}
}
- interface A {
- [Mine ("hello")]
- void Hello ();
+ public interface TestInterface {
+ void Hello ([Mine ("param")] int i);
}
public class Foo {
@@ -66,6 +65,19 @@ namespace N1 {
}
}
+ Type ifType = typeof (TestInterface);
+
+ MethodInfo method = ifType.GetMethod ("Hello",
+ BindingFlags.Public | BindingFlags.Instance);
+
+ ParameterInfo[] parameters = method.GetParameters();
+ ParameterInfo param = parameters [0];
+
+ object[] testAttrs = param.GetCustomAttributes (true);
+
+ if (testAttrs.Length != 1)
+ return 1;
+
return 0;
}
}
diff --git a/mcs/tests/test-154.cs b/mcs/tests/test-154.cs
index 585bf29b760..0a1550ca766 100644
--- a/mcs/tests/test-154.cs
+++ b/mcs/tests/test-154.cs
@@ -294,7 +294,7 @@ public class X
} finally {
fin = 1;
}
- return res;
+ return fin;
}
// from bug #30487.
@@ -515,4 +515,19 @@ public class X
end:
x = y;
}
+
+ //
+ // Bug 46640
+ //
+ public static void test35 (int a, bool test)
+ {
+ switch (a) {
+ case 3:
+ if (test)
+ break;
+ return;
+ default:
+ return;
+ }
+ }
}
diff --git a/mcs/tests/test-205.cs b/mcs/tests/test-205.cs
index 9ebc338a83b..bbd169f1b63 100644
--- a/mcs/tests/test-205.cs
+++ b/mcs/tests/test-205.cs
@@ -1,3 +1,6 @@
+//
+// NOTE: this is invalid, CSC does not compile it.
+//
namespace Foo
{
namespace A.B
diff --git a/mcs/tests/test-211.cs b/mcs/tests/test-211.cs
index f5942c40c7c..81eecb75f64 100644
--- a/mcs/tests/test-211.cs
+++ b/mcs/tests/test-211.cs
@@ -46,6 +46,12 @@ class Z
{
int a = 5;
Y y = (Y) (X) a;
+
+ //.
+ // Compile this:
+ //
+
+ int b = (System.Int32)int.Parse ("1");
return 0;
}
}
diff --git a/mcs/tests/test-222.cs b/mcs/tests/test-222.cs
new file mode 100644
index 00000000000..b6dd1079c41
--- /dev/null
+++ b/mcs/tests/test-222.cs
@@ -0,0 +1,22 @@
+//
+// This is just a compilation test
+//
+
+using System;
+
+
+class Class_1 {
+ public UIntPtr Valid() {
+ return new UIntPtr(1);
+ }
+}
+
+public class MainClass {
+
+ public static int Main()
+ {
+ return 0;
+ }
+}
+
+
diff --git a/mcs/tests/test-223.cs b/mcs/tests/test-223.cs
new file mode 100644
index 00000000000..e9d424d40a4
--- /dev/null
+++ b/mcs/tests/test-223.cs
@@ -0,0 +1,31 @@
+//
+// This tests that conversions from Enum and ValueType to structs
+// are treated as unboxing conversions, and the `unbox' opcode
+// is emitted. #52569.
+//
+
+enum Foo { Bar }
+class T {
+ static int Main ()
+ {
+ System.Enum e = Foo.Bar;
+ System.ValueType vt1 = Foo.Bar, vt2 = 1;
+
+ if (((Foo) e) != Foo.Bar)
+ return 1;
+
+ if (((Foo) vt1) != Foo.Bar)
+ return 2;
+
+ if (((int) vt2) != 1)
+ return 3;
+
+ //
+ // Test that we can assign null to a valueType
+ //
+
+ System.ValueType vt = null;
+
+ return 0;
+ }
+}
diff --git a/mcs/tests/test-224.cs b/mcs/tests/test-224.cs
new file mode 100644
index 00000000000..b13f231020a
--- /dev/null
+++ b/mcs/tests/test-224.cs
@@ -0,0 +1,74 @@
+// <file>
+// <copyright see="prj:///doc/copyright.txt"/>
+// <license see="prj:///doc/license.txt"/>
+// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
+// <version value="$version"/>
+// </file>
+
+using System;
+using System.Reflection;
+
+ /// <summary>
+ /// Indicates that field should be treated as a xml attribute for the codon or condition.
+ /// The field is treated as a array, separated by ',' example :
+ /// fileextensions = ".cpp,.cc,.C"
+ /// </summary>
+ [AttributeUsage(AttributeTargets.Field, Inherited=true)]
+ public class XmlMemberArrayAttribute : Attribute
+ {
+ char[] separator = new char[] { ',' };
+ string name;
+ bool isRequired;
+
+ /// <summary>
+ /// Constructs a new instance.
+ /// </summary>
+ public XmlMemberArrayAttribute(string name)
+ {
+ this.name = name;
+ isRequired = false;
+ }
+
+ public char[] Separator {
+ get {
+ return separator;
+ }
+ set {
+ separator = value;
+ }
+ }
+
+ /// <summary>
+ /// The name of the attribute.
+ /// </summary>
+ public string Name {
+ get {
+ return name;
+ }
+ set {
+ name = value;
+ }
+ }
+
+ /// <summary>
+ /// returns <code>true</code> if this attribute is required.
+ /// </summary>
+ public bool IsRequired {
+ get {
+ return isRequired;
+ }
+ set {
+ isRequired = value;
+ }
+ }
+ }
+
+public class t
+{
+
+ [XmlMemberArrayAttribute("shortcut", Separator=new char[] { '|'})]
+ string[] shortcut;
+
+ public static void Main () { }
+
+}
diff --git a/mcs/tests/test-225.cs b/mcs/tests/test-225.cs
new file mode 100644
index 00000000000..485f940da5f
--- /dev/null
+++ b/mcs/tests/test-225.cs
@@ -0,0 +1,18 @@
+using System;
+
+class A {
+ public int foo = 1;
+}
+
+class B : A {
+ public new int foo ()
+ {
+ return 1;
+ }
+
+ static void Main ()
+ {
+ B b = new B ();
+ Console.WriteLine (b.foo ());
+ }
+}
diff --git a/mcs/tests/test-226.cs b/mcs/tests/test-226.cs
new file mode 100644
index 00000000000..149d495c221
--- /dev/null
+++ b/mcs/tests/test-226.cs
@@ -0,0 +1,25 @@
+using System;
+
+class Test226
+{
+ static bool ok;
+
+ public static void Test ()
+ {
+ int n=0;
+ while (true) {
+ if (++n==5)
+ break;
+ switch (0) {
+ case 0: break;
+ }
+ }
+ ok = true;
+ }
+
+ public static int Main ()
+ {
+ Test ();
+ return ok ? 0 : 1;
+ }
+}
diff --git a/mcs/tests/test-227.cs b/mcs/tests/test-227.cs
new file mode 100644
index 00000000000..c6d4c72d83e
--- /dev/null
+++ b/mcs/tests/test-227.cs
@@ -0,0 +1,27 @@
+using System;
+using Mat = A.ABC.BMT;
+
+namespace A
+{
+ namespace ABC
+ {
+ public enum BMT
+ {
+ X,
+ }
+ }
+
+ class T
+ {
+ public enum Mat
+ {
+ A = 5,
+ B
+ }
+
+ public static void Main() {
+ Mat c;
+ c = Mat.A;
+ }
+ }
+}
diff --git a/mcs/tests/test-228.cs b/mcs/tests/test-228.cs
new file mode 100644
index 00000000000..32124f7c8e5
--- /dev/null
+++ b/mcs/tests/test-228.cs
@@ -0,0 +1,41 @@
+//
+// Test for bug reported on the list. The bug was that the
+// compiler was generating copies of the static variable, before
+// passing it. A trick that we do for readonly variables
+using System;
+
+namespace BadRefTest
+{
+
+public class CtorInc
+{
+ static int x, y;
+
+ static int IncByRef(ref int i) { return ++i; }
+
+ public CtorInc() { IncByRef(ref x); ++y; }
+
+ public static bool Results(int total)
+ {
+ Console.WriteLine("CtorInc test {0}: x == {1}, y == {2}",
+ x == y && x == total? "passed": "failed", x, y);
+
+ return x == y && x == total;
+ }
+}
+
+public class Runner
+{
+ public static int Main()
+ {
+ int i = 0;
+ for (; i < 5; i++)
+ {
+ CtorInc t = new CtorInc();
+ }
+ return CtorInc.Results(i) ? 0 : 1;
+ }
+
+}
+}
+
diff --git a/mcs/tests/test-91.cs b/mcs/tests/test-91.cs
index 11dddc6b45c..3414d198534 100755
--- a/mcs/tests/test-91.cs
+++ b/mcs/tests/test-91.cs
@@ -1,6 +1,18 @@
using System;
using System.Reflection;
+//
+// Test the setting for the default public constructor
+//
+abstract class Abstract {
+}
+
+//
+// Test the setting for the default public consturctor
+//
+class Plain {
+}
+
class Test {
static protected internal void MyProtectedInternal () { }
@@ -47,6 +59,23 @@ class Test {
if (mpia != MethodAttributes.Private)
return 4;
+ //
+ // Test 17.10.4 accessibility (default constructor permissions)
+ //
+ ConstructorInfo ci = typeof (Abstract).GetConstructor
+ (BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance, null, new Type [0], new
+ ParameterModifier [0]);
+
+ if (!ci.IsFamily)
+ return 5;
+
+ ci = typeof (Plain).GetConstructor
+ (BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance, null, new Type [0], new
+ ParameterModifier [0]);
+
+ if (!ci.IsPublic)
+ return 6;
+
Console.WriteLine ("All tests pass");
return 0;
}
diff --git a/mcs/tests/test-99.cs b/mcs/tests/test-99.cs
index 385330dfa55..79c5d7d7cbf 100755
--- a/mcs/tests/test-99.cs
+++ b/mcs/tests/test-99.cs
@@ -1,9 +1,18 @@
+//
+// Tests the resulting value of operator + (U x, E y)
+// as well as implicit conversions in the above operator.
+//
using System;
class X {
enum A : int {
a = 1, b, c
}
+ enum Test : short {
+ A = 1,
+ B
+ }
+
static int Main ()
{
int v = 1;
@@ -20,6 +29,17 @@ class X {
return 2;
}
+ // Now try the implicit conversions for underlying types in enum operators
+ byte b = 1;
+ short s = (short) (Test.A + b);
+
+ //
+ // Make sure that other operators still work
+ if (Test.A != Test.A)
+ return 3;
+ if (Test.A == Test.B)
+ return 4;
+
return 0;
}
}
diff --git a/mcs/tests/verify-8.cs b/mcs/tests/verify-8.cs
new file mode 100644
index 00000000000..c82983e68a3
--- /dev/null
+++ b/mcs/tests/verify-8.cs
@@ -0,0 +1,12 @@
+class X
+{
+ static void Main ()
+ {
+ while (true) {
+ if (true)
+ break;
+
+ continue;
+ }
+ }
+}
diff --git a/mcs/tools/ChangeLog b/mcs/tools/ChangeLog
index ae412457222..ae27c2afbb7 100644
--- a/mcs/tools/ChangeLog
+++ b/mcs/tools/ChangeLog
@@ -1,3 +1,7 @@
+2004-01-15 Zoltan Varga <vargaz@freemail.hu>
+
+ * Makefile: Added al directory.
+
2003-12-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* Makefile: added browsercaps-updater directory.
diff --git a/mcs/tools/Makefile b/mcs/tools/Makefile
index 65498830737..16335899207 100644
--- a/mcs/tools/Makefile
+++ b/mcs/tools/Makefile
@@ -1,5 +1,5 @@
thisdir = tools
-SUBDIRS = cilc corcompare ictool mono-xsd security wsdl genxs SqlSharp disco soapsuds browsercaps-updater
+SUBDIRS = al cilc corcompare ictool mono-xsd security wsdl genxs SqlSharp disco soapsuds browsercaps-updater
include ../build/rules.make
MONO_TOOLS = \
diff --git a/mcs/tools/SqlSharp/.cvsignore b/mcs/tools/SqlSharp/.cvsignore
new file mode 100755
index 00000000000..8da0057dc90
--- /dev/null
+++ b/mcs/tools/SqlSharp/.cvsignore
@@ -0,0 +1 @@
+sqlsharp.pdb
diff --git a/mcs/tools/al/Al.cs b/mcs/tools/al/Al.cs
new file mode 100644
index 00000000000..b04dcffb9c3
--- /dev/null
+++ b/mcs/tools/al/Al.cs
@@ -0,0 +1,618 @@
+//
+// Mono.AssemblyLinker.AssemblyLinker
+//
+// Author(s):
+// Zoltan Varga (vargaz@freemail.hu)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+
+using System;
+using System.IO;
+using System.Collections;
+using System.Reflection;
+using System.Reflection.Emit;
+
+namespace Mono.AssemblyLinker
+{
+ class ModuleInfo {
+ public string fileName;
+ public string target;
+ }
+
+ class ResourceInfo {
+ public string name;
+ public string fileName;
+ public string target;
+ public bool isEmbedded;
+ public bool isPrivate;
+ }
+
+ enum Target {
+ Dll,
+ Exe,
+ Win
+ }
+
+ public class AssemblyLinker {
+
+ ArrayList inputFiles = new ArrayList ();
+ ArrayList resources = new ArrayList ();
+ ArrayList cattrs = new ArrayList ();
+ string outputFile;
+ bool fullPaths;
+ string outFile;
+ string entryPoint;
+ string win32IconFile;
+ string win32ResFile;
+ Target target;
+
+ public static int Main (String[] args) {
+ return new AssemblyLinker ().DynMain (args);
+ }
+
+ private int DynMain (String[] args) {
+ ParseArgs (args);
+
+ DoIt ();
+
+ return 0;
+ }
+
+ private void ParseArgs (string[] args) {
+
+ if (args.Length == 0)
+ Usage ();
+
+ foreach (string str in args) {
+ if ((str [0] != '-') && (str [0] != '/')) {
+ string[] parts = str.Split (',');
+ ModuleInfo mod = new ModuleInfo ();
+ mod.fileName = parts [0];
+ if (parts.Length > 1)
+ mod.target = parts [1];
+ inputFiles.Add (mod);
+ continue;
+ }
+
+ string arg;
+ string opt = GetCommand (str, out arg);
+
+ ResourceInfo res;
+ switch (opt) {
+ case "help":
+ case "?":
+ Usage ();
+ break;
+
+ case "embed": {
+ if (arg == null)
+ ReportMissingFileSpec (opt);
+ res = new ResourceInfo ();
+ res.isEmbedded = true;
+ String[] parts = arg.Split (',');
+ res.fileName = parts [0];
+ if (parts.Length > 1)
+ res.name = parts [1];
+ if (parts.Length > 2) {
+ switch (parts [2]) {
+ case "public":
+ break;
+ case "private":
+ res.isPrivate = true;
+ break;
+ default:
+ ReportInvalidArgument (opt, parts [2]);
+ break;
+ }
+ }
+ resources.Add (res);
+ break;
+ }
+
+ case "link": {
+ if (arg == null)
+ ReportMissingFileSpec (opt);
+ res = new ResourceInfo ();
+ String[] parts = arg.Split (',');
+ res.fileName = parts [0];
+ if (parts.Length > 1)
+ res.name = parts [1];
+ if (parts.Length > 2)
+ res.target = parts [2];
+ if (parts.Length > 3) {
+ switch (parts [3]) {
+ case "public":
+ break;
+ case "private":
+ res.isPrivate = true;
+ break;
+ default:
+ ReportInvalidArgument (opt, parts [3]);
+ break;
+ }
+ }
+ resources.Add (res);
+ break;
+ }
+
+ case "algid":
+ if (arg == null)
+ ReportMissingArgument (opt);
+ try {
+ int val = Int32.Parse (arg);
+ AddCattr (typeof (AssemblyAlgorithmIdAttribute), typeof (uint), val);
+ }
+ catch (Exception) {
+ ReportInvalidArgument (opt, arg);
+ }
+ break;
+
+ case "base":
+ ReportNotImplemented (opt);
+ break;
+
+ case "baseaddress":
+ ReportNotImplemented (opt);
+ break;
+
+ case "bugreport":
+ ReportNotImplemented (opt);
+ break;
+
+ case "comp":
+ case "company":
+ if (arg == null)
+ ReportMissingText (opt);
+ AddCattr (typeof (AssemblyCompanyAttribute), arg);
+ break;
+
+ case "config":
+ case "configuration":
+ if (arg == null)
+ ReportMissingText (opt);
+ AddCattr (typeof (AssemblyConfigurationAttribute), arg);
+ break;
+
+ case "copy":
+ case "copyright":
+ if (arg == null)
+ ReportMissingText (opt);
+ AddCattr (typeof (AssemblyCopyrightAttribute), arg);
+ break;
+
+ case "c":
+ case "culture":
+ if (arg == null)
+ ReportMissingText (opt);
+ AddCattr (typeof (AssemblyCultureAttribute), arg);
+ break;
+
+ case "delay":
+ case "delaysign":
+ ReportNotImplemented (opt);
+ break;
+
+ case "descr":
+ case "description":
+ if (arg == null)
+ ReportMissingText (opt);
+ AddCattr (typeof (AssemblyDescriptionAttribute), arg);
+ break;
+
+ case "e":
+ case "evidence":
+ if (arg == null)
+ ReportMissingFileSpec (opt);
+ res = new ResourceInfo ();
+ res.name = "Security.Evidence";
+ res.fileName = arg;
+ res.isEmbedded = true;
+ res.isPrivate = true;
+ resources.Add (res);
+ break;
+
+ case "fileversion":
+ if (arg == null)
+ ReportMissingText (opt);
+
+ AddCattr (typeof (AssemblyFileVersionAttribute), arg);
+ break;
+
+ case "flags":
+ if (arg == null)
+ ReportMissingArgument (opt);
+ try {
+ int val = Int32.Parse (arg);
+ AddCattr (typeof (AssemblyFlagsAttribute), typeof (uint), val);
+ }
+ catch (Exception) {
+ ReportInvalidArgument (opt, arg);
+ }
+ break;
+
+ case "fullpaths":
+ fullPaths = true;
+ break;
+
+ case "keyf":
+ case "keyfile":
+ if (arg == null)
+ ReportMissingText (opt);
+ AddCattr (typeof (AssemblyKeyFileAttribute), arg);
+ break;
+
+ case "keyn":
+ case "keyname":
+ if (arg == null)
+ ReportMissingText (opt);
+ AddCattr (typeof (AssemblyKeyNameAttribute), arg);
+ break;
+
+ case "main":
+ if (arg == null)
+ ReportMissingText (opt);
+ entryPoint = arg;
+ break;
+
+ case "nologo":
+ break;
+
+ case "out":
+ if (arg == null)
+ ReportMissingFileSpec (opt);
+ outFile = arg;
+ break;
+
+ case "prod":
+ case "product":
+ if (arg == null)
+ ReportMissingText (opt);
+ AddCattr (typeof (AssemblyProductAttribute), arg);
+ break;
+
+ case "productv":
+ case "productversion":
+ if (arg == null)
+ ReportMissingText (opt);
+ AddCattr (typeof (AssemblyInformationalVersionAttribute), arg);
+ break;
+
+ case "t":
+ case "target":
+ if (arg == null)
+ ReportMissingText (opt);
+ switch (arg) {
+ case "lib":
+ case "library":
+ target = Target.Dll;
+ break;
+ case "exe":
+ target = Target.Exe;
+ break;
+ case "win":
+ case "winexe":
+ Report (0, "target:win is not implemented");
+ break;
+ default:
+ ReportInvalidArgument (opt, arg);
+ break;
+ }
+ break;
+
+ case "template":
+ if (arg == null)
+ ReportMissingFileSpec (opt);
+ ReportNotImplemented (opt);
+ break;
+
+ case "title":
+ if (arg == null)
+ ReportMissingText (opt);
+ AddCattr (typeof (AssemblyTitleAttribute), arg);
+ break;
+
+ case "trade":
+ case "trademark":
+ if (arg == null)
+ ReportMissingText (opt);
+ AddCattr (typeof (AssemblyTrademarkAttribute), arg);
+ break;
+
+ case "v":
+ case "version":
+ // This option conflicts with the standard UNIX meaning
+ if (arg == null) {
+ Version ();
+ break;
+ }
+ AddCattr (typeof (AssemblyVersionAttribute), arg);
+ break;
+
+ case "win32icon":
+ if (arg == null)
+ ReportMissingFileSpec (opt);
+ win32IconFile = arg;
+ break;
+
+ case "win32res":
+ if (arg == null)
+ ReportMissingFileSpec (opt);
+ win32ResFile = arg;
+ break;
+
+ default:
+ Report (1013, String.Format ("Unrecognized command line option: '{0}'", opt));
+ break;
+ }
+ }
+
+ if ((inputFiles.Count == 0) && (resources.Count == 0))
+ Report (1016, "No valid input files were specified");
+
+ if (outFile == null)
+ Report (1017, "No target filename was specified");
+
+ if (target == Target.Dll && (entryPoint != null))
+ Report (1035, "Libraries cannot have an entry point");
+
+ if (target == Target.Exe && (entryPoint == null))
+ Report (1036, "Entry point required for executable applications");
+ }
+
+ private string GetCommand (string str, out string command_arg) {
+ if ((str [0] == '-') && (str.Length > 1) && (str [1] == '-'))
+ str = str.Substring (1);
+
+ int end_index = str.IndexOfAny (new char[] {':', '='}, 1);
+ string command = str.Substring (1,
+ end_index == -1 ? str.Length - 1 : end_index - 1);
+
+ if (end_index != -1) {
+ command_arg = str.Substring (end_index+1);
+ if (command_arg == String.Empty)
+ command_arg = null;
+ } else {
+ command_arg = null;
+ }
+
+ return command.ToLower ();
+ }
+
+ private void AddCattr (Type attrType, Type arg, object value) {
+ cattrs.Add (new CustomAttributeBuilder (attrType.GetConstructor (new Type [] { arg }), new object [] { value }));
+ }
+
+ private void AddCattr (Type attrType, object value) {
+ AddCattr (attrType, typeof (string), value);
+ }
+
+ private void AddResource (ResourceInfo res) {
+ foreach (ResourceInfo res2 in resources) {
+ if (res.name == res2.name) {
+
+ }
+ }
+ resources.Add (res);
+ }
+
+ private void PrintVersion () {
+ Console.WriteLine ("Mono Assembly Linker (al.exe) version " + Assembly.GetExecutingAssembly ().GetName ().Version.ToString ());
+ }
+
+ private void Version () {
+ PrintVersion ();
+ Environment.Exit (0);
+ }
+
+ private void Usage () {
+ PrintVersion ();
+
+ foreach (string s in usage)
+ Console.WriteLine (s);
+ Environment.Exit (0);
+ }
+
+ private void Report (int errorNum, string msg) {
+ Console.WriteLine (String.Format ("ALINK: error A{0:0000}: {1}", errorNum, msg));
+ Environment.Exit (1);
+ }
+
+ private void ReportWarning (int errorNum, string msg) {
+ Console.WriteLine (String.Format ("ALINK: warning A{0:0000}: {1}", errorNum, msg));
+ }
+
+ private void ReportInvalidArgument (string option, string value) {
+ Report (1012, String.Format ("'{0}' is not a valid setting for option '{1}'", value, option));
+ }
+
+ private void ReportMissingArgument (string option) {
+ Report (1003, String.Format ("Compiler option '{0}' must be followed by an argument", option));
+ }
+
+ private void ReportNotImplemented (string option) {
+ Report (0, String.Format ("Compiler option '{0}' is not implemented", option));
+ }
+
+ private void ReportMissingFileSpec (string option) {
+ Report (1008, String.Format ("Missing file specification for '{0}' command-line option", option));
+ }
+
+ private void ReportMissingText (string option) {
+ Report (1010, String.Format ("Missing ':<text>' for '{0}' option", option));
+ }
+
+ private void DoIt () {
+ AssemblyName aname = new AssemblyName ();
+ aname.Name = Path.GetFileNameWithoutExtension (outFile);
+
+ string fileName = Path.GetFileName (outFile);
+
+ AssemblyBuilder ab;
+
+ if (fileName != outFile)
+ ab = AppDomain.CurrentDomain.DefineDynamicAssembly (aname, AssemblyBuilderAccess.Save, Path.GetDirectoryName (outFile));
+ else
+ ab = AppDomain.CurrentDomain.DefineDynamicAssembly (aname, AssemblyBuilderAccess.Save);
+
+ foreach (CustomAttributeBuilder cb in cattrs)
+ ab.SetCustomAttribute (cb);
+
+ /*
+ * Emit modules
+ */
+
+ foreach (ModuleInfo mod in inputFiles) {
+ MethodInfo mi = typeof (AssemblyBuilder).GetMethod ("AddModule", BindingFlags.Instance|BindingFlags.Public|BindingFlags.NonPublic);
+ if (mi == null)
+ Report (0, "Cannot add modules on this runtime: try the Mono runtime instead.");
+
+ if (mod.target != null) {
+ File.Copy (mod.fileName, mod.target, true);
+ mod.fileName = mod.target;
+ }
+
+ bool isAssembly = false;
+ try {
+ AssemblyName.GetAssemblyName (mod.fileName);
+ isAssembly = true;
+ }
+ catch (Exception) {
+ }
+
+ if (isAssembly)
+ ReportWarning (1020, "Ignoring included assembly '" + mod.fileName + "'");
+ else
+ mi.Invoke (ab, new object [] { mod.fileName });
+ }
+
+ /*
+ * Set entry point
+ */
+
+ string mainClass = entryPoint.Substring (0, entryPoint.LastIndexOf ('.'));
+ string mainMethod = entryPoint.Substring (entryPoint.LastIndexOf ('.') + 1);
+
+ MethodInfo mainMethodInfo = null;
+
+ try {
+ Type mainType = ab.GetType (mainClass);
+ if (mainType != null)
+ mainMethodInfo = mainType.GetMethod (mainMethod);
+ }
+ catch (Exception ex) {
+ Console.WriteLine (ex);
+ }
+ if (mainMethodInfo != null)
+ ab.SetEntryPoint (mainMethodInfo);
+ else
+ Report (1037, "Unable to find the entry point method '" + entryPoint + "'");
+
+ /*
+ * Emit resources
+ */
+
+ ab.DefineVersionInfoResource ();
+
+ if (win32IconFile != null) {
+ try {
+ MethodInfo mi = typeof (AssemblyBuilder).GetMethod ("DefineIconResource", BindingFlags.Instance|BindingFlags.Public|BindingFlags.NonPublic);
+ if (mi == null)
+ Report (0, "Cannot embed win32 icons on this runtime: try the Mono runtime instead.");
+ mi.Invoke (ab, new object [] { win32IconFile });
+ }
+ catch (Exception ex) {
+ Report (1031, "Error reading icon '" + win32IconFile + "' --" + ex);
+ }
+ }
+
+ if (win32ResFile != null) {
+ try {
+ ab.DefineUnmanagedResource (win32ResFile);
+ }
+ catch (Exception ex) {
+ Report (1019, "Metadata failure creating assembly -- " + ex);
+ }
+ }
+
+ foreach (ResourceInfo res in resources) {
+ if (res.name == null)
+ res.name = Path.GetFileName (res.fileName);
+
+ foreach (ResourceInfo res2 in resources)
+ if ((res != res2) && (res.name == res2.name))
+ Report (1046, String.Format ("Resource identifier '{0}' has already been used in this assembly", res.name));
+
+ if (res.isEmbedded) {
+ MethodInfo mi = typeof (AssemblyBuilder).GetMethod ("EmbedResourceFile", BindingFlags.Instance|BindingFlags.Public|BindingFlags.NonPublic,
+ null, CallingConventions.Any, new Type [] { typeof (string), typeof (string) }, null);
+ if (mi == null)
+ Report (0, "Cannot embed resources on this runtime: try the Mono runtime instead.");
+ mi.Invoke (ab, new object [] { res.name, res.fileName });
+ }
+ else {
+ if (res.target != null) {
+ File.Copy (res.fileName, res.target, true);
+ res.fileName = res.target;
+ }
+
+ ab.DefineResource (res.name, "", res.fileName,
+ res.isPrivate ? ResourceAttributes.Private : ResourceAttributes.Public);
+ }
+ }
+
+ try {
+ ab.Save (fileName);
+ }
+ catch (Exception ex) {
+ Report (1019, "Metadata failure creating assembly -- " + ex);
+ }
+ }
+
+ string[] usage = {
+ "Usage: al [options] [sources]",
+ "Options: ('/out' must be specified)",
+ "",
+ " /? or /help Display this usage message",
+ " @<filename> Read response file for more options",
+ " /algid:<id> Algorithm used to hash files (in hexadecimal)",
+ " /base[address]:<addr> Base address for the library",
+ " /bugreport:<filename> Create a 'Bug Report' file",
+ " /comp[any]:<text> Company name",
+ " /config[uration]:<text> Configuration string",
+ " /copy[right]:<text> Copyright message",
+ " /c[ulture]:<text> Supported culture",
+ " /delay[sign][+|-] Delay sign this assembly",
+ " /descr[iption]:<text> Description",
+ " /e[vidence]:<filename> Security evidence file to embed",
+ " /fileversion:<version> Optional Win32 version (overrides assembly version)",
+ " /flags:<flags> Assembly flags (in hexadecimal)",
+ " /fullpaths Display files using fully-qualified filenames",
+ " /keyf[ile]:<filename> File containing key to sign the assembly",
+ " /keyn[ame]:<text> Key container name of key to sign assembly",
+ " /main:<method> Specifies the method name of the entry point",
+ " /nologo Suppress the startup banner and copyright message",
+ " /out:<filename> Output file name for the assembly manifest",
+ " /prod[uct]:<text> Product name",
+ " /productv[ersion]:<text> Product version",
+ " /t[arget]:lib[rary] Create a library",
+ " /t[arget]:exe Create a console executable",
+ " /t[arget]:win[exe] Create a Windows executable",
+ " /template:<filename> Specifies an assembly to get default options from",
+ " /title:<text> Title",
+ " /trade[mark]:<text> Trademark message",
+ " /v[ersion]:<version> Version (use * to auto-generate remaining numbers)",
+ " /win32icon:<filename> Use this icon for the output",
+ " /win32res:<filename> Specifies the Win32 resource file",
+ "",
+ "Sources: (at least one source input is required)",
+ " <filename>[,<targetfile>] add file to assembly",
+ " /embed[resource]:<filename>[,<name>[,Private]]",
+ " embed the file as a resource in the assembly",
+ " /link[resource]:<filename>[,<name>[,<targetfile>[,Private]]]",
+ " link the file as a resource to the assembly",
+ };
+
+ }
+}
diff --git a/mcs/tools/al/ChangeLog b/mcs/tools/al/ChangeLog
new file mode 100644
index 00000000000..08eee6844bc
--- /dev/null
+++ b/mcs/tools/al/ChangeLog
@@ -0,0 +1,8 @@
+2004-01-16 Atsushi Enomoto <atsushi@ximian.com>
+
+ * Al.cs : csc build fix. See bugzilla #47991.
+
+2004-01-15 Zoltan Varga <vargaz@freemail.hu>
+
+ * Al.cs Makefile ChangeLog al.exe.sources: New files.
+
diff --git a/mcs/tools/al/Makefile b/mcs/tools/al/Makefile
new file mode 100644
index 00000000000..cc0f1bf0f48
--- /dev/null
+++ b/mcs/tools/al/Makefile
@@ -0,0 +1,7 @@
+thisdir = tools/al
+SUBDIRS =
+include ../../build/rules.make
+
+PROGRAM = al.exe
+
+include ../../build/executable.make
diff --git a/mcs/tools/al/al.exe.sources b/mcs/tools/al/al.exe.sources
new file mode 100644
index 00000000000..8116c719e0b
--- /dev/null
+++ b/mcs/tools/al/al.exe.sources
@@ -0,0 +1 @@
+Al.cs
diff --git a/mcs/tools/browsercaps-updater/.cvsignore b/mcs/tools/browsercaps-updater/.cvsignore
new file mode 100755
index 00000000000..48914c24232
--- /dev/null
+++ b/mcs/tools/browsercaps-updater/.cvsignore
@@ -0,0 +1 @@
+browsercaps-updater.pdb
diff --git a/mcs/tools/cilc/.cvsignore b/mcs/tools/cilc/.cvsignore
new file mode 100755
index 00000000000..e131236a600
--- /dev/null
+++ b/mcs/tools/cilc/.cvsignore
@@ -0,0 +1,3 @@
+Test.dll
+Test.pdb
+cilc.pdb
diff --git a/mcs/tools/disco/.cvsignore b/mcs/tools/disco/.cvsignore
new file mode 100755
index 00000000000..4200279f8d5
--- /dev/null
+++ b/mcs/tools/disco/.cvsignore
@@ -0,0 +1 @@
+disco.pdb
diff --git a/mcs/tools/genxs/.cvsignore b/mcs/tools/genxs/.cvsignore
new file mode 100755
index 00000000000..eddf4c3b0c3
--- /dev/null
+++ b/mcs/tools/genxs/.cvsignore
@@ -0,0 +1 @@
+genxs.pdb
diff --git a/mcs/tools/ictool/.cvsignore b/mcs/tools/ictool/.cvsignore
new file mode 100755
index 00000000000..f83163a4ef2
--- /dev/null
+++ b/mcs/tools/ictool/.cvsignore
@@ -0,0 +1 @@
+ictool.pdb
diff --git a/mcs/tools/mono-xsd/.cvsignore b/mcs/tools/mono-xsd/.cvsignore
new file mode 100755
index 00000000000..10824a64232
--- /dev/null
+++ b/mcs/tools/mono-xsd/.cvsignore
@@ -0,0 +1 @@
+xsd.pdb
diff --git a/mcs/tools/mono-xsd/ChangeLog b/mcs/tools/mono-xsd/ChangeLog
index dfa17540153..a7d86e127f6 100644
--- a/mcs/tools/mono-xsd/ChangeLog
+++ b/mcs/tools/mono-xsd/ChangeLog
@@ -1,3 +1,7 @@
+2004-01-19 Lluis Sanchez Gual <lluis@ximian.com>
+
+ * NewMonoXSD.cs: Compile the loaded schemas if they are not already compiled.
+
2003-08-05 Lluis Sanchez Gual <lluis@ximian.com>
* NewMonoXSD.cs: new implementation of monoxsd based on the
diff --git a/mcs/tools/mono-xsd/NewMonoXSD.cs b/mcs/tools/mono-xsd/NewMonoXSD.cs
index 625a0ca3b50..513c2d46d65 100755
--- a/mcs/tools/mono-xsd/NewMonoXSD.cs
+++ b/mcs/tools/mono-xsd/NewMonoXSD.cs
@@ -286,7 +286,8 @@ namespace Mono.Util {
else
{
foreach (XmlSchema schema in schemas) {
- foreach (XmlSchemaElement elem in schema.Elements)
+ if (!schema.IsCompiled) schema.Compile (null);
+ foreach (XmlSchemaElement elem in schema.Elements.Values)
qnames.Add (elem.QualifiedName);
}
}
diff --git a/mcs/tools/security/.cvsignore b/mcs/tools/security/.cvsignore
new file mode 100755
index 00000000000..5d73c0accfa
--- /dev/null
+++ b/mcs/tools/security/.cvsignore
@@ -0,0 +1,6 @@
+MakeCert.pdb
+cert2spc.pdb
+chktrust.pdb
+secutil.pdb
+signcode.pdb
+sn.pdb
diff --git a/mcs/tools/soapsuds/.cvsignore b/mcs/tools/soapsuds/.cvsignore
new file mode 100755
index 00000000000..6b8423414ec
--- /dev/null
+++ b/mcs/tools/soapsuds/.cvsignore
@@ -0,0 +1 @@
+soapsuds.pdb
diff --git a/mcs/tools/wsdl/.cvsignore b/mcs/tools/wsdl/.cvsignore
new file mode 100755
index 00000000000..0ebe72abe17
--- /dev/null
+++ b/mcs/tools/wsdl/.cvsignore
@@ -0,0 +1 @@
+wsdl.pdb
diff --git a/mcs/tools/wsdl/ChangeLog b/mcs/tools/wsdl/ChangeLog
index 28372185929..89b36ca60a9 100644
--- a/mcs/tools/wsdl/ChangeLog
+++ b/mcs/tools/wsdl/ChangeLog
@@ -1,3 +1,13 @@
+2004-01-20 Lluis Sanchez Gual <lluis@ximian.com>
+
+ * SampleGenerator.cs: Little fixes.
+
+2004-01-18 Lluis Sanchez Gual <lluis@ximian.com>
+
+ * MonoWSDL.cs: Added new option that prints a sample request and response
+ for a web service operation.
+ * SampleGenerator.cs: Added.
+
2003-12-10 Lluis Sanchez Gual <lluis@ximian.com>
* MonoWSDL.cs: Return error codes.
diff --git a/mcs/tools/wsdl/MonoWSDL.cs b/mcs/tools/wsdl/MonoWSDL.cs
index 00e7b5feaa4..b137deea390 100755
--- a/mcs/tools/wsdl/MonoWSDL.cs
+++ b/mcs/tools/wsdl/MonoWSDL.cs
@@ -15,7 +15,6 @@ using System.CodeDom;
using System.CodeDom.Compiler;
using System.IO;
using System.Net;
-using System.Text;
using System.Web.Services.Description;
using Microsoft.CSharp;
@@ -190,6 +189,7 @@ namespace Mono.WebServices
{
// FIXME validate
set { protocol = value; }
+ get { return protocol; }
}
///
@@ -267,8 +267,12 @@ namespace Mono.WebServices
hasWarnings = true;
}
- string serviceName = ((ServiceDescription)descriptions[0]).Services[0].Name;
- WriteCodeUnit(codeUnit, serviceName);
+ ServiceDescription sdesc = (ServiceDescription)descriptions[0];
+ if (sdesc.Services.Count > 0)
+ {
+ string serviceName = sdesc.Services[0].Name;
+ WriteCodeUnit(codeUnit, serviceName);
+ }
return hasWarnings;
}
@@ -365,6 +369,7 @@ namespace Mono.WebServices
+ " (default), HttpGet, HttpPost\n"
+ " -server Generate server instead of client proxy code.\n"
+ " -username:username Username used to contact server (short -u)\n"
+ + " -sample:[binding/]operation Display a sample SOAP request and response\n"
+ " -? Display this message\n"
+ "\n"
+ "Options can be of the forms -option, --option or /option\n";
@@ -378,6 +383,7 @@ namespace Mono.WebServices
bool noLogo = false;
bool help = false;
bool hasURL = false;
+ string sampleSoap = null;
// FIXME implement these options
// (are they are usable by the System.Net.WebProxy class???)
@@ -509,6 +515,10 @@ namespace Mono.WebServices
case "username":
retriever.Username = value;
break;
+
+ case "sample":
+ sampleSoap = value;
+ break;
case "?":
help = true;
@@ -559,6 +569,12 @@ namespace Mono.WebServices
ReadDocuments (serviceDescription);
}
+ if (sampleSoap != null)
+ {
+ ConsoleSampleGenerator.Generate (descriptions, schemas, sampleSoap, generator.Protocol);
+ return 0;
+ }
+
// generate the code
if (generator.GenerateCode (descriptions, schemas))
return 1;
@@ -567,7 +583,7 @@ namespace Mono.WebServices
}
catch (Exception exception)
{
- Console.WriteLine("Error: {0}", exception.Message);
+ Console.WriteLine("Error: {0}", exception);
// FIXME: surpress this except for when debug is enabled
//Console.WriteLine("Stack:\n {0}", exception.StackTrace);
return 2;
diff --git a/mcs/tools/wsdl/SampleGenerator.cs b/mcs/tools/wsdl/SampleGenerator.cs
new file mode 100644
index 00000000000..4853216291b
--- /dev/null
+++ b/mcs/tools/wsdl/SampleGenerator.cs
@@ -0,0 +1,880 @@
+//
+// SampleGenerator.cs
+//
+// Author:
+// Lluis Sanchez Gual (lluis@ximian.com)
+//
+// Copyright (C) 2004 Novel Inc.
+//
+
+using System;
+using System.IO;
+using System.Text;
+using System.Collections;
+using System.Web.Services.Description;
+using System.Xml;
+using System.Xml.Schema;
+using System.Xml.Serialization;
+
+namespace Mono.WebServices
+{
+ public class ConsoleSampleGenerator: SampleGenerator
+ {
+ public ConsoleSampleGenerator (ServiceDescriptionCollection services, XmlSchemas schemas)
+ : base (services, schemas)
+ {
+ }
+
+ public static void Generate (ArrayList services, ArrayList schemas, string binOper, string protocol)
+ {
+ ServiceDescriptionCollection descCol = new ServiceDescriptionCollection ();
+ foreach (ServiceDescription sd in services)
+ descCol.Add (sd);
+
+ XmlSchemas schemaCol;
+
+ if (schemas.Count > 0) {
+ schemaCol = new XmlSchemas ();
+ foreach (XmlSchema sc in schemas)
+ schemaCol.Add (sc);
+ }
+ else
+ schemaCol = descCol[0].Types.Schemas;
+
+ string oper, bin = null;
+
+ int i = binOper.IndexOf ('/');
+ if (i != -1) {
+ oper = binOper.Substring (i+1);
+ bin = binOper.Substring (0,i);
+ }
+ else
+ oper = binOper;
+
+ ConsoleSampleGenerator sg = new ConsoleSampleGenerator (descCol, schemaCol);
+
+ string req, resp;
+ sg.GenerateMessages (oper, bin, protocol, out req, out resp);
+
+ Console.WriteLine ();
+ Console.WriteLine ("Sample request message:");
+ Console.WriteLine ();
+ Console.WriteLine (req);
+ Console.WriteLine ();
+ Console.WriteLine ("Sample response message:");
+ Console.WriteLine ();
+ Console.WriteLine (resp);
+ }
+
+ public void GenerateMessages (string operation, string bindingName, string protocol, out string req, out string resp)
+ {
+ Port port = FindPort (bindingName, protocol);
+ Binding binding = descriptions.GetBinding (port.Binding);
+ if (binding == null) throw new InvalidOperationException ("Binding " + bindingName + " not found");
+
+ PortType portType = descriptions.GetPortType (binding.Type);
+ Operation oper = FindOperation (portType, operation);
+ if (oper == null) throw new InvalidOperationException ("Operation " + operation + " not found");
+ OperationBinding obin = FindOperation (binding, operation);
+
+ req = GenerateMessage (port, obin, oper, protocol, true);
+ resp = GenerateMessage (port, obin, oper, protocol, false);
+ }
+
+ Port FindPort (string portName, string protocol)
+ {
+ Service service = descriptions[0].Services[0];
+ foreach (Port port in service.Ports)
+ {
+ if (portName == null)
+ {
+ Binding binding = descriptions.GetBinding (port.Binding);
+ if (GetProtocol (binding) == protocol) return port;
+ }
+ else if (port.Name == portName)
+ return port;
+ }
+ return null;
+ }
+
+ string GetProtocol (Binding binding)
+ {
+ if (binding.Extensions.Find (typeof(SoapBinding)) != null) return "Soap";
+ HttpBinding hb = (HttpBinding) binding.Extensions.Find (typeof(HttpBinding));
+ if (hb == null) return "";
+ if (hb.Verb == "POST") return "HttpPost";
+ if (hb.Verb == "GET") return "HttpGet";
+ return "";
+ }
+
+ Operation FindOperation (PortType portType, string name)
+ {
+ foreach (Operation oper in portType.Operations) {
+ if (oper.Messages.Input.Name != null) {
+ if (oper.Messages.Input.Name == name) return oper;
+ }
+ else
+ if (oper.Name == name) return oper;
+ }
+
+ return null;
+ }
+
+ OperationBinding FindOperation (Binding binding, string name)
+ {
+ foreach (OperationBinding oper in binding.Operations) {
+ if (oper.Input.Name != null) {
+ if (oper.Input.Name == name) return oper;
+ }
+ else
+ if (oper.Name == name) return oper;
+ }
+
+ return null;
+ }
+ }
+
+ //
+ // Sample generator class
+ //
+
+ public class SampleGenerator
+ {
+ protected ServiceDescriptionCollection descriptions;
+ protected XmlSchemas schemas;
+ XmlSchemaElement anyElement;
+ ArrayList queue;
+ SoapBindingUse currentUse;
+ XmlDocument document = new XmlDocument ();
+
+ static readonly XmlQualifiedName anyType = new XmlQualifiedName ("anyType",XmlSchema.Namespace);
+ static readonly XmlQualifiedName arrayType = new XmlQualifiedName ("Array","http://schemas.xmlsoap.org/soap/encoding/");
+ static readonly XmlQualifiedName arrayTypeRefName = new XmlQualifiedName ("arrayType","http://schemas.xmlsoap.org/soap/encoding/");
+ const string SoapEnvelopeNamespace = "http://schemas.xmlsoap.org/soap/envelope/";
+ const string WsdlNamespace = "http://schemas.xmlsoap.org/wsdl/";
+ const string SoapEncodingNamespace = "http://schemas.xmlsoap.org/soap/encoding/";
+
+ class EncodedType
+ {
+ public EncodedType (string ns, XmlSchemaElement elem) { Namespace = ns; Element = elem; }
+ public string Namespace;
+ public XmlSchemaElement Element;
+ }
+
+ public SampleGenerator (ServiceDescriptionCollection services, XmlSchemas schemas)
+ {
+ descriptions = services;
+ this.schemas = schemas;
+ queue = new ArrayList ();
+ }
+
+ public string GenerateMessage (Port port, OperationBinding obin, Operation oper, string protocol, bool generateInput)
+ {
+ OperationMessage msg = null;
+ foreach (OperationMessage opm in oper.Messages)
+ {
+ if (opm is OperationInput && generateInput) msg = opm;
+ else if (opm is OperationOutput && !generateInput) msg = opm;
+ }
+ if (msg == null) return null;
+
+ switch (protocol) {
+ case "Soap": return GenerateHttpSoapMessage (port, obin, oper, msg);
+ case "HttpGet": return GenerateHttpGetMessage (port, obin, oper, msg);
+ case "HttpPost": return GenerateHttpPostMessage (port, obin, oper, msg);
+ }
+ return "Unknown protocol";
+ }
+
+ public string GenerateHttpSoapMessage (Port port, OperationBinding obin, Operation oper, OperationMessage msg)
+ {
+ string req = "";
+
+ if (msg is OperationInput)
+ {
+ SoapAddressBinding sab = port.Extensions.Find (typeof(SoapAddressBinding)) as SoapAddressBinding;
+ SoapOperationBinding sob = obin.Extensions.Find (typeof(SoapOperationBinding)) as SoapOperationBinding;
+ req += "POST " + new Uri (sab.Location).AbsolutePath + "\n";
+ req += "SOAPAction: " + sob.SoapAction + "\n";
+ req += "Content-Type: text/xml; charset=utf-8\n";
+ req += "Content-Length: " + GetLiteral ("string") + "\n";
+ req += "Host: " + GetLiteral ("string") + "\n\n";
+ }
+ else
+ {
+ req += "HTTP/1.0 200 OK\n";
+ req += "Content-Type: text/xml; charset=utf-8\n";
+ req += "Content-Length: " + GetLiteral ("string") + "\n\n";
+ }
+
+ req += GenerateSoapMessage (obin, oper, msg);
+ return req;
+ }
+
+ public string GenerateHttpGetMessage (Port port, OperationBinding obin, Operation oper, OperationMessage msg)
+ {
+ string req = "";
+
+ if (msg is OperationInput)
+ {
+ HttpAddressBinding sab = port.Extensions.Find (typeof(HttpAddressBinding)) as HttpAddressBinding;
+ HttpOperationBinding sob = obin.Extensions.Find (typeof(HttpOperationBinding)) as HttpOperationBinding;
+ string location = new Uri (sab.Location).AbsolutePath + sob.Location + "?" + BuildQueryString (msg);
+ req += "GET " + location + "\n";
+ req += "Host: " + GetLiteral ("string");
+ }
+ else
+ {
+ req += "HTTP/1.0 200 OK\n";
+ req += "Content-Type: text/xml; charset=utf-8\n";
+ req += "Content-Length: " + GetLiteral ("string") + "\n\n";
+
+ MimeXmlBinding mxb = (MimeXmlBinding) obin.Output.Extensions.Find (typeof(MimeXmlBinding)) as MimeXmlBinding;
+ if (mxb == null) return req;
+
+ Message message = descriptions.GetMessage (msg.Message);
+ XmlQualifiedName ename = null;
+ foreach (MessagePart part in message.Parts)
+ if (part.Name == mxb.Part) ename = part.Element;
+
+ if (ename == null) return req + GetLiteral("string");
+
+ StringWriter sw = new StringWriter ();
+ XmlTextWriter xtw = new XmlTextWriter (sw);
+ xtw.Formatting = Formatting.Indented;
+ currentUse = SoapBindingUse.Literal;
+ WriteRootElementSample (xtw, ename);
+ xtw.Close ();
+ req += sw.ToString ();
+ }
+
+ return req;
+ }
+
+ public string GenerateHttpPostMessage (Port port, OperationBinding obin, Operation oper, OperationMessage msg)
+ {
+ string req = "";
+
+ if (msg is OperationInput)
+ {
+ HttpAddressBinding sab = port.Extensions.Find (typeof(HttpAddressBinding)) as HttpAddressBinding;
+ HttpOperationBinding sob = obin.Extensions.Find (typeof(HttpOperationBinding)) as HttpOperationBinding;
+ string location = new Uri (sab.Location).AbsolutePath + sob.Location;
+ req += "POST " + location + "\n";
+ req += "Content-Type: application/x-www-form-urlencoded\n";
+ req += "Content-Length: " + GetLiteral ("string") + "\n";
+ req += "Host: " + GetLiteral ("string") + "\n\n";
+ req += BuildQueryString (msg);
+ }
+ else return GenerateHttpGetMessage (port, obin, oper, msg);
+
+ return req;
+ }
+
+ string BuildQueryString (OperationMessage opm)
+ {
+ string s = "";
+ Message msg = descriptions.GetMessage (opm.Message);
+ foreach (MessagePart part in msg.Parts)
+ {
+ if (s.Length != 0) s += "&";
+ s += part.Name + "=" + GetLiteral (part.Type.Name);
+ }
+ return s;
+ }
+
+ public string GenerateSoapMessage (OperationBinding obin, Operation oper, OperationMessage msg)
+ {
+ SoapOperationBinding sob = obin.Extensions.Find (typeof(SoapOperationBinding)) as SoapOperationBinding;
+ SoapBindingStyle style = (sob != null) ? sob.Style : SoapBindingStyle.Document;
+
+ MessageBinding msgbin = (msg is OperationInput) ? (MessageBinding) obin.Input : (MessageBinding)obin.Output;
+ SoapBodyBinding sbb = msgbin.Extensions.Find (typeof(SoapBodyBinding)) as SoapBodyBinding;
+ SoapBindingUse bodyUse = (sbb != null) ? sbb.Use : SoapBindingUse.Literal;
+
+ StringWriter sw = new StringWriter ();
+ XmlTextWriter xtw = new XmlTextWriter (sw);
+ xtw.Formatting = Formatting.Indented;
+
+ xtw.WriteStartDocument ();
+ xtw.WriteStartElement ("soap", "Envelope", SoapEnvelopeNamespace);
+ xtw.WriteAttributeString ("xmlns", "xsi", null, XmlSchema.InstanceNamespace);
+ xtw.WriteAttributeString ("xmlns", "xsd", null, XmlSchema.Namespace);
+
+ if (bodyUse == SoapBindingUse.Encoded)
+ {
+ xtw.WriteAttributeString ("xmlns", "soapenc", null, SoapEncodingNamespace);
+ xtw.WriteAttributeString ("xmlns", "tns", null, msg.Message.Namespace);
+ }
+
+ // Serialize headers
+ foreach (object ob in msgbin.Extensions)
+ {
+ SoapHeaderBinding hb = ob as SoapHeaderBinding;
+ if (hb == null) continue;
+
+ xtw.WriteStartElement ("soap", "Header", SoapEnvelopeNamespace);
+ WriteHeader (xtw, hb);
+ xtw.WriteEndElement ();
+ }
+
+ // Serialize body
+ xtw.WriteStartElement ("soap", "Body", SoapEnvelopeNamespace);
+
+ currentUse = bodyUse;
+ WriteBody (xtw, oper, msg, sbb, style);
+
+ xtw.WriteEndElement ();
+ xtw.WriteEndElement ();
+ xtw.Close ();
+ return sw.ToString ();
+ }
+
+ void WriteHeader (XmlTextWriter xtw, SoapHeaderBinding header)
+ {
+ Message msg = descriptions.GetMessage (header.Message);
+ if (msg == null) throw new InvalidOperationException ("Message " + header.Message + " not found");
+ MessagePart part = msg.Parts [header.Part];
+ if (part == null) throw new InvalidOperationException ("Message part " + header.Part + " not found in message " + header.Message);
+
+ currentUse = header.Use;
+
+ if (currentUse == SoapBindingUse.Literal)
+ WriteRootElementSample (xtw, part.Element);
+ else
+ WriteTypeSample (xtw, part.Type);
+ }
+
+ void WriteBody (XmlTextWriter xtw, Operation oper, OperationMessage opm, SoapBodyBinding sbb, SoapBindingStyle style)
+ {
+ Message msg = descriptions.GetMessage (opm.Message);
+ if (msg.Parts.Count > 0 && msg.Parts[0].Name == "parameters")
+ {
+ MessagePart part = msg.Parts[0];
+ if (part.Element == XmlQualifiedName.Empty)
+ WriteTypeSample (xtw, part.Type);
+ else
+ WriteRootElementSample (xtw, part.Element);
+ }
+ else
+ {
+ string elemName = oper.Name;
+ string ns = "";
+ if (opm is OperationOutput) elemName += "Response";
+
+ if (style == SoapBindingStyle.Rpc) {
+ xtw.WriteStartElement (elemName, sbb.Namespace);
+ ns = sbb.Namespace;
+ }
+
+ foreach (MessagePart part in msg.Parts)
+ {
+ if (part.Element == XmlQualifiedName.Empty)
+ {
+ XmlSchemaElement elem = new XmlSchemaElement ();
+ elem.SchemaTypeName = part.Type;
+ elem.Name = part.Name;
+ WriteElementSample (xtw, ns, elem);
+ }
+ else
+ WriteRootElementSample (xtw, part.Element);
+ }
+
+ if (style == SoapBindingStyle.Rpc)
+ xtw.WriteEndElement ();
+ }
+ WriteQueuedTypeSamples (xtw);
+ }
+
+ void WriteRootElementSample (XmlTextWriter xtw, XmlQualifiedName qname)
+ {
+ XmlSchemaElement elem = (XmlSchemaElement) schemas.Find (qname, typeof(XmlSchemaElement));
+ if (elem == null) throw new InvalidOperationException ("Element not found: " + qname);
+ WriteElementSample (xtw, qname.Namespace, elem);
+ }
+
+ void WriteElementSample (XmlTextWriter xtw, string ns, XmlSchemaElement elem)
+ {
+ bool sharedAnnType = false;
+ XmlQualifiedName root;
+
+ if (!elem.RefName.IsEmpty) {
+ XmlSchemaElement refElem = FindRefElement (elem);
+ if (refElem == null) throw new InvalidOperationException ("Global element not found: " + elem.RefName);
+ root = elem.RefName;
+ elem = refElem;
+ sharedAnnType = true;
+ }
+ else
+ root = new XmlQualifiedName (elem.Name, ns);
+
+ if (!elem.SchemaTypeName.IsEmpty)
+ {
+ XmlSchemaComplexType st = FindComplexTyype (elem.SchemaTypeName);
+ if (st != null)
+ WriteComplexTypeSample (xtw, st, root);
+ else
+ {
+ xtw.WriteStartElement (root.Name, root.Namespace);
+ if (currentUse == SoapBindingUse.Encoded)
+ xtw.WriteAttributeString ("type", XmlSchema.InstanceNamespace, GetQualifiedNameString (xtw, elem.SchemaTypeName));
+ xtw.WriteString (GetLiteral (FindBuiltInType (elem.SchemaTypeName)));
+ xtw.WriteEndElement ();
+ }
+ }
+ else if (elem.SchemaType == null)
+ {
+ xtw.WriteStartElement ("any");
+ xtw.WriteEndElement ();
+ }
+ else
+ WriteComplexTypeSample (xtw, (XmlSchemaComplexType) elem.SchemaType, root);
+ }
+
+ void WriteTypeSample (XmlTextWriter xtw, XmlQualifiedName qname)
+ {
+ XmlSchemaComplexType ctype = FindComplexTyype (qname);
+ if (ctype != null) {
+ WriteComplexTypeSample (xtw, ctype, qname);
+ return;
+ }
+
+ XmlSchemaSimpleType stype = (XmlSchemaSimpleType) schemas.Find (qname, typeof(XmlSchemaSimpleType));
+ if (stype != null) {
+ WriteSimpleTypeSample (xtw, stype);
+ return;
+ }
+
+ xtw.WriteString (GetLiteral (FindBuiltInType (qname)));
+ throw new InvalidOperationException ("Type not found: " + qname);
+ }
+
+ void WriteComplexTypeSample (XmlTextWriter xtw, XmlSchemaComplexType stype, XmlQualifiedName rootName)
+ {
+ WriteComplexTypeSample (xtw, stype, rootName, -1);
+ }
+
+ void WriteComplexTypeSample (XmlTextWriter xtw, XmlSchemaComplexType stype, XmlQualifiedName rootName, int id)
+ {
+ string ns = rootName.Namespace;
+
+ if (rootName.Name.IndexOf ("[]") != -1) rootName = arrayType;
+
+ if (currentUse == SoapBindingUse.Encoded) {
+ string pref = xtw.LookupPrefix (rootName.Namespace);
+ if (pref == null) pref = "q1";
+ xtw.WriteStartElement (pref, rootName.Name, rootName.Namespace);
+ ns = "";
+ }
+ else
+ xtw.WriteStartElement (rootName.Name, rootName.Namespace);
+
+ if (id != -1)
+ {
+ xtw.WriteAttributeString ("id", "id" + id);
+ if (rootName != arrayType)
+ xtw.WriteAttributeString ("type", XmlSchema.InstanceNamespace, GetQualifiedNameString (xtw, rootName));
+ }
+
+ WriteComplexTypeAttributes (xtw, stype);
+ WriteComplexTypeElements (xtw, ns, stype);
+
+ xtw.WriteEndElement ();
+ }
+
+ void WriteComplexTypeAttributes (XmlTextWriter xtw, XmlSchemaComplexType stype)
+ {
+ WriteAttributes (xtw, stype.Attributes, stype.AnyAttribute);
+ }
+
+ void WriteComplexTypeElements (XmlTextWriter xtw, string ns, XmlSchemaComplexType stype)
+ {
+ if (stype.Particle != null)
+ WriteParticleComplexContent (xtw, ns, stype.Particle);
+ else
+ {
+ if (stype.ContentModel is XmlSchemaSimpleContent)
+ WriteSimpleContent (xtw, (XmlSchemaSimpleContent)stype.ContentModel);
+ else if (stype.ContentModel is XmlSchemaComplexContent)
+ WriteComplexContent (xtw, ns, (XmlSchemaComplexContent)stype.ContentModel);
+ }
+ }
+
+ void WriteAttributes (XmlTextWriter xtw, XmlSchemaObjectCollection atts, XmlSchemaAnyAttribute anyat)
+ {
+ foreach (XmlSchemaObject at in atts)
+ {
+ if (at is XmlSchemaAttribute)
+ {
+ string ns;
+ XmlSchemaAttribute attr = (XmlSchemaAttribute)at;
+ XmlSchemaAttribute refAttr = attr;
+
+ // refAttr.Form; TODO
+
+ if (!attr.RefName.IsEmpty) {
+ refAttr = FindRefAttribute (attr.RefName);
+ if (refAttr == null) throw new InvalidOperationException ("Global attribute not found: " + attr.RefName);
+ }
+
+ string val;
+ if (!refAttr.SchemaTypeName.IsEmpty) val = FindBuiltInType (refAttr.SchemaTypeName);
+ else val = FindBuiltInType ((XmlSchemaSimpleType) refAttr.SchemaType);
+
+ xtw.WriteAttributeString (refAttr.Name, val);
+ }
+ else if (at is XmlSchemaAttributeGroupRef)
+ {
+ XmlSchemaAttributeGroupRef gref = (XmlSchemaAttributeGroupRef)at;
+ XmlSchemaAttributeGroup grp = (XmlSchemaAttributeGroup) schemas.Find (gref.RefName, typeof(XmlSchemaAttributeGroup));
+ WriteAttributes (xtw, grp.Attributes, grp.AnyAttribute);
+ }
+ }
+
+ if (anyat != null)
+ xtw.WriteAttributeString ("custom-attribute","value");
+ }
+
+ void WriteParticleComplexContent (XmlTextWriter xtw, string ns, XmlSchemaParticle particle)
+ {
+ WriteParticleContent (xtw, ns, particle, false);
+ }
+
+ void WriteParticleContent (XmlTextWriter xtw, string ns, XmlSchemaParticle particle, bool multiValue)
+ {
+ if (particle is XmlSchemaGroupRef)
+ particle = GetRefGroupParticle ((XmlSchemaGroupRef)particle);
+
+ if (particle.MaxOccurs > 1) multiValue = true;
+
+ if (particle is XmlSchemaSequence) {
+ WriteSequenceContent (xtw, ns, ((XmlSchemaSequence)particle).Items, multiValue);
+ }
+ else if (particle is XmlSchemaChoice) {
+ if (((XmlSchemaChoice)particle).Items.Count == 1)
+ WriteSequenceContent (xtw, ns, ((XmlSchemaChoice)particle).Items, multiValue);
+ else
+ WriteChoiceContent (xtw, ns, (XmlSchemaChoice)particle, multiValue);
+ }
+ else if (particle is XmlSchemaAll) {
+ WriteSequenceContent (xtw, ns, ((XmlSchemaAll)particle).Items, multiValue);
+ }
+ }
+
+ void WriteSequenceContent (XmlTextWriter xtw, string ns, XmlSchemaObjectCollection items, bool multiValue)
+ {
+ foreach (XmlSchemaObject item in items)
+ WriteContentItem (xtw, ns, item, multiValue);
+ }
+
+ void WriteContentItem (XmlTextWriter xtw, string ns, XmlSchemaObject item, bool multiValue)
+ {
+ if (item is XmlSchemaGroupRef)
+ item = GetRefGroupParticle ((XmlSchemaGroupRef)item);
+
+ if (item is XmlSchemaElement)
+ {
+ XmlSchemaElement elem = (XmlSchemaElement) item;
+ XmlSchemaElement refElem;
+ if (!elem.RefName.IsEmpty) refElem = FindRefElement (elem);
+ else refElem = elem;
+
+ int num = (elem.MaxOccurs == 1 && !multiValue) ? 1 : 2;
+ for (int n=0; n<num; n++)
+ {
+ if (currentUse == SoapBindingUse.Literal)
+ WriteElementSample (xtw, ns, refElem);
+ else
+ WriteRefTypeSample (xtw, ns, refElem);
+ }
+ }
+ else if (item is XmlSchemaAny)
+ {
+ xtw.WriteStartElement ("any"); xtw.WriteEndElement ();
+ if (multiValue) {
+ xtw.WriteStartElement ("any"); xtw.WriteEndElement ();
+ }
+ }
+ else if (item is XmlSchemaParticle) {
+ WriteParticleContent (xtw, ns, (XmlSchemaParticle)item, multiValue);
+ }
+ }
+
+ void WriteChoiceContent (XmlTextWriter xtw, string ns, XmlSchemaChoice choice, bool multiValue)
+ {
+ foreach (XmlSchemaObject item in choice.Items)
+ WriteContentItem (xtw, ns, item, multiValue);
+ }
+
+ void WriteSimpleContent (XmlTextWriter xtw, XmlSchemaSimpleContent content)
+ {
+ XmlSchemaSimpleContentExtension ext = content.Content as XmlSchemaSimpleContentExtension;
+ if (ext != null)
+ WriteAttributes (xtw, ext.Attributes, ext.AnyAttribute);
+
+ XmlQualifiedName qname = GetContentBaseType (content.Content);
+ xtw.WriteString (GetLiteral (FindBuiltInType (qname)));
+ }
+
+ string FindBuiltInType (XmlQualifiedName qname)
+ {
+ if (qname.Namespace == XmlSchema.Namespace)
+ return qname.Name;
+
+ XmlSchemaComplexType ct = FindComplexTyype (qname);
+ if (ct != null)
+ {
+ XmlSchemaSimpleContent sc = ct.ContentModel as XmlSchemaSimpleContent;
+ if (sc == null) throw new InvalidOperationException ("Invalid schema");
+ return FindBuiltInType (GetContentBaseType (sc.Content));
+ }
+
+ XmlSchemaSimpleType st = (XmlSchemaSimpleType) schemas.Find (qname, typeof(XmlSchemaSimpleType));
+ if (st != null)
+ return FindBuiltInType (st);
+
+ throw new InvalidOperationException ("Definition of type " + qname + " not found");
+ }
+
+ string FindBuiltInType (XmlSchemaSimpleType st)
+ {
+ if (st.Content is XmlSchemaSimpleTypeRestriction) {
+ return FindBuiltInType (GetContentBaseType (st.Content));
+ }
+ else if (st.Content is XmlSchemaSimpleTypeList) {
+ string s = FindBuiltInType (GetContentBaseType (st.Content));
+ return s + " " + s + " ...";
+ }
+ else if (st.Content is XmlSchemaSimpleTypeUnion)
+ {
+ // Check if all types of the union are equal. If not, then will use anyType.
+ XmlSchemaSimpleTypeUnion uni = (XmlSchemaSimpleTypeUnion) st.Content;
+ string utype = null;
+
+ // Anonymous types are unique
+ if (uni.BaseTypes.Count != 0 && uni.MemberTypes.Length != 0)
+ return "string";
+
+ foreach (XmlQualifiedName mt in uni.MemberTypes)
+ {
+ string qn = FindBuiltInType (mt);
+ if (utype != null && qn != utype) return "string";
+ else utype = qn;
+ }
+ return utype;
+ }
+ else
+ return "string";
+ }
+
+
+ XmlQualifiedName GetContentBaseType (XmlSchemaObject ob)
+ {
+ if (ob is XmlSchemaSimpleContentExtension)
+ return ((XmlSchemaSimpleContentExtension)ob).BaseTypeName;
+ else if (ob is XmlSchemaSimpleContentRestriction)
+ return ((XmlSchemaSimpleContentRestriction)ob).BaseTypeName;
+ else if (ob is XmlSchemaSimpleTypeRestriction)
+ return ((XmlSchemaSimpleTypeRestriction)ob).BaseTypeName;
+ else if (ob is XmlSchemaSimpleTypeList)
+ return ((XmlSchemaSimpleTypeList)ob).ItemTypeName;
+ else
+ return null;
+ }
+
+ void WriteComplexContent (XmlTextWriter xtw, string ns, XmlSchemaComplexContent content)
+ {
+ XmlQualifiedName qname;
+
+ XmlSchemaComplexContentExtension ext = content.Content as XmlSchemaComplexContentExtension;
+ if (ext != null) qname = ext.BaseTypeName;
+ else {
+ XmlSchemaComplexContentRestriction rest = (XmlSchemaComplexContentRestriction)content.Content;
+ qname = rest.BaseTypeName;
+ if (qname == arrayType) {
+ ParseArrayType (rest, out qname);
+ XmlSchemaElement elem = new XmlSchemaElement ();
+ elem.Name = "Item";
+ elem.SchemaTypeName = qname;
+
+ xtw.WriteAttributeString ("arrayType", SoapEncodingNamespace, qname.Name + "[2]");
+ WriteContentItem (xtw, ns, elem, true);
+ return;
+ }
+ }
+
+ // Add base map members to this map
+ XmlSchemaComplexType ctype = FindComplexTyype (qname);
+ WriteComplexTypeAttributes (xtw, ctype);
+
+ if (ext != null) {
+ // Add the members of this map
+ WriteAttributes (xtw, ext.Attributes, ext.AnyAttribute);
+ if (ext.Particle != null)
+ WriteParticleComplexContent (xtw, ns, ext.Particle);
+ }
+
+ WriteComplexTypeElements (xtw, ns, ctype);
+ }
+
+ void ParseArrayType (XmlSchemaComplexContentRestriction rest, out XmlQualifiedName qtype)
+ {
+ XmlSchemaAttribute arrayTypeAt = FindArrayAttribute (rest.Attributes);
+ XmlAttribute[] uatts = arrayTypeAt.UnhandledAttributes;
+ if (uatts == null || uatts.Length == 0) throw new InvalidOperationException ("arrayType attribute not specified in array declaration");
+
+ XmlAttribute xat = null;
+ foreach (XmlAttribute at in uatts)
+ if (at.LocalName == "arrayType" && at.NamespaceURI == WsdlNamespace)
+ { xat = at; break; }
+
+ if (xat == null)
+ throw new InvalidOperationException ("arrayType attribute not specified in array declaration");
+
+ string arrayType = xat.Value;
+ string type, ns;
+ int i = arrayType.LastIndexOf (":");
+ if (i == -1) ns = "";
+ else ns = arrayType.Substring (0,i);
+
+ int j = arrayType.IndexOf ("[", i+1);
+ if (j == -1) throw new InvalidOperationException ("Cannot parse WSDL array type: " + arrayType);
+ type = arrayType.Substring (i+1);
+ type = type.Substring (0, type.Length-2);
+
+ qtype = new XmlQualifiedName (type, ns);
+ }
+
+ XmlSchemaAttribute FindArrayAttribute (XmlSchemaObjectCollection atts)
+ {
+ foreach (object ob in atts)
+ {
+ XmlSchemaAttribute att = ob as XmlSchemaAttribute;
+ if (att != null && att.RefName == arrayTypeRefName) return att;
+
+ XmlSchemaAttributeGroupRef gref = ob as XmlSchemaAttributeGroupRef;
+ if (gref != null)
+ {
+ XmlSchemaAttributeGroup grp = (XmlSchemaAttributeGroup) schemas.Find (gref.RefName, typeof(XmlSchemaAttributeGroup));
+ att = FindArrayAttribute (grp.Attributes);
+ if (att != null) return att;
+ }
+ }
+ return null;
+ }
+
+ void WriteSimpleTypeSample (XmlTextWriter xtw, XmlSchemaSimpleType stype)
+ {
+ xtw.WriteString (GetLiteral (FindBuiltInType (stype)));
+ }
+
+ XmlSchemaParticle GetRefGroupParticle (XmlSchemaGroupRef refGroup)
+ {
+ XmlSchemaGroup grp = (XmlSchemaGroup) schemas.Find (refGroup.RefName, typeof (XmlSchemaGroup));
+ return grp.Particle;
+ }
+
+ XmlSchemaElement FindRefElement (XmlSchemaElement elem)
+ {
+ if (elem.RefName.Namespace == XmlSchema.Namespace)
+ {
+ if (anyElement != null) return anyElement;
+ anyElement = new XmlSchemaElement ();
+ anyElement.Name = "any";
+ anyElement.SchemaTypeName = anyType;
+ return anyElement;
+ }
+ return (XmlSchemaElement) schemas.Find (elem.RefName, typeof(XmlSchemaElement));
+ }
+
+ XmlSchemaAttribute FindRefAttribute (XmlQualifiedName refName)
+ {
+ if (refName.Namespace == XmlSchema.Namespace)
+ {
+ XmlSchemaAttribute at = new XmlSchemaAttribute ();
+ at.Name = refName.Name;
+ at.SchemaTypeName = new XmlQualifiedName ("string",XmlSchema.Namespace);
+ return at;
+ }
+ return (XmlSchemaAttribute) schemas.Find (refName, typeof(XmlSchemaAttribute));
+ }
+
+ void WriteRefTypeSample (XmlTextWriter xtw, string ns, XmlSchemaElement elem)
+ {
+ if (elem.SchemaTypeName.Namespace == XmlSchema.Namespace || schemas.Find (elem.SchemaTypeName, typeof(XmlSchemaSimpleType)) != null)
+ WriteElementSample (xtw, ns, elem);
+ else
+ {
+ xtw.WriteStartElement (elem.Name, ns);
+ xtw.WriteAttributeString ("href", "#id" + (queue.Count+1));
+ xtw.WriteEndElement ();
+ queue.Add (new EncodedType (ns, elem));
+ }
+ }
+
+ void WriteQueuedTypeSamples (XmlTextWriter xtw)
+ {
+ for (int n=0; n<queue.Count; n++)
+ {
+ EncodedType ec = (EncodedType) queue[n];
+ XmlSchemaComplexType st = FindComplexTyype (ec.Element.SchemaTypeName);
+ WriteComplexTypeSample (xtw, st, ec.Element.SchemaTypeName, n+1);
+ }
+ }
+
+ XmlSchemaComplexType FindComplexTyype (XmlQualifiedName qname)
+ {
+ if (qname.Name.IndexOf ("[]") != -1)
+ {
+ XmlSchemaComplexType stype = new XmlSchemaComplexType ();
+ stype.ContentModel = new XmlSchemaComplexContent ();
+
+ XmlSchemaComplexContentRestriction res = new XmlSchemaComplexContentRestriction ();
+ stype.ContentModel.Content = res;
+ res.BaseTypeName = arrayType;
+
+ XmlSchemaAttribute att = new XmlSchemaAttribute ();
+ att.RefName = arrayTypeRefName;
+ res.Attributes.Add (att);
+
+ XmlAttribute xat = document.CreateAttribute ("arrayType", WsdlNamespace);
+ xat.Value = qname.Namespace + ":" + qname.Name;
+ att.UnhandledAttributes = new XmlAttribute[] {xat};
+ return stype;
+ }
+
+ return (XmlSchemaComplexType) schemas.Find (qname, typeof(XmlSchemaComplexType));
+ }
+
+ string GetQualifiedNameString (XmlTextWriter xtw, XmlQualifiedName qname)
+ {
+ string pref = xtw.LookupPrefix (qname.Namespace);
+ if (pref != null) return pref + ":" + qname.Name;
+
+ xtw.WriteAttributeString ("xmlns", "q1", null, qname.Namespace);
+ return "q1:" + qname.Name;
+ }
+
+ protected virtual string GetLiteral (string s)
+ {
+ return s;
+ }
+
+ void GetOperationFormat (OperationBinding obin, out SoapBindingStyle style, out SoapBindingUse use)
+ {
+ style = SoapBindingStyle.Document;
+ use = SoapBindingUse.Literal;
+ SoapOperationBinding sob = obin.Extensions.Find (typeof(SoapOperationBinding)) as SoapOperationBinding;
+ if (sob != null) {
+ style = sob.Style;
+ SoapBodyBinding sbb = obin.Input.Extensions.Find (typeof(SoapBodyBinding)) as SoapBodyBinding;
+ if (sbb != null)
+ use = sbb.Use;
+ }
+ }
+ }
+
+
+
+}
+
diff --git a/mcs/tools/wsdl/wsdl.exe.sources b/mcs/tools/wsdl/wsdl.exe.sources
index c537cf0d7a1..bc7b5fb2324 100644
--- a/mcs/tools/wsdl/wsdl.exe.sources
+++ b/mcs/tools/wsdl/wsdl.exe.sources
@@ -1 +1,2 @@
MonoWSDL.cs
+SampleGenerator.cs
diff --git a/mono/arch/mips/mips-codegen.h b/mono/arch/mips/mips-codegen.h
new file mode 100644
index 00000000000..8cc0cd0bcef
--- /dev/null
+++ b/mono/arch/mips/mips-codegen.h
@@ -0,0 +1,340 @@
+#ifndef __MIPS_CODEGEN_H__
+#define __MIPS_CODEGEN_H__
+/*
+ * Copyright (c) 2004 Novell, Inc
+ * Author: Paolo Molaro (lupus@ximian.com)
+ *
+ */
+
+/* registers */
+enum {
+ mips_zero,
+ mips_at, /* assembler temp */
+ mips_v0, /* return values */
+ mips_v1,
+ mips_a0, /* 4 - func arguments */
+ mips_a1,
+ mips_a2,
+ mips_a3,
+ mips_t0, /* 8 temporaries */
+ mips_t1,
+ mips_t2,
+ mips_t3,
+ mips_t4,
+ mips_t5,
+ mips_t6,
+ mips_t7,
+ mips_s0, /* 16 calle saved */
+ mips_s1,
+ mips_s2,
+ mips_s3,
+ mips_s4,
+ mips_s5,
+ mips_s6,
+ mips_s7,
+ mips_t8, /* 24 temps */
+ mips_t9,
+ mips_k0, /* 26 kernel-reserved */
+ mips_k1,
+ mips_gp, /* 28 */
+ mips_sp, /* stack pointer */
+ mips_fp, /* frame pointer */
+ mips_ra /* return address */
+};
+
+/* we treat the register file as containing just doubles... */
+enum {
+ mips_f0, /* return regs */
+ mips_f2,
+ mips_f4, /* temps */
+ mips_f6,
+ mips_f8,
+ mips_f10,
+ mips_f12, /* first arg */
+ mips_f14, /* second arg */
+ mips_f16, /* temps */
+ mips_f18,
+ mips_f20, /* callee saved */
+ mips_f22,
+ mips_f24,
+ mips_f26,
+ mips_f28,
+ mips_f30
+};
+
+#define mips_emit32(c,x) do { *((unsigned int *) c) = x; ((unsigned int *)c)++;} while (0)
+#define mips_format_i(code,op,rs,rt,imm) mips_emit32 ((code), (((op)<<26)|((rs)<<21)|((rt)<<16)|(imm)))
+#define mips_format_j(code,op,imm) mips_emit32 ((code), (((op)<<26)|(imm)))
+#define mips_format_r(code,op,rs,rt,rd,sa,func) mips_emit32 ((code), (((op)<<26)|((rs)<<21)|((rt)<<16)|((rd)<<11)|((sa)<<6)|(func)))
+#define mips_format_divmul(code,op,src1,src2,fun) mips_emit32 ((code), (((op)<<26)|((src1)<<21)|((src2)<<16)|(fun)))
+
+/* prefetch hints */
+enum {
+ MIPS_FOR_LOAD,
+ MIPS_FOR_STORE,
+ MIPS_FOR_LOAD_STREAMED = 4,
+ MIPS_FOR_STORE_STREAMED,
+ MIPS_FOR_LOAD_RETAINED,
+ MIPS_FOR_STORE_RETAINED
+};
+
+/* coprocessors */
+enum {
+ MIPS_COP0,
+ MIPS_COP1,
+ MIPS_COP2,
+ MIPS_COP3
+};
+
+enum {
+ MIPS_FMT_SINGLE = 16,
+ MIPS_FMT_DOUBLE = 17,
+ MIPS_FMT_WORD = 20,
+ MIPS_FMT_LONG = 21,
+ MIPS_FMT3_SINGLE = 0,
+ MIPS_FMT3_DOUBLE = 1
+};
+
+/* fpu rounding mode */
+enum {
+ MIPS_ROUND_TO_NEAREST,
+ MIPS_ROUND_TO_ZERO,
+ MIPS_ROUND_TO_POSINF,
+ MIPS_ROUND_TO_NEGINF,
+ MIPS_ROUND_MASK = 3
+};
+
+/* fpu enable/cause flags, cc */
+enum {
+ MIPS_FPU_C_MASK = 1 << 23,
+ MIPS_INEXACT = 1,
+ MIPS_UNDERFLOW = 2,
+ MIPS_OVERFLOW = 4,
+ MIPS_DIVZERO = 8,
+ MIPS_INVALID = 16,
+ MIPS_NOTIMPL = 32,
+ MIPS_FPU_FLAGS_OFFSET = 2,
+ MIPS_FPU_ENABLES_OFFSET = 7,
+ MIPS_FPU_CAUSES_OFFSET = 12
+};
+
+/* fpu condition values */
+enum {
+ MIPS_FPU_FALSE, /* TRUE */
+ MIPS_FPU_UNORDERED, /* ORDERED */
+ MIPS_FPU_EQ, /* NOT_EQUAL */
+ MIPS_FPU_UNORD_EQ, /* ORDERED or NEQ */
+ MIPS_FPU_ORD_LT, /* UNORDERED or GE */
+ MIPS_FPU_UNORD_LT, /* ORDERED or GE */
+ MIPS_FPU_ORD_LE, /* UNORDERED or GT */
+ MIPS_FPU_UNORD_LE /* OREDERED or GT */
+};
+
+/* arithmetric ops */
+#define mips_add(c,dest,src1,src2) mips_format_r(c,0,src1,src2,dest,0,32)
+#define mips_addi(c,dest,src1,imm) mips_format_i(c,8,src1,dest,imm)
+#define mips_addu(c,dest,src1,src2) mips_format_r(c,0,src1,src2,dest,0,33)
+#define mips_addiu(c,dest,src1,imm) mips_format_i(c,9,src1,dest,imm)
+#define mips_dadd(c,dest,src1,src2) mips_format_r(c,0,src1,src2,dest,0,44)
+#define mips_daddi(c,dest,src1,imm) mips_format_i(c,24,src1,dest,imm)
+#define mips_daddu(c,dest,src1,src2) mips_format_r(c,0,src1,src2,dest,0,45)
+#define mips_daddiu(c,dest,src1,imm) mips_format_i(c,25,src1,dest,imm)
+#define mips_dsub(c,dest,src1,src2) mips_format_r(c,0,src1,src2,dest,0,46)
+#define mips_dsubu(c,dest,src1,src2) mips_format_r(c,0,src1,src2,dest,0,47)
+#define mips_sub(c,dest,src1,src2) mips_format_r(c,0,src1,src2,dest,0,34)
+#define mips_subu(c,dest,src1,src2) mips_format_r(c,0,src1,src2,dest,0,35)
+
+/* div and mul ops */
+#define mips_ddiv(c,src1,src2) mips_format_divmul(c,0,src1,src2,30)
+#define mips_ddivu(c,src1,src2) mips_format_divmul(c,0,src1,src2,31)
+#define mips_div(c,src1,src2) mips_format_divmul(c,0,src1,src2,26)
+#define mips_divu(c,src1,src2) mips_format_divmul(c,0,src1,src2,27)
+#define mips_dmult(c,src1,src2) mips_format_divmul(c,0,src1,src2,28)
+#define mips_dmultu(c,src1,src2) mips_format_divmul(c,0,src1,src2,29)
+#define mips_mult(c,src1,src2) mips_format_divmul(c,0,src1,src2,24)
+#define mips_multu(c,src1,src2) mips_format_divmul(c,0,src1,src2,25)
+
+/* shift ops */
+#define mips_dsll(c,dest,src1,imm) mips_format_r(c,0,0,src1,dest,imm,56)
+#define mips_dsll32(c,dest,src1,imm) mips_format_r(c,0,0,src1,dest,imm,60)
+#define mips_dsllv(c,dest,src1,src2) mips_format_r(c,0,src2,src1,dest,0,20)
+#define mips_dsra(c,dest,src1,imm) mips_format_r(c,0,0,src1,dest,imm,59)
+#define mips_dsra32(c,dest,src1,imm) mips_format_r(c,0,0,src1,dest,imm,63)
+#define mips_dsrav(c,dest,src1,src2) mips_format_r(c,0,src2,src1,dest,0,23)
+#define mips_dsrl(c,dest,src1,imm) mips_format_r(c,0,0,src1,dest,imm,58)
+#define mips_dsrl32(c,dest,src1,imm) mips_format_r(c,0,0,src1,dest,imm,62)
+#define mips_dsrlv(c,dest,src1,src2) mips_format_r(c,0,src2,src1,dest,0,22)
+#define mips_sll(c,dest,src1,imm) mips_format_r(c,0,0,src1,dest,imm,0)
+#define mips_sllv(c,dest,src1,src2) mips_format_r(c,0,src2,src1,dest,0,4)
+#define mips_sra(c,dest,src1,imm) mips_format_r(c,0,0,src1,dest,imm,3)
+#define mips_srav(c,dest,src1,src2) mips_format_r(c,0,src2,src1,dest,0,7)
+#define mips_srl(c,dest,src1,imm) mips_format_r(c,0,0,src1,dest,imm,2)
+#define mips_srlv(c,dest,src1,src2) mips_format_r(c,0,src2,src1,dest,0,6)
+
+/* logical ops */
+#define mips_and(c,dest,src1,src2) mips_format_r(c,0,src1,src2,dest,0,36)
+#define mips_andi(c,dest,src1,imm) mips_format_i(c,12,src1,dest,imm)
+#define mips_nor(c,dest,src1,src2) mips_format_r(c,0,src1,src2,dest,0,39)
+#define mips_or(c,dest,src1,src2) mips_format_r(c,0,src1,src2,dest,0,37)
+#define mips_ori(c,dest,src1,uimm) mips_format_i(c,13,src1,dest,uimm)
+#define mips_xor(c,dest,src1,src2) mips_format_r(c,0,src1,src2,dest,0,38)
+#define mips_xori(c,dest,src1,uimm) mips_format_i(c,14,src1,dest,uimm)
+
+/* compares */
+#define mips_slt(c,dest,src1,src2) mips_format_r(c,0,src1,src2,dest,0,42)
+#define mips_slti(c,dest,src1,imm) mips_format_i(c,10,src1,dest,imm)
+#define mips_sltiu(c,dest,src1,imm) mips_format_i(c,11,src1,dest,imm)
+#define mips_sltu(c,dest,src1,src2) mips_format_r(c,0,src1,src2,dest,0,43)
+/* missing traps: teq, teqi, tge, tgei, tgeiu, tgeu, tlt, tlti, tltiu, tltu, tne, tnei, */
+
+/* conditional branches */
+#define mips_beq(c,src1,src2,offset) mips_format_i(c,4,src1,src2,offset)
+#define mips_beql(c,src1,src2,offset) mips_format_i(c,20,src1,src2,offset)
+#define mips_bgez(c,src1,offset) mips_format_i(c,1,src1,1,offset)
+#define mips_bgezal(c,src1,offset) mips_format_i(c,1,src1,17,offset)
+#define mips_bgezall(c,src1,offset) mips_format_i(c,1,src1,19,offset)
+#define mips_bgezl(c,src1,offset) mips_format_i(c,1,src1,3,offset)
+#define mips_bgtz(c,src1,offset) mips_format_i(c,7,src1,0,offset)
+#define mips_bgtzl(c,src1,offset) mips_format_i(c,23,src1,0,offset)
+#define mips_blez(c,src1,offset) mips_format_i(c,6,src1,0,offset)
+#define mips_blezl(c,src1,offset) mips_format_i(c,22,src1,0,offset)
+#define mips_bltz(c,src1,offset) mips_format_i(c,1,src1,0,offset)
+#define mips_bltzal(c,src1,offset) mips_format_i(c,1,src1,16,offset)
+#define mips_bltzall(c,src1,offset) mips_format_i(c,1,src1,18,offset)
+#define mips_bltzl(c,src1,offset) mips_format_i(c,1,src1,2,offset)
+#define mips_bne(c,src1,src2,offset) mips_format_i(c,5,src1,src2,offset)
+#define mips_bnel(c,src1,src2,offset) mips_format_i(c,21,src1,src2,offset)
+
+/* uncond branches and calls */
+#define mips_jump(c,target) mips_format_j(c,2,target)
+#define mips_jumpl(c,target) mips_format_j(c,3,target)
+#define mips_jalr(c,src1,retreg) mips_format_r(c,0,src1,0,retreg,0,9)
+#define mips_jr(c,src1) mips_emit32(c,((src1)<<21)|8)
+
+/* loads and stores */
+#define mips_lb(c,dest,base,offset) mips_format_i(c,32,base,dest,offset)
+#define mips_lbu(c,dest,base,offset) mips_format_i(c,36,base,dest,offset)
+#define mips_ld(c,dest,base,offset) mips_format_i(c,55,base,dest,offset)
+#define mips_ldl(c,dest,base,offset) mips_format_i(c,26,base,dest,offset)
+#define mips_ldr(c,dest,base,offset) mips_format_i(c,27,base,dest,offset)
+#define mips_lh(c,dest,base,offset) mips_format_i(c,33,base,dest,offset)
+#define mips_lhu(c,dest,base,offset) mips_format_i(c,37,base,dest,offset)
+#define mips_ll(c,dest,base,offset) mips_format_i(c,48,base,dest,offset)
+#define mips_lld(c,dest,base,offset) mips_format_i(c,52,base,dest,offset)
+#define mips_lui(c,dest,base,uimm) mips_format_i(c,15,base,dest,uimm)
+#define mips_lw(c,dest,base,offset) mips_format_i(c,35,base,dest,offset)
+#define mips_lwl(c,dest,base,offset) mips_format_i(c,34,base,dest,offset)
+#define mips_lwr(c,dest,base,offset) mips_format_i(c,38,base,dest,offset)
+#define mips_lwu(c,dest,base,offset) mips_format_i(c,39,base,dest,offset)
+#define mips_sb(c,src,base,offset) mips_format_i(c,40,base,src,offset)
+#define mips_sc(c,src,base,offset) mips_format_i(c,56,base,src,offset)
+#define mips_scd(c,src,base,offset) mips_format_i(c,60,base,src,offset)
+#define mips_sd(c,src,base,offset) mips_format_i(c,63,base,src,offset)
+#define mips_sdl(c,src,base,offset) mips_format_i(c,44,base,src,offset)
+#define mips_sdr(c,src,base,offset) mips_format_i(c,45,base,src,offset)
+#define mips_sh(c,src,base,offset) mips_format_i(c,41,base,src,offset)
+#define mips_sw(c,src,base,offset) mips_format_i(c,43,base,src,offset)
+#define mips_swl(c,src,base,offset) mips_format_i(c,50,base,src,offset)
+#define mips_swr(c,src,base,offset) mips_format_i(c,54,base,src,offset)
+
+/* misc and coprocessor ops */
+#define mips_move(c,dest,src) mips_add(c,dest,src,mips_zero)
+#define mips_nop(c) mips_sll(c,0,0,0)
+#define mips_break(c,code) mips_emit32(c, ((code)<<6)|13)
+#define mips_mfhi(c,dest) mips_format_r(c,0,0,0,dest,0,16)
+#define mips_mflo(c,dest) mips_format_r(c,0,0,0,dest,0,18)
+#define mips_mthi(c,src) mips_format_r(c,0,src,0,0,0,17)
+#define mips_mtlo(c,src) mips_format_r(c,0,src,0,0,0,19)
+#define mips_movn(c,dest,src,test) mips_format_r(c,0,src,test,dest,0,11)
+#define mips_movz(c,dest,src,test) mips_format_r(c,0,src,test,dest,0,10)
+#define mips_pref(c,hint,base,offset) mips_format_i(c,51,base,hint,offset)
+#define mips_prefidx(c,hint,base,idx) mips_format_r(c,19,base,idx,hint,0,15)
+#define mips_sync(c,stype) mips_emit32(c, ((stype)<<6)|15)
+#define mips_syscall(c,code) mips_emit32(c, ((code)<<6)|12)
+
+#define mips_cop(c,cop,fun) mips_emit32(c, ((16|(cop))<<26)|(fun))
+#define mips_ldc(c,cop,dest,base,offset) mips_format_i(c,(52|(cop)),base,dest,offset)
+#define mips_lwc(c,cop,dest,base,offset) mips_format_i(c,(48|(cop)),base,dest,offset)
+#define mips_sdc(c,cop,src,base,offset) mips_format_i(c,(60|(cop)),base,src,offset)
+#define mips_swc(c,cop,src,base,offset) mips_format_i(c,(56|(cop)),base,src,offset)
+#define mips_cfc1(c,dest,src) mips_format_r(c,17,2,dest,src,0,0)
+#define mips_ctc1(c,dest,src) mips_format_r(c,17,6,dest,src,0,0)
+
+/* fpu ops */
+#define mips_fabss(c,dest,src) mips_format_r(c,17,MIPS_FMT_SINGLE,0,src,dest,5)
+#define mips_fabsd(c,dest,src) mips_format_r(c,17,MIPS_FMT_DOUBLE,0,src,dest,5)
+#define mips_fadds(c,dest,src1,src2) mips_format_r(c,17,MIPS_FMT_SINGLE,src2,src1,dest,0)
+#define mips_faddd(c,dest,src1,src2) mips_format_r(c,17,MIPS_FMT_DOUBLE,src2,src1,dest,0)
+#define mips_fdivs(c,dest,src1,src2) mips_format_r(c,17,MIPS_FMT_SINGLE,src2,src1,dest,3)
+#define mips_fdivd(c,dest,src1,src2) mips_format_r(c,17,MIPS_FMT_DOUBLE,src2,src1,dest,3)
+#define mips_fmuls(c,dest,src1,src2) mips_format_r(c,17,MIPS_FMT_SINGLE,src2,src1,dest,2)
+#define mips_fmuld(c,dest,src1,src2) mips_format_r(c,17,MIPS_FMT_DOUBLE,src2,src1,dest,2)
+#define mips_fnegs(c,dest,src) mips_format_r(c,17,MIPS_FMT_SINGLE,0,src,dest,7)
+#define mips_fnegd(c,dest,src) mips_format_r(c,17,MIPS_FMT_DOUBLE,0,src,dest,7)
+#define mips_fsqrts(c,dest,src) mips_format_r(c,17,MIPS_FMT_SINGLE,0,src,dest,4)
+#define mips_fsqrtd(c,dest,src) mips_format_r(c,17,MIPS_FMT_DOUBLE,0,src,dest,4)
+#define mips_fsubs(c,dest,src1,src2) mips_format_r(c,17,MIPS_FMT_SINGLE,src2,src1,dest,1)
+#define mips_fsubd(c,dest,src1,src2) mips_format_r(c,17,MIPS_FMT_DOUBLE,src2,src1,dest,1)
+#define mips_madds(c,dest,src1,src2,srcadd) mips_format_r(c,19,srcadd,src2,src1,dest,32|MIPS_FMT_SINGLE)
+#define mips_maddd(c,dest,src1,src2,srcadd) mips_format_r(c,19,srcadd,src2,src1,dest,32|MIPS_FMT_DOUBLE)
+#define mips_nmadds(c,dest,src1,src2,srcadd) mips_format_r(c,19,srcadd,src2,src1,dest,48|MIPS_FMT_SINGLE)
+#define mips_nmaddd(c,dest,src1,src2,srcadd) mips_format_r(c,19,srcadd,src2,src1,dest,48|MIPS_FMT_DOUBLE)
+#define mips_msubs(c,dest,src1,src2,srcsub) mips_format_r(c,19,srcsub,src2,src1,dest,40|MIPS_FMT_SINGLE)
+#define mips_msubd(c,dest,src1,src2,srcsub) mips_format_r(c,19,srcsub,src2,src1,dest,40|MIPS_FMT_DOUBLE)
+#define mips_nmsubs(c,dest,src1,src2,srcsub) mips_format_r(c,19,srcsub,src2,src1,dest,56|MIPS_FMT_SINGLE)
+#define mips_nmsubd(c,dest,src1,src2,srcsub) mips_format_r(c,19,srcsub,src2,src1,dest,56|MIPS_FMT_DOUBLE)
+
+/* fp compare and branch */
+#define mips_fcmps(c,cond,src1,src2) mips_format_r(c,17,MIPS_FMT_SINGLE,src2,src1,0,(3<<4)|(cond))
+#define mips_fcmpd(c,cond,src1,src2) mips_format_r(c,17,MIPS_FMT_DOUBLE,src2,src1,0,(3<<4)|(cond))
+#define mips_fbfalse(c,offset) mips_format_i(c,17,8,0,offset)
+#define mips_fbfalsel(c,offset) mips_format_i(c,17,8,2,offset)
+#define mips_fbtrue(c,offset) mips_format_i(c,17,8,1,offset)
+#define mips_fbtruel(c,offset) mips_format_i(c,17,8,3,offset)
+
+/* fp convert */
+#define mips_ceills(c,dest,src) mips_format_r(c,17,MIPS_FMT_SINGLE,0,src,dest,10)
+#define mips_ceilld(c,dest,src) mips_format_r(c,17,MIPS_FMT_DOUBLE,0,src,dest,10)
+#define mips_ceilws(c,dest,src) mips_format_r(c,17,MIPS_FMT_SINGLE,0,src,dest,14)
+#define mips_ceilwd(c,dest,src) mips_format_r(c,17,MIPS_FMT_DOUBLE,0,src,dest,14)
+#define mips_cvtds(c,dest,src) mips_format_r(c,17,MIPS_FMT_SINGLE,0,src,dest,33)
+#define mips_cvtdw(c,dest,src) mips_format_r(c,17,MIPS_FMT_WORD,0,src,dest,33)
+#define mips_cvtdl(c,dest,src) mips_format_r(c,17,MIPS_FMT_LONG,0,src,dest,33)
+#define mips_cvtls(c,dest,src) mips_format_r(c,17,MIPS_FMT_SINGLE,0,src,dest,37)
+#define mips_cvtld(c,dest,src) mips_format_r(c,17,MIPS_FMT_DOUBLE,0,src,dest,37)
+#define mips_cvtsd(c,dest,src) mips_format_r(c,17,MIPS_FMT_DOUBLE,0,src,dest,32)
+#define mips_cvtsw(c,dest,src) mips_format_r(c,17,MIPS_FMT_WORD,0,src,dest,32)
+#define mips_cvtsl(c,dest,src) mips_format_r(c,17,MIPS_FMT_LONG,0,src,dest,32)
+#define mips_cvtws(c,dest,src) mips_format_r(c,17,MIPS_FMT_SINGLE,0,src,dest,36)
+#define mips_cvtwd(c,dest,src) mips_format_r(c,17,MIPS_FMT_DOUBLE,0,src,dest,36)
+#define mips_floorls(c,dest,src) mips_format_r(c,17,MIPS_FMT_SINGLE,0,src,dest,11)
+#define mips_floorld(c,dest,src) mips_format_r(c,17,MIPS_FMT_DOUBLE,0,src,dest,11)
+#define mips_floorws(c,dest,src) mips_format_r(c,17,MIPS_FMT_SINGLE,0,src,dest,15)
+#define mips_floorwd(c,dest,src) mips_format_r(c,17,MIPS_FMT_DOUBLE,0,src,dest,15)
+#define mips_roundls(c,dest,src) mips_format_r(c,17,MIPS_FMT_SINGLE,0,src,dest,8)
+#define mips_roundld(c,dest,src) mips_format_r(c,17,MIPS_FMT_DOUBLE,0,src,dest,8)
+#define mips_roundws(c,dest,src) mips_format_r(c,17,MIPS_FMT_SINGLE,0,src,dest,12)
+#define mips_roundwd(c,dest,src) mips_format_r(c,17,MIPS_FMT_DOUBLE,0,src,dest,12)
+#define mips_truncls(c,dest,src) mips_format_r(c,17,MIPS_FMT_SINGLE,0,src,dest,9)
+#define mips_truncld(c,dest,src) mips_format_r(c,17,MIPS_FMT_DOUBLE,0,src,dest,9)
+#define mips_truncws(c,dest,src) mips_format_r(c,17,MIPS_FMT_SINGLE,0,src,dest,13)
+#define mips_truncwd(c,dest,src) mips_format_r(c,17,MIPS_FMT_DOUBLE,0,src,dest,13)
+
+/* fp moves, loads */
+#define mips_fmovs(c,dest,src) mips_format_r(c,17,MIPS_FMT_SINGLE,0,src,dest,6)
+#define mips_fmovd(c,dest,src) mips_format_r(c,17,MIPS_FMT_DOUBLE,0,src,dest,6)
+#define mips_wmovfc1(c,dest,src) mips_format_r(c,17,0,dest,src,0,0)
+#define mips_wmovtc1(c,dest,src) mips_format_r(c,17,4,src,dest,0,0)
+#define mips_dmovfc1(c,dest,src) mips_format_r(c,17,1,0,dest,src,0,0)
+#define mips_dmovtc1(c,dest,src) mips_format_r(c,17,1,0,src,dest,0,0)
+#define mips_ldc1(c,dest,base,offset) mips_ldc(c,1,dest,base,offset)
+#define mips_ldxc1(c,dest,base,idx) mips_format_r(c,19,base,idx,0,dest,1)
+#define mips_lwc1(c,dest,base,offset) mips_lwc(c,1,dest,base,offset)
+#define mips_lwxc1(c,dest,base,idx) mips_format_r(c,19,base,idx,0,dest,0)
+#define mips_sdc1(c,src,base,offset) mips_sdc(c,1,src,base,offset)
+#define mips_sdxc1(c,src,base,idx) mips_format_r(c,19,base,idx,src,0,9)
+#define mips_swc1(c,src,base,offset) mips_swc(c,1,src,base,offset)
+#define mips_swxc1(c,src,base,idx) mips_format_r(c,19,base,idx,src,0,8)
+
+#endif /* __MIPS_CODEGEN_H__ */
+
diff --git a/mono/arch/mips/test.c b/mono/arch/mips/test.c
new file mode 100644
index 00000000000..d83f833f27e
--- /dev/null
+++ b/mono/arch/mips/test.c
@@ -0,0 +1,149 @@
+#include "mips-codegen.h"
+#include <stdlib.h>
+
+int main () {
+ unsigned int *code, * p;
+
+ code = p = malloc (sizeof (int) * 1024);
+
+ mips_add (p, 3, 4, 5);
+ mips_addi (p, 3, 4, 5);
+ mips_addu (p, 3, 4, 5);
+ mips_addiu (p, 3, 4, 5);
+ mips_sub (p, 3, 4, 5);
+ mips_subu (p, 3, 4, 5);
+ mips_dadd (p, 3, 4, 5);
+ mips_daddi (p, 3, 4, 5);
+ mips_daddu (p, 3, 4, 5);
+ mips_daddiu (p, 3, 4, 5);
+ mips_dsub (p, 3, 4, 5);
+ mips_dsubu (p, 3, 4, 5);
+
+ mips_mult (p, 6, 7);
+ mips_multu (p, 6, 7);
+ mips_div (p, 6, 7);
+ mips_divu (p, 6, 7);
+ mips_dmult (p, 6, 7);
+ mips_dmultu (p, 6, 7);
+ mips_ddiv (p, 6, 7);
+ mips_ddivu (p, 6, 7);
+
+ mips_sll (p, 3, 4, 5);
+ mips_sllv (p, 3, 4, 5);
+ mips_sra (p, 3, 4, 5);
+ mips_srav (p, 3, 4, 5);
+ mips_srl (p, 3, 4, 5);
+ mips_srlv (p, 3, 4, 5);
+ mips_dsll (p, 3, 4, 5);
+ mips_dsll32 (p, 3, 4, 5);
+ mips_dsllv (p, 3, 4, 5);
+ mips_dsra (p, 3, 4, 5);
+ mips_dsra32 (p, 3, 4, 5);
+ mips_dsrav (p, 3, 4, 5);
+ mips_dsrl (p, 3, 4, 5);
+ mips_dsrl32 (p, 3, 4, 5);
+ mips_dsrlv (p, 3, 4, 5);
+
+ mips_and (p, 8, 9, 10);
+ mips_andi (p, 8, 9, 10);
+ mips_nor (p, 8, 9, 10);
+ mips_or (p, 8, 9, 10);
+ mips_ori (p, 8, 9, 10);
+ mips_xor (p, 8, 9, 10);
+ mips_xori (p, 8, 9, 10);
+
+ mips_slt (p, 8, 9, 10);
+ mips_slti (p, 8, 9, 10);
+ mips_sltu (p, 8, 9, 10);
+ mips_sltiu (p, 8, 9, 10);
+
+ mips_beq (p, 8, 9, 0xff1f);
+ mips_beql (p, 8, 9, 0xff1f);
+ mips_bne (p, 8, 9, 0xff1f);
+ mips_bnel (p, 8, 9, 0xff1f);
+ mips_bgez (p, 11, 0xff1f);
+ mips_bgezal (p, 11, 0xff1f);
+ mips_bgezall (p, 11, 0xff1f);
+ mips_bgezl (p, 11, 0xff1f);
+ mips_bgtz (p, 11, 0xff1f);
+ mips_bgtzl (p, 11, 0xff1f);
+ mips_blez (p, 11, 0xff1f);
+ mips_blezl (p, 11, 0xff1f);
+ mips_bltz (p, 11, 0xff1f);
+ mips_bltzal (p, 11, 0xff1f);
+ mips_bltzall (p, 11, 0xff1f);
+ mips_bltzl (p, 11, 0xff1f);
+
+ mips_jump (p, 0xff1f);
+ mips_jumpl (p, 0xff1f);
+ mips_jalr (p, 12, mips_ra);
+ mips_jr (p, 12);
+
+ mips_lb (p, 13, 14, 128);
+ mips_lbu (p, 13, 14, 128);
+ mips_ld (p, 13, 14, 128);
+ mips_ldl (p, 13, 14, 128);
+ mips_ldr (p, 13, 14, 128);
+ mips_lh (p, 13, 14, 128);
+ mips_lhu (p, 13, 14, 128);
+ mips_ll (p, 13, 14, 128);
+ mips_lld (p, 13, 14, 128);
+ mips_lui (p, 13, 14, 128);
+ mips_lw (p, 13, 14, 128);
+ mips_lwl (p, 13, 14, 128);
+ mips_lwr (p, 13, 14, 128);
+ mips_lwu (p, 13, 14, 128);
+ mips_sb (p, 13, 14, 128);
+ mips_sc (p, 13, 14, 128);
+ mips_scd (p, 13, 14, 128);
+ mips_sd (p, 13, 14, 128);
+ mips_sdl (p, 13, 14, 128);
+ mips_sdr (p, 13, 14, 128);
+ mips_sh (p, 13, 14, 128);
+ mips_sw (p, 13, 14, 128);
+ mips_swl (p, 13, 14, 128);
+ mips_swr (p, 13, 14, 128);
+
+ mips_move (p, 15, 16);
+ mips_nop (p);
+ mips_break (p, 0);
+ mips_sync (p, 0);
+ mips_mfhi (p, 17);
+ mips_mflo (p, 17);
+ mips_mthi (p, 17);
+ mips_mtlo (p, 17);
+
+ mips_fabsd (p, 16, 18);
+ mips_fnegd (p, 16, 18);
+ mips_fsqrtd (p, 16, 18);
+ mips_faddd (p, 16, 18, 20);
+ mips_fdivd (p, 16, 18, 20);
+ mips_fmuld (p, 16, 18, 20);
+ mips_fsubd (p, 16, 18, 20);
+
+ mips_fcmpd (p, MIPS_FPU_EQ, 18, 20);
+ mips_fbfalse (p, 0xff1f);
+ mips_fbfalsel (p, 0xff1f);
+ mips_fbtrue (p, 0xff1f);
+ mips_fbtruel (p, 0xff1f);
+
+ mips_ceilwd (p, 20, 22);
+ mips_ceilld (p, 20, 22);
+ mips_floorwd (p, 20, 22);
+ mips_floorld (p, 20, 22);
+ mips_roundwd (p, 20, 22);
+ mips_roundld (p, 20, 22);
+ mips_truncwd (p, 20, 22);
+ mips_truncld (p, 20, 22);
+ mips_cvtdw (p, 20, 22);
+ mips_cvtds (p, 20, 22);
+ mips_cvtdl (p, 20, 22);
+ mips_cvtld (p, 20, 22);
+ mips_cvtsd (p, 20, 22);
+ mips_cvtwd (p, 20, 22);
+
+ mips_fmovd (p, 20, 22);
+ printf ("size: %d\n", p - code);
+
+ return 0;
+}
diff --git a/mono/arch/s390/tramp.c b/mono/arch/s390/tramp.c
index c5ebbf984e8..912e8fef5bb 100644
--- a/mono/arch/s390/tramp.c
+++ b/mono/arch/s390/tramp.c
@@ -757,7 +757,7 @@ emit_epilog (guint8 *p, MonoMethodSignature *sig, size_data *sz)
/*------------------------------------------------------------------*/
/* */
-/* Name - mono_create_trampoline. */
+/* Name - mono_arch_create_trampoline. */
/* */
/* Function - Create the code that will allow a mono method to */
/* invoke a system subroutine. */
@@ -765,7 +765,7 @@ emit_epilog (guint8 *p, MonoMethodSignature *sig, size_data *sz)
/*------------------------------------------------------------------*/
MonoPIFunc
-mono_create_trampoline (MonoMethodSignature *sig, gboolean string_ctor)
+mono_arch_create_trampoline (MonoMethodSignature *sig, gboolean string_ctor)
{
guint8 *p, *code_buffer;
size_data sz;
@@ -796,7 +796,7 @@ mono_create_trampoline (MonoMethodSignature *sig, gboolean string_ctor)
/*------------------------------------------------------------------*/
/* */
-/* Name - mono_arch_create_method_pointer */
+/* Name - mono_arch_create_method_pointer */
/* */
/* Function - Returns a pointer to a native function that can */
/* be used to call the specified method. */
@@ -811,7 +811,7 @@ mono_create_trampoline (MonoMethodSignature *sig, gboolean string_ctor)
/* */
/* Logic: */
/* ------ */
-/* mono_arch_create_method_pointer (MonoMethod *method) */
+/* mono_arch_create_method_pointer (MonoMethod *method) */
/* create the unmanaged->managed wrapper */
/* register it with mono_jit_info_table_add() */
/* */
diff --git a/mono/dis/ChangeLog b/mono/dis/ChangeLog
index 8793d835527..fd79a08de9e 100644
--- a/mono/dis/ChangeLog
+++ b/mono/dis/ChangeLog
@@ -1,3 +1,40 @@
+2004-01-31 Martin Baulig <martin@ximian.com>
+
+ * get.c (get_methodspec): It's a methoddef or ref token.
+
+2004-01-26 Martin Baulig <martin@ximian.com>
+
+ * main.cs (--show-tokens): New command line argument to show
+ type tokens in the disassembly.
+
+ * get.c (get_typedef, get_typespec, get_typeref): If
+ `show_tokens', include the token in the type name.
+ (get_type): Do some type parsing here and include the token in the
+ returned type name if requested.
+ (get_method): Include tokens if requested.
+
+2004-01-17 Zoltan Varga <vargaz@freemail.hu>
+
+ * main.c get.c: Add support for dumping the custom attributes of
+ modules.
+
+2004-01-09 Jackson Harper <jackson@ximian.com>
+
+ * monodis.1: Add --show-method-tokens switch
+ * get.c: When stringifying methods show the method token if the
+ show-method-tokens flag is set.
+ * get.h: Add show_method_tokens flag
+ * main.c: Add --show-method-tokens switch
+
+2004-01-09 Jackson Harper <jackson@ximian.com>
+
+ * monodis.1: Add typespec switch
+
+2004-01-08 Jackson Harper <jackson@ximian.com>
+
+ * main.c: Add switch to dump typespec table.
+ * dump.c/dump.h: Add function for dumping typespec table.
+
2003-12-19 Zoltan Varga <vargaz@freemail.hu>
* dump.c (dump_table_exported): Fix output.
diff --git a/mono/dis/dump.c b/mono/dis/dump.c
index 5678866830d..3a76437db79 100644
--- a/mono/dis/dump.c
+++ b/mono/dis/dump.c
@@ -94,6 +94,23 @@ dump_table_typedef (MonoImage *m)
}
void
+dump_table_typespec (MonoImage *m)
+{
+ MonoTableInfo *t = &m->tables [MONO_TABLE_TYPESPEC];
+ int i;
+
+ fprintf (output, "Typespec Table\n");
+
+ for (i = 1; i <= t->rows; i++){
+ char *typespec = get_typespec (m, i);
+
+ fprintf (output, "%d: %s\n", i, typespec);
+ g_free (typespec);
+ }
+ fprintf (output, "\n");
+}
+
+void
dump_table_assemblyref (MonoImage *m)
{
MonoTableInfo *t = &m->tables [MONO_TABLE_ASSEMBLYREF];
diff --git a/mono/dis/dump.h b/mono/dis/dump.h
index 90b04e860ca..4699a732c1d 100644
--- a/mono/dis/dump.h
+++ b/mono/dis/dump.h
@@ -21,6 +21,7 @@ void dump_table_memberref (MonoImage *m);
void dump_table_param (MonoImage *m);
void dump_table_typedef (MonoImage *m);
void dump_table_typeref (MonoImage *m);
+void dump_table_typespec (MonoImage *m);
void dump_table_exported (MonoImage *m);
void dump_table_nestedclass (MonoImage *m);
void dump_table_interfaceimpl (MonoImage *m);
diff --git a/mono/dis/get.c b/mono/dis/get.c
index d2a20d3ca9f..3f2df4c59ae 100644
--- a/mono/dis/get.c
+++ b/mono/dis/get.c
@@ -24,12 +24,15 @@ static char *
get_memberref_parent (MonoImage *m, guint32 mrp_token);
GHashTable *key_table = NULL;
+gboolean show_method_tokens = FALSE;
+gboolean show_tokens = FALSE;
char *
get_typedef (MonoImage *m, int idx)
{
guint32 cols [MONO_TYPEDEF_SIZE];
const char *ns;
+ char *tstring, *result;
guint32 token;
mono_metadata_decode_row (&m->tables [MONO_TABLE_TYPEDEF], idx - 1, cols, MONO_TYPEDEF_SIZE);
@@ -39,21 +42,27 @@ get_typedef (MonoImage *m, int idx)
/* Check if this is a nested type */
token = MONO_TOKEN_TYPE_DEF | (idx);
token = mono_metadata_nested_in_typedef (m, token);
+ tstring = show_tokens ? g_strdup_printf ("/*%08x*/", token) : NULL;
if (token) {
- char *outer, *result;
+ char *outer;
outer = get_typedef (m, mono_metadata_token_index (token));
result = g_strdup_printf (
- "%s%s%s/%s", ns, *ns?".":"", outer,
- mono_metadata_string_heap (m, cols [MONO_TYPEDEF_NAME]));
+ "%s%s%s/%s%s", ns, *ns?".":"", outer,
+ mono_metadata_string_heap (m, cols [MONO_TYPEDEF_NAME]),
+ tstring ? tstring : "");
g_free (outer);
+ g_free (tstring);
return result;
}
- return g_strdup_printf (
- "%s%s%s", ns, *ns?".":"",
- mono_metadata_string_heap (m, cols [MONO_TYPEDEF_NAME]));
+ result = g_strdup_printf (
+ "%s%s%s%s", ns, *ns?".":"",
+ mono_metadata_string_heap (m, cols [MONO_TYPEDEF_NAME]),
+ tstring ? tstring : "");
+ g_free (tstring);
+ return result;
}
char *
@@ -238,7 +247,12 @@ get_typespec (MonoImage *m, guint32 idx)
break;
}
- result = res->str;
+ if (show_tokens) {
+ int token = mono_metadata_make_token (MONO_TABLE_TYPESPEC, idx);
+ result = g_strdup_printf ("%s/*%08x*/", res->str, token);
+ } else
+ result = res->str;
+
g_string_free (res, FALSE);
return result;
@@ -291,6 +305,13 @@ get_typeref (MonoImage *m, int idx)
ret = g_strdup_printf ("Unknown table in TypeRef %d", table);
}
+ if (show_tokens) {
+ int token = mono_metadata_make_token (MONO_TABLE_TYPEREF, idx);
+ char *temp = g_strdup_printf ("%s/*%08x*/", ret, token);
+ g_free (ret);
+ ret = temp;
+ }
+
return ret;
}
@@ -633,6 +654,10 @@ dis_stringify_method_signature (MonoImage *m, MonoMethodSignature *method, int m
}
g_string_append (result, ") ");
+ if (show_method_tokens && methoddef_row)
+ g_string_append_printf (result, " /* 0x%X */ ",
+ (methoddef_row >> MONO_TYPEORMETHOD_BITS) | MONO_TOKEN_METHOD_DEF);
+
if (free_method)
mono_metadata_free_method_signature (method);
retval = result->str;
@@ -802,9 +827,62 @@ dis_stringify_type (MonoImage *m, MonoType *type)
const char *
get_type (MonoImage *m, const char *ptr, char **result)
{
- MonoType *type = mono_metadata_parse_type (m, MONO_PARSE_TYPE, 0, ptr, &ptr);
- *result = dis_stringify_type (m, type);
- mono_metadata_free_type (type);
+ const char *start = ptr;
+ guint32 type;
+ MonoType *t;
+
+ if (*ptr == MONO_TYPE_BYREF)
+ ++ptr;
+
+ type = mono_metadata_decode_value (ptr, &ptr);
+
+ switch (type){
+ case MONO_TYPE_VALUETYPE:
+ case MONO_TYPE_CLASS: {
+ guint32 token = mono_metadata_parse_typedef_or_ref (m, ptr, &ptr);
+ MonoClass *klass = mono_class_get (m, token);
+ char *temp = dis_stringify_object_with_class (m, klass);
+
+ if (show_tokens) {
+ *result = g_strdup_printf ("%s/*%08x*/", temp, token);
+ g_free (temp);
+ } else
+ *result = temp;
+ break;
+ }
+
+ case MONO_TYPE_GENERICINST: {
+ GString *str = g_string_new ("");
+ int count, i;
+ char *temp;
+
+ ptr = get_type (m, ptr, &temp);
+ g_string_append (str, temp);
+ g_free (temp);
+
+ count = mono_metadata_decode_value (ptr, &ptr);
+ g_string_append (str, "<");
+
+ for (i = 0; i < count; i++) {
+ if (i)
+ g_string_append (str, ",");
+ ptr = get_type (m, ptr, &temp);
+ g_string_append (str, temp);
+ }
+
+ g_string_append (str, ">");
+ *result = str->str;
+ g_string_free (str, FALSE);
+ break;
+ }
+
+ default:
+ t = mono_metadata_parse_type (m, MONO_PARSE_TYPE, 0, start, &ptr);
+ *result = dis_stringify_type (m, t);
+ mono_metadata_free_type (t);
+ break;
+ }
+
return ptr;
}
@@ -1254,7 +1332,10 @@ get_method (MonoImage *m, guint32 token)
if (mh) {
esname = get_escaped_name (mh->name);
sig = dis_stringify_object_with_class (m, mh->klass);
- name = g_strdup_printf ("%s::%s", sig, esname);
+ if (show_tokens)
+ name = g_strdup_printf ("%s/*%08x*/::%s", sig, token, esname);
+ else
+ name = g_strdup_printf ("%s::%s", sig, esname);
g_free (sig);
g_free (esname);
} else
@@ -1266,7 +1347,7 @@ get_method (MonoImage *m, guint32 token)
idx - 1, method_cols, MONO_METHOD_SIZE);
sig = get_methodref_signature (m, method_cols [MONO_METHOD_SIGNATURE], name);
- return sig;
+ break;
case MONO_TOKEN_MEMBER_REF: {
mono_metadata_decode_row (&m->tables [MONO_TABLE_MEMBERREF],
@@ -1277,20 +1358,26 @@ get_method (MonoImage *m, guint32 token)
mono_metadata_string_heap (m, member_cols [MONO_MEMBERREF_NAME]));
sig = get_methodref_signature (
m, member_cols [MONO_MEMBERREF_SIGNATURE], name);
- return sig;
+ break;
}
case MONO_TOKEN_METHOD_SPEC: {
mono_metadata_decode_row (&m->tables [MONO_TABLE_METHODSPEC],
idx - 1, member_cols, MONO_METHODSPEC_SIZE);
token = member_cols [MONO_METHODSPEC_METHOD];
- return get_methodspec (m, idx, token, name);
+ sig = get_methodspec (m, idx, token, name);
+ break;
}
default:
g_assert_not_reached ();
}
- g_assert_not_reached ();
- return NULL;
+
+ if (show_tokens) {
+ char *retval = g_strdup_printf ("%s /* %08x */", sig, token);
+ g_free (sig);
+ return retval;
+ } else
+ return sig;
}
/**
@@ -1367,13 +1454,27 @@ get_methodspec (MonoImage *m, int idx, guint32 token, const char *fancy_name)
guint32 member_cols [MONO_MEMBERREF_SIZE], method_cols [MONO_METHOD_SIZE];
char *s, *type_param;
const char *ptr;
+ guint32 sig;
int param_count, cconv, i, gen_count = 0;
-
- token >>= METHODDEFORREF_BITS;
- mono_metadata_decode_row (&m->tables [MONO_TABLE_METHOD],
- token-1, method_cols, MONO_METHOD_SIZE);
-
- ptr = mono_metadata_blob_heap (m, method_cols [MONO_METHOD_SIGNATURE]);
+
+ switch (token & METHODDEFORREF_MASK) {
+ case METHODDEFORREF_METHODDEF:
+ mono_metadata_decode_row (&m->tables [MONO_TABLE_METHOD],
+ (token >> METHODDEFORREF_BITS) - 1,
+ method_cols, MONO_METHOD_SIZE);
+ sig = method_cols [MONO_METHOD_SIGNATURE];
+ break;
+ case METHODDEFORREF_METHODREF:
+ mono_metadata_decode_row (&m->tables [MONO_TABLE_MEMBERREF],
+ (token >> METHODDEFORREF_BITS) - 1,
+ member_cols, MONO_MEMBERREF_SIZE);
+ sig = member_cols [MONO_MEMBERREF_SIGNATURE];
+ break;
+ default:
+ g_assert_not_reached ();
+ }
+
+ ptr = mono_metadata_blob_heap (m, sig);
mono_metadata_decode_value (ptr, &ptr);
if (*ptr & 0x20){
@@ -1653,6 +1754,9 @@ dis_get_custom_attrs (MonoImage *m, guint32 token)
case MONO_TABLE_ASSEMBLY:
idx |= CUSTOM_ATTR_ASSEMBLY;
break;
+ case MONO_TABLE_MODULE:
+ idx |= CUSTOM_ATTR_MODULE;
+ break;
case MONO_TABLE_PROPERTY:
idx |= CUSTOM_ATTR_PROPERTY;
break;
diff --git a/mono/dis/get.h b/mono/dis/get.h
index c73dbb45bfc..c0919310c95 100644
--- a/mono/dis/get.h
+++ b/mono/dis/get.h
@@ -67,3 +67,6 @@ MonoTypeEnum get_field_literal_type (MonoImage *m, guint32 blob_signature);
* This is called to initialize the table containing keyword names
*/
void init_key_table (void);
+
+extern gboolean show_method_tokens;
+extern gboolean show_tokens;
diff --git a/mono/dis/main.c b/mono/dis/main.c
index 0e3dde9861b..8d80453d354 100644
--- a/mono/dis/main.c
+++ b/mono/dis/main.c
@@ -133,8 +133,10 @@ dis_directive_module (MonoImage *m)
name = mono_metadata_string_heap (m, cols [MONO_MODULE_NAME]);
ename = get_escaped_name (name);
guid = get_guid (m, cols [MONO_MODULE_MVID]);
- fprintf (output, ".module %s // GUID = %s\n", ename, guid);
+ fprintf (output, ".module %s // GUID = %s\n\n", ename, guid);
g_free (ename);
+
+ dump_cattrs (m, MONO_TOKEN_MODULE | (i + 1), "");
}
}
@@ -1139,6 +1141,7 @@ struct {
{ "--propertymap", MONO_TABLE_PROPERTYMAP, dump_table_property_map },
{ "--typedef", MONO_TABLE_TYPEDEF, dump_table_typedef },
{ "--typeref", MONO_TABLE_TYPEREF, dump_table_typeref },
+ { "--typespec", MONO_TABLE_TYPESPEC, dump_table_typespec },
{ "--implmap", MONO_TABLE_IMPLMAP, dump_table_implmap },
{ NULL, -1 }
};
@@ -1216,6 +1219,12 @@ main (int argc, char *argv [])
else if (strcmp (argv [i], "--mscorlib") == 0) {
substitute_with_mscorlib_p = TRUE;
continue;
+ } else if (strcmp (argv [i], "--show-method-tokens") == 0) {
+ show_method_tokens = TRUE;
+ continue;
+ } else if (strcmp (argv [i], "--show-tokens") == 0) {
+ show_tokens = TRUE;
+ continue;
} else if (strncmp (argv [i], "--output=", 9) == 0) {
output = fopen (argv [i]+9, "w");
if (output == NULL) {
diff --git a/mono/dis/monodis.1 b/mono/dis/monodis.1
index 98728f040ff..1db1d235e65 100644
--- a/mono/dis/monodis.1
+++ b/mono/dis/monodis.1
@@ -52,6 +52,9 @@ Write output into \fIFILENAME\fP.
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
+.TP
.I "--assembly"
Dumps the contents of the assembly table
.TP
@@ -117,6 +120,9 @@ Dumps the contents of the propertymap table
.I "--typedef"
Dumps the contents of the typedef table
.TP
+.I "--typespec"
+Dumps the contents of the typespec table
+.TP
.I "--typeref"
Dumps the contents of the typeref table
.PP
diff --git a/mono/interpreter/ChangeLog b/mono/interpreter/ChangeLog
index 1a8c71c2c40..1e5464eda5d 100644
--- a/mono/interpreter/ChangeLog
+++ b/mono/interpreter/ChangeLog
@@ -1,3 +1,27 @@
+2004-01-22 Zoltan Varga <vargaz@freemail.hu>
+
+ * interp.c (mono_main): Remove call to mono_verify_corlib (), since
+ the verification code is not up-to-date.
+
+2004-01-19 Bernie Solomon <bernard@ugsolutions.com>
+
+ * interp.c (ves_exec_method_with_context):
+ get_native_wrapper removed and call
+ mono_marshal_get_native_wrapper directly
+ with new DllNotFoundException handling
+
+Mon Jan 19 17:52:33 CET 2004 Paolo Molaro <lupus@ximian.com>
+
+ * interp.c: eliminate CSIZE macro.
+
+2004-01-15 Zoltan Varga <vargaz@freemail.hu>
+
+ * interp.c (ves_array_set): Check for ArrayTypeMismatchException.
+
+2004-01-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * interp.c: call setlocale (). Fixes bug #52100.
+
2003-12-19 Bernie Solomon <bernard@ugsolutions.com>
* embed.h, main.c: new files to enable embedding
diff --git a/mono/interpreter/interp.c b/mono/interpreter/interp.c
index 6ca1eeeec37..baf7ac8325d 100644
--- a/mono/interpreter/interp.c
+++ b/mono/interpreter/interp.c
@@ -22,6 +22,7 @@
#include <setjmp.h>
#include <signal.h>
#include <math.h>
+#include <locale.h>
#include <mono/os/gc_wrapper.h>
@@ -98,7 +99,6 @@ enum {
#else
#define GET_NATI(sp) (sp).data.i
#endif
-#define CSIZE(x) (sizeof (x) / 4)
#define INIT_FRAME(frame,parent_frame,obj_this,method_args,method_retval,mono_method) \
do { \
@@ -573,6 +573,12 @@ ves_array_set (MonoInvocation *frame)
return;
}
+ if ((sp [ac->rank].type == VAL_OBJ) && sp [ac->rank].data.p && !mono_object_isinst (sp [ac->rank].data.p, mono_object_class (o)->element_class)) {
+ frame->ex = mono_get_exception_array_type_mismatch ();
+ FILL_IN_TRACE (frame->ex, frame);
+ return;
+ }
+
esize = mono_array_element_size (ac);
ea = mono_array_addr_with_size (ao, esize, pos);
@@ -1565,24 +1571,6 @@ mono_create_method_pointer (MonoMethod *method)
return addr;
}
-static MonoMethod *
-get_native_wrapper(MonoMethod *method, ThreadContext *context)
-{
- jmp_buf env;
- jmp_buf *old_env;
- MonoMethod *wrapper;
- old_env = context->current_env;
- if (setjmp(env) != 0) {
- context->current_env = old_env;
- context->search_for_handler = 1;
- return NULL;
- }
- context->current_env = &env;
- wrapper = mono_marshal_get_native_wrapper (method);
- context->current_env = old_env;
- return wrapper;
-}
-
/*
* Need to optimize ALU ops when natural int == int32
*
@@ -1621,7 +1609,7 @@ ves_exec_method_with_context (MonoInvocation *frame, ThreadContext *context)
context->current_frame = frame;
if (frame->method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL) {
- frame->method = get_native_wrapper (frame->method, context);
+ frame->method = mono_marshal_get_native_wrapper (frame->method);
if (frame->method == NULL)
goto exit_frame;
}
@@ -3738,9 +3726,6 @@ array_constructed:
if (aindex >= mono_array_length (o))
THROW_EX (mono_get_exception_index_out_of_range (), ip);
- /*
- * FIXME: throw mono_get_exception_array_type_mismatch () if needed
- */
switch (*ip) {
case CEE_STELEM_I:
mono_array_set (o, mono_i, aindex, sp [2].data.nati);
@@ -4998,7 +4983,6 @@ static void main_thread_handler (gpointer user_data)
{
MainThreadArgs *main_args=(MainThreadArgs *)user_data;
MonoAssembly *assembly;
- char *error;
if (main_args->enable_debugging)
mono_debug_init (main_args->domain, MONO_DEBUG_FORMAT_MONO);
@@ -5017,11 +5001,6 @@ static void main_thread_handler (gpointer user_data)
#ifdef RUN_TEST
test_load_class (assembly->image);
#else
- error = mono_verify_corlib ();
- if (error) {
- fprintf (stderr, "Corlib not in sync with this runtime: %s\n", error);
- exit (1);
- }
segv_exception = mono_get_exception_null_reference ();
segv_exception->message = mono_string_new (main_args->domain, "Segmentation fault");
signal (SIGSEGV, segv_handler);
@@ -5111,7 +5090,8 @@ mono_main (int argc, char *argv [])
int enable_debugging = FALSE;
MainThreadArgs main_args;
const char *error;
-
+
+ setlocale (LC_ALL, "");
if (argc < 2)
usage ();
@@ -5159,16 +5139,10 @@ mono_main (int argc, char *argv [])
domain = mono_interp_init(file);
mono_config_parse (config_file);
- error = mono_verify_corlib ();
- if (error) {
- fprintf (stderr, "Corlib not in sync with this runtime: %s\n", error);
- exit (1);
- }
-
error = mono_check_corlib_version ();
if (error) {
fprintf (stderr, "Corlib not in sync with this runtime: %s\n", error);
- fprintf (stderr, "Download a newer corlib at http://go-mono/daily.\n");
+ fprintf (stderr, "Download a newer corlib at http://www.go-mono.com/daily.\n");
exit (1);
}
diff --git a/mono/io-layer/ChangeLog b/mono/io-layer/ChangeLog
index 9d94e1fbe99..fe45222a0fc 100644
--- a/mono/io-layer/ChangeLog
+++ b/mono/io-layer/ChangeLog
@@ -1,3 +1,28 @@
+2004-01-27 Bernie Solomon <bernard@ugsolutions.com>
+
+ * shared.c (_wapi_shm_file): add hostname
+ to shared data file names to handle NFS mounted
+ .wapi directories.
+
+Mon Jan 26 16:15:03 CET 2004 Paolo Molaro <lupus@ximian.com>
+
+ * sockets.h: remove obsolete soklen_t typedef.
+
+Fri Jan 23 21:07:02 CET 2004 Paolo Molaro <lupus@ximian.com>
+
+ * socket-wrappers.h, sockets.h, sockets.c, Makefile.am: move socket
+ wrappers to its own non-installed header file.
+
+2004-01-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * io.c:
+ (FindFirstFile): unlock the handle if FindNextFile fails.
+ (FindNextFile): g_free a couple of pointers before retrying.
+
+ * wait.c:
+ (WaitForMultipleObjects): if only one handle provided, use
+ WaitForSingleObject.
+
2003-12-22 Bernie Solomon <bernard@ugsolutions.com>
* handles-private.h: (_wapi_handle_type) check
diff --git a/mono/io-layer/Makefile.am b/mono/io-layer/Makefile.am
index 44be38d6969..f90230d701d 100644
--- a/mono/io-layer/Makefile.am
+++ b/mono/io-layer/Makefile.am
@@ -4,7 +4,6 @@ INCLUDES = \
$(GLIB_CFLAGS) \
$(GMODULE_CFLAGS) \
$(LIBGC_CFLAGS) \
- -D_WAPI_BUILDING=1 \
-DMONO_BINDIR=\""$(bindir)"\" \
-I$(top_srcdir)
@@ -80,6 +79,7 @@ OTHER_SRC = \
sockets.c \
sockets.h \
socket-private.h \
+ socket-wrappers.h \
status.h \
system.c \
system.h \
diff --git a/mono/io-layer/atomic.h b/mono/io-layer/atomic.h
index fe32ba8e857..d44882cba8d 100644
--- a/mono/io-layer/atomic.h
+++ b/mono/io-layer/atomic.h
@@ -266,10 +266,11 @@ InterlockedCompareExchange(volatile gint32 *dest,
gint32 old;
__asm__ __volatile__ ("\tL\t%1,%0\n"
- "\tCS\t%3,%2,%0\n"
+ "\tLA\t1,%0\n"
+ "\tCS\t%3,%2,0(1)\n"
: "=m" (*dest), "=r" (old)
: "r" (exch), "r" (comp)
- : "cc");
+ : "1", "cc");
return(old);
}
@@ -280,13 +281,14 @@ InterlockedIncrement(volatile gint32 *val)
{
gint32 tmp;
- __asm__ __volatile__ ("0:\tL\t%0,%1\n"
+ __asm__ __volatile__ ("\tLA\t2,%1\n"
+ "\tL\t%0,%1\n"
"\tLR\t1,%0\n"
"\tAHI\t1,1\n"
- "0:\tCS\t%0,1,%1\n"
+ "0:\tCS\t%0,1,0(2)\n"
"\tJNZ\t0b"
: "=r" (tmp), "+m" (*val)
- : : "1", "cc");
+ : : "1", "2", "cc");
return(tmp+1);
}
@@ -296,13 +298,14 @@ InterlockedDecrement(volatile gint32 *val)
{
gint32 tmp;
- __asm__ __volatile__ ("0:\tL\t%0,%1\n"
+ __asm__ __volatile__ ("\tLA\t2,%1\n"
+ "\tL\t%0,%1\n"
"\tLR\t1,%0\n"
"\tAHI\t1,-1\n"
- "0:\tCS\t%0,1,%1\n"
+ "0:\tCS\t%0,1,0(2)\n"
"\tJNZ\t0b"
: "=r" (tmp), "+m" (*val)
- : : "1", "cc");
+ : : "1", "2", "cc");
return(tmp-1);
}
@@ -313,12 +316,13 @@ InterlockedExchange(volatile gint32 *val, gint32 new_val)
{
gint32 ret;
- __asm__ __volatile__ ("0:\tL\t%1,%0\n"
- "\tCS\t%1,%2,%0\n"
+ __asm__ __volatile__ ("\tLA\t1,%1\n"
+ "0:\tL\t%1,%0\n"
+ "\tCS\t%1,%2,0(1)\n"
"\tJNZ\t0b"
: "+m" (*val), "=r" (ret)
: "r" (new_val)
- : "cc");
+ : "1", "cc");
return(ret);
}
@@ -330,14 +334,15 @@ InterlockedExchangeAdd(volatile gint32 *val, gint32 add)
{
gint32 ret;
- __asm__ __volatile__ ("0:\tL\t%0,%1\n"
+ __asm__ __volatile__ ("\tL\t%0,%1\n"
"\tLR\t1,%0\n"
"\tAR\t1,%2\n"
- "0:\tCS\t%0,1,%1\n"
+ "\tLA\t2,%1\n"
+ "0:\tCS\t%0,1,0(2)\n"
"\tJNZ\t0b"
: "=r" (ret), "+m" (*val)
: "r" (add)
- : "1", "cc");
+ : "1", "2", "cc");
return(ret);
}
diff --git a/mono/io-layer/io.c b/mono/io-layer/io.c
index 8ef29e07f5f..871aaf9f6ab 100644
--- a/mono/io-layer/io.c
+++ b/mono/io-layer/io.c
@@ -2351,6 +2351,7 @@ gpointer FindFirstFile (const gunichar2 *pattern, WapiFindData *find_data)
find_handle->count = 0;
if (!FindNextFile (handle, find_data)) {
+ _wapi_handle_unlock_handle (handle);
FindClose (handle);
SetLastError (ERROR_NO_MORE_FILES);
return INVALID_HANDLE_VALUE;
@@ -2448,6 +2449,8 @@ retry:
utf16_basename = g_utf8_to_utf16 (utf8_basename, -1, NULL, &bytes,
NULL);
if(utf16_basename==NULL) {
+ g_free (utf8_basename);
+ g_free (utf8_filename);
goto retry;
}
diff --git a/mono/io-layer/shared.c b/mono/io-layer/shared.c
index e57f5e25aa8..aa37a29265e 100644
--- a/mono/io-layer/shared.c
+++ b/mono/io-layer/shared.c
@@ -71,16 +71,20 @@ guchar *_wapi_shm_file (_wapi_shm_t type, guint32 segment)
{
static guchar file[_POSIX_PATH_MAX];
guchar *name, *filename, *dir, *wapi_dir;
+ gchar machine_name[256];
+
+ if (gethostname(machine_name, sizeof(machine_name)) != 0)
+ machine_name[0] = '\0';
/* Change the filename whenever the format of the contents
* changes
*/
if(type==WAPI_SHM_DATA) {
- name=g_strdup_printf ("shared_data-%d-%d",
- _WAPI_HANDLE_VERSION, segment);
+ name=g_strdup_printf ("shared_data-%s-%d-%d",
+ machine_name, _WAPI_HANDLE_VERSION, segment);
} else if (type==WAPI_SHM_SCRATCH) {
- name=g_strdup_printf ("shared_scratch-%d-%d",
- _WAPI_HANDLE_VERSION, segment);
+ name=g_strdup_printf ("shared_scratch-%s-%d-%d",
+ machine_name, _WAPI_HANDLE_VERSION, segment);
} else {
g_assert_not_reached ();
}
diff --git a/mono/io-layer/socket-wrappers.h b/mono/io-layer/socket-wrappers.h
new file mode 100644
index 00000000000..bca03cc5909
--- /dev/null
+++ b/mono/io-layer/socket-wrappers.h
@@ -0,0 +1,76 @@
+/*
+ * Special header file to be included only in selected C files.
+ * We need to use the _wapi_ equivalents of the socket API when
+ * working with io-layer handles. On windows we define the wrappers to use
+ * the normal win32 functions.
+ */
+
+#include <config.h>
+
+#ifndef HAVE_SOCKLEN_T
+#define socklen_t int
+#endif
+
+#ifdef PLATFORM_WIN32
+#define _wapi_accept accept
+#define _wapi_bind bind
+#define _wapi_connect connect
+#define _wapi_getpeername getpeername
+#define _wapi_getsockname getsockname
+#define _wapi_getsockopt getsockopt
+#define _wapi_listen listen
+#define _wapi_recv recv
+#define _wapi_recvfrom recvfrom
+#define _wapi_send send
+#define _wapi_sendto sendto
+#define _wapi_setsockopt setsockopt
+#define _wapi_shutdown shutdown
+#define _wapi_socket socket
+#define _wapi_gethostbyname gethostbyname
+#define _wapi_select select
+
+/* No need to wrap FD_ZERO because it doesnt involve file
+ * descriptors
+*/
+#define _wapi_FD_CLR FD_CLR
+#define _wapi_FD_ISSET FD_ISSET
+#define _wapi_FD_SET FD_SET
+
+#else
+
+extern guint32 _wapi_accept(guint32 handle, struct sockaddr *addr,
+ socklen_t *addrlen);
+extern int _wapi_bind(guint32 handle, struct sockaddr *my_addr,
+ socklen_t addrlen);
+extern int _wapi_connect(guint32 handle, const struct sockaddr *serv_addr,
+ socklen_t addrlen);
+extern int _wapi_getpeername(guint32 handle, struct sockaddr *name,
+ socklen_t *namelen);
+extern int _wapi_getsockname(guint32 handle, struct sockaddr *name,
+ socklen_t *namelen);
+extern int _wapi_getsockopt(guint32 handle, int level, int optname,
+ void *optval, socklen_t *optlen);
+extern int _wapi_listen(guint32 handle, int backlog);
+extern int _wapi_recv(guint32 handle, void *buf, size_t len, int recv_flags);
+extern int _wapi_recvfrom(guint32 handle, void *buf, size_t len,
+ int recv_flags, struct sockaddr *from,
+ socklen_t *fromlen);
+extern int _wapi_send(guint32 handle, const void *msg, size_t len,
+ int send_flags);
+extern int _wapi_sendto(guint32 handle, const void *msg, size_t len,
+ int send_flags, const struct sockaddr *to,
+ socklen_t tolen);
+extern int _wapi_setsockopt(guint32 handle, int level, int optname,
+ const void *optval, socklen_t optlen);
+extern int _wapi_shutdown(guint32 handle, int how);
+extern guint32 _wapi_socket(int domain, int type, int protocol);;
+extern struct hostent *_wapi_gethostbyname(const char *hostname);
+extern int _wapi_select(int nfds, fd_set *readfds, fd_set *writefds,
+ fd_set *exceptfds, struct timeval *timeout);
+
+extern void _wapi_FD_CLR(guint32 handle, fd_set *set);
+extern int _wapi_FD_ISSET(guint32 handle, fd_set *set);
+extern void _wapi_FD_SET(guint32 handle, fd_set *set);
+
+#endif /* PLATFORM_WIN32 */
+
diff --git a/mono/io-layer/sockets.c b/mono/io-layer/sockets.c
index 8c856f0f019..50f44c0d46a 100644
--- a/mono/io-layer/sockets.c
+++ b/mono/io-layer/sockets.c
@@ -32,6 +32,7 @@
#include <mono/io-layer/wapi-private.h>
#include <mono/io-layer/socket-private.h>
#include <mono/io-layer/handles-private.h>
+#include <mono/io-layer/socket-wrappers.h>
#undef DEBUG
diff --git a/mono/io-layer/sockets.h b/mono/io-layer/sockets.h
index cb897ae43d8..3fb0d9dd5d0 100644
--- a/mono/io-layer/sockets.h
+++ b/mono/io-layer/sockets.h
@@ -23,10 +23,6 @@
#define WSADESCRIPTION_LEN 256
#define WSASYS_STATUS_LEN 128
-#ifdef __APPLE__
-typedef unsigned int socklen_t;
-#endif
-
typedef struct
{
guint16 wVersion;
@@ -47,78 +43,6 @@ extern void WSASetLastError(int error);
extern int WSAGetLastError(void);
extern int closesocket(guint32 handle);
-#ifndef _WAPI_BUILDING
-#define accept _wapi_accept
-#define bind _wapi_bind
-#define connect _wapi_connect
-#define getpeername _wapi_getpeername
-#define getsockname _wapi_getsockname
-#define getsockopt _wapi_getsockopt
-#define listen _wapi_listen
-#define recv _wapi_recv
-#define recvfrom _wapi_recvfrom
-#define send _wapi_send
-#define sendto _wapi_sendto
-#define setsockopt _wapi_setsockopt
-#define shutdown _wapi_shutdown
-#define socket _wapi_socket
-#define gethostbyname _wapi_gethostbyname
-#define select _wapi_select
-
-#ifdef FD_CLR
-#undef FD_CLR
-#endif
-
-#ifdef FD_ISSET
-#undef FD_ISSET
-#endif
-
-#ifdef FD_SET
-#undef FD_SET
-#endif
-
-/* No need to wrap FD_ZERO because it doesnt involve file
- * descriptors
-*/
-#define FD_CLR _wapi_FD_CLR
-#define FD_ISSET _wapi_FD_ISSET
-#define FD_SET _wapi_FD_SET
-
-#endif /* _WAPI_BUILDING */
-
-extern guint32 _wapi_accept(guint32 handle, struct sockaddr *addr,
- socklen_t *addrlen);
-extern int _wapi_bind(guint32 handle, struct sockaddr *my_addr,
- socklen_t addrlen);
-extern int _wapi_connect(guint32 handle, const struct sockaddr *serv_addr,
- socklen_t addrlen);
-extern int _wapi_getpeername(guint32 handle, struct sockaddr *name,
- socklen_t *namelen);
-extern int _wapi_getsockname(guint32 handle, struct sockaddr *name,
- socklen_t *namelen);
-extern int _wapi_getsockopt(guint32 handle, int level, int optname,
- void *optval, socklen_t *optlen);
-extern int _wapi_listen(guint32 handle, int backlog);
-extern int _wapi_recv(guint32 handle, void *buf, size_t len, int recv_flags);
-extern int _wapi_recvfrom(guint32 handle, void *buf, size_t len,
- int recv_flags, struct sockaddr *from,
- socklen_t *fromlen);
-extern int _wapi_send(guint32 handle, const void *msg, size_t len,
- int send_flags);
-extern int _wapi_sendto(guint32 handle, const void *msg, size_t len,
- int send_flags, const struct sockaddr *to,
- socklen_t tolen);
-extern int _wapi_setsockopt(guint32 handle, int level, int optname,
- const void *optval, socklen_t optlen);
-extern int _wapi_shutdown(guint32 handle, int how);
-extern guint32 _wapi_socket(int domain, int type, int protocol);;
-extern struct hostent *_wapi_gethostbyname(const char *hostname);
-extern int _wapi_select(int nfds, fd_set *readfds, fd_set *writefds,
- fd_set *exceptfds, struct timeval *timeout);
-extern void _wapi_FD_CLR(guint32 handle, fd_set *set);
-extern int _wapi_FD_ISSET(guint32 handle, fd_set *set);
-extern void _wapi_FD_SET(guint32 handle, fd_set *set);
-
extern int ioctlsocket(guint32 handle, gint32 command, gpointer arg);
#endif /* _WAPI_SOCKETS_H_ */
diff --git a/mono/io-layer/wait.c b/mono/io-layer/wait.c
index b4e7116cb55..0369bd1d635 100644
--- a/mono/io-layer/wait.c
+++ b/mono/io-layer/wait.c
@@ -321,6 +321,10 @@ guint32 WaitForMultipleObjects(guint32 numobjects, gpointer *handles,
return(WAIT_FAILED);
}
+ if (numobjects == 1) {
+ return WaitForSingleObject (handles [0], timeout);
+ }
+
/* Check for duplicates */
dups=g_hash_table_new(g_direct_hash, g_direct_equal);
for(i=0; i<numobjects; i++) {
diff --git a/mono/metadata/ChangeLog b/mono/metadata/ChangeLog
index daf5ab52799..420a5e95f62 100644
--- a/mono/metadata/ChangeLog
+++ b/mono/metadata/ChangeLog
@@ -1,3 +1,319 @@
+2004-02-01 Martin Baulig <martin@ximian.com>
+
+ * loader.c (method_from_methodspec): Use `ginst->mtype_argc/v' for
+ method type arguments.
+
+2004-01-30 Duncan Mak <duncan@ximian.com>
+
+ * marshal.h: Add prototype for
+ "ves_icall_System_Runtime_InteropServices_Marshal_AllocCoTaskMem"
+ and
+ "ves_icall_System_Runtime_InteropServices_Marshal_FreeCoTaskMem" to
+ fix the build.
+
+2004-01-30 Zoltan Varga <vargaz@freemail.hu>
+
+ * marshal.c (ves_icall_System_Runtime_InteropServices_Marshal_AllocCoTaskMem): New icall.
+ (ves_icall_System_Runtime_InteropServices_Marshal_FreeCoTaskMem): New icall.
+
+2004-01-29 Zoltan Varga <vargaz@freemail.hu>
+
+ * marshal.c (mono_marshal_get_native_wrapper): Add support for
+ custom marshalling of valuetypes.
+
+ * marshal.c: Fix some warnings.
+
+2004-01-29 Martin Baulig <martin@ximian.com>
+
+ * class.h (MonoGenericInst): Added `mtype_argc' and `mtype_argv'
+ for generic method parameters.
+
+ * reflection.c (method_encode_methodspec): Write the uninflated
+ signature into the methodspec table.
+ (mono_reflection_inflate_method_or_ctor): Ensure `res->declaring'
+ is always the uninflated method.
+ (reflection_methodbuilder_to_mono_method): Copy the generic
+ parameters from the MethodBuilder into `header->gen_params'.
+
+2004-01-29 Zoltan Varga <vargaz@freemail.hu>
+
+ * class.c (mono_class_from_generic_parameter): Fix warning.
+
+2004-01-27 Martin Baulig <martin@ximian.com>
+
+ * class.c (mono_class_from_generic_parameter): Don't create
+ `klass->methods' here.
+
+2004-01-26 Zoltan Varga <vargaz@freemail.hu>
+
+ * loader.c (mono_lookup_pinvoke_call): Disable trimming of .dll
+ extension since it does not work with libraries named lib<FOO>.dll.so.
+
+2004-01-25 Martin Baulig <martin@ximian.com>
+
+ * class.c (mono_class_inflate_generic_type): Added support for
+ MONO_TYPE_GENERICINST.
+
+ * reflection.c (mono_reflection_inflate_method_or_ctor): Also
+ inflate methods on open constructed types.
+
+2004-01-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * object.c: fire ProcessExit event in the root AppDomain after running
+ Main. Fixes bug #53299.
+
+Fri Jan 23 21:27:40 CET 2004 Paolo Molaro <lupus@ximian.com>
+
+ * socket-io.c: include the new socket-wrappers.h header.
+ Use the wrappers instead of the unix socket functions to make the code
+ more clear.
+
+2004-01-23 Zoltan Varga <vargaz@freemail.hu>
+
+ * profiler.c (merge_methods): Fix merging of profile info. Fixes #53010.
+
+ * loader.c (mono_lookup_pinvoke_call): Strip .dll from library names.
+ Fixes #22532.
+
+2004-01-22 Zoltan Varga <vargaz@freemail.hu>
+
+ * reflection.c (mono_image_create_pefile): Handle the case when the
+ entry point is not a MethodBuilder.
+
+ * reflection.h (MonoReflectionAssemblyBuilder): Change 'entry_point'
+ field to ReflectionMethod since it is not allways a builder.
+
+ * reflection.c (type_get_fully_qualified_name): New helper function to
+ return the fully qualified name of a type.
+
+ * reflection.c (encode_marshal_blob): Always emit the fully qualified
+ type name for custom marshallers.
+
+ * reflection.c (mono_marshal_spec_from_builder): Ditto.
+
+ * class.c (mono_class_setup_vtable): If a parent class already
+ implements an interface, use the implementing methods from that class.
+ Fixes #53148.
+
+2004-01-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * threadpool.c: just return instead of ExitThread to allow for thread
+ clean up earlier.
+
+2004-01-21 Zoltan Varga <vargaz@freemail.hu>
+
+ * icall.c (ves_icall_System_Reflection_Module_Close): Prevent assertion
+ when closing resource modules.
+
+ * reflection.c (mono_image_create_pefile): Handle the case when the
+ entry point is not a MethodBuilder.
+
+ * reflection.h (MonoReflectionAssemblyBuilder): Change 'entry_point'
+ field to ReflectionMethod since it is not allways a builder.
+
+2004-01-20 Bernie Solomon <bernard@ugsolutions.com>
+
+ * marshal.c (mono_marshal_get_managed_wrapper):
+ mono_marshal_alloc takes native int so CONV_I
+ the arg for 64bits.
+
+2004-01-20 Zoltan Varga <vargaz@freemail.hu>
+
+ * reflection.c (fixup_cattrs): New function to fixup the methoddef
+ tokens in the cattr table. Fixes #53108.
+
+2004-01-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * loader.c: don't trim ".dll" before looking up in the config file.
+ Don't leak orig_scope. Reopened bug #22532 in the meanwhile.
+
+2004-01-19 Zoltan Varga <vargaz@freemail.hu>
+
+ * icall.c (ves_icall_System_Reflection_Assembly_GetManifestResourceInternal):
+ Return the module which contains the resource as well.
+ (ves_icall_System_Reflection_Module_Close): New icall.
+
+ * appdomain.c: Bump corlib version number.
+
+ * image.c (mono_image_addref): New public function.
+
+ * assembly.c: Call mono_image_addref.
+
+ * reflection.c (mono_module_get_object): Increase reference count of
+ the image.
+
+ * loader.c (mono_lookup_pinvoke_call): Strip .dll from library names.
+ Fixes #22532.
+
+ * exception.h exception.c loader.h loader.c icall.c marshal.h marshal.c:
+ Applied patch from Bernie Solomon <bernard@ugsolutions.com>. Throw
+ proper exceptions on DllImport problems.
+
+Mon Jan 19 17:50:27 CET 2004 Paolo Molaro <lupus@ximian.com>
+
+ * class.c, metadata.c: eliminate CSIZE macro.
+
+2004-01-19 Lluis Sanchez Gual <lluis@ximian.com>
+
+ * icall.c: Added ves_icall_type_IsInstanceOf internal call.
+ * object.h: Added async_callback field in MonoAsyncResult.
+ * marshal.c: In mono_delegate_begin_invoke, set the value of async_callback.
+ * verify.c: Added async_callback in MonoAsyncResult layout.
+
+2004-01-17 Zoltan Varga <vargaz@freemail.hu>
+
+ * reflection.c (mono_reflection_get_custom_attrs): Add support
+ for Modules.
+
+2004-01-16 Zoltan Varga <vargaz@freemail.hu>
+
+ * marshal.c (mono_string_builder_to_utf8): Fix stringbuilder
+ marshalling.
+ (mono_marshal_method_from_wrapper): Add null pointer check.
+
+2004-01-16 Martin Baulig <martin@ximian.com>
+
+ * debug-mono-symfile.h: Set version number to 36 and reflect
+ latest symbol writer changes.
+
+2004-01-16 Zoltan Varga <vargaz@freemail.hu>
+
+ * class.c (mono_bounded_array_class_get): Set 'bounded' to FALSE for
+ multi-dimensional arrays.
+ (mono_class_is_assignable_from): Check vectors<->one dim. arrays.
+ (mono_class_from_mono_type): Use bounded_array_class_get.
+
+ * class.c (mono_bounded_array_class_get): New function which takes
+ a 'bounded' bool argument to distinguish vectors from one dimensional
+ arrays.
+
+ * icall.c (ves_icall_System_Array_CreateInstanceImpl): Call
+ bounded_array_class_get if the array has bounds.
+
+ * icall.c (ves_icall_System_Reflection_Assembly_InternalGetType):
+ Search modules loaded using AssemblyBuilder:AddModule as well.
+
+2004-01-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * appdomain.c: increased corlib version.
+ * filewatcher.c: removed g_print.
+ * icall.c:
+ (get_property_info): only allocate what is actually requested.
+ (ves_icall_Type_GetInterfaces): free the bitset in case of early error.
+
+2004-01-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Makefile.am: added filewatcher.[ch]
+ * filewatcher.[ch]: FileSystemWatcher runtime support.
+ * icall.c: added new FSW icalls.
+
+Tue Jan 13 20:03:17 CET 2004 Paolo Molaro <lupus@ximian.com>
+
+ * string-icalls.c: fix stringbuilder regression as suggested by
+ Iain McCoy <iain@mccoy.id.au>.
+
+2004-01-13 Zoltan Varga <vargaz@freemail.hu>
+
+ * process.c (process_read_stringtable_block): Recognize '007f' as
+ a language neutral stringtable block.
+
+2004-01-12 Patrik Torstensson
+
+ * object.h (MonoStringBuilder) : Changed layout to support our
+ new stringbuilder class.
+ * marshal.c: Change marshalling to support the new layout of
+ string builder.
+ * appdomain.c: increased version number because new layout of
+ string builder.
+
+2004-01-12 Zoltan Varga <vargaz@freemail.hu>
+
+ * appdomain.c (ves_icall_System_AppDomain_LoadAssembly): Receive the
+ assembly name as an string instead of an AssemblyName, since it is
+ easier to extract info from it.
+
+ * appdomain.c (mono_domain_assembly_preload): Look for assemblies in
+ the culture subdirectories too. Fixes #52231.
+
+2004-01-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * icall.c: renamed ves_icall_Type_GetMethods to GetMethodsByName.
+ It takes 2 new parameters with an optional name for the method to look
+ for and case ignoring info.
+
+ * threadpool.c: removed unused variable.
+
+2004-01-11 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * icall.c: renamed ves_icall_Type_GetProperties to GetPropertiesByName.
+ It takes 2 new parameters with an optional name for the property to look
+ for and case ignoring info.
+ Fixes bug #52753.
+
+2004-01-09 Zoltan Varga <vargaz@freemail.hu>
+
+ * reflection.c: Applied patch from Benjamin Jemlich (pcgod@gmx.net).
+ Fix #52451.
+
+2004-01-08 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * appdomain.c:
+ * assembly.c: escape the uri before passing it to g_filename_from_uri.
+ Fixes bug #52630.
+
+2004-01-07 Zoltan Varga <vargaz@freemail.hu>
+
+ * reflection.c: Add support for more than one unmanaged resource.
+
+ * icall.c (ves_icall_get_enum_info): Store the value of the enum fields
+ in field->def_value, as done in all other cases.
+
+ * reflection.c (mono_reflection_get_custom_attrs): Add support for
+ TypeBuilders.
+
+ * reflection.c (mono_reflection_create_runtime_class): Remove
+ errorneous assignment to klass->element_class, since it is already
+ done in mono_reflection_setup_internal_class.
+
+2004-01-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * gc.c: added missing LeaveCriticalSection.
+ * icall.c: indented a couple of lines.
+ * threadpool.c: remove dangling LeaveCriticalSection. Don't wait forever
+ if we call EndInvoke inside a callback. Fixes bug #52601.
+
+2004-01-07 Martin Baulig <martin@ximian.com>
+
+ * mono-debug-debugger.h
+ (MonoDebuggerIOLayer): Added `GetCurrentThreadID'.
+
+2004-01-06 Miguel de Icaza <miguel@ximian.com>
+
+ * appdomain.c: Use messages in NotImplementedException.
+
+ * exception.c (mono_get_exception_not_implemented): Now this takes
+ a message argument.
+
+ * marshal.c (emit_str_to_ptr_conv): g_warning and throw an
+ exception instead of g_asserting an aborting when something is not
+ implemented.
+
+ Add some inline docs.
+
+2004-01-05 Zoltan Varga <vargaz@freemail.hu>
+
+ * reflection.h: Update after changes to object layout.
+
+ * reflection.c: Implement saving of unmanaged aka win32 resources.
+
+ * appdomain.c: Bump version number.
+
+ * appdomain.c (ves_icall_System_AppDomain_InternalSetDomainByID):
+ Handle missing domains gracefully.
+
+2004-01-05 Atsushi Enomoto <atsushi@ximian.com>
+
+ * file-io.c : On Windows, there are much more invalid_path_chars.
Fri Jan 2 13:35:48 CET 2004 Paolo Molaro <lupus@ximian.com>
diff --git a/mono/metadata/Makefile.am b/mono/metadata/Makefile.am
index aec39f267f6..c8ea367f2a1 100644
--- a/mono/metadata/Makefile.am
+++ b/mono/metadata/Makefile.am
@@ -71,7 +71,9 @@ libmonoruntime_la_SOURCES = \
environment.c \
environment.h \
locales.c \
- locales.h
+ locales.h \
+ filewatcher.c \
+ filewatcher.h
libmetadata_la_SOURCES = \
assembly.c \
diff --git a/mono/metadata/appdomain.c b/mono/metadata/appdomain.c
index ad8c120812d..4df5e91c14b 100644
--- a/mono/metadata/appdomain.c
+++ b/mono/metadata/appdomain.c
@@ -24,8 +24,9 @@
#include <mono/metadata/tabledefs.h>
#include <mono/metadata/gc-internal.h>
#include <mono/metadata/marshal.h>
+#include <mono/utils/mono-uri.h>
-#define MONO_CORLIB_VERSION 5
+#define MONO_CORLIB_VERSION 10
CRITICAL_SECTION mono_delegate_section;
@@ -577,13 +578,18 @@ set_domain_search_path (MonoDomain *domain)
if (strncmp (*tmp, "file://", 7) == 0) {
gchar *file = *tmp;
gchar *uri = *tmp;
+ gchar *tmpuri;
if (uri [7] != '/')
uri = g_strdup_printf ("file:///%s", uri + 7);
+ tmpuri = uri;
+ uri = mono_escape_uri_string (tmpuri);
*tmp = g_filename_from_uri (uri, NULL, &error);
- if (uri != file)
- g_free (uri);
+ g_free (uri);
+
+ if (tmpuri != file)
+ g_free (tmpuri);
if (error != NULL) {
g_warning ("%s\n", error->message);
@@ -618,7 +624,7 @@ set_domain_search_path (MonoDomain *domain)
}
static MonoAssembly *
-real_load (gchar **search_path, gchar *filename)
+real_load (gchar **search_path, const gchar *culture, gchar *filename)
{
MonoAssembly *result;
gchar **path;
@@ -627,7 +633,10 @@ real_load (gchar **search_path, gchar *filename)
for (path = search_path; *path; path++) {
if (**path == '\0')
continue; /* Ignore empty ApplicationBase */
- fullpath = g_build_filename (*path, filename, NULL);
+ if (culture && (strlen (culture) > 0))
+ fullpath = g_build_filename (*path, culture, filename, NULL);
+ else
+ fullpath = g_build_filename (*path, filename, NULL);
result = mono_assembly_open (fullpath, NULL);
g_free (fullpath);
if (result)
@@ -658,14 +667,14 @@ mono_domain_assembly_preload (MonoAssemblyName *aname,
if (domain->search_path && domain->search_path [0] != NULL) {
/* TODO: should also search in name/name.dll and name/name.exe from appbase */
- result = real_load (domain->search_path, dll);
+ result = real_load (domain->search_path, aname->culture, dll);
if (result) {
g_free (dll);
g_free (exe);
return result;
}
- result = real_load (domain->search_path, exe);
+ result = real_load (domain->search_path, aname->culture, exe);
if (result) {
g_free (dll);
g_free (exe);
@@ -674,14 +683,14 @@ mono_domain_assembly_preload (MonoAssemblyName *aname,
}
if (assemblies_path && assemblies_path [0] != NULL) {
- result = real_load (assemblies_path, dll);
+ result = real_load (assemblies_path, aname->culture, dll);
if (result) {
g_free (dll);
g_free (exe);
return result;
}
- result = real_load (assemblies_path, exe);
+ result = real_load (assemblies_path, aname->culture, exe);
if (result) {
g_free (dll);
g_free (exe);
@@ -735,7 +744,7 @@ free_assembly_name (MonoAssemblyName *aname)
}
static gboolean
-get_info_from_assembly_name (MonoReflectionAssemblyName *assRef, MonoAssemblyName *aname)
+get_info_from_assembly_name (MonoString *assRef, MonoAssemblyName *aname)
{
gchar *name;
gchar *value;
@@ -745,7 +754,7 @@ get_info_from_assembly_name (MonoReflectionAssemblyName *assRef, MonoAssemblyNam
memset (aname, 0, sizeof (MonoAssemblyName));
- name = mono_string_to_utf8 (assRef->name);
+ name = mono_string_to_utf8 (assRef);
parts = tmp = g_strsplit (name, ",", 4);
g_free (name);
if (!tmp || !*tmp) {
@@ -853,7 +862,7 @@ ves_icall_System_AppDomain_LoadAssemblyRaw (MonoAppDomain *ad,
MonoImage *image = mono_image_open_from_data (mono_array_addr (raw_assembly, gchar, 0), raw_assembly_len, TRUE, NULL);
if (raw_symbol_store)
- mono_raise_exception (mono_get_exception_not_implemented ());
+ mono_raise_exception (mono_get_exception_not_implemented ("LoadAssemblyRaw: Raw Symbol Store not Implemented"));
if (!image) {
mono_raise_exception (mono_get_exception_bad_image_format (""));
@@ -872,7 +881,7 @@ ves_icall_System_AppDomain_LoadAssemblyRaw (MonoAppDomain *ad,
}
MonoReflectionAssembly *
-ves_icall_System_AppDomain_LoadAssembly (MonoAppDomain *ad, MonoReflectionAssemblyName *assRef, MonoObject *evidence)
+ves_icall_System_AppDomain_LoadAssembly (MonoAppDomain *ad, MonoString *assRef, MonoObject *evidence)
{
MonoDomain *domain = ad->data;
MonoImageOpenStatus status = MONO_IMAGE_OK;
@@ -887,23 +896,22 @@ ves_icall_System_AppDomain_LoadAssembly (MonoAppDomain *ad, MonoReflectionAssem
/* FIXME : examine evidence? */
g_assert (assRef != NULL);
- g_assert (assRef->name != NULL);
if (!get_info_from_assembly_name (assRef, &aname)) {
MonoException *exc;
free_assembly_name (&aname);
/* This is a parse error... */
- exc = mono_get_exception_file_not_found (assRef->name);
+ exc = mono_get_exception_file_not_found (assRef);
mono_raise_exception (exc);
}
ass = mono_assembly_load (&aname, NULL, &status);
free_assembly_name (&aname);
- if (!ass && (refass = try_assembly_resolve (domain, assRef->name)) == NULL){
+ if (!ass && (refass = try_assembly_resolve (domain, assRef)) == NULL){
/* FIXME: it doesn't make much sense since we really don't have a filename ... */
- MonoException *exc = mono_get_exception_file_not_found (assRef->name);
+ MonoException *exc = mono_get_exception_file_not_found (assRef);
mono_raise_exception (exc);
}
@@ -1009,7 +1017,7 @@ ves_icall_System_AppDomain_InternalSetDomainByID (gint32 domainid)
MONO_ARCH_SAVE_REGS;
- if (!mono_domain_set (domain, FALSE))
+ if (!domain || !mono_domain_set (domain, FALSE))
mono_raise_exception (mono_get_exception_appdomain_unloaded ());
return current_domain->domain;
@@ -1141,6 +1149,8 @@ unload_thread_main (void *arg)
domain->state = MONO_APPDOMAIN_UNLOADED;
+ //printf ("UNLOADED %s.\n", domain->friendly_name);
+
mono_domain_free (domain, FALSE);
#ifdef HAVE_BOEHM_GC
diff --git a/mono/metadata/appdomain.h b/mono/metadata/appdomain.h
index 8c1d073eb79..45b8a3195be 100644
--- a/mono/metadata/appdomain.h
+++ b/mono/metadata/appdomain.h
@@ -241,7 +241,7 @@ ves_icall_System_Reflection_Assembly_LoadFrom (MonoString *fname);
MonoReflectionAssembly *
ves_icall_System_AppDomain_LoadAssembly (MonoAppDomain *ad,
- MonoReflectionAssemblyName *assRef,
+ MonoString *assRef,
MonoObject *evidence);
gboolean
diff --git a/mono/metadata/assembly.c b/mono/metadata/assembly.c
index f77faeac56e..5a86137ba52 100644
--- a/mono/metadata/assembly.c
+++ b/mono/metadata/assembly.c
@@ -23,6 +23,7 @@
#include "mono-bundle.h"
#endif
#include <mono/io-layer/io-layer.h>
+#include <mono/utils/mono-uri.h>
/* the default search path is just MONO_ASSEMBLIES */
static const char*
@@ -433,7 +434,7 @@ do_mono_assembly_open (const char *filename, MonoImageOpenStatus *status)
}
g_free (name);
if (image) {
- InterlockedIncrement (&image->ref_count);
+ mono_image_addref (image);
return image;
}
#endif
@@ -469,6 +470,7 @@ mono_assembly_open (const char *filename, MonoImageOpenStatus *status)
if (strncmp (filename, "file://", 7) == 0) {
GError *error = NULL;
gchar *uri = (gchar *) filename;
+ gchar *tmpuri;
/*
* MS allows file://c:/... and fails on file://localhost/c:/...
@@ -477,9 +479,13 @@ mono_assembly_open (const char *filename, MonoImageOpenStatus *status)
if (uri [7] != '/')
uri = g_strdup_printf ("file:///%s", uri + 7);
+ tmpuri = uri;
+ uri = mono_escape_uri_string (tmpuri);
fname = g_filename_from_uri (uri, NULL, &error);
- if (uri != filename)
- g_free (uri);
+ g_free (uri);
+
+ if (tmpuri != filename)
+ g_free (tmpuri);
if (error != NULL) {
g_warning ("%s\n", error->message);
diff --git a/mono/metadata/class.c b/mono/metadata/class.c
index d10f8ba9d01..b2502b94230 100644
--- a/mono/metadata/class.c
+++ b/mono/metadata/class.c
@@ -33,8 +33,6 @@
#include <mono/metadata/reflection.h>
#include <mono/os/gc_wrapper.h>
-#define CSIZE(x) (sizeof (x) / 4)
-
MonoStats mono_stats;
gboolean mono_print_vtable = FALSE;
@@ -205,8 +203,8 @@ mono_class_inflate_generic_type (MonoType *type, MonoGenericInst *ginst)
{
switch (type->type) {
case MONO_TYPE_MVAR:
- if (ginst)
- return dup_type (ginst->type_argv [type->data.generic_param->num]);
+ if (ginst && ginst->mtype_argv)
+ return dup_type (ginst->mtype_argv [type->data.generic_param->num]);
else
return type;
case MONO_TYPE_VAR: {
@@ -232,6 +230,26 @@ mono_class_inflate_generic_type (MonoType *type, MonoGenericInst *ginst)
nt->data.klass = nclass;
return nt;
}
+ case MONO_TYPE_GENERICINST: {
+ MonoGenericInst *oginst = type->data.generic_inst;
+ MonoGenericInst *nginst;
+ MonoType *nt;
+ int i;
+
+ nginst = g_new0 (MonoGenericInst, 1);
+ *nginst = *oginst;
+
+ nginst->type_argv = g_new0 (MonoType *, oginst->type_argc);
+
+ for (i = 0; i < oginst->type_argc; i++) {
+ MonoType *t = oginst->type_argv [i];
+ nginst->type_argv [i] = mono_class_inflate_generic_type (t, ginst);
+ };
+
+ nt = dup_type (type);
+ nt->data.generic_inst = nginst;
+ return nt;
+ }
default:
return type;
}
@@ -362,7 +380,7 @@ class_compute_field_layout (MonoClass *class)
int idx = class->field.first + i;
field = &class->fields [i];
- mono_metadata_decode_row (t, idx, cols, CSIZE (cols));
+ mono_metadata_decode_row (t, idx, cols, MONO_FIELD_SIZE);
/* The name is needed for fieldrefs */
field->name = mono_metadata_string_heap (m, cols [MONO_FIELD_NAME]);
sig = mono_metadata_blob_heap (m, cols [MONO_FIELD_SIGNATURE]);
@@ -949,6 +967,20 @@ mono_class_setup_vtable (MonoClass *class, MonoMethod **overrides, int onum)
if (im->flags & METHOD_ATTRIBUTE_STATIC)
continue;
g_assert (io + l <= max_vtsize);
+
+ /*
+ * If one of our parents already implements this interface
+ * we can inherit the implementation.
+ */
+ if (!(vtable [io + l])) {
+ MonoClass *parent = class->parent;
+
+ if ((ic->interface_id <= parent->max_interface_id) &&
+ (parent->interface_offsets [ic->interface_id]) &&
+ parent->vtable)
+ vtable [io + l] = parent->vtable [parent->interface_offsets [ic->interface_id] + l];
+ }
+
if (!(vtable [io + l])) {
for (j = 0; j < onum; ++j) {
g_print (" at slot %d: %s (%d) overrides %s (%d)\n", io+l, overrides [j*2+1]->name,
@@ -1572,7 +1604,7 @@ mono_class_create_from_typedef (MonoImage *image, guint32 type_token)
class->method.first = cols [MONO_TYPEDEF_METHOD_LIST] - 1;
if (tt->rows > tidx){
- mono_metadata_decode_row (tt, tidx, cols_next, CSIZE (cols_next));
+ mono_metadata_decode_row (tt, tidx, cols_next, MONO_TYPEDEF_SIZE);
class->field.last = cols_next [MONO_TYPEDEF_FIELD_LIST] - 1;
class->method.last = cols_next [MONO_TYPEDEF_METHOD_LIST] - 1;
} else {
@@ -1741,21 +1773,10 @@ mono_class_from_generic_parameter (MonoGenericParam *param, MonoImage *image, gb
klass->parent = mono_defaults.object_class;
if (count - pos > 0) {
- int j;
-
klass->interface_count = count - pos;
klass->interfaces = g_new0 (MonoClass *, count - pos);
- for (i = pos; i < count; i++) {
+ for (i = pos; i < count; i++)
klass->interfaces [i - pos] = param->constraints [i];
- klass->method.count += param->constraints [i]->method.count;
- }
-
- klass->methods = g_new0 (MonoMethod *, klass->method.count);
- for (i = pos; i < count; i++) {
- MonoClass *iface = klass->interfaces [i - pos];
- for (j = 0; j < iface->method.count; j++)
- klass->methods [klass->method.last++] = iface->methods [j];
- }
}
klass->name = g_strdup_printf (is_mvar ? "!!%d" : "!%d", param->num);
@@ -1924,7 +1945,7 @@ mono_class_from_mono_type (MonoType *type)
case MONO_TYPE_TYPEDBYREF:
return type->data.klass? type->data.klass: mono_defaults.typed_reference_class;
case MONO_TYPE_ARRAY:
- return mono_array_class_get (type->data.array->eklass, type->data.array->rank);
+ return mono_bounded_array_class_get (type->data.array->eklass, type->data.array->rank, TRUE);
case MONO_TYPE_PTR:
return mono_ptr_class_get (type->data.type);
case MONO_TYPE_FNPTR:
@@ -1983,15 +2004,16 @@ mono_class_create_from_typespec (MonoImage *image, guint32 type_spec)
}
/**
- * mono_array_class_get:
+ * mono_bounded_array_class_get:
* @element_class: element class
* @rank: the dimension of the array class
+ * @bounded: whenever the array has non-zero bounds
*
* Returns: a class object describing the array with element type @element_type and
* dimension @rank.
*/
MonoClass *
-mono_array_class_get (MonoClass *eclass, guint32 rank)
+mono_bounded_array_class_get (MonoClass *eclass, guint32 rank, gboolean bounded)
{
MonoImage *image;
MonoClass *class;
@@ -2003,6 +2025,10 @@ mono_array_class_get (MonoClass *eclass, guint32 rank)
g_assert (rank <= 255);
+ if (rank > 1)
+ /* bounded only matters for one-dimensional arrays */
+ bounded = FALSE;
+
image = eclass->image;
mono_loader_lock ();
@@ -2010,7 +2036,7 @@ mono_array_class_get (MonoClass *eclass, guint32 rank)
if ((rootlist = list = g_hash_table_lookup (image->array_cache, eclass))) {
for (; list; list = list->next) {
class = list->data;
- if (class->rank == rank) {
+ if ((class->rank == rank) && (class->byval_arg.type == (bounded ? MONO_TYPE_ARRAY : MONO_TYPE_SZARRAY))) {
mono_loader_unlock ();
return class;
}
@@ -2058,7 +2084,7 @@ mono_array_class_get (MonoClass *eclass, guint32 rank)
class->element_class = eclass;
- if (rank > 1) {
+ if ((rank > 1) || bounded) {
MonoArrayType *at = g_new0 (MonoArrayType, 1);
class->byval_arg.type = MONO_TYPE_ARRAY;
class->byval_arg.data.array = at;
@@ -2066,7 +2092,6 @@ mono_array_class_get (MonoClass *eclass, guint32 rank)
at->rank = rank;
/* FIXME: complete.... */
} else {
- /* FIXME: this is not correct. the lbound could be >0 */
class->byval_arg.type = MONO_TYPE_SZARRAY;
class->byval_arg.data.klass = eclass;
}
@@ -2085,6 +2110,20 @@ mono_array_class_get (MonoClass *eclass, guint32 rank)
}
/**
+ * mono_array_class_get:
+ * @element_class: element class
+ * @rank: the dimension of the array class
+ *
+ * Returns: a class object describing the array with element type @element_type and
+ * dimension @rank.
+ */
+MonoClass *
+mono_array_class_get (MonoClass *eclass, guint32 rank)
+{
+ return mono_bounded_array_class_get (eclass, rank, FALSE);
+}
+
+/**
* mono_class_instance_size:
* @klass: a class
*
@@ -2236,7 +2275,7 @@ mono_class_get_property_from_name (MonoClass *klass, const char *name)
MonoClass *
mono_class_get (MonoImage *image, guint32 type_token)
{
- MonoClass *class;
+ MonoClass *class = NULL;
if (image->dynamic)
return mono_lookup_dynamic_token (image, type_token);
@@ -2422,6 +2461,10 @@ mono_class_is_assignable_from (MonoClass *klass, MonoClass *oklass)
if (oklass->rank != klass->rank)
return FALSE;
+ /* vectors vs. one dimensional arrays */
+ if (oklass->byval_arg.type != klass->byval_arg.type)
+ return FALSE;
+
eclass = klass->cast_class;
eoclass = oklass->cast_class;
diff --git a/mono/metadata/class.h b/mono/metadata/class.h
index 7b2e52ede04..a3486ce4176 100644
--- a/mono/metadata/class.h
+++ b/mono/metadata/class.h
@@ -222,6 +222,8 @@ struct _MonoGenericInst {
MonoMethod *generic_method;
int type_argc;
MonoType **type_argv;
+ int mtype_argc;
+ MonoType **mtype_argv;
guint is_open : 1;
guint initialized : 1;
guint init_pending : 1;
@@ -319,6 +321,9 @@ MonoMethod**
mono_class_get_overrides (MonoImage *image, guint32 type_token, gint32 *num_overrides);
MonoClass *
+mono_bounded_array_class_get (MonoClass *element_class, guint32 rank, gboolean bounded);
+
+MonoClass *
mono_array_class_get (MonoClass *element_class, guint32 rank);
MonoClass *
diff --git a/mono/metadata/debug-mono-symfile.h b/mono/metadata/debug-mono-symfile.h
index 750d7aac666..a3231747404 100644
--- a/mono/metadata/debug-mono-symfile.h
+++ b/mono/metadata/debug-mono-symfile.h
@@ -43,7 +43,6 @@ struct MonoSymbolFileMethodEntry {
guint32 num_locals;
guint32 num_line_numbers;
guint32 name_offset;
- guint32 full_name_offset;
guint32 type_index_table_offset;
guint32 local_variable_table_offset;
guint32 line_number_table_offset;
@@ -64,7 +63,6 @@ struct MonoSymbolFileSourceEntry {
struct MonoSymbolFileMethodIndexEntry {
guint32 file_offset;
- guint32 full_name_offset;
guint32 token;
};
@@ -120,7 +118,7 @@ struct _MonoSymbolFile {
MonoSymbolFileOffsetTable *offset_table;
};
-#define MONO_SYMBOL_FILE_VERSION 35
+#define MONO_SYMBOL_FILE_VERSION 36
#define MONO_SYMBOL_FILE_MAGIC 0x45e82623fd7fa614
MonoSymbolFile *
diff --git a/mono/metadata/exception.c b/mono/metadata/exception.c
index b579cdd2dc3..14559ffde38 100644
--- a/mono/metadata/exception.c
+++ b/mono/metadata/exception.c
@@ -110,9 +110,9 @@ mono_exception_from_name_two_strings (MonoImage *image, const char *name_space,
*
* Returns: the initialized exception instance.
*/
-static MonoException *
+MonoException *
mono_exception_from_name_msg (MonoImage *image, const char *name_space,
- const char *name, const guchar *msg)
+ const char *name, const guchar *msg)
{
MonoException *ex;
MonoDomain *domain;
@@ -218,10 +218,19 @@ mono_get_exception_type_load (MonoString *type_name)
}
MonoException *
-mono_get_exception_not_implemented ()
+mono_get_exception_not_implemented (const guchar *msg)
{
- return mono_exception_from_name (mono_defaults.corlib, "System",
- "NotImplementedException");
+ MonoException *ex;
+ MonoDomain *domain;
+
+ ex = mono_exception_from_name (mono_defaults.corlib, "System",
+ "NotImplementedException");
+ domain = ((MonoObject *)ex)->vtable->domain;
+
+ if (msg)
+ ex->message = mono_string_new (domain, msg);
+
+ return ex;
}
MonoException *
diff --git a/mono/metadata/exception.h b/mono/metadata/exception.h
index ccd818cfe1e..58cba415b14 100644
--- a/mono/metadata/exception.h
+++ b/mono/metadata/exception.h
@@ -22,6 +22,10 @@ mono_exception_from_name (MonoImage *image,
const char* name_space,
const char *name);
+MonoException *
+mono_exception_from_name_msg (MonoImage *image, const char *name_space,
+ const char *name, const guchar *msg);
+
extern MonoException *
mono_exception_from_name_domain (MonoDomain *domain, MonoImage *image,
const char* name_space,
@@ -70,7 +74,7 @@ MonoException *
mono_get_exception_missing_method (void);
MonoException *
-mono_get_exception_not_implemented (void);
+mono_get_exception_not_implemented (const guchar *msg);
MonoException*
mono_get_exception_argument_null (const guchar *arg);
diff --git a/mono/metadata/file-io.c b/mono/metadata/file-io.c
index 1cb647d6abf..3847409fcd8 100644
--- a/mono/metadata/file-io.c
+++ b/mono/metadata/file-io.c
@@ -809,10 +809,20 @@ ves_icall_System_IO_MonoIO_get_PathSeparator ()
static gunichar2 invalid_path_chars [] = {
#if defined (PLATFORM_WIN32)
- 0x0022, /* double quote */
+ 0x0022, /* double quote, which seems allowed in MS.NET but should be rejected */
0x003c, /* less than */
0x003e, /* greater than */
0x007c, /* pipe */
+ 0x0008,
+ 0x0010,
+ 0x0011,
+ 0x0012,
+ 0x0014,
+ 0x0015,
+ 0x0016,
+ 0x0017,
+ 0x0018,
+ 0x0019,
#endif
0x0000 /* null */
};
@@ -827,7 +837,7 @@ ves_icall_System_IO_MonoIO_get_InvalidPathChars ()
MONO_ARCH_SAVE_REGS;
domain = mono_domain_get ();
- chars = mono_array_new (domain, mono_defaults.char_class, 5);
+ chars = mono_array_new (domain, mono_defaults.char_class, 15);
n = sizeof (invalid_path_chars) / sizeof (gunichar2);
diff --git a/mono/metadata/filewatcher.c b/mono/metadata/filewatcher.c
new file mode 100644
index 00000000000..1553a199032
--- /dev/null
+++ b/mono/metadata/filewatcher.c
@@ -0,0 +1,167 @@
+/*
+ * filewatcher.c: File System Watcher internal calls
+ *
+ * Authors:
+ * Gonzalo Paniagua Javier (gonzalo@ximian.com)
+ *
+ * (C) 2004 Novell, Inc. (http://www.novell.com)
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <mono/metadata/appdomain.h>
+#include <mono/metadata/exception.h>
+#include <mono/metadata/filewatcher.h>
+
+#if (defined (PLATFORM_WIN32) && WINVER >= 0x0400)
+/* Supported under windows */
+gint
+ves_icall_System_IO_FSW_SupportsFSW (void)
+{
+ return 1;
+}
+
+gpointer
+ves_icall_System_IO_FSW_OpenDirectory (MonoString *path, gpointer reserved)
+{
+ gpointer dir;
+ gchar *utf8path;
+
+ MONO_ARCH_SAVE_REGS;
+
+ utf8path = mono_string_to_utf8 (path);
+ dir = CreateFile (path, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_DELETE,
+ NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL);
+ g_free (utf8path);
+
+ return dir;
+}
+
+gboolean
+ves_icall_System_IO_FSW_CloseDirectory (gpointer handle)
+{
+ MONO_ARCH_SAVE_REGS;
+
+ return CloseHandle (handle);
+}
+
+gboolean
+ves_icall_System_IO_FSW_ReadDirectoryChanges ( gpointer handle,
+ MonoArray *buffer,
+ gboolean includeSubdirs,
+ gint filters,
+ gpointer overlap,
+ gpointer callback)
+{
+ gpointer dest;
+ gint size;
+ MonoObject *delegate = (MonoObject *) callback;
+ MonoMethod *im;
+ LPOVERLAPPED_COMPLETION_ROUTINE func;
+
+ MONO_ARCH_SAVE_REGS;
+
+ size = mono_array_length (buffer);
+ dest = mono_array_addr_with_size (buffer, 1, 0);
+
+ im = mono_get_delegate_invoke (delegate->vtable->klass);
+ func = mono_compile_method (im);
+ return FALSE;
+ /* return ReadDirectoryChanges (handle, dest, size, includeSubdirs, filters,
+ NULL, (LPOVERLAPPED) overlap,
+ func); */
+}
+
+gboolean
+ves_icall_System_IO_FAMW_InternalFAMNextEvent (gpointer conn,
+ MonoString **filename,
+ gint *code,
+ gint *reqnum)
+{
+ return FALSE;
+}
+#else
+
+static int (*FAMNextEvent) (gpointer, gpointer);
+
+gint
+ves_icall_System_IO_FSW_SupportsFSW (void)
+{
+ GModule *fam_module;
+
+ MONO_ARCH_SAVE_REGS;
+
+ fam_module = g_module_open ("libfam", G_MODULE_BIND_LAZY);
+ if (fam_module == NULL) {
+ return 0;
+ }
+
+
+ g_module_symbol (fam_module, "FAMNextEvent", (gpointer *) &FAMNextEvent);
+ if (FAMNextEvent == NULL)
+ return 0;
+
+ return 2;
+}
+
+gpointer
+ves_icall_System_IO_FSW_OpenDirectory (MonoString *path, gpointer reserved)
+{
+ return NULL;
+}
+
+gboolean
+ves_icall_System_IO_FSW_CloseDirectory (gpointer handle)
+{
+ return FALSE;
+}
+
+gboolean
+ves_icall_System_IO_FSW_ReadDirectoryChanges ( gpointer handle,
+ MonoArray *buffer,
+ gboolean includeSubdirs,
+ gint filters,
+ gpointer overlap,
+ gpointer callback)
+{
+ return FALSE;
+}
+
+/* Almost copied from fam.h. Weird, I know */
+typedef struct {
+ gint reqnum;
+} FAMRequest;
+
+typedef struct FAMEvent {
+ gpointer fc;
+ FAMRequest fr;
+ gchar *hostname;
+ gchar filename [PATH_MAX];
+ gpointer userdata;
+ gint code;
+} FAMEvent;
+
+gboolean
+ves_icall_System_IO_FAMW_InternalFAMNextEvent (gpointer conn,
+ MonoString **filename,
+ gint *code,
+ gint *reqnum)
+{
+ FAMEvent ev;
+
+ MONO_ARCH_SAVE_REGS;
+
+ if (FAMNextEvent (conn, &ev) == 1) {
+ *filename = mono_string_new (mono_domain_get (), ev.filename);
+ *code = ev.code;
+ *reqnum = ev.fr.reqnum;
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+#endif
+
diff --git a/mono/metadata/filewatcher.h b/mono/metadata/filewatcher.h
new file mode 100644
index 00000000000..83f2dc633ff
--- /dev/null
+++ b/mono/metadata/filewatcher.h
@@ -0,0 +1,40 @@
+/*
+ * filewatcher.h: File System Watcher internal calls
+ *
+ * Authors:
+ * Gonzalo Paniagua Javier (gonzalo@ximian.com)
+ *
+ * (C) 2004 Novell, Inc. (http://www.novell.com)
+ */
+
+#ifndef _MONO_METADATA_FILEWATCHER_H
+#define _MONO_METADATA_FILEWATCHER_H
+
+#include <mono/metadata/object.h>
+#include <mono/io-layer/io-layer.h>
+
+G_BEGIN_DECLS
+
+gboolean ves_icall_System_IO_FSW_SupportsFSW (void);
+
+gpointer ves_icall_System_IO_FSW_OpenDirectory (MonoString *path, gpointer reserved);
+
+gboolean ves_icall_System_IO_FSW_CloseDirectory (gpointer handle);
+
+gboolean ves_icall_System_IO_FSW_ReadDirectoryChanges (
+ gpointer handle,
+ MonoArray *buffer,
+ gboolean includeSubdirs,
+ gint filters,
+ gpointer overlap,
+ gpointer callback);
+
+gboolean ves_icall_System_IO_FAMW_InternalFAMNextEvent (gpointer conn,
+ MonoString **filename,
+ gint *code,
+ gint *reqnum);
+
+G_END_DECLS
+
+#endif
+
diff --git a/mono/metadata/gc.c b/mono/metadata/gc.c
index e5833a28c6f..6815f0027d9 100644
--- a/mono/metadata/gc.c
+++ b/mono/metadata/gc.c
@@ -415,6 +415,7 @@ ves_icall_System_GCHandle_FreeHandle (guint32 handle)
GC_unregister_disappearing_link (&(gc_handles [idx]));
}
#else
+ LeaveCriticalSection (&handle_section);
mono_raise_exception (mono_get_exception_execution_engine ("No GCHandle support"));
#endif
diff --git a/mono/metadata/icall.c b/mono/metadata/icall.c
index 9dc793e2bd9..70409c70992 100644
--- a/mono/metadata/icall.c
+++ b/mono/metadata/icall.c
@@ -42,6 +42,7 @@
#include <mono/metadata/environment.h>
#include <mono/metadata/profiler-private.h>
#include <mono/metadata/locales.h>
+#include <mono/metadata/filewatcher.h>
#include <mono/io-layer/io-layer.h>
#include <mono/utils/strtod.h>
#include <mono/utils/monobitset.h>
@@ -462,6 +463,7 @@ ves_icall_System_Array_CreateInstanceImpl (MonoReflectionType *type, MonoArray *
MonoClass *aklass;
MonoArray *array;
gint32 *sizes, i;
+ gboolean bounded = FALSE;
MONO_ARCH_SAVE_REGS;
@@ -476,7 +478,13 @@ ves_icall_System_Array_CreateInstanceImpl (MonoReflectionType *type, MonoArray *
if (mono_array_get (lengths, gint32, i) < 0)
mono_raise_exception (mono_get_exception_argument_out_of_range (NULL));
- aklass = mono_array_class_get (mono_class_from_mono_type (type->type), mono_array_length (lengths));
+ if (bounds && (mono_array_length (bounds) == 1) && (mono_array_get (bounds, gint32, 0) != 0))
+ /* vectors are not the same as one dimensional arrays with no-zero bounds */
+ bounded = TRUE;
+ else
+ bounded = FALSE;
+
+ aklass = mono_bounded_array_class_get (mono_class_from_mono_type (type->type), mono_array_length (lengths), bounded);
sizes = alloca (aklass->rank * sizeof(guint32) * 2);
for (i = 0; i < aklass->rank; ++i) {
@@ -805,8 +813,8 @@ ves_icall_System_ValueType_Equals (MonoObject *this, MonoObject *that, MonoArray
/*
* Do the comparison for fields of primitive type and return a result if
* possible. Otherwise, return the remaining fields in an array to the
- * managed side. This way, we can avoid costly reflection operations in
- * managed code.
+ * managed side. This way, we can avoid costly reflection operations in
+ * managed code.
*/
*fields = NULL;
for (i = 0; i < klass->field.count; ++i) {
@@ -1127,6 +1135,13 @@ ves_icall_type_is_assignable_from (MonoReflectionType *type, MonoReflectionType
}
static guint32
+ves_icall_type_IsInstanceOfType (MonoReflectionType *type, MonoObject *obj)
+{
+ MonoClass *klass = mono_class_from_mono_type (type->type);
+ return mono_object_isinst (obj, klass) != NULL;
+}
+
+static guint32
ves_icall_get_attributes (MonoReflectionType *type)
{
MonoClass *klass = mono_class_from_mono_type (type->type);
@@ -1317,18 +1332,39 @@ ves_icall_FieldInfo_SetValueInternal (MonoReflectionField *field, MonoObject *ob
}
}
+/* From MonoProperty.cs */
+typedef enum {
+ PInfo_Attributes = 1,
+ PInfo_GetMethod = 1 << 1,
+ PInfo_SetMethod = 1 << 2,
+ PInfo_ReflectedType = 1 << 3,
+ PInfo_DeclaringType = 1 << 4,
+ PInfo_Name = 1 << 5
+} PInfo;
+
static void
-ves_icall_get_property_info (MonoReflectionProperty *property, MonoPropertyInfo *info)
+ves_icall_get_property_info (MonoReflectionProperty *property, MonoPropertyInfo *info, PInfo req_info)
{
MonoDomain *domain = mono_object_domain (property);
MONO_ARCH_SAVE_REGS;
- info->parent = mono_type_get_object (domain, &property->klass->byval_arg);
- info->name = mono_string_new (domain, property->property->name);
- info->attrs = property->property->attrs;
- info->get = property->property->get ? mono_method_get_object (domain, property->property->get, NULL): NULL;
- info->set = property->property->set ? mono_method_get_object (domain, property->property->set, NULL): NULL;
+ if ((req_info & PInfo_ReflectedType) != 0 || (req_info & PInfo_DeclaringType) != 0)
+ info->parent = mono_type_get_object (domain, &property->klass->byval_arg);
+
+ if ((req_info & PInfo_Name) != 0)
+ info->name = mono_string_new (domain, property->property->name);
+
+ if ((req_info & PInfo_Attributes) != 0)
+ info->attrs = property->property->attrs;
+
+ if ((req_info & PInfo_GetMethod) != 0)
+ info->get = property->property->get ?
+ mono_method_get_object (domain, property->property->get, NULL): NULL;
+
+ if ((req_info & PInfo_SetMethod) != 0)
+ info->set = property->property->set ?
+ mono_method_get_object (domain, property->property->set, NULL): NULL;
/*
* There may be other methods defined for properties, though, it seems they are not exposed
* in the reflection API
@@ -1364,6 +1400,7 @@ ves_icall_Type_GetInterfaces (MonoReflectionType* type)
if (class->rank) {
/* GetInterfaces() returns an empty array in MS.NET (this may be a bug) */
+ mono_bitset_free (slots);
return mono_array_new (domain, mono_defaults.monotype_class, 0);
}
@@ -2000,7 +2037,7 @@ ves_icall_get_enum_info (MonoReflectionType *type, MonoEnumInfo *info)
MonoClass *enumc = mono_class_from_mono_type (type->type);
guint i, j, nvalues, crow;
MonoClassField *field;
-
+
MONO_ARCH_SAVE_REGS;
info->utype = mono_type_get_object (domain, enumc->enum_basetype);
@@ -2010,35 +2047,42 @@ ves_icall_get_enum_info (MonoReflectionType *type, MonoEnumInfo *info)
crow = -1;
for (i = 0, j = 0; i < enumc->field.count; ++i) {
+ const char *p;
+ int len;
+
field = &enumc->fields [i];
if (strcmp ("value__", field->name) == 0)
continue;
if (mono_field_is_deleted (field))
continue;
mono_array_set (info->names, gpointer, j, mono_string_new (domain, field->name));
- if (!field->data) {
+ if (!field->def_value) {
+ field->def_value = g_new0 (MonoConstant, 1);
crow = mono_metadata_get_constant_index (enumc->image, MONO_TOKEN_FIELD_DEF | (i+enumc->field.first+1), crow + 1);
+ field->def_value->type = mono_metadata_decode_row_col (&enumc->image->tables [MONO_TABLE_CONSTANT], crow-1, MONO_CONSTANT_TYPE);
crow = mono_metadata_decode_row_col (&enumc->image->tables [MONO_TABLE_CONSTANT], crow-1, MONO_CONSTANT_VALUE);
- /* 1 is the length of the blob */
- field->data = 1 + mono_metadata_blob_heap (enumc->image, crow);
+ field->def_value->value = (gpointer)mono_metadata_blob_heap (enumc->image, crow);
}
+
+ p = field->def_value->value;
+ len = mono_metadata_decode_blob_size (p, &p);
switch (enumc->enum_basetype->type) {
case MONO_TYPE_U1:
case MONO_TYPE_I1:
- mono_array_set (info->values, gchar, j, *field->data);
+ mono_array_set (info->values, gchar, j, *p);
break;
case MONO_TYPE_CHAR:
case MONO_TYPE_U2:
case MONO_TYPE_I2:
- mono_array_set (info->values, gint16, j, read16 (field->data));
+ mono_array_set (info->values, gint16, j, read16 (p));
break;
case MONO_TYPE_U4:
case MONO_TYPE_I4:
- mono_array_set (info->values, gint32, j, read32 (field->data));
+ mono_array_set (info->values, gint32, j, read32 (p));
break;
case MONO_TYPE_U8:
case MONO_TYPE_I8:
- mono_array_set (info->values, gint64, j, read64 (field->data));
+ mono_array_set (info->values, gint64, j, read64 (p));
break;
default:
g_error ("Implement type 0x%02x in get_enum_info", enumc->enum_basetype->type);
@@ -2185,7 +2229,7 @@ handle_parent:
}
static MonoArray*
-ves_icall_Type_GetMethods (MonoReflectionType *type, guint32 bflags)
+ves_icall_Type_GetMethodsByName (MonoReflectionType *type, MonoString *name, guint32 bflags, MonoBoolean ignore_case)
{
MonoDomain *domain;
GSList *l = NULL, *tmp;
@@ -2195,12 +2239,18 @@ ves_icall_Type_GetMethods (MonoReflectionType *type, guint32 bflags)
MonoObject *member;
int i, len, match;
GHashTable *method_slots = g_hash_table_new (NULL, NULL);
+ gchar *mname = NULL;
+ int (*compare_func) (const char *s1, const char *s2) = NULL;
MONO_ARCH_SAVE_REGS;
domain = ((MonoObject *)type)->vtable->domain;
klass = startklass = mono_class_from_mono_type (type->type);
len = 0;
+ if (name != NULL) {
+ mname = mono_string_to_utf8 (name);
+ compare_func = (ignore_case) ? g_strcasecmp : strcmp;
+ }
handle_parent:
for (i = 0; i < klass->method.count; ++i) {
@@ -2229,6 +2279,12 @@ handle_parent:
if (!match)
continue;
+
+ if (name != NULL) {
+ if (compare_func (mname, method->name))
+ continue;
+ }
+
match = 0;
if (g_hash_table_lookup (method_slots, GUINT_TO_POINTER (method->slot)))
continue;
@@ -2240,6 +2296,8 @@ handle_parent:
}
if (!(bflags & BFLAGS_DeclaredOnly) && (klass = klass->parent))
goto handle_parent;
+
+ g_free (mname);
res = mono_array_new (domain, mono_defaults.method_info_class, len);
i = 0;
@@ -2313,7 +2371,7 @@ ves_icall_Type_GetConstructors (MonoReflectionType *type, guint32 bflags)
}
static MonoArray*
-ves_icall_Type_GetProperties (MonoReflectionType *type, guint32 bflags)
+ves_icall_Type_GetPropertiesByName (MonoReflectionType *type, MonoString *name, guint32 bflags, MonoBoolean ignore_case)
{
MonoDomain *domain;
GSList *l = NULL, *tmp;
@@ -2325,11 +2383,17 @@ ves_icall_Type_GetProperties (MonoReflectionType *type, guint32 bflags)
int i, match;
int len = 0;
GHashTable *method_slots = g_hash_table_new (NULL, NULL);
+ gchar *propname = NULL;
+ int (*compare_func) (const char *s1, const char *s2) = NULL;
MONO_ARCH_SAVE_REGS;
domain = ((MonoObject *)type)->vtable->domain;
klass = startklass = mono_class_from_mono_type (type->type);
+ if (name != NULL) {
+ propname = mono_string_to_utf8 (name);
+ compare_func = (ignore_case) ? g_strcasecmp : strcmp;
+ }
handle_parent:
for (i = 0; i < klass->property.count; ++i) {
@@ -2361,6 +2425,11 @@ handle_parent:
continue;
match = 0;
+ if (name != NULL) {
+ if (compare_func (propname, prop->name))
+ continue;
+ }
+
if (g_hash_table_lookup (method_slots, GUINT_TO_POINTER (method->slot)))
continue;
g_hash_table_insert (method_slots, GUINT_TO_POINTER (method->slot), prop);
@@ -2370,6 +2439,8 @@ handle_parent:
}
if ((!(bflags & BFLAGS_DeclaredOnly) && (klass = klass->parent)))
goto handle_parent;
+
+ g_free (propname);
if (!System_Reflection_PropertyInfo)
System_Reflection_PropertyInfo = mono_class_from_name (
mono_defaults.corlib, "System.Reflection", "PropertyInfo");
@@ -2609,9 +2680,8 @@ ves_icall_System_Reflection_Assembly_InternalGetType (MonoReflectionAssembly *as
MonoReflectionAssemblyBuilder *abuilder = (MonoReflectionAssemblyBuilder*)assembly;
int i;
- if (!abuilder->modules)
- type = NULL;
- else {
+ type = NULL;
+ if (abuilder->modules) {
for (i = 0; i < mono_array_length (abuilder->modules); ++i) {
MonoReflectionModuleBuilder *mb = mono_array_get (abuilder->modules, MonoReflectionModuleBuilder*, i);
type = mono_reflection_get_type (&mb->dynamic_image->image, &info, ignoreCase);
@@ -2619,6 +2689,15 @@ ves_icall_System_Reflection_Assembly_InternalGetType (MonoReflectionAssembly *as
break;
}
}
+
+ if (!type && abuilder->loaded_modules) {
+ for (i = 0; i < mono_array_length (abuilder->loaded_modules); ++i) {
+ MonoReflectionModule *mod = mono_array_get (abuilder->loaded_modules, MonoReflectionModule*, i);
+ type = mono_reflection_get_type (mod->image, &info, ignoreCase);
+ if (type)
+ break;
+ }
+ }
}
else
type = mono_reflection_get_type (assembly->assembly->image, &info, ignoreCase);
@@ -2831,7 +2910,7 @@ g_concat_dir_and_file (const char *dir, const char *file)
}
static void *
-ves_icall_System_Reflection_Assembly_GetManifestResourceInternal (MonoReflectionAssembly *assembly, MonoString *name, gint32 *size)
+ves_icall_System_Reflection_Assembly_GetManifestResourceInternal (MonoReflectionAssembly *assembly, MonoString *name, gint32 *size, MonoReflectionModule **ref_module)
{
char *n = mono_string_to_utf8 (name);
MonoTableInfo *table = &assembly->assembly->image->tables [MONO_TABLE_MANIFESTRESOURCE];
@@ -2869,6 +2948,8 @@ ves_icall_System_Reflection_Assembly_GetManifestResourceInternal (MonoReflection
else
module = assembly->assembly->image;
+ *ref_module = mono_module_get_object (mono_domain_get (), module);
+
return (void*)mono_image_get_resource (module, cols [MONO_MANIFEST_OFFSET], size);
}
@@ -3280,6 +3361,13 @@ ves_icall_System_Reflection_Module_GetGlobalType (MonoReflectionModule *module)
return mono_type_get_object (domain, &klass->byval_arg);
}
+static void
+ves_icall_System_Reflection_Module_Close (MonoReflectionModule *module)
+{
+ if (module->image)
+ mono_image_close (module->image);
+}
+
static MonoString*
ves_icall_System_Reflection_Module_GetGuidInternal (MonoReflectionModule *module)
{
@@ -4324,9 +4412,14 @@ mono_TypedReference_ToObject (MonoTypedRef tref)
static void
prelink_method (MonoMethod *method)
{
+ const char *exc_class, *exc_arg;
if (!(method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL))
return;
- mono_lookup_pinvoke_call (method);
+ mono_lookup_pinvoke_call (method, &exc_class, &exc_arg);
+ if (exc_class) {
+ mono_raise_exception(
+ mono_exception_from_name_msg (mono_defaults.corlib, "System", exc_class, exc_arg ) );
+ }
/* create the wrapper, too? */
}
@@ -4560,6 +4653,7 @@ static gconstpointer icall_map [] = {
"System.MonoType::get_attributes", ves_icall_get_attributes,
"System.Type::type_is_subtype_of", ves_icall_type_is_subtype_of,
"System.Type::type_is_assignable_from", ves_icall_type_is_assignable_from,
+ "System.Type::IsInstanceOfType", ves_icall_type_IsInstanceOfType,
"System.Type::Equals", ves_icall_type_Equals,
"System.Type::GetTypeCode", ves_icall_type_GetTypeCode,
"System.Type::GetInterfaceMapData", ves_icall_Type_GetInterfaceMapData,
@@ -4687,6 +4781,8 @@ static gconstpointer icall_map [] = {
"System.Runtime.InteropServices.Marshal::AllocHGlobal", mono_marshal_alloc,
"System.Runtime.InteropServices.Marshal::FreeHGlobal", mono_marshal_free,
"System.Runtime.InteropServices.Marshal::ReAllocHGlobal", mono_marshal_realloc,
+ "System.Runtime.InteropServices.Marshal::AllocCoTaskMem", ves_icall_System_Runtime_InteropServices_Marshal_AllocCoTaskMem,
+ "System.Runtime.InteropServices.Marshal::FreeCoTaskMem", ves_icall_System_Runtime_InteropServices_Marshal_FreeCoTaskMem,
"System.Runtime.InteropServices.Marshal::copy_to_unmanaged", ves_icall_System_Runtime_InteropServices_Marshal_copy_to_unmanaged,
"System.Runtime.InteropServices.Marshal::copy_from_unmanaged", ves_icall_System_Runtime_InteropServices_Marshal_copy_from_unmanaged,
"System.Runtime.InteropServices.Marshal::SizeOf", ves_icall_System_Runtime_InteropServices_Marshal_SizeOf,
@@ -4726,6 +4822,7 @@ static gconstpointer icall_map [] = {
* System.Reflection.Module
*/
"System.Reflection.Module::GetGlobalType", ves_icall_System_Reflection_Module_GetGlobalType,
+ "System.Reflection.Module::Close", ves_icall_System_Reflection_Module_Close,
"System.Reflection.Module::GetGuidInternal", ves_icall_System_Reflection_Module_GetGuidInternal,
"System.Reflection.Module::InternalGetTypes", ves_icall_System_Reflection_Module_InternalGetTypes,
@@ -4748,9 +4845,9 @@ static gconstpointer icall_map [] = {
"System.MonoType::IsByRefImpl", ves_icall_type_isbyref,
"System.MonoType::GetField", ves_icall_Type_GetField,
"System.MonoType::GetFields", ves_icall_Type_GetFields,
- "System.MonoType::GetMethods", ves_icall_Type_GetMethods,
+ "System.MonoType::GetMethodsByName", ves_icall_Type_GetMethodsByName,
"System.MonoType::GetConstructors", ves_icall_Type_GetConstructors,
- "System.MonoType::GetProperties", ves_icall_Type_GetProperties,
+ "System.MonoType::GetPropertiesByName", ves_icall_Type_GetPropertiesByName,
"System.MonoType::GetEvents", ves_icall_Type_GetEvents,
"System.MonoType::InternalGetEvent", ves_icall_MonoType_GetEvent,
"System.MonoType::GetInterfaces", ves_icall_Type_GetInterfaces,
@@ -5042,6 +5139,18 @@ static gconstpointer icall_map [] = {
"System.String::InternalToUpper(System.Globalization.CultureInfo)", ves_icall_System_String_InternalToUpper_Comp,
/*
+ * System.IO.FileSystemWatcher
+ */
+ "System.IO.FileSystemWatcher::InternalSupportsFSW", ves_icall_System_IO_FSW_SupportsFSW,
+ "System.IO.FileSystemWatcher::InternalOpenDirectory", ves_icall_System_IO_FSW_OpenDirectory,
+ "System.IO.FileSystemWatcher::InternalCloseDirectory", ves_icall_System_IO_FSW_CloseDirectory,
+ "System.IO.FileSystemWatcher::InternalReadDirectoryChanges", ves_icall_System_IO_FSW_ReadDirectoryChanges,
+ /*
+ * System.IO.FAMWatcher
+ */
+ "System.IO.FAMWatcher::InternalFAMNextEvent", ves_icall_System_IO_FAMW_InternalFAMNextEvent,
+
+ /*
* add other internal calls here
*/
diff --git a/mono/metadata/image.c b/mono/metadata/image.c
index 34a776aae9a..16ac1a37bb6 100644
--- a/mono/metadata/image.c
+++ b/mono/metadata/image.c
@@ -887,6 +887,18 @@ free_hash_table (gpointer key, gpointer val, gpointer user_data)
/**
* mono_image_close:
+ * @image: The image file we wish to add a reference to
+ *
+ * Increases the reference count of an image.
+ */
+void
+mono_image_addref (MonoImage *image)
+{
+ InterlockedIncrement (&image->ref_count);
+}
+
+/**
+ * mono_image_close:
* @image: The image file we wish to close
*
* Closes an image file, deallocates all memory consumed and
diff --git a/mono/metadata/image.h b/mono/metadata/image.h
index 9d0cbb1909d..b16e61085d3 100644
--- a/mono/metadata/image.h
+++ b/mono/metadata/image.h
@@ -165,6 +165,7 @@ MonoImage *mono_image_loaded (const char *name);
MonoImage *mono_image_loaded_by_guid (const char *guid);
void mono_image_init (MonoImage *image);
void mono_image_close (MonoImage *image);
+void mono_image_addref (MonoImage *image);
const char *mono_image_strerror (MonoImageOpenStatus status);
int mono_image_ensure_section (MonoImage *image,
diff --git a/mono/metadata/loader.c b/mono/metadata/loader.c
index 6b9fa45ed49..fb380bc6c75 100644
--- a/mono/metadata/loader.c
+++ b/mono/metadata/loader.c
@@ -507,14 +507,14 @@ method_from_methodspec (MonoImage *image, guint32 idx)
ginst = g_new0 (MonoGenericInst, 1);
ginst->generic_method = method;
- ginst->type_argc = param_count;
- ginst->type_argv = g_new0 (MonoType *, param_count);
+ ginst->mtype_argc = param_count;
+ ginst->mtype_argv = g_new0 (MonoType *, param_count);
for (i = 0; i < param_count; i++) {
- ginst->type_argv [i] = mono_metadata_parse_type (image, MONO_PARSE_TYPE, 0, ptr, &ptr);
+ ginst->mtype_argv [i] = mono_metadata_parse_type (image, MONO_PARSE_TYPE, 0, ptr, &ptr);
if (!ginst->is_open)
- ginst->is_open = mono_class_is_open_constructed_type (ginst->type_argv [i]);
+ ginst->is_open = mono_class_is_open_constructed_type (ginst->mtype_argv [i]);
}
return mono_class_inflate_generic_method (method, ginst);
@@ -535,6 +535,8 @@ int
mono_dllmap_lookup (const char *dll, const char* func, const char **rdll, const char **rfunc) {
MonoDllMap *map, *tmp;
+ *rdll = dll;
+
if (!dll_map)
return 0;
@@ -593,7 +595,7 @@ mono_dllmap_insert (const char *dll, const char *func, const char *tdll, const c
}
gpointer
-mono_lookup_pinvoke_call (MonoMethod *method)
+mono_lookup_pinvoke_call (MonoMethod *method, const char **exc_class, const char **exc_arg)
{
MonoImage *image = method->klass->image;
MonoMethodPInvoke *piinfo = (MonoMethodPInvoke *)method;
@@ -603,12 +605,19 @@ mono_lookup_pinvoke_call (MonoMethod *method)
guint32 im_cols [MONO_IMPLMAP_SIZE];
guint32 scope_token;
const char *import = NULL;
- const char *scope = NULL;
+ char *scope = NULL;
+ const char *orig_scope;
+ const char *new_scope;
char *full_name;
GModule *gmodule;
g_assert (method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL);
+ if (exc_class) {
+ *exc_class = NULL;
+ *exc_arg = NULL;
+ }
+
if (method->addr)
return method->addr;
if (!piinfo->implmap_idx)
@@ -619,9 +628,16 @@ mono_lookup_pinvoke_call (MonoMethod *method)
piinfo->piflags = im_cols [MONO_IMPLMAP_FLAGS];
import = mono_metadata_string_heap (image, im_cols [MONO_IMPLMAP_NAME]);
scope_token = mono_metadata_decode_row_col (mr, im_cols [MONO_IMPLMAP_SCOPE] - 1, MONO_MODULEREF_NAME);
- scope = mono_metadata_string_heap (image, scope_token);
+ orig_scope = mono_metadata_string_heap (image, scope_token);
- mono_dllmap_lookup (scope, import, &scope, &import);
+ mono_dllmap_lookup (orig_scope, import, &new_scope, &import);
+
+ scope = g_strdup (new_scope);
+
+ if (strstr (scope, ".dll") == (scope + strlen (scope) - 4)) {
+ // FIXME: This won't work for libraries named lib<FOO>.dll.so
+ //scope [strlen (scope) - 4] = '\0';
+ }
full_name = g_module_build_path (NULL, scope);
gmodule = g_module_open (full_name, G_MODULE_BIND_LAZY);
@@ -635,14 +651,20 @@ mono_lookup_pinvoke_call (MonoMethod *method)
if (!gmodule) {
gchar *error = g_strdup (g_module_error ());
if (!(gmodule=g_module_open (scope, G_MODULE_BIND_LAZY))) {
- g_warning ("Failed to load library %s (%s): %s", full_name, scope, error);
+ if (exc_class) {
+ *exc_class = "DllNotFoundException";
+ *exc_arg = orig_scope;
+ }
g_free (error);
g_free (full_name);
+ g_free (scope);
return NULL;
}
g_free (error);
}
+
g_free (full_name);
+ g_free (scope);
if (piinfo->piflags & PINVOKE_ATTRIBUTE_NO_MANGLE) {
g_module_symbol (gmodule, import, &method->addr);
@@ -675,7 +697,10 @@ mono_lookup_pinvoke_call (MonoMethod *method)
}
if (!method->addr) {
- g_warning ("Failed to load function %s from %s", import, scope);
+ if (exc_class) {
+ *exc_class = "EntryPointNotFoundException";
+ *exc_arg = import;
+ }
return NULL;
}
return method->addr;
diff --git a/mono/metadata/loader.h b/mono/metadata/loader.h
index f3df2cf8641..42b4dc3b847 100644
--- a/mono/metadata/loader.h
+++ b/mono/metadata/loader.h
@@ -159,7 +159,7 @@ void
mono_dllmap_insert (const char *dll, const char *func, const char *tdll, const char *tfunc);
gpointer
-mono_lookup_pinvoke_call (MonoMethod *method);
+mono_lookup_pinvoke_call (MonoMethod *method, const char **exc_class, const char **exc_arg);
void
mono_method_get_param_names (MonoMethod *method, const char **names);
diff --git a/mono/metadata/marshal.c b/mono/metadata/marshal.c
index 38ee7a9a6c9..02a63653756 100644
--- a/mono/metadata/marshal.c
+++ b/mono/metadata/marshal.c
@@ -167,12 +167,12 @@ mono_string_utf8_to_builder (MonoStringBuilder *sb, char *text)
l = strlen (text);
ut = g_utf8_to_utf16 (text, l, NULL, &items_written, &error);
-
- if (items_written > sb->capacity)
- items_written = sb->capacity;
+
+ if (items_written > mono_stringbuilder_capacity (sb))
+ items_written = mono_stringbuilder_capacity (sb);
if (!error) {
- memcpy (sb->chars->vector, ut, items_written * 2);
+ memcpy (mono_string_chars (sb->str), ut, items_written * 2);
sb->length = items_written;
} else
g_error_free (error);
@@ -183,15 +183,19 @@ mono_string_utf8_to_builder (MonoStringBuilder *sb, char *text)
gpointer
mono_string_builder_to_utf8 (MonoStringBuilder *sb)
{
- char *res;
+ GError *error = NULL;
+ glong *res;
if (!sb)
return NULL;
- res = g_malloc (sb->capacity + 1);
+ res = g_malloc0 (mono_stringbuilder_capacity (sb) + 1);
- /* fixme: copy the content of the string builder? */
- res [0] = 0;
+ g_utf16_to_utf8 (mono_string_chars (sb->str), sb->length, NULL, res, &error);
+ if (error) {
+ g_error_free (error);
+ mono_raise_exception (mono_get_exception_execution_engine ("Failed to convert StringBuilder from utf16 to utf8"));
+ }
return res;
}
@@ -553,7 +557,7 @@ mono_mb_emit_native_call (MonoMethodBuilder *mb, MonoMethodSignature *sig, gpoin
}
void
-mono_mb_emit_exception (MonoMethodBuilder *mb, const char *exc_name)
+mono_mb_emit_exception (MonoMethodBuilder *mb, const char *exc_name, const char *msg)
{
/* fixme: we need a better way to throw exception,
* supporting several exception types and messages */
@@ -571,8 +575,13 @@ mono_mb_emit_exception (MonoMethodBuilder *mb, const char *exc_name)
g_assert (ctor);
mono_mb_emit_byte (mb, CEE_NEWOBJ);
mono_mb_emit_i4 (mb, mono_mb_add_data (mb, ctor));
+ if (msg != NULL) {
+ mono_mb_emit_byte (mb, CEE_DUP);
+ mono_mb_emit_ldflda (mb, G_STRUCT_OFFSET (MonoException, message));
+ mono_mb_emit_ldstr (mb, msg);
+ mono_mb_emit_byte (mb, CEE_STIND_I);
+ }
mono_mb_emit_byte (mb, CEE_THROW);
-
}
void
@@ -614,7 +623,7 @@ emit_ptr_to_str_conv (MonoMethodBuilder *mb, MonoType *type, MonoMarshalConv con
mono_mb_emit_byte (mb, CEE_STIND_I1);
break;
case MONO_MARSHAL_CONV_ARRAY_BYVALARRAY: {
- MonoClass *eclass;
+ MonoClass *eclass = NULL;
int esize;
if (type->type == MONO_TYPE_SZARRAY) {
@@ -792,7 +801,7 @@ emit_str_to_ptr_conv (MonoMethodBuilder *mb, MonoType *type, MonoMarshalConv con
break;
}
case MONO_MARSHAL_CONV_ARRAY_BYVALARRAY: {
- MonoClass *eclass;
+ MonoClass *eclass = NULL;
int esize;
if (type->type == MONO_TYPE_SZARRAY) {
@@ -866,9 +875,13 @@ emit_str_to_ptr_conv (MonoMethodBuilder *mb, MonoType *type, MonoMarshalConv con
mono_mb_patch_addr_s (mb, pos, mb->pos - pos - 1);
break;
}
- default:
- g_warning ("marshalling conversion %d not implemented", conv);
- g_assert_not_reached ();
+ default: {
+ char *msg = g_strdup_printf ("marshalling conversion %d not implemented", conv);
+ MonoException *exc = mono_get_exception_not_implemented (msg);
+ g_warning (msg);
+ g_free (msg);
+ mono_raise_exception (exc);
+ }
}
}
@@ -1041,7 +1054,8 @@ mono_delegate_begin_invoke (MonoDelegate *delegate, gpointer *params)
msg = mono_method_call_message_new (method, params, NULL, &async_callback, &state);
handle = CreateEvent (NULL, TRUE, FALSE, NULL);
ares = mono_async_result_new (mono_domain_get (), handle, state, handle);
- ares->async_delegate = (MonoObject *)async_callback;
+ ares->async_delegate = (MonoObject *)delegate;
+ ares->async_callback = (MonoObject *)async_callback;
msg->async_result = ares;
msg->call_type = CallType_BeginInvoke;
@@ -1181,7 +1195,7 @@ mono_marshal_method_from_wrapper (MonoMethod *wrapper)
res = mono_g_hash_table_lookup (wrapper_hash, wrapper);
LeaveCriticalSection (&marshal_mutex);
- if (wrapper->wrapper_type == MONO_WRAPPER_REMOTING_INVOKE_WITH_CHECK)
+ if (res && wrapper->wrapper_type == MONO_WRAPPER_REMOTING_INVOKE_WITH_CHECK)
/* See mono_marshal_get_remoting_invoke_with_check */
return (MonoMethod*)((char*)res - 1);
else
@@ -1975,10 +1989,10 @@ mono_marshal_get_managed_wrapper (MonoMethod *method, MonoObject *this, MonoMars
{
MonoMethodSignature *sig, *csig;
MonoMethodBuilder *mb;
- MonoClass *klass;
+ MonoClass *klass = NULL;
MonoMethod *res;
GHashTable *cache;
- int i, pos, sigsize, *tmp_locals;
+ int i, pos = 0, sigsize, *tmp_locals;
static MonoMethodSignature *alloc_sig = NULL;
int retobj_var = 0;
@@ -2064,6 +2078,8 @@ mono_marshal_get_managed_wrapper (MonoMethod *method, MonoObject *this, MonoMars
MonoMethod *marshal_native_to_managed;
MonoMethod *get_instance;
+ /* FIXME: Call CleanUpNativeData after the call */
+
mtype = mono_reflection_type_from_name (spec->data.custom_data.custom_name, method->klass->image);
g_assert (mtype != NULL);
mklass = mono_class_from_mono_type (mtype);
@@ -2130,7 +2146,7 @@ mono_marshal_get_managed_wrapper (MonoMethod *method, MonoObject *this, MonoMars
pos2 = mb->pos;
mono_mb_emit_i4 (mb, 0);
- mono_mb_emit_exception (mb, "ArgumentNullException");
+ mono_mb_emit_exception (mb, "ArgumentNullException", NULL);
mono_mb_patch_addr (mb, pos2, mb->pos - (pos2 + 4));
mono_mb_emit_ldarg (mb, i);
@@ -2333,6 +2349,7 @@ mono_marshal_get_managed_wrapper (MonoMethod *method, MonoObject *this, MonoMars
retobj_var = mono_mb_add_local (mb, &mono_defaults.int_class->byval_arg);
g_assert (retobj_var);
mono_mb_emit_icon (mb, mono_class_native_size (klass, NULL));
+ mono_mb_emit_byte (mb, CEE_CONV_I);
mono_mb_emit_native_call (mb, alloc_sig, mono_marshal_alloc);
mono_mb_emit_byte (mb, CEE_STLOC_1);
mono_mb_emit_byte (mb, CEE_LDLOC_1);
@@ -2367,6 +2384,7 @@ mono_marshal_get_managed_wrapper (MonoMethod *method, MonoObject *this, MonoMars
/* Allocate and set dest */
mono_mb_emit_icon (mb, mono_class_native_size (klass, NULL));
+ mono_mb_emit_byte (mb, CEE_CONV_I);
mono_mb_emit_native_call (mb, alloc_sig, mono_marshal_alloc);
mono_mb_emit_byte (mb, CEE_DUP);
mono_mb_emit_byte (mb, CEE_STLOC_1);
@@ -2416,6 +2434,7 @@ mono_marshal_get_managed_wrapper (MonoMethod *method, MonoObject *this, MonoMars
/* Allocate and set dest */
mono_mb_emit_icon (mb, mono_class_native_size (klass, NULL));
+ mono_mb_emit_byte (mb, CEE_CONV_I);
mono_mb_emit_native_call (mb, alloc_sig, mono_marshal_alloc);
mono_mb_emit_byte (mb, CEE_STLOC_1);
@@ -2474,7 +2493,7 @@ mono_marshal_get_ldfld_wrapper (MonoType *type)
MonoClass *klass;
static GHashTable *ldfld_hash = NULL;
char *name;
- int t, pos0, pos1;
+ int t, pos0, pos1 = 0;
t = type->type;
@@ -2806,7 +2825,10 @@ mono_marshal_get_icall_wrapper (MonoMethodSignature *sig, const char *name, gcon
return res;
}
-/*
+/**
+ * mono_marshal_get_native_wrapper:
+ * @method: The MonoMethod to wrap.
+ *
* generates IL code for the pinvoke wrapper (the generated method
* calls the unmanaged code in method->addr)
*/
@@ -2823,6 +2845,8 @@ mono_marshal_get_native_wrapper (MonoMethod *method)
gboolean pinvoke = FALSE;
int i, pos, argnum, *tmp_locals;
int type, sigsize;
+ const char *exc_class = "MissingMethodException";
+ const char *exc_arg = NULL;
g_assert (method != NULL);
g_assert (method->signature->pinvoke);
@@ -2840,7 +2864,7 @@ mono_marshal_get_native_wrapper (MonoMethod *method)
if (!method->addr) {
if (pinvoke)
- mono_lookup_pinvoke_call (method);
+ mono_lookup_pinvoke_call (method, &exc_class, &exc_arg);
else
method->addr = mono_lookup_internal_call (method);
}
@@ -2852,7 +2876,7 @@ mono_marshal_get_native_wrapper (MonoMethod *method)
piinfo = (MonoMethodPInvoke *)method;
if (!method->addr) {
- mono_mb_emit_exception (mb, "MissingMethodException");
+ mono_mb_emit_exception (mb, exc_class, exc_arg);
csig = g_memdup (sig, sigsize);
csig->pinvoke = 0;
res = mono_mb_create_and_cache (cache, method,
@@ -2934,6 +2958,8 @@ mono_marshal_get_native_wrapper (MonoMethod *method)
MonoMethod *marshal_managed_to_native;
MonoMethod *get_instance;
+ /* FIXME: Call CleanUpNativeData after the call */
+
mtype = mono_reflection_type_from_name (spec->data.custom_data.custom_name, method->klass->image);
g_assert (mtype != NULL);
mklass = mono_class_from_mono_type (mtype);
@@ -2950,6 +2976,7 @@ mono_marshal_get_native_wrapper (MonoMethod *method)
case MONO_TYPE_STRING:
case MONO_TYPE_ARRAY:
case MONO_TYPE_SZARRAY:
+ case MONO_TYPE_VALUETYPE:
if (t->byref)
break;
@@ -2961,12 +2988,18 @@ mono_marshal_get_native_wrapper (MonoMethod *method)
mono_mb_emit_i4 (mb, mono_mb_add_data (mb, get_instance));
mono_mb_emit_ldarg (mb, argnum);
-
+
+ if (t->type == MONO_TYPE_VALUETYPE) {
+ mono_mb_emit_byte (mb, CEE_BOX);
+ mono_mb_emit_i4 (mb, mono_mb_add_data (mb, mono_class_from_mono_type (t)));
+ }
+
mono_mb_emit_byte (mb, CEE_CALLVIRT);
mono_mb_emit_i4 (mb, mono_mb_add_data (mb, marshal_managed_to_native));
mono_mb_emit_stloc (mb, tmp_locals [i]);
break;
+
default:
g_warning ("custom marshalling of type %x is currently not supported", t->type);
g_assert_not_reached ();
@@ -3043,9 +3076,13 @@ mono_marshal_get_native_wrapper (MonoMethod *method)
case MONO_NATIVE_LPSTR:
mono_mb_emit_byte (mb, MONO_MARSHAL_CONV_STR_LPSTR);
break;
- default:
- g_warning ("marshalling conversion %d not implemented", spec->native);
- g_assert_not_reached ();
+ default: {
+ char *msg = g_strdup_printf ("string marshalling conversion %d not implemented", spec->native);
+ MonoException *exc = mono_get_exception_not_implemented (msg);
+ g_warning (msg);
+ g_free (msg);
+ mono_raise_exception (exc);
+ }
}
} else {
switch (piinfo->piflags & PINVOKE_ATTRIBUTE_CHAR_SET_MASK) {
@@ -3750,7 +3787,10 @@ mono_marshal_get_native_wrapper (MonoMethod *method)
return res;
}
-/*
+/**
+ * mono_marshal_get_struct_to_ptr:
+ * @klass:
+ *
* generates IL code for StructureToPtr (object structure, IntPtr ptr, bool fDeleteOld)
*/
MonoMethod *
@@ -3810,7 +3850,10 @@ mono_marshal_get_struct_to_ptr (MonoClass *klass)
return res;
}
-/*
+/**
+ * mono_marshal_get_ptr_to_struct:
+ * @klass:
+ *
* generates IL code for PtrToStructure (IntPtr src, object structure)
*/
MonoMethod *
@@ -4057,6 +4100,12 @@ mono_marshal_string_array (MonoArray *array)
return result;
}
+/**
+ * mono_marshal_set_last_error:
+ *
+ * This function is invoked to set the last error value from a P/Invoke call
+ * which has SetLastError set.
+ */
void
mono_marshal_set_last_error (void)
{
@@ -4484,6 +4533,24 @@ ves_icall_System_Runtime_InteropServices_Marshal_DestroyStructure (gpointer src,
mono_struct_delete_old (klass, (char *)src);
}
+void*
+ves_icall_System_Runtime_InteropServices_Marshal_AllocCoTaskMem (int size)
+{
+ /* FIXME: Call AllocCoTaskMem under windows */
+ MONO_ARCH_SAVE_REGS;
+
+ return g_try_malloc ((gulong)size);
+}
+
+void
+ves_icall_System_Runtime_InteropServices_Marshal_FreeCoTaskMem (void *ptr)
+{
+ /* FIXME: Call FreeCoTaskMem under windows */
+ MONO_ARCH_SAVE_REGS;
+
+ g_free (ptr);
+}
+
MonoMarshalType *
mono_marshal_load_type_info (MonoClass* klass)
{
diff --git a/mono/metadata/marshal.h b/mono/metadata/marshal.h
index 31f71bb2038..5b0067a78d9 100644
--- a/mono/metadata/marshal.h
+++ b/mono/metadata/marshal.h
@@ -115,7 +115,7 @@ void
mono_mb_emit_stloc (MonoMethodBuilder *mb, guint num);
void
-mono_mb_emit_exception (MonoMethodBuilder *mb, const char *exc_name);
+mono_mb_emit_exception (MonoMethodBuilder *mb, const char *exc_name, const char *msg);
void
mono_mb_emit_icon (MonoMethodBuilder *mb, gint32 value);
@@ -282,5 +282,12 @@ ves_icall_System_Runtime_InteropServices_Marshal_StringToHGlobalUni (MonoString
void
ves_icall_System_Runtime_InteropServices_Marshal_DestroyStructure (gpointer src, MonoReflectionType *type);
+void*
+ves_icall_System_Runtime_InteropServices_Marshal_AllocCoTaskMem (int size);
+
+void
+ves_icall_System_Runtime_InteropServices_Marshal_FreeCoTaskMem (void *ptr);
+
+
#endif /* __MONO_MARSHAL_H__ */
diff --git a/mono/metadata/metadata.c b/mono/metadata/metadata.c
index fea68072989..4e0b599cb7b 100644
--- a/mono/metadata/metadata.c
+++ b/mono/metadata/metadata.c
@@ -1890,8 +1890,6 @@ typedef struct {
guint32 result;
} locator_t;
-#define CSIZE(x) (sizeof (x) / 4)
-
/*
* How the row locator works.
*
diff --git a/mono/metadata/mono-debug-debugger.c b/mono/metadata/mono-debug-debugger.c
index 890d1bf4aa3..e402d264771 100644
--- a/mono/metadata/mono-debug-debugger.c
+++ b/mono/metadata/mono-debug-debugger.c
@@ -47,7 +47,8 @@ void (*mono_debugger_event_handler) (MonoDebuggerEvent event, gpointer data, gui
MonoDebuggerIOLayer mono_debugger_io_layer = {
InitializeCriticalSection, DeleteCriticalSection, TryEnterCriticalSection,
EnterCriticalSection, LeaveCriticalSection, WaitForSingleObject, SignalObjectAndWait,
- WaitForMultipleObjects, CreateSemaphore, ReleaseSemaphore, CreateThread
+ WaitForMultipleObjects, CreateSemaphore, ReleaseSemaphore, CreateThread,
+ GetCurrentThreadId
};
#endif
diff --git a/mono/metadata/mono-debug-debugger.h b/mono/metadata/mono-debug-debugger.h
index f6ab2eb8380..f52d7dbaa9b 100644
--- a/mono/metadata/mono-debug-debugger.h
+++ b/mono/metadata/mono-debug-debugger.h
@@ -197,6 +197,7 @@ struct _MonoDebuggerIOLayer
gpointer (*CreateThread) (WapiSecurityAttributes *security,
guint32 stacksize, WapiThreadStart start,
gpointer param, guint32 create, guint32 *tid);
+ guint32 (*GetCurrentThreadId) (void);
};
extern MonoDebuggerIOLayer mono_debugger_io_layer;
diff --git a/mono/metadata/object.c b/mono/metadata/object.c
index 32b928c8149..432c288c802 100644
--- a/mono/metadata/object.c
+++ b/mono/metadata/object.c
@@ -1005,6 +1005,29 @@ mono_runtime_get_main_args (void)
return main_args;
}
+static void
+fire_process_exit_event (void)
+{
+ MonoClassField *field;
+ MonoDomain *domain = mono_domain_get ();
+ gpointer pa [2];
+ MonoObject *delegate, *exc;
+
+ field = mono_class_get_field_from_name (mono_defaults.appdomain_class, "ProcessExit");
+ g_assert (field);
+
+ if (domain != mono_root_domain)
+ return;
+
+ delegate = *(MonoObject **)(((char *)domain->domain) + field->offset);
+ if (delegate == NULL)
+ return;
+
+ pa [0] = domain;
+ pa [1] = NULL;
+ mono_runtime_delegate_invoke (delegate, pa, &exc);
+}
+
/*
* Execute a standard Main() method (argc/argv contains the
* executable name). This method also sets the command line argument value
@@ -1018,6 +1041,7 @@ mono_runtime_run_main (MonoMethod *method, int argc, char* argv[],
MonoArray *args = NULL;
MonoDomain *domain = mono_domain_get ();
gchar *utf8_fullpath;
+ int result;
main_args = (MonoArray*)mono_array_new (domain, mono_defaults.string_class, argc);
@@ -1086,7 +1110,9 @@ mono_runtime_run_main (MonoMethod *method, int argc, char* argv[],
mono_assembly_set_main (method->klass->image->assembly);
- return mono_runtime_exec_main (method, args, exc);
+ result = mono_runtime_exec_main (method, args, exc);
+ fire_process_exit_event ();
+ return result;
}
/* Used in mono_unhandled_exception */
@@ -2781,8 +2807,10 @@ mono_store_remote_field (MonoObject *this, MonoClass *klass, MonoClassField *fie
field_class = mono_class_from_mono_type (field->type);
if (tp->klass->contextbound && tp->rp->context == (MonoObject *) mono_context_get ()) {
- if (field_class->valuetype) mono_field_set_value (tp->rp->unwrapped_server, field, val);
- else mono_field_set_value (tp->rp->unwrapped_server, field, *((MonoObject **)val));
+ if (field_class->valuetype)
+ mono_field_set_value (tp->rp->unwrapped_server, field, val);
+ else
+ mono_field_set_value (tp->rp->unwrapped_server, field, *((MonoObject **)val));
return;
}
@@ -2834,8 +2862,10 @@ mono_store_remote_field_new (MonoObject *this, MonoClass *klass, MonoClassField
field_class = mono_class_from_mono_type (field->type);
if (tp->klass->contextbound && tp->rp->context == (MonoObject *) mono_context_get ()) {
- if (field_class->valuetype) mono_field_set_value (tp->rp->unwrapped_server, field, ((gchar *) arg) + sizeof (MonoObject));
- else mono_field_set_value (tp->rp->unwrapped_server, field, arg);
+ if (field_class->valuetype)
+ mono_field_set_value (tp->rp->unwrapped_server, field, ((gchar *) arg) + sizeof (MonoObject));
+ else
+ mono_field_set_value (tp->rp->unwrapped_server, field, arg);
return;
}
diff --git a/mono/metadata/object.h b/mono/metadata/object.h
index 0250b6d4e4d..e240734d7c2 100644
--- a/mono/metadata/object.h
+++ b/mono/metadata/object.h
@@ -112,9 +112,8 @@ typedef struct {
typedef struct {
MonoObject object;
- gint32 capacity;
gint32 length;
- MonoArray *chars;
+ MonoString *str;
} MonoStringBuilder;
typedef struct {
@@ -177,6 +176,7 @@ typedef struct {
MonoBoolean sync_completed;
MonoBoolean completed;
MonoBoolean endinvoke_called;
+ MonoObject *async_callback;
} MonoAsyncResult;
typedef struct {
@@ -373,6 +373,7 @@ typedef void (*MonoMainThreadFunc) (gpointer user_data);
#define mono_string_chars(s) ((gunichar2*)(s)->chars)
#define mono_string_length(s) ((s)->length)
+#define mono_stringbuilder_capacity(sb) ((sb)->str->length)
MonoObject *
mono_object_new (MonoDomain *domain, MonoClass *klass);
diff --git a/mono/metadata/process.c b/mono/metadata/process.c
index 3832f82de66..ebd6cf7d44a 100644
--- a/mono/metadata/process.c
+++ b/mono/metadata/process.c
@@ -323,10 +323,11 @@ static gpointer process_read_string_block (MonoObject *filever,
value=(gunichar2 *)data_ptr;
/* Skip over the value */
data_ptr=((gunichar2 *)data_ptr)+block.value_len;
-
+
if(store==TRUE) {
if(!memcmp (block.key, &comments_key,
unicode_bytes (block.key))) {
+
process_set_field_string (filever, "comments", value, unicode_chars (value));
} else if (!memcmp (block.key, &compname_key,
unicode_bytes (block.key))) {
@@ -382,18 +383,9 @@ static gpointer process_read_stringtable_block (MonoObject *filever,
guint16 data_len)
{
version_data block;
+ const char *language;
guint16 string_len=36; /* length of the StringFileInfo block */
- /* Specifies language-neutral unicode string block */
- guchar uni_key[]= {'0', '\0', '0', '\0', '0', '\0', '0', '\0',
- '0', '\0', '4', '\0', 'b', '\0', '0', '\0',
- '\0', '\0'
- };
- guchar uni_key_uc[]= {'0', '\0', '0', '\0', '0', '\0', '0', '\0',
- '0', '\0', '4', '\0', 'B', '\0', '0', '\0',
- '\0', '\0'
- };
-
/* data_ptr is pointing at an array of StringTable blocks,
* with total length (not including alignment padding) of
* data_len.
@@ -415,9 +407,10 @@ static gpointer process_read_stringtable_block (MonoObject *filever,
return(NULL);
}
string_len=string_len+block.data_len;
-
- if(!memcmp (block.key, &uni_key, unicode_bytes (block.key)) ||
- !memcmp (block.key, &uni_key_uc, unicode_bytes (block.key))) {
+
+ language = g_utf16_to_utf8 (block.key, unicode_bytes (block.key), NULL, NULL, NULL);
+ g_strdown (language);
+ if (!strcmp (language, "007f04b0") || !strcmp (language, "000004b0")) {
/* Got the one we're interested in */
process_set_field_string_utf8 (filever, "language",
"Language Neutral");
@@ -433,6 +426,7 @@ static gpointer process_read_stringtable_block (MonoObject *filever,
block.data_len,
FALSE);
}
+ g_free (language);
if(data_ptr==NULL) {
/* Child block hit padding */
diff --git a/mono/metadata/profiler.c b/mono/metadata/profiler.c
index 5ab26dd6c6c..7bbdee0ef9e 100644
--- a/mono/metadata/profiler.c
+++ b/mono/metadata/profiler.c
@@ -806,7 +806,7 @@ merge_methods (MonoMethod *method, MethodProfile *profile, MonoProfiler *prof)
MethodProfile *mprof;
AllocInfo *talloc_info, *alloc_info;
CallerInfo *tcaller_info, *caller_info;
-
+
mprof = g_hash_table_lookup (prof->methods, method);
if (!mprof) {
/* the master thread didn't see this method, just transfer the info as is */
@@ -848,7 +848,7 @@ merge_methods (MonoMethod *method, MethodProfile *profile, MonoProfiler *prof)
caller_info = mono_mempool_alloc0 (prof->mempool, sizeof (CallerInfo));
*caller_info = *tcaller_info;
caller_info->next = mprof->caller_info;
- mprof->caller_info = caller_info->next;
+ mprof->caller_info = caller_info;
}
}
}
diff --git a/mono/metadata/rand.c b/mono/metadata/rand.c
index 720c71b4cb7..604c1137e24 100644
--- a/mono/metadata/rand.c
+++ b/mono/metadata/rand.c
@@ -107,7 +107,7 @@ ves_icall_System_Security_Cryptography_RNGCryptoServiceProvider_InternalGetBytes
void ves_icall_System_Security_Cryptography_RNGCryptoServiceProvider_InternalGetBytes(MonoObject *self, MonoArray *arry)
{
- mono_raise_exception(mono_get_exception_not_implemented());
+ mono_raise_exception(mono_get_exception_not_implemented(NULL));
}
#endif /* OS definition */
diff --git a/mono/metadata/reflection.c b/mono/metadata/reflection.c
index 5b9fce9087b..ad4de0cafdd 100644
--- a/mono/metadata/reflection.c
+++ b/mono/metadata/reflection.c
@@ -1259,6 +1259,38 @@ mono_image_get_ctor_info (MonoDomain *domain, MonoReflectionCtorBuilder *mb, Mon
mono_image_basic_method (&rmb, assembly);
}
+static char*
+type_get_fully_qualified_name (MonoType *type) {
+ char *name, *result;
+ MonoClass *klass;
+ MonoAssembly *ta;
+
+ name = mono_type_get_name (type);
+ klass = my_mono_class_from_mono_type (type);
+ ta = klass->image->assembly;
+
+ /* missing public key */
+ result = g_strdup_printf ("%s, %s, Version=%d.%d.%d.%d, Culture=%s",
+ name, ta->aname.name,
+ ta->aname.major, ta->aname.minor, ta->aname.build, ta->aname.revision,
+ ta->aname.culture && *ta->aname.culture? ta->aname.culture: "neutral");
+ g_free (name);
+ return result;
+}
+
+static char*
+type_get_qualified_name (MonoType *type, MonoAssembly *ass) {
+ MonoClass *klass;
+ MonoAssembly *ta;
+
+ klass = my_mono_class_from_mono_type (type);
+ ta = klass->image->assembly;
+ if (ta == ass || klass->image == mono_defaults.corlib)
+ return mono_type_get_name (type);
+
+ return type_get_fully_qualified_name (type);
+}
+
static guint32
fieldref_encode_signature (MonoDynamicImage *assembly, MonoType *type)
{
@@ -1436,7 +1468,7 @@ encode_marshal_blob (MonoDynamicImage *assembly, MonoReflectionMarshal *minfo) {
mono_metadata_encode_value (0, p, &p);
}
if (minfo->marshaltyperef) {
- str = type_get_qualified_name (minfo->marshaltyperef->type, assembly->image.assembly);
+ str = type_get_fully_qualified_name (minfo->marshaltyperef->type);
len = strlen (str);
mono_metadata_encode_value (len, p, &p);
if (p + len >= buf + bufsize) {
@@ -2108,7 +2140,7 @@ encode_generic_method_sig (MonoDynamicImage *assembly, MonoGenericInst *ginst)
char *buf;
char *p;
int i;
- guint32 nparams = ginst->type_argc;
+ guint32 nparams = ginst->mtype_argc;
guint32 size = 10 + nparams * 10;
guint32 idx;
char blob_size [6];
@@ -2125,7 +2157,7 @@ encode_generic_method_sig (MonoDynamicImage *assembly, MonoGenericInst *ginst)
mono_metadata_encode_value (nparams, p, &p);
for (i = 0; i < nparams; i++)
- encode_type (assembly, ginst->type_argv [i], p, &p);
+ encode_type (assembly, ginst->mtype_argv [i], p, &p);
/* store length */
g_assert (p - buf < size);
@@ -2136,27 +2168,23 @@ encode_generic_method_sig (MonoDynamicImage *assembly, MonoGenericInst *ginst)
}
static guint32
-method_encode_methodspec (MonoDynamicImage *assembly, MonoGenericInst *ginst)
+method_encode_methodspec (MonoDynamicImage *assembly, MonoMethod *method, MonoGenericInst *ginst)
{
MonoDynamicTable *table;
guint32 *values;
guint32 token, mtoken = 0, sig;
+ MonoClass *k;
table = &assembly->tables [MONO_TABLE_METHODSPEC];
g_assert (ginst);
- if (ginst->generic_method) {
- MonoMethod *gm = ginst->generic_method;
- MonoClass *k = ginst->klass ? ginst->klass : gm->klass;
+ k = ginst->klass ? ginst->klass : method->klass;
- sig = method_encode_signature (assembly, gm->signature);
- mtoken = mono_image_get_memberref_token (assembly, &k->byval_arg, gm->name, sig);
+ sig = method_encode_signature (assembly, method->signature);
+ mtoken = mono_image_get_memberref_token (assembly, &k->byval_arg, method->name, sig);
- if (!ginst->generic_method->signature->generic_param_count)
- return mtoken;
- }
- else
- g_assert_not_reached ();
+ if (!method->signature->generic_param_count)
+ return mtoken;
switch (mono_metadata_token_table (mtoken)) {
case MONO_TABLE_MEMBERREF:
@@ -2185,15 +2213,28 @@ method_encode_methodspec (MonoDynamicImage *assembly, MonoGenericInst *ginst)
}
static guint32
-mono_image_get_methodspec_token (MonoDynamicImage *assembly, MonoMethod *method, MonoGenericInst *ginst)
+mono_image_get_methodspec_token (MonoDynamicImage *assembly, MonoReflectionInflatedMethod *m)
{
guint32 token;
- token = GPOINTER_TO_UINT (g_hash_table_lookup (assembly->handleref, method));
+ token = GPOINTER_TO_UINT (g_hash_table_lookup (assembly->handleref, m->rmethod.method));
if (token)
return token;
- token = method_encode_methodspec (assembly, ginst);
- g_hash_table_insert (assembly->handleref, method, GUINT_TO_POINTER(token));
+ if (m->declaring->method->signature->generic_param_count)
+ token = method_encode_methodspec (assembly, m->declaring->method, m->ginst);
+ else {
+ MonoClass *k;
+ guint32 sig;
+
+ g_assert (m->ginst);
+ k = m->ginst->klass ? m->ginst->klass : m->ginst->generic_method->klass;
+
+ sig = method_encode_signature (assembly, m->ginst->generic_method->signature);
+ token = mono_image_get_memberref_token (
+ assembly, &k->byval_arg, m->ginst->generic_method->name, sig);
+ }
+
+ g_hash_table_insert (assembly->handleref, m->rmethod.method, GUINT_TO_POINTER(token));
return token;
}
@@ -3165,6 +3206,41 @@ fixup_method (MonoReflectionILGen *ilgen, gpointer value, MonoDynamicImage *asse
}
}
+/*
+ * fixup_cattrs:
+ *
+ * The CUSTOM_ATTRIBUTE table might contain METHODDEF tokens whose final
+ * value is not known when the table is emitted.
+ */
+static void
+fixup_cattrs (MonoDynamicImage *assembly)
+{
+ MonoDynamicTable *table;
+ guint32 *values;
+ guint32 type, i, idx, token;
+ MonoObject *ctor;
+
+ table = &assembly->tables [MONO_TABLE_CUSTOMATTRIBUTE];
+
+ for (i = 0; i < table->rows; ++i) {
+ values = table->values + ((i + 1) * MONO_CUSTOM_ATTR_SIZE);
+
+ type = values [MONO_CUSTOM_ATTR_TYPE];
+ if ((type & CUSTOM_ATTR_TYPE_MASK) == CUSTOM_ATTR_TYPE_METHODDEF) {
+ idx = type >> CUSTOM_ATTR_TYPE_BITS;
+ token = mono_metadata_make_token (MONO_TABLE_METHOD, idx);
+ ctor = mono_g_hash_table_lookup (assembly->tokens, GUINT_TO_POINTER (token));
+ g_assert (ctor);
+
+ if (!strcmp (ctor->vtable->klass->name, "MonoCMethod")) {
+ MonoMethod *m = ((MonoReflectionMethod*)ctor)->method;
+ idx = GPOINTER_TO_UINT (mono_g_hash_table_lookup (assembly->method_to_table_idx, m));
+ values [MONO_CUSTOM_ATTR_TYPE] = (idx << CUSTOM_ATTR_TYPE_BITS) | CUSTOM_ATTR_TYPE_METHODDEF;
+ }
+ }
+ }
+}
+
static void
assembly_add_resource_manifest (MonoReflectionModuleBuilder *mb, MonoDynamicImage *assembly, MonoReflectionResource *rsrc, guint32 implementation)
{
@@ -3474,6 +3550,7 @@ mono_image_build_metadata (MonoReflectionModuleBuilder *moduleb)
/* fixup tokens */
mono_g_hash_table_foreach (assembly->token_fixups, (GHFunc)fixup_method, assembly);
+ fixup_cattrs (assembly);
}
/*
@@ -3589,7 +3666,6 @@ mono_image_create_token (MonoDynamicImage *assembly, MonoObject *obj)
MonoReflectionMethod *m = (MonoReflectionMethod *)obj;
if (m->method->signature->generic_param_count) {
g_assert_not_reached ();
- token = mono_image_get_methodspec_token (assembly, m->method, NULL);
} else if ((m->method->klass->image == &assembly->image) &&
!m->method->klass->generic_inst) {
static guint32 method_table_idx = 0xffffff;
@@ -3607,7 +3683,7 @@ mono_image_create_token (MonoDynamicImage *assembly, MonoObject *obj)
else if (strcmp (klass->name, "MonoInflatedMethod") == 0 ||
strcmp (klass->name, "MonoInflatedCtor") == 0) {
MonoReflectionInflatedMethod *m = (MonoReflectionInflatedMethod *)obj;
- token = mono_image_get_methodspec_token (assembly, m->rmethod.method, m->ginst);
+ token = mono_image_get_methodspec_token (assembly, m);
}
else if (strcmp (klass->name, "MonoInflatedField") == 0) {
MonoReflectionInflatedField *f = (MonoReflectionInflatedField *)obj;
@@ -3784,6 +3860,14 @@ calc_section_size (MonoDynamicImage *assembly)
assembly->sections [MONO_SECTION_TEXT].attrs = SECT_FLAGS_HAS_CODE | SECT_FLAGS_MEM_EXECUTE | SECT_FLAGS_MEM_READ;
nsections++;
+ if (assembly->win32_res) {
+ guint32 res_size = (assembly->win32_res_size + 3) & ~3;
+
+ assembly->sections [MONO_SECTION_RSRC].size = res_size;
+ assembly->sections [MONO_SECTION_RSRC].attrs = SECT_FLAGS_HAS_INITIALIZED_DATA | SECT_FLAGS_MEM_READ;
+ nsections++;
+ }
+
assembly->sections [MONO_SECTION_RELOC].size = 12;
assembly->sections [MONO_SECTION_RELOC].attrs = SECT_FLAGS_MEM_READ | SECT_FLAGS_MEM_DISCARDABLE | SECT_FLAGS_HAS_INITIALIZED_DATA;
nsections++;
@@ -3791,6 +3875,227 @@ calc_section_size (MonoDynamicImage *assembly)
return nsections;
}
+typedef struct {
+ guint32 id;
+ guint32 offset;
+ GSList *children;
+ MonoReflectionWin32Resource *win32_res; /* Only for leaf nodes */
+} ResTreeNode;
+
+static int
+resource_tree_compare_by_id (gconstpointer a, gconstpointer b)
+{
+ ResTreeNode *t1 = (ResTreeNode*)a;
+ ResTreeNode *t2 = (ResTreeNode*)b;
+
+ return t1->id - t2->id;
+}
+
+/*
+ * resource_tree_create:
+ *
+ * Organize the resources into a resource tree.
+ */
+static ResTreeNode *
+resource_tree_create (MonoArray *win32_resources)
+{
+ ResTreeNode *tree, *res_node, *type_node, *lang_node;
+ GSList *l;
+ int i;
+
+ tree = g_new0 (ResTreeNode, 1);
+
+ for (i = 0; i < mono_array_length (win32_resources); ++i) {
+ MonoReflectionWin32Resource *win32_res =
+ (MonoReflectionWin32Resource*)mono_array_addr (win32_resources, MonoReflectionWin32Resource, i);
+
+ /* Create node */
+
+ lang_node = g_new0 (ResTreeNode, 1);
+ lang_node->id = win32_res->lang_id;
+ lang_node->win32_res = win32_res;
+
+ /* Create type node if neccesary */
+ type_node = NULL;
+ for (l = tree->children; l; l = l->next)
+ if (((ResTreeNode*)(l->data))->id == win32_res->res_type) {
+ type_node = (ResTreeNode*)l->data;
+ break;
+ }
+
+ if (!type_node) {
+ type_node = g_new0 (ResTreeNode, 1);
+ type_node->id = win32_res->res_type;
+
+ /*
+ * The resource types have to be sorted otherwise
+ * Windows Explorer can't display the version information.
+ */
+ tree->children = g_slist_insert_sorted (tree->children, type_node,
+ resource_tree_compare_by_id);
+ }
+
+ /* Create res node if neccesary */
+ res_node = NULL;
+ for (l = type_node->children; l; l = l->next)
+ if (((ResTreeNode*)(l->data))->id == win32_res->res_id) {
+ res_node = (ResTreeNode*)l->data;
+ break;
+ }
+
+ if (!res_node) {
+ res_node = g_new0 (ResTreeNode, 1);
+ res_node->id = win32_res->res_id;
+ type_node->children = g_slist_append (type_node->children, res_node);
+ }
+
+ res_node->children = g_slist_append (res_node->children, lang_node);
+ }
+
+ return tree;
+}
+
+/*
+ * resource_tree_encode:
+ *
+ * Encode the resource tree into the format used in the PE file.
+ */
+static void
+resource_tree_encode (ResTreeNode *node, char *begin, char *p, char **endbuf)
+{
+ char *entries;
+ MonoPEResourceDir dir;
+ MonoPEResourceDirEntry dir_entry;
+ MonoPEResourceDataEntry data_entry;
+ GSList *l;
+
+ /*
+ * For the format of the resource directory, see the article
+ * "An In-Depth Look into the Win32 Portable Executable File Format" by
+ * Matt Pietrek
+ */
+
+ memset (&dir, 0, sizeof (dir));
+ memset (&dir_entry, 0, sizeof (dir_entry));
+ memset (&data_entry, 0, sizeof (data_entry));
+
+ g_assert (sizeof (dir) == 16);
+ g_assert (sizeof (dir_entry) == 8);
+ g_assert (sizeof (data_entry) == 16);
+
+ node->offset = p - begin;
+
+ /* IMAGE_RESOURCE_DIRECTORY */
+ dir.res_id_entries = GUINT32_TO_LE (g_slist_length (node->children));
+
+ memcpy (p, &dir, sizeof (dir));
+ p += sizeof (dir);
+
+ /* Reserve space for entries */
+ entries = p;
+ p += sizeof (dir_entry) * dir.res_id_entries;
+
+ /* Write children */
+ for (l = node->children; l; l = l->next) {
+ ResTreeNode *child = (ResTreeNode*)l->data;
+
+ if (child->win32_res) {
+
+ child->offset = p - begin;
+
+ /* IMAGE_RESOURCE_DATA_ENTRY */
+ data_entry.rde_data_offset = GUINT32_TO_LE (p - begin + sizeof (data_entry));
+ data_entry.rde_size = mono_array_length (child->win32_res->res_data);
+
+ memcpy (p, &data_entry, sizeof (data_entry));
+ p += sizeof (data_entry);
+
+ memcpy (p, mono_array_addr (child->win32_res->res_data, char, 0), data_entry.rde_size);
+ p += data_entry.rde_size;
+ }
+ else
+ resource_tree_encode (child, begin, p, &p);
+ }
+
+ /* IMAGE_RESOURCE_ENTRY */
+ for (l = node->children; l; l = l->next) {
+ ResTreeNode *child = (ResTreeNode*)l->data;
+ dir_entry.name_offset = GUINT32_TO_LE (child->id);
+
+ dir_entry.is_dir = child->win32_res ? 0 : 1;
+ dir_entry.dir_offset = GUINT32_TO_LE (child->offset);
+
+ memcpy (entries, &dir_entry, sizeof (dir_entry));
+ entries += sizeof (dir_entry);
+ }
+
+ *endbuf = p;
+}
+
+static void
+assembly_add_win32_resources (MonoDynamicImage *assembly, MonoReflectionAssemblyBuilder *assemblyb)
+{
+ char *buf;
+ char *p;
+ guint32 size, i;
+ MonoReflectionWin32Resource *win32_res;
+ ResTreeNode *tree;
+
+ if (!assemblyb->win32_resources)
+ return;
+
+ /*
+ * Resources are stored in a three level tree inside the PE file.
+ * - level one contains a node for each type of resource
+ * - level two contains a node for each resource
+ * - level three contains a node for each instance of a resource for a
+ * specific language.
+ */
+
+ tree = resource_tree_create (assemblyb->win32_resources);
+
+ /* Estimate the size of the encoded tree */
+ size = 0;
+ for (i = 0; i < mono_array_length (assemblyb->win32_resources); ++i) {
+ win32_res = (MonoReflectionWin32Resource*)mono_array_addr (assemblyb->win32_resources, MonoReflectionWin32Resource, i);
+ size += mono_array_length (win32_res->res_data);
+ }
+ /* Directory structure */
+ size += mono_array_length (assemblyb->win32_resources) * 256;
+ p = buf = g_malloc (size);
+
+ resource_tree_encode (tree, p, p, &p);
+
+ g_assert (p - buf < size);
+
+ assembly->win32_res = g_malloc (p - buf);
+ assembly->win32_res_size = p - buf;
+ memcpy (assembly->win32_res, buf, p - buf);
+
+ g_free (buf);
+}
+
+static void
+fixup_resource_directory (char *res_section, char *p, guint32 rva)
+{
+ MonoPEResourceDir *dir = (MonoPEResourceDir*)p;
+ int i;
+
+ p += sizeof (MonoPEResourceDir);
+ for (i = 0; i < dir->res_named_entries + dir->res_id_entries; ++i) {
+ MonoPEResourceDirEntry *dir_entry = (MonoPEResourceDirEntry*)p;
+ char *child = res_section + (GUINT32_FROM_LE (dir_entry->dir_offset));
+ if (dir_entry->is_dir)
+ fixup_resource_directory (res_section, child, rva);
+ else {
+ MonoPEResourceDataEntry *data_entry = (MonoPEResourceDataEntry*)child;
+ data_entry->rde_data_offset = GUINT32_TO_LE (GUINT32_FROM_LE (data_entry->rde_data_offset) + rva);
+ }
+
+ p += sizeof (MonoPEResourceDirEntry);
+ }
+}
+
/*
* mono_image_create_pefile:
* @mb: a module builder object
@@ -3849,6 +4154,9 @@ mono_image_create_pefile (MonoReflectionModuleBuilder *mb) {
build_compressed_metadata (assembly);
+ if (mb->is_main)
+ assembly_add_win32_resources (assembly, assemblyb);
+
nsections = calc_section_size (assembly);
pefile = &assembly->pefile;
@@ -4012,8 +4320,16 @@ mono_image_create_pefile (MonoReflectionModuleBuilder *mb) {
cli_header->ch_size = GUINT32_FROM_LE (72);
cli_header->ch_runtime_major = GUINT16_FROM_LE (2);
cli_header->ch_flags = GUINT32_FROM_LE (CLI_FLAGS_ILONLY);
- if (assemblyb->entry_point)
- cli_header->ch_entry_point = GUINT32_FROM_LE (assemblyb->entry_point->table_idx | MONO_TOKEN_METHOD_DEF);
+ if (assemblyb->entry_point) {
+ guint32 table_idx = 0;
+ if (!strcmp (assemblyb->entry_point->object.vtable->klass->name, "MethodBuilder")) {
+ MonoReflectionMethodBuilder *methodb = (MonoReflectionMethodBuilder*)assemblyb->entry_point;
+ table_idx = methodb->table_idx;
+ }
+ else
+ table_idx = GPOINTER_TO_UINT (mono_g_hash_table_lookup (assembly->method_to_table_idx, assemblyb->entry_point->method));
+ cli_header->ch_entry_point = GUINT32_FROM_LE (table_idx | MONO_TOKEN_METHOD_DEF);
+ }
else
cli_header->ch_entry_point = GUINT32_FROM_LE (0);
/* The embedded managed resources */
@@ -4084,6 +4400,15 @@ mono_image_create_pefile (MonoReflectionModuleBuilder *mb) {
*data16 = 0; /* terminate */
break;
case MONO_SECTION_RSRC:
+ if (assembly->win32_res) {
+ text_offset = assembly->sections [i].offset;
+
+ /* Fixup the offsets in the IMAGE_RESOURCE_DATA_ENTRY structures */
+ fixup_resource_directory (assembly->win32_res, assembly->win32_res, assembly->sections [i].rva);
+
+ memcpy (pefile->data + text_offset, assembly->win32_res, assembly->win32_res_size);
+ }
+ break;
default:
g_assert_not_reached ();
}
@@ -4270,6 +4595,8 @@ mono_module_get_object (MonoDomain *domain, MonoImage *image)
res->name = mono_string_new (domain, g_path_get_basename (image->name));
res->scopename = mono_string_new (domain, image->module_name);
+ mono_image_addref (image);
+
CACHE_OBJECT (image, res, NULL);
return res;
}
@@ -5291,6 +5618,10 @@ create_custom_attr (MonoImage *image, MonoMethod *method,
named += type_len;
/* FIXME: lookup the type and check type consistency */
}
+ else
+ if (data_type == MONO_TYPE_SZARRAY)
+ /* The spec does not mention this */
+ named ++;
name_len = mono_metadata_decode_blob_size (named, &named);
name = g_malloc (name_len + 1);
memcpy (name, named, name_len);
@@ -5434,6 +5765,20 @@ mono_custom_attrs_from_assembly (MonoAssembly *assembly)
return mono_custom_attrs_from_index (assembly->image, idx);
}
+static MonoCustomAttrInfo*
+mono_custom_attrs_from_module (MonoImage *image)
+{
+ MonoCustomAttrInfo *cinfo;
+ guint32 idx;
+
+ if (dynamic_custom_attrs && (cinfo = g_hash_table_lookup (dynamic_custom_attrs, image)))
+ return cinfo;
+ idx = 1; /* there is only one module */
+ idx <<= CUSTOM_ATTR_BITS;
+ idx |= CUSTOM_ATTR_MODULE;
+ return mono_custom_attrs_from_index (image, idx);
+}
+
MonoCustomAttrInfo*
mono_custom_attrs_from_property (MonoClass *klass, MonoProperty *property)
{
@@ -5546,6 +5891,9 @@ mono_reflection_get_custom_attrs (MonoObject *obj)
} else if (strcmp ("Assembly", klass->name) == 0) {
MonoReflectionAssembly *rassembly = (MonoReflectionAssembly*)obj;
cinfo = mono_custom_attrs_from_assembly (rassembly->assembly);
+ } else if (strcmp ("Module", klass->name) == 0) {
+ MonoReflectionModule *module = (MonoReflectionModule*)obj;
+ cinfo = mono_custom_attrs_from_module (module->image);
} else if (strcmp ("MonoProperty", klass->name) == 0) {
MonoReflectionProperty *rprop = (MonoReflectionProperty*)obj;
cinfo = mono_custom_attrs_from_property (rprop->klass, rprop->property);
@@ -5565,6 +5913,9 @@ mono_reflection_get_custom_attrs (MonoObject *obj)
} else if (strcmp ("AssemblyBuilder", klass->name) == 0) {
MonoReflectionAssemblyBuilder *assemblyb = (MonoReflectionAssemblyBuilder*)obj;
cinfo = mono_custom_attrs_from_builders (assemblyb->assembly.assembly->image, assemblyb->cattrs);
+ } else if (strcmp ("TypeBuilder", klass->name) == 0) {
+ MonoReflectionTypeBuilder *tb = (MonoReflectionTypeBuilder*)obj;
+ cinfo = mono_custom_attrs_from_builders (&tb->module->dynamic_image->image, tb->cattrs);
} else { /* handle other types here... */
g_error ("get custom attrs not yet supported for %s", klass->name);
}
@@ -5661,27 +6012,6 @@ get_field_name_and_type (MonoObject *field, char **name, MonoType **type)
}
}
-static char*
-type_get_qualified_name (MonoType *type, MonoAssembly *ass) {
- char *name, *result;
- MonoClass *klass;
- MonoAssembly *ta;
-
- name = mono_type_get_name (type);
- klass = my_mono_class_from_mono_type (type);
- ta = klass->image->assembly;
- if (ta == ass || klass->image == mono_defaults.corlib)
- return name;
-
- /* missing public key */
- result = g_strdup_printf ("%s, %s, Version=%d.%d.%d.%d, Culture=%s",
- name, ta->aname.name,
- ta->aname.major, ta->aname.minor, ta->aname.build, ta->aname.revision,
- ta->aname.culture && *ta->aname.culture? ta->aname.culture: "neutral");
- g_free (name);
- return result;
-}
-
static void
encode_cattr_value (char *buffer, char *p, char **retbuffer, char **retp, guint32 *buflen, MonoType *type, MonoObject *arg)
{
@@ -5939,6 +6269,8 @@ mono_reflection_get_custom_attrs_blob (MonoObject *ctor, MonoArray *ctorArgs, Mo
g_free (str);
} else {
mono_metadata_encode_value (ptype->type, p, &p);
+ if (ptype->type == MONO_TYPE_SZARRAY)
+ mono_metadata_encode_value (ptype->data.klass->this_arg.type, p, &p);
}
len = strlen (pname);
mono_metadata_encode_value (len, p, &p);
@@ -6169,8 +6501,7 @@ mono_marshal_spec_from_builder (MonoAssembly *assembly,
case MONO_NATIVE_CUSTOM:
if (minfo->marshaltyperef)
res->data.custom_data.custom_name =
- type_get_qualified_name (minfo->marshaltyperef->type,
- assembly);
+ type_get_fully_qualified_name (minfo->marshaltyperef->type);
if (minfo->mcookie)
res->data.custom_data.cookie = mono_string_to_utf8 (minfo->mcookie);
break;
@@ -6184,8 +6515,8 @@ mono_marshal_spec_from_builder (MonoAssembly *assembly,
static MonoMethod*
reflection_methodbuilder_to_mono_method (MonoClass *klass,
- ReflectionMethodBuilder *rmb,
- MonoMethodSignature *sig)
+ ReflectionMethodBuilder *rmb,
+ MonoMethodSignature *sig)
{
MonoMethod *m;
MonoMethodNormal *pm;
@@ -6274,8 +6605,20 @@ reflection_methodbuilder_to_mono_method (MonoClass *klass,
header->num_clauses = num_clauses;
if (num_clauses) {
header->clauses = method_encode_clauses ((MonoDynamicImage*)klass->image,
- rmb->ilgen,
- num_clauses);
+ rmb->ilgen,
+ num_clauses);
+ }
+
+ if (rmb->generic_params) {
+ int count = mono_array_length (rmb->generic_params);
+ header->gen_params = g_new0 (MonoGenericParam, count);
+ for (i = 0; i < count; i++) {
+ MonoReflectionGenericParam *gp =
+ mono_array_get (rmb->generic_params,
+ MonoReflectionGenericParam*, i);
+
+ header->gen_params [i] = *gp->type.type->data.generic_param;
+ }
}
pm->header = header;
@@ -6572,6 +6915,7 @@ mono_reflection_bind_generic_method_parameters (MonoReflectionMethod *rmethod, M
{
MonoMethod *method, *inflated;
MonoReflectionMethodBuilder *mb = NULL;
+ MonoReflectionMethod *declaring;
MonoGenericInst *ginst;
int count, i;
@@ -6585,8 +6929,15 @@ mono_reflection_bind_generic_method_parameters (MonoReflectionMethod *rmethod, M
klass = mono_class_from_mono_type (tb->type.type);
method = methodbuilder_to_mono_method (klass, mb);
- } else
+ declaring = rmethod;
+ } else if (!strcmp (rmethod->object.vtable->klass->name, "MonoInflatedMethod") ||
+ !strcmp (rmethod->object.vtable->klass->name, "MonoInflatedCtor")) {
+ method = ((MonoReflectionInflatedMethod *) rmethod)->rmethod.method;
+ declaring = ((MonoReflectionInflatedMethod *) rmethod)->declaring;
+ } else {
method = rmethod->method;
+ declaring = rmethod;
+ }
count = method->signature->generic_param_count;
if (count != mono_array_length (types))
@@ -6594,16 +6945,24 @@ mono_reflection_bind_generic_method_parameters (MonoReflectionMethod *rmethod, M
ginst = g_new0 (MonoGenericInst, 1);
ginst->generic_method = method;
- ginst->type_argc = count;
- ginst->type_argv = g_new0 (MonoType *, count);
+ ginst->mtype_argc = count;
+ ginst->mtype_argv = g_new0 (MonoType *, count);
for (i = 0; i < count; i++) {
MonoReflectionType *garg = mono_array_get (types, gpointer, i);
- ginst->type_argv [i] = garg->type;
+ ginst->mtype_argv [i] = garg->type;
+ }
+
+ if (method->klass->generic_inst) {
+ MonoGenericInst *kginst = method->klass->generic_inst->data.generic_inst;
+
+ ginst->type_argc = kginst->type_argc;
+ ginst->type_argv = kginst->type_argv;
}
inflated = mono_class_inflate_generic_method (method, ginst);
- return inflated_method_get_object (mono_object_domain (rmethod), inflated, rmethod, ginst);
+ return inflated_method_get_object (
+ mono_object_domain (rmethod), inflated, declaring, ginst);
}
MonoReflectionInflatedMethod*
@@ -6614,6 +6973,7 @@ mono_reflection_inflate_method_or_ctor (MonoReflectionGenericInst *declaring_typ
MonoGenericInst *ginst, *type_ginst;
MonoMethod *method = NULL, *inflated;
MonoReflectionInflatedMethod *res;
+ MonoReflectionMethod *declaring;
MonoClass *klass;
MONO_ARCH_SAVE_REGS;
@@ -6621,17 +6981,21 @@ mono_reflection_inflate_method_or_ctor (MonoReflectionGenericInst *declaring_typ
klass = mono_class_from_mono_type (reflected_type->type.type);
type_ginst = reflected_type->type.type->data.generic_inst;
- if (!strcmp (obj->vtable->klass->name, "MethodBuilder"))
+ if (!strcmp (obj->vtable->klass->name, "MethodBuilder")) {
method = methodbuilder_to_mono_method (klass, (MonoReflectionMethodBuilder *) obj);
- else if (!strcmp (obj->vtable->klass->name, "ConstructorBuilder"))
+ declaring = (MonoReflectionMethod *) obj;
+ } else if (!strcmp (obj->vtable->klass->name, "ConstructorBuilder")) {
method = ctorbuilder_to_mono_method (klass, (MonoReflectionCtorBuilder *) obj);
- else if (!strcmp (obj->vtable->klass->name, "MonoMethod") ||
- !strcmp (obj->vtable->klass->name, "MonoCMethod"))
+ declaring = (MonoReflectionMethod *) obj;
+ } else if (!strcmp (obj->vtable->klass->name, "MonoMethod") ||
+ !strcmp (obj->vtable->klass->name, "MonoCMethod")) {
method = ((MonoReflectionMethod *) obj)->method;
- else if (!strcmp (obj->vtable->klass->name, "MonoInflatedMethod") ||
- !strcmp (obj->vtable->klass->name, "MonoInflatedCtor"))
+ declaring = (MonoReflectionMethod *) obj;
+ } else if (!strcmp (obj->vtable->klass->name, "MonoInflatedMethod") ||
+ !strcmp (obj->vtable->klass->name, "MonoInflatedCtor")) {
method = ((MonoReflectionInflatedMethod *) obj)->rmethod.method;
- else
+ declaring = ((MonoReflectionInflatedMethod *) obj)->declaring;
+ } else
g_assert_not_reached ();
ginst = g_new0 (MonoGenericInst, 1);
@@ -6643,13 +7007,10 @@ mono_reflection_inflate_method_or_ctor (MonoReflectionGenericInst *declaring_typ
ginst->klass = mono_class_from_generic (ginst->generic_type, FALSE);
- if (type_ginst->is_open)
- inflated = method;
- else
- inflated = mono_class_inflate_generic_method (method, ginst);
+ inflated = mono_class_inflate_generic_method (method, ginst);
res = inflated_method_get_object (
- mono_object_domain (reflected_type), inflated, (MonoReflectionMethod *) obj, ginst);
+ mono_object_domain (reflected_type), inflated, declaring, ginst);
res->declaring_type = declaring_type;
res->reflected_type = reflected_type;
@@ -6914,7 +7275,6 @@ mono_reflection_create_runtime_class (MonoReflectionTypeBuilder *tb)
* nested_classes
*/
klass->flags = tb->attrs;
- klass->element_class = klass;
if (!((MonoDynamicImage*)(MonoDynamicImage*)klass->image)->run)
/* No need to fully construct the type */
@@ -7095,7 +7455,7 @@ mono_reflection_create_dynamic_method (MonoReflectionDynamicMethod *mb)
rmb.refs = g_new0 (gpointer, mb->nrefs + 1);
for (i = 0; i < mb->nrefs; ++i) {
gpointer ref = resolve_object (mb->module->image,
- mono_array_get (mb->refs, MonoObject*, i));
+ mono_array_get (mb->refs, MonoObject*, i));
if (!ref) {
g_free (rmb.refs);
mono_raise_exception (mono_get_exception_type_load (NULL));
diff --git a/mono/metadata/reflection.h b/mono/metadata/reflection.h
index f571570ec04..7af4beec0da 100644
--- a/mono/metadata/reflection.h
+++ b/mono/metadata/reflection.h
@@ -301,6 +301,8 @@ typedef struct {
gboolean save;
char *strong_name;
guint32 strong_name_size;
+ char *win32_res;
+ guint32 win32_res_size;
MonoDynamicStream pefile;
MonoDynamicStream sheap;
MonoDynamicStream code; /* used to store method headers and bytecode */
@@ -321,6 +323,13 @@ typedef struct {
} MonoReflectionResource;
typedef struct {
+ guint32 res_type;
+ guint32 res_id;
+ guint32 lang_id;
+ MonoArray *res_data;
+} MonoReflectionWin32Resource;
+
+typedef struct {
guint32 action;
MonoString *pset;
} MonoReflectionPermissionSet;
@@ -328,7 +337,7 @@ typedef struct {
typedef struct {
MonoReflectionAssembly assembly;
MonoDynamicAssembly *dynamic_assembly;
- MonoReflectionMethodBuilder *entry_point;
+ MonoReflectionMethod *entry_point;
MonoArray *modules;
MonoString *name;
MonoString *dir;
@@ -343,6 +352,7 @@ typedef struct {
MonoBoolean delay_sign;
guint32 access;
MonoArray *loaded_modules;
+ MonoArray *win32_resources;
} MonoReflectionAssemblyBuilder;
typedef struct {
diff --git a/mono/metadata/socket-io.c b/mono/metadata/socket-io.c
index 96c8d461545..2f6bec80594 100644
--- a/mono/metadata/socket-io.c
+++ b/mono/metadata/socket-io.c
@@ -36,6 +36,8 @@
#include <sys/un.h>
#endif
+#include "mono/io-layer/socket-wrappers.h"
+
#ifdef PLATFORM_WIN32
/* This is a kludge to make this file build under cygwin:
* w32api/ws2tcpip.h has definitions for some AF_INET6 values and
@@ -609,7 +611,7 @@ gpointer ves_icall_System_Net_Sockets_Socket_Socket_internal(MonoObject *this, g
return(NULL);
}
- sock=socket(sock_family, sock_type, sock_proto);
+ sock = _wapi_socket (sock_family, sock_type, sock_proto);
if(sock==INVALID_SOCKET) {
mono_raise_exception(get_socket_exception(WSAGetLastError()));
return(NULL);
@@ -628,7 +630,7 @@ gpointer ves_icall_System_Net_Sockets_Socket_Socket_internal(MonoObject *this, g
/* .net seems to set this by default for SOCK_STREAM,
* not for SOCK_DGRAM (see bug #36322)
*/
- ret=setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &true, sizeof(true));
+ ret = _wapi_setsockopt (sock, SOL_SOCKET, SO_REUSEADDR, &true, sizeof (true));
if(ret==SOCKET_ERROR) {
closesocket(sock);
mono_raise_exception(get_socket_exception(WSAGetLastError()));
@@ -697,7 +699,7 @@ gpointer ves_icall_System_Net_Sockets_Socket_Accept_internal(SOCKET sock)
MONO_ARCH_SAVE_REGS;
- newsock=accept(sock, NULL, 0);
+ newsock = _wapi_accept (sock, NULL, 0);
if(newsock==INVALID_SOCKET) {
mono_raise_exception(get_socket_exception(WSAGetLastError()));
return(NULL);
@@ -713,7 +715,7 @@ void ves_icall_System_Net_Sockets_Socket_Listen_internal(SOCKET sock,
MONO_ARCH_SAVE_REGS;
- ret=listen(sock, backlog);
+ ret = _wapi_listen (sock, backlog);
if(ret==SOCKET_ERROR) {
mono_raise_exception(get_socket_exception(WSAGetLastError()));
}
@@ -832,7 +834,7 @@ extern MonoObject *ves_icall_System_Net_Sockets_Socket_LocalEndPoint_internal(SO
MONO_ARCH_SAVE_REGS;
salen=sizeof(sa);
- ret=getsockname(sock, (struct sockaddr *)sa, &salen);
+ ret = _wapi_getsockname (sock, (struct sockaddr *)sa, &salen);
if(ret==SOCKET_ERROR) {
mono_raise_exception(get_socket_exception(WSAGetLastError()));
@@ -854,7 +856,7 @@ extern MonoObject *ves_icall_System_Net_Sockets_Socket_RemoteEndPoint_internal(S
MONO_ARCH_SAVE_REGS;
salen=sizeof(sa);
- ret=getpeername(sock, (struct sockaddr *)sa, &salen);
+ ret = _wapi_getpeername (sock, (struct sockaddr *)sa, &salen);
if(ret==SOCKET_ERROR) {
mono_raise_exception(get_socket_exception(WSAGetLastError()));
@@ -968,7 +970,7 @@ extern void ves_icall_System_Net_Sockets_Socket_Bind_internal(SOCKET sock, MonoO
g_message(G_GNUC_PRETTY_FUNCTION ": binding to %s port %d", inet_ntoa(((struct sockaddr_in *)sa)->sin_addr), ntohs (((struct sockaddr_in *)sa)->sin_port));
#endif
- ret=bind(sock, sa, sa_size);
+ ret = _wapi_bind (sock, sa, sa_size);
g_free(sa);
if(ret==SOCKET_ERROR) {
@@ -990,7 +992,7 @@ extern void ves_icall_System_Net_Sockets_Socket_Connect_internal(SOCKET sock, Mo
g_message(G_GNUC_PRETTY_FUNCTION ": connecting to %s port %d", inet_ntoa(((struct sockaddr_in *)sa)->sin_addr), ntohs (((struct sockaddr_in *)sa)->sin_port));
#endif
- ret=connect(sock, sa, sa_size);
+ ret = _wapi_connect (sock, sa, sa_size);
g_free(sa);
if(ret==SOCKET_ERROR) {
@@ -1014,7 +1016,7 @@ gint32 ves_icall_System_Net_Sockets_Socket_Receive_internal(SOCKET sock, MonoArr
buf=mono_array_addr(buffer, guchar, offset);
- ret=recv(sock, buf, count, recvflags);
+ ret = _wapi_recv (sock, buf, count, recvflags);
if(ret==SOCKET_ERROR) {
mono_raise_exception(get_socket_exception(WSAGetLastError()));
}
@@ -1042,7 +1044,7 @@ gint32 ves_icall_System_Net_Sockets_Socket_RecvFrom_internal(SOCKET sock, MonoAr
buf=mono_array_addr(buffer, guchar, offset);
- ret=recvfrom(sock, buf, count, recvflags, sa, &sa_size);
+ ret = _wapi_recvfrom (sock, buf, count, recvflags, sa, &sa_size);
if(ret==SOCKET_ERROR) {
g_free(sa);
@@ -1079,7 +1081,7 @@ gint32 ves_icall_System_Net_Sockets_Socket_Send_internal(SOCKET sock, MonoArray
g_message(G_GNUC_PRETTY_FUNCTION ": Sending %d bytes", count);
#endif
- ret=send(sock, buf, count, sendflags);
+ ret = _wapi_send (sock, buf, count, sendflags);
if(ret==SOCKET_ERROR) {
mono_raise_exception(get_socket_exception(WSAGetLastError()));
}
@@ -1115,7 +1117,7 @@ gint32 ves_icall_System_Net_Sockets_Socket_SendTo_internal(SOCKET sock, MonoArra
g_message(G_GNUC_PRETTY_FUNCTION ": Sending %d bytes", count);
#endif
- ret=sendto(sock, buf, count, sendflags, sa, sa_size);
+ ret = _wapi_sendto (sock, buf, count, sendflags, sa, sa_size);
g_free(sa);
if(ret==SOCKET_ERROR) {
@@ -1166,7 +1168,7 @@ void ves_icall_System_Net_Sockets_Socket_Select_internal(MonoArray **read_socks,
FD_ZERO(&readfds);
for(i=0; i<readarrsize; i++) {
handle = Socket_to_SOCKET(mono_array_get(*read_socks, MonoObject *, i));
- FD_SET(handle, &readfds);
+ _wapi_FD_SET(handle, &readfds);
}
}
@@ -1183,7 +1185,7 @@ void ves_icall_System_Net_Sockets_Socket_Select_internal(MonoArray **read_socks,
FD_ZERO(&writefds);
for(i=0; i<writearrsize; i++) {
handle = Socket_to_SOCKET(mono_array_get(*write_socks, MonoObject *, i));
- FD_SET(handle, &writefds);
+ _wapi_FD_SET(handle, &writefds);
}
}
@@ -1200,7 +1202,7 @@ void ves_icall_System_Net_Sockets_Socket_Select_internal(MonoArray **read_socks,
FD_ZERO(&errfds);
for(i=0; i<errarrsize; i++) {
handle = Socket_to_SOCKET(mono_array_get(*err_socks, MonoObject *, i));
- FD_SET(handle, &errfds);
+ _wapi_FD_SET(handle, &errfds);
}
}
@@ -1215,9 +1217,9 @@ void ves_icall_System_Net_Sockets_Socket_Select_internal(MonoArray **read_socks,
tv.tv_sec=divvy.quot;
tv.tv_usec=divvy.rem;
- ret=select(0, readptr, writeptr, errptr, &tv);
+ ret = _wapi_select (0, readptr, writeptr, errptr, &tv);
} else {
- ret=select(0, readptr, writeptr, errptr, NULL);
+ ret = _wapi_select (0, readptr, writeptr, errptr, NULL);
}
} while ((ret==SOCKET_ERROR) && (WSAGetLastError() == WSAEINTR));
@@ -1231,7 +1233,7 @@ void ves_icall_System_Net_Sockets_Socket_Select_internal(MonoArray **read_socks,
count=0;
for(i=0; i<readarrsize; i++) {
- if(FD_ISSET(Socket_to_SOCKET(mono_array_get(*read_socks, MonoObject *, i)), &readfds)) {
+ if(_wapi_FD_ISSET(Socket_to_SOCKET(mono_array_get(*read_socks, MonoObject *, i)), &readfds)) {
count++;
}
}
@@ -1240,7 +1242,7 @@ void ves_icall_System_Net_Sockets_Socket_Select_internal(MonoArray **read_socks,
for(i=0; i<readarrsize; i++) {
MonoObject *sock=mono_array_get(*read_socks, MonoObject *, i);
- if(FD_ISSET(Socket_to_SOCKET(sock), &readfds)) {
+ if(_wapi_FD_ISSET(Socket_to_SOCKET(sock), &readfds)) {
mono_array_set(socks, MonoObject *, count, sock);
count++;
}
@@ -1254,7 +1256,7 @@ void ves_icall_System_Net_Sockets_Socket_Select_internal(MonoArray **read_socks,
sock_arr_class=((MonoObject *)*write_socks)->vtable->klass;
count=0;
for(i=0; i<writearrsize; i++) {
- if(FD_ISSET(Socket_to_SOCKET(mono_array_get(*write_socks, MonoObject *, i)), &writefds)) {
+ if(_wapi_FD_ISSET(Socket_to_SOCKET(mono_array_get(*write_socks, MonoObject *, i)), &writefds)) {
count++;
}
}
@@ -1263,7 +1265,7 @@ void ves_icall_System_Net_Sockets_Socket_Select_internal(MonoArray **read_socks,
for(i=0; i<writearrsize; i++) {
MonoObject *sock=mono_array_get(*write_socks, MonoObject *, i);
- if(FD_ISSET(Socket_to_SOCKET(sock), &writefds)) {
+ if(_wapi_FD_ISSET(Socket_to_SOCKET(sock), &writefds)) {
mono_array_set(socks, MonoObject *, count, sock);
count++;
}
@@ -1277,7 +1279,7 @@ void ves_icall_System_Net_Sockets_Socket_Select_internal(MonoArray **read_socks,
sock_arr_class=((MonoObject *)*err_socks)->vtable->klass;
count=0;
for(i=0; i<errarrsize; i++) {
- if(FD_ISSET(Socket_to_SOCKET(mono_array_get(*err_socks, MonoObject *, i)), &errfds)) {
+ if(_wapi_FD_ISSET(Socket_to_SOCKET(mono_array_get(*err_socks, MonoObject *, i)), &errfds)) {
count++;
}
}
@@ -1286,7 +1288,7 @@ void ves_icall_System_Net_Sockets_Socket_Select_internal(MonoArray **read_socks,
for(i=0; i<errarrsize; i++) {
MonoObject *sock=mono_array_get(*err_socks, MonoObject *, i);
- if(FD_ISSET(Socket_to_SOCKET(sock), &errfds)) {
+ if(_wapi_FD_ISSET(Socket_to_SOCKET(sock), &errfds)) {
mono_array_set(socks, MonoObject *, count, sock);
count++;
}
@@ -1340,18 +1342,18 @@ void ves_icall_System_Net_Sockets_Socket_GetSocketOption_obj_internal(SOCKET soc
switch(name) {
case SocketOptionName_Linger:
case SocketOptionName_DontLinger:
- ret=getsockopt(sock, system_level, system_name, &linger,
+ ret = _wapi_getsockopt(sock, system_level, system_name, &linger,
&lingersize);
break;
case SocketOptionName_SendTimeout:
case SocketOptionName_ReceiveTimeout:
- ret=getsockopt(sock, system_level, system_name, &tv,
+ ret = _wapi_getsockopt (sock, system_level, system_name, &tv,
&tvsize);
break;
default:
- ret=getsockopt(sock, system_level, system_name, &val,
+ ret = _wapi_getsockopt (sock, system_level, system_name, &val,
&valsize);
}
@@ -1416,7 +1418,7 @@ void ves_icall_System_Net_Sockets_Socket_GetSocketOption_arr_internal(SOCKET soc
valsize=mono_array_length(*byte_val);
buf=mono_array_addr(*byte_val, guchar, 0);
- ret=getsockopt(sock, system_level, system_name, buf, &valsize);
+ ret = _wapi_getsockopt (sock, system_level, system_name, buf, &valsize);
if(ret==SOCKET_ERROR) {
mono_raise_exception(get_socket_exception(WSAGetLastError()));
}
@@ -1515,7 +1517,7 @@ void ves_icall_System_Net_Sockets_Socket_SetSocketOption_internal(SOCKET sock, g
linger.l_onoff=0;
linger.l_linger=0;
valsize=sizeof(linger);
- ret=setsockopt(sock, system_level, system_name,
+ ret = _wapi_setsockopt (sock, system_level, system_name,
&linger, valsize);
break;
@@ -1529,7 +1531,7 @@ void ves_icall_System_Net_Sockets_Socket_SetSocketOption_internal(SOCKET sock, g
linger.l_linger=*(guint32 *)(((char *)obj_val)+field->offset);
valsize=sizeof(linger);
- ret=setsockopt(sock, system_level, system_name,
+ ret = _wapi_setsockopt (sock, system_level, system_name,
&linger, valsize);
break;
case SocketOptionName_AddMembership:
@@ -1555,7 +1557,7 @@ void ves_icall_System_Net_Sockets_Socket_SetSocketOption_internal(SOCKET sock, g
field=mono_class_get_field_from_name(obj_val->vtable->klass, "ifIndex");
mreq6.ipv6mr_interface =*(guint64 *)(((char *)obj_val)+field->offset);
- ret = setsockopt (sock, system_level,
+ ret = _wapi_setsockopt (sock, system_level,
system_name, &mreq6,
sizeof (mreq6));
} else if(system_level == sol_ip)
@@ -1593,7 +1595,7 @@ void ves_icall_System_Net_Sockets_Socket_SetSocketOption_internal(SOCKET sock, g
}
#endif /* HAVE_STRUCT_IP_MREQN */
- ret = setsockopt (sock, system_level,
+ ret = _wapi_setsockopt (sock, system_level,
system_name, &mreq,
sizeof (mreq));
}
@@ -1608,7 +1610,7 @@ void ves_icall_System_Net_Sockets_Socket_SetSocketOption_internal(SOCKET sock, g
int valsize=mono_array_length(byte_val);
guchar *buf=mono_array_addr(byte_val, guchar, 0);
- ret=setsockopt(sock, system_level, system_name, buf, valsize);
+ ret = _wapi_setsockopt (sock, system_level, system_name, buf, valsize);
if(ret==SOCKET_ERROR) {
mono_raise_exception(get_socket_exception(WSAGetLastError()));
}
@@ -1619,11 +1621,11 @@ void ves_icall_System_Net_Sockets_Socket_SetSocketOption_internal(SOCKET sock, g
struct timeval tv;
tv.tv_sec = int_val / 1000;
tv.tv_usec = (int_val % 1000) * 1000;
- ret=setsockopt(sock, system_level, system_name, &tv, sizeof (tv));
+ ret = _wapi_setsockopt (sock, system_level, system_name, &tv, sizeof (tv));
break;
}
default:
- ret=setsockopt(sock, system_level, system_name, &int_val,
+ ret = _wapi_setsockopt (sock, system_level, system_name, &int_val,
sizeof(int_val));
}
}
@@ -1643,7 +1645,7 @@ void ves_icall_System_Net_Sockets_Socket_Shutdown_internal(SOCKET sock,
/* Currently, the values for how (recv=0, send=1, both=2) match
* the BSD API
*/
- ret=shutdown(sock, how);
+ ret = _wapi_shutdown (sock, how);
if(ret==SOCKET_ERROR) {
mono_raise_exception(get_socket_exception(WSAGetLastError()));
}
@@ -1983,7 +1985,7 @@ MonoBoolean ves_icall_System_Net_Dns_GetHostByName_internal(MonoString *host, Mo
hostname=mono_string_to_utf8(host);
- he=gethostbyname(hostname);
+ he = _wapi_gethostbyname (hostname);
g_free(hostname);
if(he==NULL) {
@@ -2116,7 +2118,7 @@ extern MonoBoolean ves_icall_System_Net_Dns_GetHostName_internal(MonoString **h_
MONO_ARCH_SAVE_REGS;
- ret=gethostname (hostname, sizeof(hostname));
+ ret = gethostname (hostname, sizeof (hostname));
if(ret==-1) {
return(FALSE);
}
diff --git a/mono/metadata/string-icalls.c b/mono/metadata/string-icalls.c
index 5061e125d8e..54756557ef5 100644
--- a/mono/metadata/string-icalls.c
+++ b/mono/metadata/string-icalls.c
@@ -774,7 +774,7 @@ ves_icall_System_String_InternalStrcpy_Str (MonoString *dest, gint32 destPos, Mo
srcptr = mono_string_chars (src);
destptr = mono_string_chars (dest);
- memcpy(destptr + destPos, srcptr, mono_string_length(src) * sizeof(gunichar2));
+ g_memmove (destptr + destPos, srcptr, mono_string_length(src) * sizeof(gunichar2));
}
void
@@ -787,7 +787,7 @@ ves_icall_System_String_InternalStrcpy_StrN (MonoString *dest, gint32 destPos, M
srcptr = mono_string_chars (src);
destptr = mono_string_chars (dest);
- memcpy(destptr + destPos, srcptr + startPos, count * sizeof(gunichar2));
+ g_memmove (destptr + destPos, srcptr + startPos, count * sizeof(gunichar2));
}
MonoString *
diff --git a/mono/metadata/threadpool.c b/mono/metadata/threadpool.c
index da2f5fd133c..b531ce2ce0e 100644
--- a/mono/metadata/threadpool.c
+++ b/mono/metadata/threadpool.c
@@ -136,7 +136,6 @@ mono_thread_pool_finish (MonoAsyncResult *ares, MonoArray **out_args, MonoObject
if (ares->endinvoke_called) {
*exc = (MonoObject *)mono_exception_from_name (mono_defaults.corlib, "System",
"InvalidOperationException");
- LeaveCriticalSection (&mono_delegate_section);
return NULL;
}
@@ -146,7 +145,8 @@ mono_thread_pool_finish (MonoAsyncResult *ares, MonoArray **out_args, MonoObject
g_assert (ac != NULL);
/* wait until we are really finished */
- WaitForSingleObject (ac->wait_semaphore, INFINITE);
+ if (!ares->completed)
+ WaitForSingleObject (ac->wait_semaphore, INFINITE);
*exc = ac->msg->exc;
*out_args = ac->out_args;
@@ -191,7 +191,6 @@ async_invoke_thread (gpointer data)
thread->threadpool_thread = TRUE;
thread->state |= ThreadState_Background;
for (;;) {
- gboolean cont;
MonoAsyncResult *ar;
ar = (MonoAsyncResult *) data;
@@ -210,7 +209,7 @@ async_invoke_thread (gpointer data)
if (!data) {
InterlockedDecrement (&mono_worker_threads);
- ExitThread (0);
+ return;
}
InterlockedIncrement (&busy_worker_threads);
}
diff --git a/mono/metadata/verify.c b/mono/metadata/verify.c
index f6ac7d2cf5a..fecda6801c5 100644
--- a/mono/metadata/verify.c
+++ b/mono/metadata/verify.c
@@ -2399,6 +2399,7 @@ async_result_fields[] = {
{"sync_completed", G_STRUCT_OFFSET (MonoAsyncResult, sync_completed)},
{"completed", G_STRUCT_OFFSET (MonoAsyncResult, completed)},
{"endinvoke_called", G_STRUCT_OFFSET (MonoAsyncResult, endinvoke_called)},
+ {"async_callback", G_STRUCT_OFFSET (MonoAsyncResult, async_callback)},
{NULL, 0}
};
diff --git a/mono/mini/ChangeLog b/mono/mini/ChangeLog
index acbd022ba64..03077d73878 100644
--- a/mono/mini/ChangeLog
+++ b/mono/mini/ChangeLog
@@ -1,3 +1,111 @@
+2004-02-01 Martin Baulig <martin@ximian.com>
+
+ * mini.c (MTYPE_PARAM_TO_TYPE): Method type arguments are stored
+ in `ginst->mtype_argv'.
+
+2004-01-31 Miguel de Icaza <miguel@ximian.com>
+
+ * mini.c: Add comments, replace CEE_XXX+128 with OP_XXX to
+ facilitate grepping.
+
+Wed Jan 28 14:04:58 CET 2004 Paolo Molaro <lupus@ximian.com>
+
+ * mini.c: fixed buglet in initobj generic implementation for references.
+
+Fri Jan 23 16:10:44 EST 2004 Paolo Molaro <lupus@ximian.com>
+
+ * Makefile.am: make the version script conditional.
+ * jit-icalls.c: handle missing truncl().
+
+2004-01-23 Zoltan Varga <vargaz@freemail.hu>
+
+ * exceptions.cs: Add more tests for double->int conversion.
+
+ * jit-icalls.c (mono_fconv_ovf_i8): Call truncl before comparison, so
+ we don't throw exceptions when converting 1.1 to a long. Fixes #53250.
+
+Fri Jan 23 17:12:08 CET 2004 Paolo Molaro <lupus@ximian.com>
+
+ * driver.c: make --verbose --version emit an error
+ if the loaded corlib doesn't match the runtime version.
+
+Mon Jan 19 17:44:50 CET 2004 Paolo Molaro <lupus@ximian.com>
+
+ * mini-ppc.h: export ppc_patch().
+ * mini-ppc.c: call convention fixes. Added assert in ppc_patch().
+ * tramp-ppc.c: call convention fixes: Linux/PPC support should be
+ on par or better than on MacOSX.
+
+2004-01-19 Zoltan Varga <vargaz@freemail.hu>
+
+ * mini.c tramp-x86.c tramp-sparc.c: Updated after changes to
+ mono_lookup_pinvoke_call.
+
+ * mini-x86.c: Under windows, the default pinvoke calling convention is
+ stdcall. Fixes #52834.
+
+ * mini.c (optimize_branches): Add an upper bound to the number of
+ iterations to prevent infinite loops on strange loops. Fixes #53003.
+
+2004-01-16 Zoltan Varga <vargaz@freemail.hu>
+
+ * inssel.brg: Add vectors<->one dimensional array checking to CASTCLASS
+ and ISINST. Fixes #52093.
+
+ * objects.cs (test_0_vector_array_cast): New tests.
+
+2004-01-15 Zoltan Varga <vargaz@freemail.hu>
+
+ * jit-icalls.c (helper_stelem_ref_check): New jit icall for array type
+ checking in Array.Set ().
+
+ * mini.c (method_to_ir): Add array type checking in Array.Set (). Fixes
+ #52590.
+
+ * object.cs (test_0_multi_array_cast): New regression test.
+
+Thu Jan 15 16:30:24 CET 2004 Paolo Molaro <lupus@ximian.com>
+
+ * exceptions-ppc.c: fix build on Linux/PPC.
+
+2004-01-14 Zoltan Varga <vargaz@freemail.hu>
+
+ * tramp-x86.c (x86_magic_trampoline): Disable code patching when
+ running under valgrind.
+ (x86_magic_trampoline): Fix build bustage.
+
+ * debug-mini.c: Modify the debug info serialize/deserialize code so it handles
+ negative values as well. This is needed for the encoding of the line number
+ info, since sometimes the line numbers are not in increasing order.
+
+2004-01-13 Zoltan Varga <vargaz@freemail.hu>
+
+ * cpu-pentium.md (localloc): Increase the size of the localloc
+ instruction since it is a loop under Win32.
+
+ * debug-mini.c (record_line_number): Get rid of unneccesary memory
+ allocation.
+
+2004-01-09 Zoltan Varga <vargaz@freemail.hu>
+
+ * exceptions-ppc.c exceptions-x86.c exceptions-sparc.c
+ tramp-x86.c tramp-ppc.c tramp-sparc.c: Applied patch from
+ Max Horn (max@quendi.de). Fix file names in comments.
+
+2004-01-03 Zoltan Varga <vargaz@freemail.hu>
+
+ * ssa.c (mono_ssa_rename_vars): Allocate new_stack on the heap to
+ avoid stack overflow.
+ (replace_usage): Avoid uninitialized variable warnings.
+
+ * mini.c (mono_method_to_ir): Avoid disabling SSA for array operations
+ and taking the address of valuetype variables.
+
+2004-01-03 Patrik Torstensson
+
+ * mini-x86.c: renamed fpflags to flags in RegTrack, going to be used
+ for other purposes than FP later on.
+
2004-01-02 Zoltan Varga <vargaz@freemail.hu>
* mini.c (mono_method_to_ir): Prevent register allocation for arguments
diff --git a/mono/mini/Makefile.am b/mono/mini/Makefile.am
index 7a36f1d39c9..6dcac76015e 100644
--- a/mono/mini/Makefile.am
+++ b/mono/mini/Makefile.am
@@ -28,7 +28,12 @@ endif
# hack for automake to have the same source file in a library and a bin
genmdesc_CFLAGS = $(AM_CFLAGS)
-libmono_la_LDFLAGS=-Wl,-version-script=$(srcdir)/ldscript
+if NO_VERSION_SCRIPT
+monoldflags=
+else
+monoldflags=-Wl,-version-script=$(srcdir)/ldscript
+endif
+libmono_la_LDFLAGS=$(monoldflags)
if JIT_SUPPORTED
bin_PROGRAMS = mono
diff --git a/mono/mini/cpu-pentium.md b/mono/mini/cpu-pentium.md
index a2de65687f5..216537787a4 100644
--- a/mono/mini/cpu-pentium.md
+++ b/mono/mini/cpu-pentium.md
@@ -260,7 +260,7 @@ starg:
ldloc:
ldloca:
stloc:
-localloc: dest:i src1:i len:32
+localloc: dest:i src1:i len:64
endfilter:
unaligned.:
volatile.:
diff --git a/mono/mini/debug-mini.c b/mono/mini/debug-mini.c
index f007279ff03..053c63fdc35 100644
--- a/mono/mini/debug-mini.c
+++ b/mono/mini/debug-mini.c
@@ -16,15 +16,15 @@
#include "config.h"
#include <mono/metadata/mono-debug-debugger.h>
-static void
+static inline void
record_line_number (MonoDebugMethodJitInfo *jit, guint32 address, guint32 offset)
{
- MonoDebugLineNumberEntry *lne = g_new0 (MonoDebugLineNumberEntry, 1);
+ MonoDebugLineNumberEntry lne;
- lne->address = address;
- lne->offset = offset;
+ lne.address = address;
+ lne.offset = offset;
- g_array_append_val (jit->line_numbers, *lne);
+ g_array_append_val (jit->line_numbers, lne);
}
typedef struct
@@ -161,7 +161,7 @@ mono_debug_record_line_number (MonoCompile *cfg, MonoInst *ins, guint32 address)
}
static inline void
-encode_value (guint32 value, char *buf, char **endbuf)
+encode_value (gint32 value, char *buf, char **endbuf)
{
char *p = buf;
@@ -171,13 +171,13 @@ encode_value (guint32 value, char *buf, char **endbuf)
* Same encoding as the one used in the metadata, extended to handle values
* greater than 0x1fffffff.
*/
- if (value <= 127)
+ if ((value >= 0) && (value <= 127))
*p++ = value;
- else if (value <= 16384) {
+ else if ((value >= 0) && (value <= 16384)) {
p [0] = 0x80 | (value >> 8);
p [1] = value & 0xff;
p += 2;
- } else if (value <= 0x1fffffff) {
+ } else if ((value >= 0) && (value <= 0x1fffffff)) {
p [0] = (value >> 24) | 0xc0;
p [1] = (value >> 16) & 0xff;
p [2] = (value >> 8) & 0xff;
@@ -196,12 +196,12 @@ encode_value (guint32 value, char *buf, char **endbuf)
*endbuf = p;
}
-static inline guint32
+static inline gint32
decode_value (char *_ptr, char **rptr)
{
unsigned char *ptr = (unsigned char *) _ptr;
unsigned char b = *ptr;
- guint32 len;
+ gint32 len;
if ((b & 0x80) == 0){
len = b;
@@ -217,7 +217,7 @@ decode_value (char *_ptr, char **rptr)
ptr += 4;
}
else {
- len = (ptr [0] << 24) | (ptr [1] << 16) | (ptr [2] << 8) | ptr [3];
+ len = (ptr [1] << 24) | (ptr [2] << 16) | (ptr [3] << 8) | ptr [4];
ptr += 5;
}
if (rptr)
@@ -284,6 +284,7 @@ mono_debug_serialize_debug_info (MonoCompile *cfg,
prev_offset = 0;
prev_native_offset = 0;
for (i = 0; i < jit->line_numbers->len; ++i) {
+ /* Sometimes, the offset values are not in increasing order */
MonoDebugLineNumberEntry *lne = &g_array_index (jit->line_numbers,
MonoDebugLineNumberEntry,
i);
@@ -327,7 +328,7 @@ deserialize_debug_info (MonoMethod *method,
{
MonoMethodHeader *header;
MonoDebugMethodJitInfo *jit;
- guint32 offset, native_offset, prev_offset, prev_native_offset, len;
+ gint32 offset, native_offset, prev_offset, prev_native_offset, len;
char *p;
int i;
diff --git a/mono/mini/driver.c b/mono/mini/driver.c
index c34eb2ac50b..09746c85a30 100644
--- a/mono/mini/driver.c
+++ b/mono/mini/driver.c
@@ -592,7 +592,20 @@ mono_main (int argc, char* argv[])
} else if (strcmp (argv [i], "--verbose") == 0 || strcmp (argv [i], "-v") == 0) {
mini_verbose++;
} else if (strcmp (argv [i], "--version") == 0 || strcmp (argv [i], "-V") == 0) {
- g_print ("Mono JIT compiler version %s, (C) 2002, 2003 Ximian, Inc.\n", VERSION);
+ g_print ("Mono JIT compiler version %s, (C) 2002-2004 Novell, Inc. www.go-mono.com\n", VERSION);
+ if (mini_verbose) {
+ const guchar *cerror;
+ const guchar *clibpath;
+ mono_init ("mono");
+ cerror = mono_check_corlib_version ();
+ clibpath = mono_defaults.corlib? mono_defaults.corlib->name: "unknown";
+ if (cerror) {
+ g_print ("The currently installed mscorlib doesn't match this runtime version.\n");
+ g_print ("The error is: %s\n", cerror);
+ g_print ("mscorlib.dll loaded at: %s\n", clibpath);
+ return 1;
+ }
+ }
return 0;
} else if (strcmp (argv [i], "--help") == 0 || strcmp (argv [i], "-h") == 0) {
mini_usage ();
@@ -726,7 +739,7 @@ mono_main (int argc, char* argv[])
mono_debug_init_2 (assembly);
if (mono_compile_aot || action == DO_EXEC) {
- guint32 error;
+ const guchar *error;
mono_config_parse (config_file);
//mono_set_rootdir ();
@@ -734,7 +747,7 @@ mono_main (int argc, char* argv[])
error = mono_check_corlib_version ();
if (error) {
fprintf (stderr, "Corlib not in sync with this runtime: %s\n", error);
- fprintf (stderr, "Download a newer corlib or a newer runtime at http://go-mono/daily.\n");
+ fprintf (stderr, "Download a newer corlib or a newer runtime at http://www.go-mono.com/daily.\n");
exit (1);
}
diff --git a/mono/mini/exceptions-ppc.c b/mono/mini/exceptions-ppc.c
index 45b9fb2759c..3dd85e42e1a 100644
--- a/mono/mini/exceptions-ppc.c
+++ b/mono/mini/exceptions-ppc.c
@@ -1,5 +1,5 @@
/*
- * exception.c: exception support
+ * exceptions-ppc.c: exception support for PowerPC
*
* Authors:
* Dietmar Maurer (dietmar@ximian.com)
@@ -866,7 +866,11 @@ mono_jit_walk_stack (MonoStackWalk func, gpointer user_data) {
MonoContext ctx, new_ctx;
+#ifdef __APPLE__
__asm__ volatile("lwz %0,0(r1)" : "=r" (sframe));
+#else
+ __asm__ volatile("lwz %0,0(1)" : "=r" (sframe));
+#endif
MONO_CONTEXT_SET_IP (&ctx, sframe->lr);
MONO_CONTEXT_SET_BP (&ctx, sframe->sp);
diff --git a/mono/mini/exceptions-sparc.c b/mono/mini/exceptions-sparc.c
index 335d07799ad..0c9a21e276c 100644
--- a/mono/mini/exceptions-sparc.c
+++ b/mono/mini/exceptions-sparc.c
@@ -1,5 +1,5 @@
/*
- * exceptionsparc.c: exception support for 64 bit sparc
+ * exceptions-sparc.c: exception support for 64 bit sparc
*
* Authors:
* Mark Crichton (crichton@gimp.org)
diff --git a/mono/mini/exceptions-x86.c b/mono/mini/exceptions-x86.c
index 7f7e73228b9..4a35c4b75ca 100644
--- a/mono/mini/exceptions-x86.c
+++ b/mono/mini/exceptions-x86.c
@@ -1,5 +1,5 @@
/*
- * exception.c: exception support
+ * exceptions-x86.c: exception support for x86
*
* Authors:
* Dietmar Maurer (dietmar@ximian.com)
@@ -1011,7 +1011,6 @@ mono_arch_handle_exception (MonoContext *ctx, gpointer obj, gboolean test_only)
mono_ex = NULL;
}
-
if (!call_filter)
call_filter = arch_get_call_filter ();
diff --git a/mono/mini/exceptions.cs b/mono/mini/exceptions.cs
index 48974fa1870..4dca2a3fd97 100644
--- a/mono/mini/exceptions.cs
+++ b/mono/mini/exceptions.cs
@@ -1009,6 +1009,14 @@ class Tests {
if (failed)
return 8;
+ {
+ int i;
+ float f = 1.1f;
+ checked {
+ i = (int) f;
+ }
+ }
+
return 0;
}
@@ -1112,6 +1120,14 @@ class Tests {
}
if (failed)
return 8;
+
+ {
+ uint i;
+ float f = 1.1f;
+ checked {
+ i = (uint) f;
+ }
+ }
return 0;
}
@@ -1169,6 +1185,14 @@ class Tests {
if (failed)
return 4;
+ {
+ long i;
+ float f = 1.1f;
+ checked {
+ i = (long) f;
+ }
+ }
+
return 0;
}
@@ -1225,6 +1249,14 @@ class Tests {
if (failed)
return 4;
+ {
+ ulong i;
+ float f = 1.1f;
+ checked {
+ i = (ulong) f;
+ }
+ }
+
return 0;
}
diff --git a/mono/mini/inssel.brg b/mono/mini/inssel.brg
index 20c2cfdc6a3..c3e7facb19d 100644
--- a/mono/mini/inssel.brg
+++ b/mono/mini/inssel.brg
@@ -1290,6 +1290,14 @@ reg: CEE_ISINST (reg) {
} else if (klass->cast_class->flags & TYPE_ATTRIBUTE_INTERFACE) {
mini_emit_isninst_iface_class_cast (s, eclass_reg, klass->cast_class, false_label, object_is_null);
} else {
+ if ((klass->rank == 1) && (klass->byval_arg.type == MONO_TYPE_SZARRAY)) {
+ /* Check that the object is a vector too */
+ int bounds_reg = mono_regstate_next_int (s->rs);
+ MONO_EMIT_NEW_LOAD_MEMBASE (s, bounds_reg, obj_reg, G_STRUCT_OFFSET (MonoArray, bounds));
+ MONO_EMIT_NEW_BIALU_IMM (s, OP_COMPARE_IMM, -1, bounds_reg, 0);
+ MONO_EMIT_NEW_BRANCH_LABEL (s, CEE_BNE_UN, false_label);
+ }
+
/* the object_is_null target simply copies the input register to the output */
mini_emit_isninst_cast (s, eclass_reg, klass->cast_class, false_label, object_is_null);
}
@@ -1417,6 +1425,14 @@ reg: CEE_CASTCLASS (reg) {
} else {
mini_emit_castclass (s, eclass_reg, klass->cast_class);
}
+
+ if ((klass->rank == 1) && (klass->byval_arg.type == MONO_TYPE_SZARRAY)) {
+ /* Check that the object is a vector too */
+ int bounds_reg = mono_regstate_next_int (s->rs);
+ MONO_EMIT_NEW_LOAD_MEMBASE (s, bounds_reg, obj_reg, G_STRUCT_OFFSET (MonoArray, bounds));
+ MONO_EMIT_NEW_BIALU_IMM (s, OP_COMPARE_IMM, -1, bounds_reg, 0);
+ MONO_EMIT_NEW_COND_EXC (s, NE_UN, "InvalidCastException");
+ }
} else {
mini_emit_castclass (s, klass_reg, klass);
}
diff --git a/mono/mini/jit-icalls.c b/mono/mini/jit-icalls.c
index f5363c6177e..a906e37381d 100644
--- a/mono/mini/jit-icalls.c
+++ b/mono/mini/jit-icalls.c
@@ -72,6 +72,15 @@ helper_stelem_ref (MonoArray *array, int index, MonoObject *val)
mono_array_set (array, gpointer, index, val);
}
+static void
+helper_stelem_ref_check (MonoArray *array, MonoObject *val)
+{
+ MONO_ARCH_SAVE_REGS;
+
+ if (val && !mono_object_isinst (val, array->obj.vtable->klass->element_class))
+ mono_raise_exception (mono_get_exception_array_type_mismatch ());
+}
+
static gint64
mono_llmult (gint64 a, gint64 b)
{
@@ -415,6 +424,18 @@ mono_fconv_u4 (double v)
return (guint32)v;
}
+#ifndef HAVE_TRUNCL
+/* should mostly work */
+static double
+truncl (double x)
+{
+ if (x < 0)
+ x += 1.0;
+ return floor (x);
+}
+
+#endif
+
static gint64
mono_fconv_ovf_i8 (double v)
{
@@ -424,7 +445,7 @@ mono_fconv_ovf_i8 (double v)
res = (gint64)v;
- if (isnan(v) || v != res) {
+ if (isnan(v) || truncl (v) != res) {
mono_raise_exception (mono_get_exception_overflow ());
}
return res;
@@ -439,7 +460,7 @@ mono_fconv_ovf_u8 (double v)
res = (guint64)v;
- if (isnan(v) || v != res) {
+ if (isnan(v) || truncl (v) != res) {
mono_raise_exception (mono_get_exception_overflow ());
}
return res;
diff --git a/mono/mini/mini-porting.txt b/mono/mini/mini-porting.txt
index 918ac8d1c68..25be0a77566 100644
--- a/mono/mini/mini-porting.txt
+++ b/mono/mini/mini-porting.txt
@@ -1,349 +1,424 @@
- Mono JIT porting guide.
- Paolo Molaro (lupus@ximian.com)
+ Mono JIT porting guide.
+ Paolo Molaro (lupus@ximian.com)
* Introduction
-This documents describes the process of porting the mono JIT
-to a new CPU architecture. The new mono JIT has been designed
-to make porting easier though at the same time enable the port
-to take full advantage from the new architecture features and
-instructions. Knowledge of the mini architecture (described in the
-mini-doc.txt file) is a requirement for understanding this guide,
-as well as an earlier document about porting the mono interpreter
-(available on the web site).
-
-There are six main areas that a port needs to implement to
-have a fully-functional JIT for a given architecture:
-
- 1) instruction selection
- 2) native code emission
- 3) call conventions and register allocation
- 4) method trampolines
- 5) exception handling
- 6) minor helper methods
-
-To take advantage of some not-so-common processor features (for example
-conditional execution of instructions as may be found on ARM or ia64), it may
-be needed to develop an high-level optimization, but doing so is not a
-requirement for getting the JIT to work.
-
-We'll see in more details each of the steps required, note, though,
-that a new port may just as well start from a cut&paste of an existing
-port to a similar architecture (for example from x86 to amd64, or from
-powerpc to sparc).
-The architecture specific code is split from the rest of the JIT,
-for example the x86 specific code and data is all included in the
-following files in the distribution:
-
- mini-x86.h mini-x86.c
- inssel-x86.brg
- cpu-pentium.md
- tramp-x86.c
- exceptions-x86.c
-
-I suggest a similar split for other architectures as well.
-
-Note that this document is still incomplete: some sections are only
-sketched and some are missing, but the important info to get a port
-going is already described.
+ This documents describes the process of porting the mono JIT
+ to a new CPU architecture. The new mono JIT has been designed
+ to make porting easier though at the same time enable the port
+ to take full advantage from the new architecture features and
+ instructions. Knowledge of the mini architecture (described in
+ the mini-doc.txt file) is a requirement for understanding this
+ guide, as well as an earlier document about porting the mono
+ interpreter (available on the web site).
+
+ There are six main areas that a port needs to implement to
+ have a fully-functional JIT for a given architecture:
+
+ 1) instruction selection
+ 2) native code emission
+ 3) call conventions and register allocation
+ 4) method trampolines
+ 5) exception handling
+ 6) minor helper methods
+
+ To take advantage of some not-so-common processor features
+ (for example conditional execution of instructions as may be
+ found on ARM or ia64), it may be needed to develop an
+ high-level optimization, but doing so is not a requirement for
+ getting the JIT to work.
+
+ We'll see in more details each of the steps required, note,
+ though, that a new port may just as well start from a
+ cut&paste of an existing port to a similar architecture (for
+ example from x86 to amd64, or from powerpc to sparc).
+
+ The architecture specific code is split from the rest of the
+ JIT, for example the x86 specific code and data is all
+ included in the following files in the distribution:
+
+ mini-x86.h mini-x86.c
+ inssel-x86.brg
+ cpu-pentium.md
+ tramp-x86.c
+ exceptions-x86.c
+
+ I suggest a similar split for other architectures as well.
+
+ Note that this document is still incomplete: some sections are
+ only sketched and some are missing, but the important info to
+ get a port going is already described.
* Architecture-specific instructions and instruction selection.
-The JIT already provides a set of instructions that can be easily
-mapped to a great variety of different processor instructions.
-Sometimes it may be necessary or advisable to add a new instruction
-that represent more closely an instruction in the architecture.
-Note that a mini instruction can be used to represent also a short
-sequence of CPU low-level instructions, but note that each
-instruction represents the minimum amount of code the instruction
-scheduler will handle (i.e., the scheduler won't schedule the instructions
-that compose the low-level sequence as individual instructions, but just
-the whole sequence, as an indivisible block).
-New instructions are created by adding a line in the mini-ops.h file,
-assigning an opcode and a name. To specify the input and output for
-the instruction, there are two different places, depending on the context
-in which the instruction gets used.
-If the instruction is used in the tree representation, the input and output
-types are defined by the BURG rules in the *.brg files (the usual
-non-terminals are 'reg' to represent a normal register, 'lreg' to
-represent a register or two that hold a 64 bit value, freg for a
-floating point register).
-If an instruction is used as a low-level CPU instruction, the info
-is specified in a machine description file. The description file is
-processed by the genmdesc program to provide a data structure that
-can be easily used from C code to query the needed info about the
-instruction.
-As an example, let's consider the add instruction for both x86 and ppc:
-
-x86 version:
- add: dest:i src1:i src2:i len:2 clob:1
-ppc version:
- add: dest:i src1:i src2:i len:4
-
-Note that the instruction takes two input integer registers on both CPU,
-but on x86 the first source register is clobbered (clob:1) and the length
-in bytes of the instruction differs.
-Note that integer adds and floating point adds use different opcodes, unlike
-the IL language (64 bit add is done with two instructions on 32 bit architectures,
-using a add that sets the carry and an add with carry).
-A specific CPU port may assign any meaning to the clob field for an instruction
-since the value will be processed in an arch-specific file anyway.
-See the top of the existing cpu-pentium.md file for more info on other fields:
-the info may or may not be applicable to a different CPU, in this latter case
-the info can be ignored.
-The code in mini.c together with the BURG rules in inssel.brg, inssel-float.brg
-and inssel-long32.brg provides general purpose mappings from the tree representation
-to a set of instructions that should be easily implemented in any architecture.
-To allow for additional arch-specific functionality, an arch-specific BURG file
-can be used: in this file arch-specific instructions can be selected that provide
-better performance than the general instructions or that provide functionality
-that is needed by the JIT but that cannot be expressed in a general enough way.
-As an example, x86 has the special instruction "push" to make it easier to
-implement the default call convention (passing arguments on the stack): almost
-all the other architectures don't have such an instruction (and don't need it anyway),
-so we added a special rule in the inssel-x86.brg file for it.
-
-So, one of the first things needed in a port is to write a cpu-$(arch).md machine
-description file and fill it with the needed info. As a start, only a few
-instructions can be specified, like the ones required to do simple integer
-operations. The default rules of the instruction selector will emit the common
-instructions and so we're ready to go for the next step in porting the JIT.
-
+ The JIT already provides a set of instructions that can be
+ easily mapped to a great variety of different processor
+ instructions. Sometimes it may be necessary or advisable to
+ add a new instruction that represent more closely an
+ instruction in the architecture. Note that a mini instruction
+ can be used to represent also a short sequence of CPU
+ low-level instructions, but note that each instruction
+ represents the minimum amount of code the instruction
+ scheduler will handle (i.e., the scheduler won't schedule the
+ instructions that compose the low-level sequence as individual
+ instructions, but just the whole sequence, as an indivisible
+ block).
+
+ New instructions are created by adding a line in the
+ mini-ops.h file, assigning an opcode and a name. To specify
+ the input and output for the instruction, there are two
+ different places, depending on the context in which the
+ instruction gets used.
+
+ If the instruction is used in the tree representation, the
+ input and output types are defined by the BURG rules in the
+ *.brg files (the usual non-terminals are 'reg' to represent a
+ normal register, 'lreg' to represent a register or two that
+ hold a 64 bit value, freg for a floating point register).
+
+ If an instruction is used as a low-level CPU instruction, the
+ info is specified in a machine description file. The
+ description file is processed by the genmdesc program to
+ provide a data structure that can be easily used from C code
+ to query the needed info about the instruction.
+
+ As an example, let's consider the add instruction for both x86
+ and ppc:
+
+ x86 version:
+ add: dest:i src1:i src2:i len:2 clob:1
+ ppc version:
+ add: dest:i src1:i src2:i len:4
+
+ Note that the instruction takes two input integer registers on
+ both CPU, but on x86 the first source register is clobbered
+ (clob:1) and the length in bytes of the instruction differs.
+
+ Note that integer adds and floating point adds use different
+ opcodes, unlike the IL language (64 bit add is done with two
+ instructions on 32 bit architectures, using a add that sets
+ the carry and an add with carry).
+
+ A specific CPU port may assign any meaning to the clob field
+ for an instruction since the value will be processed in an
+ arch-specific file anyway.
+
+ See the top of the existing cpu-pentium.md file for more info
+ on other fields: the info may or may not be applicable to a
+ different CPU, in this latter case the info can be ignored.
+
+ The code in mini.c together with the BURG rules in inssel.brg,
+ inssel-float.brg and inssel-long32.brg provides general
+ purpose mappings from the tree representation to a set of
+ instructions that should be easily implemented in any
+ architecture. To allow for additional arch-specific
+ functionality, an arch-specific BURG file can be used: in this
+ file arch-specific instructions can be selected that provide
+ better performance than the general instructions or that
+ provide functionality that is needed by the JIT but that
+ cannot be expressed in a general enough way.
+
+ As an example, x86 has the special instruction "push" to make
+ it easier to implement the default call convention (passing
+ arguments on the stack): almost all the other architectures
+ don't have such an instruction (and don't need it anyway), so
+ we added a special rule in the inssel-x86.brg file for it.
+
+ So, one of the first things needed in a port is to write a
+ cpu-$(arch).md machine description file and fill it with the
+ needed info. As a start, only a few instructions can be
+ specified, like the ones required to do simple integer
+ operations. The default rules of the instruction selector will
+ emit the common instructions and so we're ready to go for the
+ next step in porting the JIT.
+
*) Native code emission
-Since the first step in porting mono to a new CPU is to port the interpreter,
-there should be already a file that allows the emission of binary native code
-in a buffer for the architecture. This file should be placed in the
- mono/arch/$(arch)/
-directory.
-
-The bulk of the code emission happens in the mini-$(arch).c file, in a function
-called mono_arch_output_basic_block (). This function takes a basic block, walks the
-list of instructions in the block and emits the binary code for each.
-Optionally a peephole optimization pass is done on the basic block, but this can be
-left for later, when the port actually works.
-This function is very simple, there is just a big switch on the instruction opcode
-and in the corresponding case the functions or macros to emit the binary native code
-are used. Note that in this function the lengths of the instructions are used to
-determine if the buffer for the code needs enlarging.
-
-To complete the code emission for a method, a few other functions need
-implementing as well:
-
- mono_arch_emit_prolog ()
- mono_arch_emit_epilog ()
- mono_arch_patch_code ()
-
-mono_arch_emit_prolog () will emit the code to setup the stack frame for a method,
-optionally call the callbacks used in profiling and tracing, and move the
-arguments to their home location (in a caller-save register if the variable was
-allocated to one, or in a stack location if the argument was passed in a volatile
-register and wasn't allocated a non-volatile one). caller-save registers used by the
-function are saved in the prolog as well.
-
-mono_arch_emit_epilog () will emit the code needed to return from the function,
-optionally calling the profiling or tracing callbacks. At this point the basic blocks
-or the code that was moved out of the normal flow for the function can be emitted
-as well (this is usually done to provide better info for the static branch predictor).
-In the epilog, caller-save registers are restored if they were used.
-Note that, to help exception handling and stack unwinding, when there is a transition
-from managed to unmanaged code, some special processing needs to be done (basically,
-saving all the registers and setting up the links in the Last Managed Frame
-structure).
-
-When the epilog has been emitted, the upper level code arranges for the buffer of
-memory that contains the native code to be copied in an area of executable memory
-and at this point, instructions that use relative addressing need to be patched
-to have the right offsets: this work is done by mono_arch_patch_code ().
+ Since the first step in porting mono to a new CPU is to port
+ the interpreter, there should be already a file that allows
+ the emission of binary native code in a buffer for the
+ architecture. This file should be placed in the
+
+ mono/arch/$(arch)/
+
+ directory.
+
+ The bulk of the code emission happens in the mini-$(arch).c
+ file, in a function called mono_arch_output_basic_block
+ (). This function takes a basic block, walks the list of
+ instructions in the block and emits the binary code for each.
+ Optionally a peephole optimization pass is done on the basic
+ block, but this can be left for later, when the port actually
+ works.
+
+ This function is very simple, there is just a big switch on
+ the instruction opcode and in the corresponding case the
+ functions or macros to emit the binary native code are
+ used. Note that in this function the lengths of the
+ instructions are used to determine if the buffer for the code
+ needs enlarging.
+
+ To complete the code emission for a method, a few other
+ functions need implementing as well:
+
+ mono_arch_emit_prolog ()
+ mono_arch_emit_epilog ()
+ mono_arch_patch_code ()
+
+ mono_arch_emit_prolog () will emit the code to setup the stack
+ frame for a method, optionally call the callbacks used in
+ profiling and tracing, and move the arguments to their home
+ location (in a caller-save register if the variable was
+ allocated to one, or in a stack location if the argument was
+ passed in a volatile register and wasn't allocated a
+ non-volatile one). caller-save registers used by the function
+ are saved in the prolog as well.
+
+ mono_arch_emit_epilog () will emit the code needed to return
+ from the function, optionally calling the profiling or tracing
+ callbacks. At this point the basic blocks or the code that was
+ moved out of the normal flow for the function can be emitted
+ as well (this is usually done to provide better info for the
+ static branch predictor). In the epilog, caller-save
+ registers are restored if they were used.
+
+ Note that, to help exception handling and stack unwinding,
+ when there is a transition from managed to unmanaged code,
+ some special processing needs to be done (basically, saving
+ all the registers and setting up the links in the Last Managed
+ Frame structure).
+
+ When the epilog has been emitted, the upper level code
+ arranges for the buffer of memory that contains the native
+ code to be copied in an area of executable memory and at this
+ point, instructions that use relative addressing need to be
+ patched to have the right offsets: this work is done by
+ mono_arch_patch_code ().
* Call conventions and register allocation
-To account for the differences in the call conventions, a few functions need to
-be implemented.
-
-mono_arch_allocate_vars () assigns to both arguments and local variables
-the offset relative to the frame register where they are stored, dead
-variables are simply discarded. The total amount of stack needed is calculated.
-
-mono_arch_call_opcode () is the function that more closely deals with the call
-convention on a given system. For each argument to a function call, an instruction
-is created that actually puts the argument where needed, be it the stack or a
-specific register. This function can also re-arrange th order of evaluation
-when multiple arguments are involved if needed (like, on x86 arguments are pushed
-on the stack in reverse order). The function needs to carefully take into accounts
-platform specific issues, like how structures are returned as well as the
-differences in size and/or alignment of managed and corresponding unmanaged
-structures.
-
-The other chunk of code that needs to deal with the call convention and other
-specifics of a CPU, is the local register allocator, implemented in a function
-named mono_arch_local_regalloc (). The local allocator deals with a basic block
-at a time and basically just allocates registers for temporary
-values during expression evaluation, spilling and unspilling as necessary.
-The local allocator needs to take into account clobbering information, both
-during simple instructions and during function calls and it needs to deal
-with other architecture-specific weirdnesses, like instructions that take
-inputs only in specific registers or output only is some.
-Some effort will be put later in moving most of the local register allocator to
-a common file so that the code can be shared more for similar, risc-like CPUs.
-The register allocator does a first pass on the instructions in a block, collecting
-liveness information and in a backward pass on the same list performs the
-actual register allocation, inserting the instructions needed to spill values,
-if necessary.
-
-When this part of code is implemented, some testing can be done with the generated
-code for the new architecture. Most helpful is the use of the --regression
-command line switch to run the regression tests (basic.cs, for example).
-Note that the JIT will try to initialize the runtime, but it may not be able yet to
-compile and execute complex code: commenting most of the code in the mini_init()
-function in mini.c is needed to let the JIT just compile the regression tests.
-Also, using multiple -v switches on the command line makes the JIT dump an
-increasing amount of information during compilation.
-
-
+ To account for the differences in the call conventions, a few functions need to
+ be implemented.
+
+ mono_arch_allocate_vars () assigns to both arguments and local
+ variables the offset relative to the frame register where they
+ are stored, dead variables are simply discarded. The total
+ amount of stack needed is calculated.
+
+ mono_arch_call_opcode () is the function that more closely
+ deals with the call convention on a given system. For each
+ argument to a function call, an instruction is created that
+ actually puts the argument where needed, be it the stack or a
+ specific register. This function can also re-arrange th order
+ of evaluation when multiple arguments are involved if needed
+ (like, on x86 arguments are pushed on the stack in reverse
+ order). The function needs to carefully take into accounts
+ platform specific issues, like how structures are returned as
+ well as the differences in size and/or alignment of managed
+ and corresponding unmanaged structures.
+
+ The other chunk of code that needs to deal with the call
+ convention and other specifics of a CPU, is the local register
+ allocator, implemented in a function named
+ mono_arch_local_regalloc (). The local allocator deals with a
+ basic block at a time and basically just allocates registers
+ for temporary values during expression evaluation, spilling
+ and unspilling as necessary.
+
+ The local allocator needs to take into account clobbering
+ information, both during simple instructions and during
+ function calls and it needs to deal with other
+ architecture-specific weirdnesses, like instructions that take
+ inputs only in specific registers or output only is some.
+
+ Some effort will be put later in moving most of the local
+ register allocator to a common file so that the code can be
+ shared more for similar, risc-like CPUs. The register
+ allocator does a first pass on the instructions in a block,
+ collecting liveness information and in a backward pass on the
+ same list performs the actual register allocation, inserting
+ the instructions needed to spill values, if necessary.
+
+ When this part of code is implemented, some testing can be
+ done with the generated code for the new architecture. Most
+ helpful is the use of the --regression command line switch to
+ run the regression tests (basic.cs, for example).
+
+ Note that the JIT will try to initialize the runtime, but it
+ may not be able yet to compile and execute complex code:
+ commenting most of the code in the mini_init() function in
+ mini.c is needed to let the JIT just compile the regression
+ tests. Also, using multiple -v switches on the command line
+ makes the JIT dump an increasing amount of information during
+ compilation.
+
+
* Method trampolines
-To get better startup performance, the JIT actually compiles a method only when
-needed. To achieve this, when a call to a method is compiled, we actually emit a
-call to a magic trampoline. The magic trampoline is a function written in assembly
-that invokes the compiler to compile the given method and jumps to the newly compiled
-code, ensuring the arguments it received are passed correctly to the actual method.
-Before jumping to the new code, though, the magic trampoline takes care of patching
-the call site so that next time the call will go directly to the method instead of the
-trampoline. How does this all work?
-mono_arch_create_jit_trampoline () creates a small function that just
-preserves the arguments passed to it and adds an additional argument (the method
-to compile) before calling the generic trampoline. This small function is called
-the specific trampoline, because it is method-specific (the method to compile
-is hard-code in the instruction stream).
-The generic trampoline saves all the arguments that could get clobbered
-and calls a C function that will do two things:
-
-*) actually call the JIT to compile the method
-*) identify the calling code so that it can be patched to call directly
-the actual method
-
-If the 'this' argument to a method is a boxed valuetype that is passed to
-a method that expects just a pointer to the data, an additional unboxing
-trampoline will need to be inserted as well.
-
+ To get better startup performance, the JIT actually compiles a
+ method only when needed. To achieve this, when a call to a
+ method is compiled, we actually emit a call to a magic
+ trampoline. The magic trampoline is a function written in
+ assembly that invokes the compiler to compile the given method
+ and jumps to the newly compiled code, ensuring the arguments
+ it received are passed correctly to the actual method.
+
+ Before jumping to the new code, though, the magic trampoline
+ takes care of patching the call site so that next time the
+ call will go directly to the method instead of the
+ trampoline. How does this all work?
+
+ mono_arch_create_jit_trampoline () creates a small function
+ that just preserves the arguments passed to it and adds an
+ additional argument (the method to compile) before calling the
+ generic trampoline. This small function is called the specific
+ trampoline, because it is method-specific (the method to
+ compile is hard-code in the instruction stream).
+
+ The generic trampoline saves all the arguments that could get
+ clobbered and calls a C function that will do two things:
+
+ *) actually call the JIT to compile the method
+ *) identify the calling code so that it can be patched to call directly
+ the actual method
+
+ If the 'this' argument to a method is a boxed valuetype that
+ is passed to a method that expects just a pointer to the data,
+ an additional unboxing trampoline will need to be inserted as
+ well.
+
* Exception handling
-Exception handling is likely the most difficult part of the port, as it needs
-to deal with unwinding (both managed and unmanaged code) and calling
-catch and filter blocks. It also needs to deal with signals, because mono
-takes advantage of the MMU in the CPU and of the operation system to
-handle dereferences of the NULL pointer. Some of the function needed
-to implement the mechanisms are:
-
-mono_arch_get_throw_exception () returns a function that takes an exception object
-and invokes an arch-specific function that will enter the exception processing.
-To do so, all the relevant registers need to be saved and passed on.
-
-mono_arch_handle_exception () this function takes the exception thrown and
-a context that describes the state of the CPU at the time the exception was
-thrown. The function needs to implement the exception handling mechanism,
-so it makes a search for an handler for the exception and if none is found,
-it follows the unhandled exception path (that can print a trace and exit or
-just abort the current thread). The difficulty here is to unwind the stack
-correctly, by restoring the register state at each call site in the call chain,
-calling finally, filters and handler blocks while doing so.
-
-As part of exception handling a couple of internal calls need to be implemented
-as well.
-ves_icall_get_frame_info () returns info about a specific frame.
-mono_jit_walk_stack () walks the stack and calls a callback with info for
-each frame found.
-ves_icall_get_trace () return an array of StackFrame objects.
-
+ Exception handling is likely the most difficult part of the
+ port, as it needs to deal with unwinding (both managed and
+ unmanaged code) and calling catch and filter blocks. It also
+ needs to deal with signals, because mono takes advantage of
+ the MMU in the CPU and of the operation system to handle
+ dereferences of the NULL pointer. Some of the function needed
+ to implement the mechanisms are:
+
+ mono_arch_get_throw_exception () returns a function that takes
+ an exception object and invokes an arch-specific function that
+ will enter the exception processing. To do so, all the
+ relevant registers need to be saved and passed on.
+
+ mono_arch_handle_exception () this function takes the
+ exception thrown and a context that describes the state of the
+ CPU at the time the exception was thrown. The function needs
+ to implement the exception handling mechanism, so it makes a
+ search for an handler for the exception and if none is found,
+ it follows the unhandled exception path (that can print a
+ trace and exit or just abort the current thread). The
+ difficulty here is to unwind the stack correctly, by restoring
+ the register state at each call site in the call chain,
+ calling finally, filters and handler blocks while doing so.
+
+ As part of exception handling a couple of internal calls need
+ to be implemented as well.
+
+ ves_icall_get_frame_info () returns info about a specific
+ frame.
+
+ mono_jit_walk_stack () walks the stack and calls a callback with info for
+ each frame found.
+
+ ves_icall_get_trace () return an array of StackFrame objects.
+
** Code generation for filter/finally handlers
-Filter and finally handlers are called from 2 different locations:
-
- 1.) from within the method containing the exception clauses
- 2.) from the stack unwinding code
-
-To make this possible we implement them like subroutines, ending with a
-"return" statement. The subroutine does not save the base pointer, because we
-need access to the local variables of the enclosing method. Its is possible
-that instructions inside those handlers modify the stack pointer, thus we save
-the stack pointer at the start of the handler, and restore it at the end. We
-have to use a "call" instruction to execute such finally handlers.
-
-The MIR code for filter and finally handlers looks like:
-
- OP_START_HANDLER
- ...
- OP_END_FINALLY | OP_ENDFILTER(reg)
-
-OP_START_HANDLER: should save the stack pointer somewhere
-OP_END_FINALLY: restores the stack pointers and returns.
-OP_ENDFILTER (reg): restores the stack pointers and returns the value in "reg".
-
+ Filter and finally handlers are called from 2 different locations:
+
+ 1.) from within the method containing the exception clauses
+ 2.) from the stack unwinding code
+
+ To make this possible we implement them like subroutines,
+ ending with a "return" statement. The subroutine does not save
+ the base pointer, because we need access to the local
+ variables of the enclosing method. Its is possible that
+ instructions inside those handlers modify the stack pointer,
+ thus we save the stack pointer at the start of the handler,
+ and restore it at the end. We have to use a "call" instruction
+ to execute such finally handlers.
+
+ The MIR code for filter and finally handlers looks like:
+
+ OP_START_HANDLER
+ ...
+ OP_END_FINALLY | OP_ENDFILTER(reg)
+
+ OP_START_HANDLER: should save the stack pointer somewhere
+ OP_END_FINALLY: restores the stack pointers and returns.
+ OP_ENDFILTER (reg): restores the stack pointers and returns the value in "reg".
+
** Calling finally/filter handlers
-There is a special opcode to call those handler, its called OP_CALL_HANDLER. It
-simple emits a call instruction.
-
-Its a bit more complex to call handler from outside (in the stack unwinding
-code), because we have to restore the whole context of the method first. After that
-we simply emit a call instruction to invoke the handler. Its usually
-possible to use the same code to call filter and finally handlers (see
-arch_get_call_filter).
-
+ There is a special opcode to call those handler, its called
+ OP_CALL_HANDLER. It simple emits a call instruction.
+
+ Its a bit more complex to call handler from outside (in the
+ stack unwinding code), because we have to restore the whole
+ context of the method first. After that we simply emit a call
+ instruction to invoke the handler. Its usually possible to use
+ the same code to call filter and finally handlers (see
+ arch_get_call_filter).
+
** Calling catch handlers
-Catch handlers are always called from the stack unwinding code. Unlike finally clauses
-or filters, catch handler never return. Instead we simply restore the whole
-context, and restart execution at the catch handler.
-
+ Catch handlers are always called from the stack unwinding
+ code. Unlike finally clauses or filters, catch handler never
+ return. Instead we simply restore the whole context, and
+ restart execution at the catch handler.
+
** Passing Exception objects to catch handlers and filters.
-We use a local variable to store exception objects. The stack unwinding code
-must store the exception object into this variable before calling catch handler
-or filter.
-
+ We use a local variable to store exception objects. The stack
+ unwinding code must store the exception object into this
+ variable before calling catch handler or filter.
+
* Minor helper methods
-A few minor helper methods are referenced from the arch-independent code.
-Some of them are:
-
-*) mono_arch_cpu_optimizations ()
- This function returns a mask of optimizations that should be enabled for the
- current CPU and a mask of optimizations that should be excluded, instead.
-
-*) mono_arch_regname ()
- Returns the name for a numeric register.
-
-*) mono_arch_get_allocatable_int_vars ()
- Returns a list of variables that can be allocated to the integer registers
- in the current architecture.
-
-*) mono_arch_get_global_int_regs ()
- Returns a list of caller-save registers that can be used to allocate variables
- in the current method.
-
-*) mono_arch_instrument_mem_needs ()
-*) mono_arch_instrument_prolog ()
-*) mono_arch_instrument_epilog ()
- Functions needed to implement the profiling interface.
-
-
+ A few minor helper methods are referenced from the arch-independent code.
+ Some of them are:
+
+ *) mono_arch_cpu_optimizations ()
+ This function returns a mask of optimizations that
+ should be enabled for the current CPU and a mask of
+ optimizations that should be excluded, instead.
+
+ *) mono_arch_regname ()
+ Returns the name for a numeric register.
+
+ *) mono_arch_get_allocatable_int_vars ()
+ Returns a list of variables that can be allocated to
+ the integer registers in the current architecture.
+
+ *) mono_arch_get_global_int_regs ()
+ Returns a list of caller-save registers that can be
+ used to allocate variables in the current method.
+
+ *) mono_arch_instrument_mem_needs ()
+ *) mono_arch_instrument_prolog ()
+ *) mono_arch_instrument_epilog ()
+ Functions needed to implement the profiling interface.
+
+
* Writing regression tests
-Regression tests for the JIT should be written for any bug found in the JIT
-in one of the *.cs files in the mini directory. Eventually all the operations
-of the JIT should be tested (including the ones that get selected only when
-some specific optimization is enabled).
-
+ Regression tests for the JIT should be written for any bug
+ found in the JIT in one of the *.cs files in the mini
+ directory. Eventually all the operations of the JIT should be
+ tested (including the ones that get selected only when some
+ specific optimization is enabled).
+
* Platform specific optimizations
-An example of a platform-specific optimization is the peephole optimization:
-we look at a small window of code at a time and we replace one or more
-instructions with others that perform better for the given architecture or CPU.
-
+ An example of a platform-specific optimization is the peephole
+ optimization: we look at a small window of code at a time and
+ we replace one or more instructions with others that perform
+ better for the given architecture or CPU.
+
diff --git a/mono/mini/mini-ppc.c b/mono/mini/mini-ppc.c
index 04ebb088359..651744a868e 100644
--- a/mono/mini/mini-ppc.c
+++ b/mono/mini/mini-ppc.c
@@ -499,24 +499,15 @@ mono_arch_flush_icache (guint8 *code, gint size)
#define NOT_IMPLEMENTED(x) \
g_error ("FIXME: %s is not yet implemented. (trampoline)", x);
-#define PROLOG_INS 8
-#define CALL_INS 2
-#define EPILOG_INS 6
#define FLOAT_REGS 8
#define GENERAL_REGS 8
#ifdef __APPLE__
-#define MINIMAL_STACK_SIZE 10
#define ALWAYS_ON_STACK(s) s
#define FP_ALSO_IN_REG(s) s
-#define RET_ADDR_OFFSET 8
-#define STACK_PARAM_OFFSET 24
#else
-#define MINIMAL_STACK_SIZE 5
#define ALWAYS_ON_STACK(s)
#define FP_ALSO_IN_REG(s) s
#define ALIGN_DOUBLES
-#define RET_ADDR_OFFSET 4
-#define STACK_PARAM_OFFSET 8
#endif
enum {
@@ -560,21 +551,21 @@ add_general (guint *gr, guint *stack_size, ArgInfo *ainfo, gboolean simple)
}
} else {
if (*gr >= 3 + GENERAL_REGS - 1) {
+#ifdef ALIGN_DOUBLES
+ //*stack_size += (*stack_size % 8);
+#endif
ainfo->offset = PPC_STACK_PARAM_OFFSET + *stack_size;
ainfo->reg = ppc_sp; /* in the caller */
ainfo->regtype = RegTypeBase;
*stack_size += 8;
+ } else {
#ifdef ALIGN_DOUBLES
- *stack_size += (*stack_size % 8);
+ if (!((*gr) & 1))
+ (*gr) ++;
#endif
- } else {
ALWAYS_ON_STACK (*stack_size += 8);
ainfo->reg = *gr;
}
-#ifdef ALIGN_DOUBLES
- if ((*gr) & 1)
- (*gr) ++;
-#endif
(*gr) ++;
}
(*gr) ++;
@@ -2270,11 +2261,16 @@ ppc_patch (guchar *code, guchar *target)
// absolute address
if (ins & 2) {
guint32 li = (guint32)target;
+ ovf = li & 0xfc000000;
+ if ((li & 3) || ovf)
+ g_assert_not_reached ();
ins = prim << 26 | (ins & 3);
ins |= li;
- // FIXME: assert the top bits of li are 0
} else {
gint diff = target - code;
+ ovf = diff & 0xfc000000;
+ if ((diff & 3) || (ovf != 0 && ovf != 0xfc000000))
+ g_assert_not_reached ();
ins = prim << 26 | (ins & 3);
diff &= ~3;
diff &= ~(63 << 26);
diff --git a/mono/mini/mini-ppc.h b/mono/mini/mini-ppc.h
index 714913645c1..4a866f278cf 100644
--- a/mono/mini/mini-ppc.h
+++ b/mono/mini/mini-ppc.h
@@ -12,6 +12,8 @@
* reproduceable results for benchmarks */
#define MONO_ARCH_CODE_ALIGNMENT 32
+void ppc_patch (guchar *code, guchar *target);
+
struct MonoLMF {
gpointer previous_lmf;
gpointer lmf_addr;
diff --git a/mono/mini/mini-x86.c b/mono/mini/mini-x86.c
index 34761bbc7cc..82eb38bd29a 100644
--- a/mono/mini/mini-x86.c
+++ b/mono/mini/mini-x86.c
@@ -4,6 +4,7 @@
* Authors:
* Paolo Molaro (lupus@ximian.com)
* Dietmar Maurer (dietmar@ximian.com)
+ * Patrik Torstensson
*
* (C) 2003 Ximian, Inc.
*/
@@ -22,6 +23,13 @@
static gint lmf_tls_offset = -1;
+#ifdef PLATFORM_WIN32
+/* Under windows, the default pinvoke calling convention is stdcall */
+#define CALLCONV_IS_STDCALL(call_conv) (((call_conv) == MONO_CALL_STDCALL) || ((call_conv) == MONO_CALL_DEFAULT))
+#else
+#define CALLCONV_IS_STDCALL(call_conv) ((call_conv) == MONO_CALL_STDCALL)
+#endif
+
const char*
mono_arch_regname (int reg) {
switch (reg) {
@@ -1251,7 +1259,7 @@ typedef struct {
int killed_in;
int last_use;
int prev_use;
- int fpflags; /* used to track if we spill/load */
+ int flags; /* used to track fp spill/load */
} RegTrack;
static const char*const * ins_spec = pentium_desc;
@@ -1494,10 +1502,10 @@ alloc_int_reg (MonoCompile *cfg, InstList *curinst, MonoInst *ins, int sym_reg,
}
#endif
-/* flags used in reginfo->fpflags */
-#define MONO_X86_FP_NEEDS_LOAD_SPILL 32
-#define MONO_X86_FP_NEEDS_SPILL 64
-#define MONO_X86_FP_NEEDS_LOAD 128
+/* flags used in reginfo->flags */
+#define MONO_X86_FP_NEEDS_LOAD_SPILL 1
+#define MONO_X86_FP_NEEDS_SPILL 2
+#define MONO_X86_FP_NEEDS_LOAD 4
/*#include "cprop.c"*/
@@ -1551,7 +1559,7 @@ mono_arch_local_regalloc (MonoCompile *cfg, MonoBasicBlock *bb)
spill = g_list_first (fspill_list);
if (spill && fpcount < MONO_MAX_FREGS) {
- reginfo1 [ins->sreg1].fpflags |= MONO_X86_FP_NEEDS_LOAD;
+ reginfo1 [ins->sreg1].flags |= MONO_X86_FP_NEEDS_LOAD;
fspill_list = g_list_remove (fspill_list, spill->data);
} else
fpcount--;
@@ -1569,12 +1577,12 @@ mono_arch_local_regalloc (MonoCompile *cfg, MonoBasicBlock *bb)
reginfo2 = reginfof;
spill = g_list_first (fspill_list);
if (spill) {
- reginfo2 [ins->sreg2].fpflags |= MONO_X86_FP_NEEDS_LOAD;
+ reginfo2 [ins->sreg2].flags |= MONO_X86_FP_NEEDS_LOAD;
fspill_list = g_list_remove (fspill_list, spill->data);
if (fpcount >= MONO_MAX_FREGS) {
fspill++;
fspill_list = g_list_prepend (fspill_list, GINT_TO_POINTER(fspill));
- reginfo2 [ins->sreg2].fpflags |= MONO_X86_FP_NEEDS_LOAD_SPILL;
+ reginfo2 [ins->sreg2].flags |= MONO_X86_FP_NEEDS_LOAD_SPILL;
}
} else
fpcount--;
@@ -1590,7 +1598,7 @@ mono_arch_local_regalloc (MonoCompile *cfg, MonoBasicBlock *bb)
if (spec [MONO_INST_DEST] == 'f') {
reginfod = reginfof;
if (fpcount >= MONO_MAX_FREGS) {
- reginfod [ins->dreg].fpflags |= MONO_X86_FP_NEEDS_SPILL;
+ reginfod [ins->dreg].flags |= MONO_X86_FP_NEEDS_SPILL;
fspill++;
fspill_list = g_list_prepend (fspill_list, GINT_TO_POINTER(fspill));
fpcount--;
@@ -1771,7 +1779,7 @@ mono_arch_local_regalloc (MonoCompile *cfg, MonoBasicBlock *bb)
/* Track dreg */
if (spec [MONO_INST_DEST] == 'f') {
- if (reginfof [ins->dreg].fpflags & MONO_X86_FP_NEEDS_SPILL) {
+ if (reginfof [ins->dreg].flags & MONO_X86_FP_NEEDS_SPILL) {
GList *spill_node;
MonoInst *store;
spill_node = g_list_first (fspill_list);
@@ -1873,11 +1881,11 @@ mono_arch_local_regalloc (MonoCompile *cfg, MonoBasicBlock *bb)
/* Track sreg1 */
if (spec [MONO_INST_SRC1] == 'f') {
- if (reginfof [ins->sreg1].fpflags & MONO_X86_FP_NEEDS_LOAD) {
+ if (reginfof [ins->sreg1].flags & MONO_X86_FP_NEEDS_LOAD) {
MonoInst *load;
MonoInst *store = NULL;
- if (reginfof [ins->sreg1].fpflags & MONO_X86_FP_NEEDS_LOAD_SPILL) {
+ if (reginfof [ins->sreg1].flags & MONO_X86_FP_NEEDS_LOAD_SPILL) {
GList *spill_node;
spill_node = g_list_first (fspill_list);
g_assert (spill_node);
@@ -1951,16 +1959,16 @@ mono_arch_local_regalloc (MonoCompile *cfg, MonoBasicBlock *bb)
}
/* track sreg2 */
if (spec [MONO_INST_SRC2] == 'f') {
- if (reginfof [ins->sreg2].fpflags & MONO_X86_FP_NEEDS_LOAD) {
+ if (reginfof [ins->sreg2].flags & MONO_X86_FP_NEEDS_LOAD) {
MonoInst *load;
MonoInst *store = NULL;
- if (reginfof [ins->sreg2].fpflags & MONO_X86_FP_NEEDS_LOAD_SPILL) {
+ if (reginfof [ins->sreg2].flags & MONO_X86_FP_NEEDS_LOAD_SPILL) {
GList *spill_node;
spill_node = g_list_first (fspill_list);
g_assert (spill_node);
- if (spec [MONO_INST_SRC1] == 'f' && (reginfof [ins->sreg1].fpflags & MONO_X86_FP_NEEDS_LOAD_SPILL))
+ if (spec [MONO_INST_SRC1] == 'f' && (reginfof [ins->sreg1].flags & MONO_X86_FP_NEEDS_LOAD_SPILL))
spill_node = g_list_next (spill_node);
store = create_spilled_store_float (cfg, GPOINTER_TO_INT (spill_node->data), ins->sreg2, ins);
@@ -2558,7 +2566,7 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
mono_add_patch_info (cfg, offset, MONO_PATCH_INFO_ABS, call->fptr);
}
x86_call_code (code, 0);
- if (call->stack_usage && (call->signature->call_convention != MONO_CALL_STDCALL))
+ if (call->stack_usage && !CALLCONV_IS_STDCALL (call->signature->call_convention))
x86_alu_reg_imm (code, X86_ADD, X86_ESP, call->stack_usage);
break;
case OP_FCALL_REG:
@@ -2568,7 +2576,7 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
case OP_CALL_REG:
call = (MonoCallInst*)ins;
x86_call_reg (code, ins->sreg1);
- if (call->stack_usage && (call->signature->call_convention != MONO_CALL_STDCALL))
+ if (call->stack_usage && !CALLCONV_IS_STDCALL (call->signature->call_convention))
x86_alu_reg_imm (code, X86_ADD, X86_ESP, call->stack_usage);
break;
case OP_FCALL_MEMBASE:
@@ -2578,7 +2586,7 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
case OP_CALL_MEMBASE:
call = (MonoCallInst*)ins;
x86_call_membase (code, ins->sreg1, ins->inst_offset);
- if (call->stack_usage && (call->signature->call_convention != MONO_CALL_STDCALL))
+ if (call->stack_usage && !CALLCONV_IS_STDCALL (call->signature->call_convention))
x86_alu_reg_imm (code, X86_ADD, X86_ESP, call->stack_usage);
break;
case OP_OUTARG:
@@ -3578,7 +3586,7 @@ mono_arch_emit_epilog (MonoCompile *cfg)
x86_leave (code);
- if (sig->call_convention == MONO_CALL_STDCALL) {
+ if (CALLCONV_IS_STDCALL (sig->call_convention)) {
MonoJitArgumentInfo *arg_info = alloca (sizeof (MonoJitArgumentInfo) * (sig->param_count + 1));
stack_to_pop = arch_get_argument_info (sig, sig->param_count, arg_info);
diff --git a/mono/mini/mini.c b/mono/mini/mini.c
index 3d163cc1f5a..3a89f635852 100644
--- a/mono/mini/mini.c
+++ b/mono/mini/mini.c
@@ -97,6 +97,7 @@ static MonoMethodSignature *helper_sig_double_double_double = NULL;
static MonoMethodSignature *helper_sig_uint_double = NULL;
static MonoMethodSignature *helper_sig_int_double = NULL;
static MonoMethodSignature *helper_sig_stelem_ref = NULL;
+static MonoMethodSignature *helper_sig_stelem_ref_check = NULL;
static MonoMethodSignature *helper_sig_class_init_trampoline = NULL;
static MonoMethodSignature *helper_sig_obj_obj_cls = NULL;
@@ -405,7 +406,8 @@ mono_jump_info_token_new (MonoMemPool *mp, MonoImage *image, guint32 token)
(dest)->opcode = OP_LDADDR; \
(dest)->type = STACK_MP; \
(dest)->klass = (dest)->inst_i0->klass; \
- (cfg)->disable_ssa = TRUE; \
+ if (!MONO_TYPE_ISSTRUCT (header->locals [(num)])) \
+ (cfg)->disable_ssa = TRUE; \
} while (0)
#define NEW_RETLOADA(cfg,dest) do { \
@@ -448,7 +450,8 @@ mono_jump_info_token_new (MonoMemPool *mp, MonoImage *image, guint32 token)
(dest)->opcode = OP_LDADDR; \
(dest)->type = STACK_MP; \
(dest)->klass = (dest)->inst_i0->klass; \
- (cfg)->disable_ssa = TRUE; \
+ if (!MONO_TYPE_ISSTRUCT (cfg->varinfo [(num)]->inst_vtype)) \
+ (cfg)->disable_ssa = TRUE; \
} while (0)
@@ -669,9 +672,19 @@ link_bblock (MonoCompile *cfg, MonoBasicBlock *from, MonoBasicBlock* to)
}
}
-/*
- * We mark each basic block with a region ID. We use that to avoid BB
- * optimizations when blocks are in different regions.
+/**
+ * mono_find_block_region:
+ *
+ * We mark each basic block with a region ID. We use that to avoid BB
+ * optimizations when blocks are in different regions.
+ *
+ * Returns:
+ * A region token that encodes where this region is, and information
+ * about the clause owner for this block.
+ *
+ * The region encodes the try/catch/filter clause that owns this block
+ * as well as the type. -1 is a special value that represents a block
+ * that is in none of try/catch/filter.
*/
static int
mono_find_block_region (MonoCompile *cfg, int offset, int *filter_lengths)
@@ -1174,11 +1187,11 @@ type_from_op (MonoInst *ins) {
/* FIXME: handle some specifics with ins->next->type */
ins->type = bin_comp_table [ins->inst_i0->type] [ins->inst_i1->type] ? STACK_I4: STACK_INV;
return;
- case 256+CEE_CEQ:
- case 256+CEE_CGT:
- case 256+CEE_CGT_UN:
- case 256+CEE_CLT:
- case 256+CEE_CLT_UN:
+ case OP_CEQ:
+ case OP_CGT:
+ case OP_CGT_UN:
+ case OP_CLT:
+ case OP_CLT_UN:
ins->type = bin_comp_table [ins->inst_i0->type] [ins->inst_i1->type] ? STACK_I4: STACK_INV;
ins->opcode += ceqops_op_map [ins->inst_i0->type];
return;
@@ -2250,10 +2263,7 @@ mini_get_ldelema_ins (MonoCompile *cfg, MonoBasicBlock *bblock, MonoMethod *cmet
MonoMethodSignature *esig;
rank = cmethod->signature->param_count - (is_set? 1: 0);
- /*
- * FIXME: handle TypeMismatch for set or use the slow path
- * for that.
- */
+
if (rank == 2 && (cfg->opt & MONO_OPT_INTRINS)) {
MonoInst *indexes;
NEW_GROUP (cfg, indexes, sp [1], sp [2]);
@@ -2471,7 +2481,7 @@ inline_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsig,
#define TYPE_PARAM_TO_TYPE(num) (method->klass->generic_inst->data.generic_inst->type_argv [(num)])
#define TYPE_PARAM_TO_CLASS(num) (mono_class_from_mono_type (TYPE_PARAM_TO_TYPE ((num))))
-#define MTYPE_PARAM_TO_TYPE(num) (((MonoMethodNormal *) method)->header->geninst->type_argv [(num)])
+#define MTYPE_PARAM_TO_TYPE(num) (((MonoMethodNormal *) method)->header->geninst->mtype_argv [(num)])
#define MTYPE_PARAM_TO_CLASS(num) (mono_class_from_mono_type (MTYPE_PARAM_TO_TYPE ((num))))
@@ -3285,6 +3295,17 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
MonoInst *addr;
if (strcmp (cmethod->name, "Set") == 0) { /* array Set */
+ if (sp [fsig->param_count]->type == STACK_OBJ) {
+ MonoInst *iargs [2];
+
+ handle_loaded_temps (cfg, bblock, stack_start, sp);
+
+ iargs [0] = sp [0];
+ iargs [1] = sp [fsig->param_count];
+
+ mono_emit_jit_icall (cfg, bblock, helper_stelem_ref_check, iargs, ip);
+ }
+
addr = mini_get_ldelema_ins (cfg, bblock, cmethod, sp, ip, TRUE);
NEW_INDSTORE (cfg, ins, addr, sp [fsig->param_count], fsig->params [fsig->param_count - 1]);
ins->cil_code = ip;
@@ -4650,7 +4671,6 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
handle_loaded_temps (cfg, bblock, stack_start, sp);
MONO_ADD_INS (bblock, ins);
inline_costs += 1;
- cfg->disable_ssa = TRUE;
break;
}
case CEE_STELEM: {
@@ -4691,7 +4711,6 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
}
ip += 5;
inline_costs += 1;
- cfg->disable_ssa = TRUE;
break;
}
case CEE_STELEM_REF: {
@@ -4720,7 +4739,6 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
++ip;
inline_costs += 1;
- cfg->disable_ssa = TRUE;
break;
}
case CEE_CKFINITE: {
@@ -5188,7 +5206,16 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
case CEE_CLT_UN: {
MonoInst *cmp;
CHECK_STACK (2);
+ /*
+ * The following transforms:
+ * CEE_CEQ into OP_CEQ
+ * CEE_CGT into OP_CGT
+ * CEE_CGT_UN into OP_CGT_UN
+ * CEE_CLT into OP_CLT
+ * CEE_CLT_UN into OP_CLT_UN
+ */
MONO_INST_NEW (cfg, cmp, 256 + ip [1]);
+
MONO_INST_NEW (cfg, ins, cmp->opcode);
sp -= 2;
cmp->inst_i0 = sp [0];
@@ -5340,7 +5367,7 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
--sp;
if (sp != stack_start)
goto unverified;
- MONO_INST_NEW (cfg, ins, 256 + ip [1]);
+ MONO_INST_NEW (cfg, ins, OP_LOCALLOC);
ins->inst_left = *sp;
ins->cil_code = ip;
@@ -5423,7 +5450,6 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
MONO_ADD_INS (bblock, store);
store->inst_i0 = sp [0];
store->inst_i1 = load;
- break;
} else {
handle_initobj (cfg, bblock, *sp, NULL, klass, stack_start, sp);
}
@@ -5593,8 +5619,10 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
}
}
- /* we compute regions here, because the length of filter clauses is not known in advance.
- * It is computed in the CEE_ENDFILTER case in the above switch statement*/
+ /*
+ * we compute regions here, because the length of filter clauses is not known in advance.
+ * It is computed in the CEE_ENDFILTER case in the above switch statement
+ */
if (cfg->method == method) {
MonoBasicBlock *bb;
for (bb = cfg->bb_entry; bb; bb = bb->next_bb) {
@@ -5804,6 +5832,13 @@ create_helper_signature (void)
helper_sig_stelem_ref->ret = &mono_defaults.void_class->byval_arg;
helper_sig_stelem_ref->pinvoke = 1;
+ /* void* stelem_ref_check (MonoArray *, MonoObject *) */
+ helper_sig_stelem_ref_check = mono_metadata_signature_alloc (mono_defaults.corlib, 2);
+ helper_sig_stelem_ref_check->params [0] = &mono_defaults.array_class->byval_arg;
+ helper_sig_stelem_ref_check->params [1] = &mono_defaults.object_class->byval_arg;
+ helper_sig_stelem_ref_check->ret = &mono_defaults.void_class->byval_arg;
+ helper_sig_stelem_ref_check->pinvoke = 1;
+
/* long amethod (long, long) */
helper_sig_long_long_long = mono_metadata_signature_alloc (mono_defaults.corlib, 2);
helper_sig_long_long_long->params [0] = helper_sig_long_long_long->params [1] =
@@ -6550,13 +6585,26 @@ merge_basic_blocks (MonoBasicBlock *bb, MonoBasicBlock *bbn)
nullify_basic_block (bbn);
}
+/*
+ * Optimizes the branches on the Control Flow Graph
+ *
+ */
static void
-optimize_branches (MonoCompile *cfg) {
+optimize_branches (MonoCompile *cfg)
+{
int i, changed = FALSE;
MonoBasicBlock *bb, *bbn;
+ guint32 niterations;
+ /*
+ * Some crazy loops could cause the code below to go into an infinite
+ * loop, see bug #53003 for an example. To prevent this, we put an upper
+ * bound on the number of iterations.
+ */
+ niterations = 1000;
do {
changed = FALSE;
+ niterations --;
/* we skip the entry block (exit is handled specially instead ) */
for (bb = cfg->bb_entry->next_bb; bb; bb = bb->next_bb) {
@@ -6615,10 +6663,12 @@ optimize_branches (MonoCompile *cfg) {
}
}
}
- } while (changed);
+ } while (changed && (niterations > 0));
+ niterations = 1000;
do {
changed = FALSE;
+ niterations --;
/* we skip the entry block (exit is handled specially instead ) */
for (bb = cfg->bb_entry->next_bb; bb; bb = bb->next_bb) {
@@ -6706,7 +6756,7 @@ optimize_branches (MonoCompile *cfg) {
}
}
}
- } while (changed);
+ } while (changed && (niterations > 0));
}
@@ -7513,7 +7563,7 @@ mono_jit_compile_method_inner (MonoMethod *method)
method->addr = mono_lookup_internal_call (method);
else
if (method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL)
- mono_lookup_pinvoke_call (method);
+ mono_lookup_pinvoke_call (method, NULL, NULL);
}
#ifdef MONO_USE_EXC_TABLES
if (mono_method_blittable (method)) {
@@ -7934,6 +7984,7 @@ mini_init (const char *filename)
mono_register_jit_icall (helper_memset, "helper_memset", helper_sig_memset, FALSE);
mono_register_jit_icall (helper_initobj, "helper_initobj", helper_sig_initobj, FALSE);
mono_register_jit_icall (helper_stelem_ref, "helper_stelem_ref", helper_sig_stelem_ref, FALSE);
+ mono_register_jit_icall (helper_stelem_ref_check, "helper_stelem_ref_check", helper_sig_stelem_ref_check, FALSE);
mono_register_jit_icall (mono_object_new, "mono_object_new", helper_sig_object_new, FALSE);
mono_register_jit_icall (mono_object_new_specific, "mono_object_new_specific", helper_sig_object_new_specific, FALSE);
mono_register_jit_icall (mono_object_new_fast, "mono_object_new_fast", helper_sig_object_new_specific, FALSE);
diff --git a/mono/mini/mini.h b/mono/mini/mini.h
index a0267f14a80..6b609a13b01 100644
--- a/mono/mini/mini.h
+++ b/mono/mini/mini.h
@@ -190,6 +190,20 @@ struct MonoBasicBlock {
/* we use that to prevent merging of bblock covered by different clauses*/
guint real_offset;
+
+ /*
+ * The region encodes whether the basic block is inside
+ * a finally, catch, filter or none of thoese.
+ *
+ * If the value is -1, then it is neither finally, catch nor filter
+ *
+ * Otherwise the format is:
+ *
+ * Bits: | 0-3 | 4-7 | 8-31
+ * | | |
+ * | clause-flags | MONO_REGION | clause-index
+ *
+ */
guint region;
/* The current symbolic register number, used in local register allocation. */
@@ -434,9 +448,10 @@ enum {
MONO_OPT_PRECOMP = 1 << 17
};
+/* Bit-fields in the MonoBasicBlock.region */
#define MONO_REGION_FINALLY 16
#define MONO_REGION_CATCH 32
-#define MONO_REGION_FAULT 64
+#define MONO_REGION_FAULT 64 /* Currently unused */
#define MONO_REGION_FILTER 128
/*
@@ -467,12 +482,15 @@ typedef struct {
MonoSpillInfo *spill_info; /* machine register spills */
MonoSpillInfo *spill_info_float; /* fp register spills */
gint spill_count;
- // unsigned char *cil_code;
+ /* unsigned char *cil_code; */
- MonoInst *exvar; /* the exception object passed to catch/filter blocks */
+ /* the exception object passed to catch/filter blocks */
+ MonoInst *exvar;
+
MonoInst *domainvar; /* a cache for the current domain */
+
/* A hashtable of region ID-> SP var mappings */
- /* An SP var is a place to store the stack pointer (used by handlers) */
+ /* An SP var is a place to store the stack pointer (used by handlers)*/
GHashTable *spvars;
GList *ldstr_list; /* used by AOT */
diff --git a/mono/mini/objects.cs b/mono/mini/objects.cs
index c11748644d7..f639b0a319b 100644
--- a/mono/mini/objects.cs
+++ b/mono/mini/objects.cs
@@ -244,6 +244,47 @@ class Tests {
return 0;
}
+ static int test_0_multi_array_cast () {
+ Duper[,] d = new Duper [1, 1];
+ object[,] o = d;
+
+ try {
+ o [0, 0] = new Super ();
+ return 1;
+ }
+ catch (ArrayTypeMismatchException) {
+ }
+
+ return 0;
+ }
+
+ static int test_0_vector_array_cast () {
+ Array arr1 = Array.CreateInstance (typeof (int), new int[] {1}, new int[] {0});
+ Array arr2 = Array.CreateInstance (typeof (int), new int[] {1}, new int[] {10});
+
+ if (arr1.GetType () != typeof (int[]))
+ return 1;
+
+ if (arr2.GetType () == typeof (int[]))
+ return 2;
+
+ int[] b;
+
+ b = (int[])arr1;
+
+ try {
+ b = (int[])arr2;
+ return 3;
+ }
+ catch (InvalidCastException) {
+ }
+
+ if (arr2 is int[])
+ return 4;
+
+ return 0;
+ }
+
static int test_0_enum_array_cast () {
TypeCode[] tc = new TypeCode [0];
object[] oa;
diff --git a/mono/mini/ssa.c b/mono/mini/ssa.c
index b689d789e4f..058c88acc79 100644
--- a/mono/mini/ssa.c
+++ b/mono/mini/ssa.c
@@ -104,7 +104,7 @@ replace_usage (MonoCompile *cfg, MonoBasicBlock *bb, MonoInst *inst, MonoInst **
} else {
new_var = cfg->varinfo [idx];
- if (new_var->opcode != OP_ARG) {
+ if ((new_var->opcode != OP_ARG) && (new_var->opcode != OP_LOCAL)) {
/* uninitialized variable ? */
g_warning ("using uninitialized variables %d in BB%d (%s)", idx, bb->block_num,
mono_method_full_name (cfg->method, TRUE));
@@ -188,7 +188,7 @@ mono_ssa_rename_vars (MonoCompile *cfg, int max_vars, MonoBasicBlock *bb, MonoIn
MonoInst *inst, *new_var;
int i, j, idx;
GList *tmp;
- MonoInst *new_stack [max_vars];
+ MonoInst **new_stack;
#ifdef DEBUG_SSA
printf ("RENAME VARS BB%d %s\n", bb->block_num, mono_method_full_name (cfg->method, TRUE));
@@ -245,9 +245,13 @@ mono_ssa_rename_vars (MonoCompile *cfg, int max_vars, MonoBasicBlock *bb, MonoIn
}
}
- for (tmp = bb->dominated; tmp; tmp = tmp->next) {
- memcpy (new_stack, stack, sizeof (MonoInst *) * max_vars);
- mono_ssa_rename_vars (cfg, max_vars, (MonoBasicBlock *)tmp->data, new_stack);
+ if (bb->dominated) {
+ new_stack = g_new (MonoInst*, max_vars);
+ for (tmp = bb->dominated; tmp; tmp = tmp->next) {
+ memcpy (new_stack, stack, sizeof (MonoInst *) * max_vars);
+ mono_ssa_rename_vars (cfg, max_vars, (MonoBasicBlock *)tmp->data, new_stack);
+ }
+ g_free (new_stack);
}
}
diff --git a/mono/mini/tramp-ppc.c b/mono/mini/tramp-ppc.c
index 0cf26e2c7de..b2bfc48fa53 100644
--- a/mono/mini/tramp-ppc.c
+++ b/mono/mini/tramp-ppc.c
@@ -1,5 +1,5 @@
/*
- * trampoline.c: JIT trampoline code
+ * tramp-ppc.c: JIT trampoline code for PowerPC
*
* Authors:
* Dietmar Maurer (dietmar@ximian.com)
@@ -56,8 +56,8 @@ get_unbox_trampoline (MonoMethod *m, gpointer addr)
start = code = g_malloc (20);
- ppc_load (code, ppc_r11, addr);
- ppc_mtctr (code, ppc_r11);
+ ppc_load (code, ppc_r0, addr);
+ ppc_mtctr (code, ppc_r0);
ppc_addi (code, this_pos, this_pos, sizeof (MonoObject));
ppc_bcctr (code, 20, 0);
g_assert ((code - start) <= 20);
@@ -183,7 +183,7 @@ ppc_magic_trampoline (MonoMethod *method, guint32 *code, char *sp)
start = o;
#if 1
/* FIXME: make the patching thread safe */
- ppc_ba (o, 0);
+ ppc_b (o, 0);
ppc_patch (o - 4, addr);
#else
ppc_stwu (o, ppc_r1, -16, ppc_r1);
@@ -360,7 +360,7 @@ create_trampoline_code (MonoTrampolineType tramp_type)
if (tramp_type == MONO_TRAMPOLINE_JUMP) {
ppc_li (buf, ppc_r4, 0);
} else
- ppc_lwz (buf, ppc_r4, STACK + 4, ppc_r1);
+ ppc_lwz (buf, ppc_r4, STACK + PPC_RET_ADDR_OFFSET, ppc_r1);
/* Arg 3: stack pointer */
ppc_mr (buf, ppc_r5, ppc_r1);
@@ -440,7 +440,7 @@ create_trampoline_code (MonoTrampolineType tramp_type)
/* Restore stack pointer, r31, LR and jump to the code */
ppc_lwz (buf, ppc_r1, 0, ppc_r1);
ppc_lwz (buf, ppc_r31, -4, ppc_r1);
- ppc_lwz (buf, ppc_r11, 4, ppc_r1);
+ ppc_lwz (buf, ppc_r11, PPC_RET_ADDR_OFFSET, ppc_r1);
ppc_mtlr (buf, ppc_r11);
ppc_mtctr (buf, ppc_r0);
ppc_bcctr (buf, 20, 0);
@@ -526,8 +526,7 @@ mono_arch_create_jit_trampoline (MonoMethod *method)
/* Now save LR - we'll overwrite it now */
ppc_mflr (buf, ppc_r11);
- ppc_stw (buf, ppc_r11, 4, ppc_r1);
- ppc_stw (buf, ppc_r11, 8, ppc_r1);
+ ppc_stw (buf, ppc_r11, PPC_RET_ADDR_OFFSET, ppc_r1);
/* Prepare the jump to the generic trampoline code.*/
ppc_lis (buf, ppc_r11, (guint32) vc >> 16);
diff --git a/mono/mini/tramp-sparc.c b/mono/mini/tramp-sparc.c
index 058748767f3..9d6cc52e721 100644
--- a/mono/mini/tramp-sparc.c
+++ b/mono/mini/tramp-sparc.c
@@ -1,5 +1,5 @@
/*
- * trampolinesparc.c: JIT trampoline code for Sparc 64
+ * tramp-sparc.c: JIT trampoline code for Sparc 64
*
* Authors:
* Mark Crichton (crichton@gimp.org)
@@ -251,7 +251,7 @@ mono_arch_create_jump_trampoline (MonoMethod *method)
if (method->iflags & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL)
method->addr = mono_lookup_internal_call (method);
if (method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL)
- mono_lookup_pinvoke_call (method);
+ mono_lookup_pinvoke_call (method, NULL, NULL);
}
#ifdef MONO_USE_EXC_TABLES
if (mono_method_blittable (method)) {
diff --git a/mono/mini/tramp-x86.c b/mono/mini/tramp-x86.c
index 94f29bace45..83bad9893f2 100644
--- a/mono/mini/tramp-x86.c
+++ b/mono/mini/tramp-x86.c
@@ -1,5 +1,5 @@
/*
- * trampoline.c: JIT trampoline code
+ * tramp-x86.c: JIT trampoline code for x86
*
* Authors:
* Dietmar Maurer (dietmar@ximian.com)
@@ -124,11 +124,21 @@ x86_magic_trampoline (int eax, int ecx, int edx, int esi, int edi,
/* The first part of the condition means an icall without a wrapper */
if ((!target_ji && m->addr) || mono_method_same_domain (ji, target_ji)) {
- InterlockedExchange ((gint32*)(code + 2), (guint)addr - ((guint)code + 1) - 5);
+ gboolean do_patch = TRUE;
+
+#ifdef HAVE_VALGRIND_MEMCHECK_H
+ if (RUNNING_ON_VALGRIND)
+ do_patch = FALSE;
+#endif
+
+ if (do_patch) {
+ InterlockedExchange ((gint32*)(code + 2), (guint)addr - ((guint)code + 1) - 5);
+
#ifdef HAVE_VALGRIND_MEMCHECK_H
- /* Tell valgrind to recompile the patched code */
- VALGRIND_DISCARD_TRANSLATIONS (code + 2, code + 6);
+ /* Tell valgrind to recompile the patched code */
+ VALGRIND_DISCARD_TRANSLATIONS (code + 2, code + 6);
#endif
+ }
}
return addr;
} else if ((code [4] == 0xff) && (((code [5] >> 6) & 0x3) == 0) && (((code [5] >> 3) & 0x7) == 2)) {
@@ -386,7 +396,7 @@ mono_arch_create_jump_trampoline (MonoMethod *method)
if (method->iflags & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL)
method->addr = mono_lookup_internal_call (method);
if (method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL)
- mono_lookup_pinvoke_call (method);
+ mono_lookup_pinvoke_call (method, NULL, NULL);
}
#ifdef MONO_USE_EXC_TABLES
if (mono_method_blittable (method)) {
diff --git a/mono/tests/ChangeLog b/mono/tests/ChangeLog
index 13cf80c5d07..6e94459cef7 100644
--- a/mono/tests/ChangeLog
+++ b/mono/tests/ChangeLog
@@ -1,3 +1,21 @@
+2004-01-30 Zoltan Varga <vargaz@freemail.hu>
+
+ * Makefile.am: Set SHELL to bash, since some commands require it.
+
+2004-01-22 Zoltan Varga <vargaz@freemail.hu>
+
+ * pinvoke17.cs: Fix test.
+
+2004-01-19 Zoltan Varga <vargaz@freemail.hu>
+
+ * pinvoke2.cs: Add tests for DllImport problems.
+
+ * pinvoke.cs: Make this run under linux.
+
+2004-01-09 Zoltan Varga <vargaz@freemail.hu>
+
+ * custom-attr.cs: Add test for properties with array type.
+
2003-12-13 Patrik Torstensson <p@rxc.se>
* bug-42136.cs: invalid liveness analyse for locals
diff --git a/mono/tests/Makefile.am b/mono/tests/Makefile.am
index 65a4f457522..400d3269747 100644
--- a/mono/tests/Makefile.am
+++ b/mono/tests/Makefile.am
@@ -3,6 +3,9 @@ TEST_PROG=../interpreter/mint
JITTEST_PROG=../mini/mono
RUNTIME_ARGS=--config tests-config --optimize=all
+# Some of the shell commands below require bash
+SHELL=bash
+
#CSC=csc /unsafe
CSC=mcs --unsafe -nowarn:0162
@@ -185,8 +188,8 @@ TEST_IL_SRC= \
initblkTest.il \
qt-instance.il \
vararg.il \
- bug-29859.il
-# even-odd.il
+ bug-29859.il \
+ even-odd.il
TESTSI_CS=$(TEST_CS_SRC:.cs=.exe)
diff --git a/mono/tests/custom-attr.cs b/mono/tests/custom-attr.cs
index 4fa114186a9..4105f244bfb 100644
--- a/mono/tests/custom-attr.cs
+++ b/mono/tests/custom-attr.cs
@@ -17,8 +17,23 @@ namespace Test {
ival = blah;
}
}
+
+ public class My3Attribute : Attribute {
+ char[] array_val;
+
+ public char[] Prop {
+ get {
+ return array_val;
+ }
+ set {
+ array_val = value;
+ }
+ }
+ }
+
[My("testclass")]
[My2("testclass", 22)]
+ [My3(Prop = new char [] { 'A', 'B', 'C' })]
public class Test {
static public int Main() {
System.Reflection.MemberInfo info = typeof (Test);
@@ -26,11 +41,18 @@ namespace Test {
for (int i = 0; i < attributes.Length; i ++) {
System.Console.WriteLine(attributes[i]);
}
- if (attributes.Length != 2)
+ if (attributes.Length != 3)
return 1;
- MyAttribute attr = (MyAttribute) attributes [0];
- if (attr.val != "testclass")
- return 2;
+ for (int i = 0; i < attributes.Length; ++i) {
+ if (attributes [i] is MyAttribute) {
+ if (((MyAttribute)attributes [i]).val != "testclass")
+ return 2;
+ }
+ if (attributes [i] is My3Attribute) {
+ if (new String (((My3Attribute)attributes [i]).Prop) != "ABC")
+ return 3;
+ }
+ }
return 0;
}
}
diff --git a/mono/tests/pinvoke.cs b/mono/tests/pinvoke.cs
index eaa62983d88..b929318a3e4 100755
--- a/mono/tests/pinvoke.cs
+++ b/mono/tests/pinvoke.cs
@@ -23,8 +23,12 @@ public class Test {
double f, double g, double h, double i, double j);
public static int Main () {
- puts ("A simple Test for PInvoke");
-
+ try {
+ puts ("A simple Test for PInvoke");
+ }
+ catch (DllNotFoundException) {
+ }
+
if (Math.Cos (Math.PI) != -1)
return 1;
if (Math.Acos (1) != 0)
diff --git a/mono/tests/pinvoke17.cs b/mono/tests/pinvoke17.cs
index 2b491b970d9..4df6d561e78 100644
--- a/mono/tests/pinvoke17.cs
+++ b/mono/tests/pinvoke17.cs
@@ -22,7 +22,7 @@ public class LibWrap
public static extern int GetVersionEx ([In, Out] OSVersionInfo osvi);
[DllImport ("libtest")]
- public static extern int BugGetVersionEx (int a, int b, int c, int d, int e, int f, int g, int h, OSVersionInfo osvi);
+ public static extern int BugGetVersionEx (int a, int b, int c, int d, int e, int f, int g, int h, [In, Out] OSVersionInfo osvi);
[DllImport ("libtest", EntryPoint="GetVersionEx" )]
public static extern int GetVersionEx2 (ref OSVersionInfo2 osvi);
diff --git a/mono/tests/pinvoke2.cs b/mono/tests/pinvoke2.cs
index 495724c0da8..be9e9d4872a 100755
--- a/mono/tests/pinvoke2.cs
+++ b/mono/tests/pinvoke2.cs
@@ -66,6 +66,15 @@ public class Tests {
public class EmptyClass {
}
+ [DllImport ("libnot-found", EntryPoint="not_found")]
+ public static extern int mono_library_not_found ();
+
+ [DllImport ("libtest", EntryPoint="not_found")]
+ public static extern int mono_entry_point_not_found ();
+
+ [DllImport ("libtest.dll", EntryPoint="mono_test_marshal_char")]
+ public static extern int mono_test_marshal_char_2 (char a1);
+
[DllImport ("libtest", EntryPoint="mono_test_marshal_char")]
public static extern int mono_test_marshal_char (char a1);
@@ -338,4 +347,36 @@ public class Tests {
else
return 1;
}
+
+ static int test_0_library_not_found () {
+
+ try {
+ mono_entry_point_not_found ();
+ return 1;
+ }
+ catch (EntryPointNotFoundException) {
+ }
+
+ return 0;
+ }
+
+ static int test_0_entry_point_not_found () {
+
+ try {
+ mono_library_not_found ();
+ return 1;
+ }
+ catch (DllNotFoundException) {
+ }
+
+ return 0;
+ }
+
+ /* Check that the runtime trims .dll from the library name */
+ static int test_0_trim_dll_from_name () {
+
+ mono_test_marshal_char_2 ('A');
+
+ return 0;
+ }
}
diff --git a/mono/tests/setenv.cs b/mono/tests/setenv.cs
index 63ad579fdc4..90c0e6eec6a 100644
--- a/mono/tests/setenv.cs
+++ b/mono/tests/setenv.cs
@@ -10,14 +10,19 @@ namespace Test {
static extern string getenv(string name);
static int Main() {
- string name = "mono_test";
- string value = "val";
+ try {
+ string name = "mono_test";
+ string value = "val";
- setenv (name, value, 1);
- string ret = getenv (name);
+ setenv (name, value, 1);
+ string ret = getenv (name);
- if (ret != value)
- return 1;
+ if (ret != value)
+ return 1;
+ }
+ catch (EntryPointNotFoundException) {
+ /* setenv is not available on some platforms */
+ }
return 0;
}
}
diff --git a/mono/utils/ChangeLog b/mono/utils/ChangeLog
index de03cad6512..6fd8c8fa6aa 100644
--- a/mono/utils/ChangeLog
+++ b/mono/utils/ChangeLog
@@ -1,3 +1,20 @@
+
+2004-01-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * strenc.c:
+ (mono_unicode_from_external): UTF8 is the default, not the preferred
+ encoding, ie, try MONO_EXTERNAL_ENCODINGS first. When "default_locale"
+ was passed in the env. var., it always failed because we were passing
+ "default_locale" to g_convert. Also fixed the byte count for non-UTF8
+ conversions.
+ (mono_utf8_from_external): UTF8 is the default, not the preferred one.
+
+ Fixes bug #53166.
+
+Thu Jan 8 19:56:08 CET 2004 Paolo Molaro <lupus@ximian.com>
+
+ * mono-uri.c: fixed compile problem.
+
2003-12-02 Bernie Solomon <bernard@ugsolutions.com>
* mono-math.c: fix for older C compilers and big endian machines
diff --git a/mono/utils/Makefile.am b/mono/utils/Makefile.am
index e7958ff2896..992652f1721 100644
--- a/mono/utils/Makefile.am
+++ b/mono/utils/Makefile.am
@@ -12,7 +12,8 @@ libmonoutils_la_SOURCES = \
strtod.h \
strtod.c \
strenc.h \
- strenc.c
+ strenc.c \
+ mono-uri.c
libmonoutilsincludedir = $(includedir)/mono/utils
@@ -21,7 +22,8 @@ libmonoutilsinclude_HEADERS = \
mono-digest.h \
mono-logger.h \
mono-hash.h \
- mono-math.h
+ mono-math.h \
+ mono-uri.h
EXTRA_DIST = ChangeLog
diff --git a/mono/utils/mono-uri.c b/mono/utils/mono-uri.c
new file mode 100644
index 00000000000..49342847a1b
--- /dev/null
+++ b/mono/utils/mono-uri.c
@@ -0,0 +1,95 @@
+/* GLIB - Library of useful routines for C programming
+ *
+ * gconvert.c: Convert between character sets using iconv
+ * Copyright Red Hat Inc., 2000
+ * Authors: Havoc Pennington <hp@redhat.com>, Owen Taylor <otaylor@redhat.com
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+#include <glib.h>
+#include "mono-uri.h"
+
+typedef enum {
+ UNSAFE_ALL = 0x1, /* Escape all unsafe characters */
+ UNSAFE_ALLOW_PLUS = 0x2, /* Allows '+' */
+ UNSAFE_PATH = 0x4, /* Allows '/' and '?' and '&' and '=' */
+ UNSAFE_DOS_PATH = 0x8, /* Allows '/' and '?' and '&' and '=' and ':' */
+ UNSAFE_HOST = 0x10, /* Allows '/' and ':' and '@' */
+ UNSAFE_SLASHES = 0x20 /* Allows all characters except for '/' and '%' */
+} UnsafeCharacterSet;
+
+static const guchar acceptable[96] = {
+ /* A table of the ASCII chars from space (32) to DEL (127) */
+ /* ! " # $ % & ' ( ) * + , - . / */
+ 0x00,0x3F,0x20,0x20,0x20,0x00,0x2C,0x3F,0x3F,0x3F,0x3F,0x22,0x20,0x3F,0x3F,0x1C,
+ /* 0 1 2 3 4 5 6 7 8 9 : ; < = > ? */
+ 0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x38,0x20,0x20,0x2C,0x20,0x2C,
+ /* @ A B C D E F G H I J K L M N O */
+ 0x30,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,
+ /* P Q R S T U V W X Y Z [ \ ] ^ _ */
+ 0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x20,0x20,0x20,0x20,0x3F,
+ /* ` a b c d e f g h i j k l m n o */
+ 0x20,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,
+ /* p q r s t u v w x y z { | } ~ DEL */
+ 0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x20,0x20,0x20,0x3F,0x20
+};
+
+static const gchar hex[] = "0123456789ABCDEF";
+
+/* Note: This escape function works on file: URIs, but if you want to
+ * escape something else, please read RFC-2396 */
+gchar *
+mono_escape_uri_string (const gchar *string)
+{
+#define ACCEPTABLE(a) ((a)>=32 && (a)<128 && (acceptable[(a)-32] & use_mask))
+
+ const gchar *p;
+ gchar *q;
+ gchar *result;
+ int c;
+ gint unacceptable;
+ UnsafeCharacterSet use_mask;
+
+ unacceptable = 0;
+ use_mask = UNSAFE_DOS_PATH;
+ for (p = string; *p != '\0'; p++)
+ {
+ c = (guchar) *p;
+ if (!ACCEPTABLE (c))
+ unacceptable++;
+ }
+
+ result = g_malloc (p - string + unacceptable * 2 + 1);
+
+ for (q = result, p = string; *p != '\0'; p++)
+ {
+ c = (guchar) *p;
+
+ if (!ACCEPTABLE (c))
+ {
+ *q++ = '%'; /* means hex coming */
+ *q++ = hex[c >> 4];
+ *q++ = hex[c & 15];
+ }
+ else
+ *q++ = *p;
+ }
+
+ *q = '\0';
+
+ return result;
+}
+
diff --git a/mono/utils/mono-uri.h b/mono/utils/mono-uri.h
new file mode 100644
index 00000000000..dddb611f04c
--- /dev/null
+++ b/mono/utils/mono-uri.h
@@ -0,0 +1,7 @@
+#ifndef __MONO_URI_H
+#define __MONO_URI_H
+
+gchar * mono_escape_uri_string (const gchar *string);
+
+#endif /* __MONO_URI_H */
+
diff --git a/mono/utils/strenc.c b/mono/utils/strenc.c
index 3d0fd5d4d73..b2a5d7e46aa 100644
--- a/mono/utils/strenc.c
+++ b/mono/utils/strenc.c
@@ -32,20 +32,15 @@ gunichar2 *mono_unicode_from_external (const gchar *in, gsize *bytes)
gchar **encodings;
const gchar *encoding_list;
int i;
+ glong lbytes;
if(in==NULL) {
return(NULL);
}
- if(g_utf8_validate (in, -1, NULL)) {
- gunichar2 *unires=g_utf8_to_utf16 (in, -1, NULL, (glong *)bytes, NULL);
- *bytes *= 2;
- return(unires);
- }
-
encoding_list=g_getenv ("MONO_EXTERNAL_ENCODINGS");
if(encoding_list==NULL) {
- return(NULL);
+ encoding_list = "";
}
encodings=g_strsplit (encoding_list, ":", 0);
@@ -54,30 +49,33 @@ gunichar2 *mono_unicode_from_external (const gchar *in, gsize *bytes)
g_message (G_GNUC_PRETTY_FUNCTION ": Trying encoding [%s]",
encodings[i]);
#endif
-
/* "default_locale" is a special case encoding */
if(!strcmp (encodings[i], "default_locale")) {
- gchar *utf8=g_locale_to_utf8 (in, -1, NULL, NULL,
- NULL);
- if(utf8!=NULL && g_utf8_validate (utf8, -1, NULL)) {
- res=g_convert (utf8, -1, "UTF16",
- encodings[i], NULL, bytes,
- NULL);
+ gchar *utf8=g_locale_to_utf8 (in, -1, NULL, NULL, NULL);
+ if(utf8!=NULL) {
+ res=(gchar *) g_utf8_to_utf16 (utf8, -1, NULL, &lbytes, NULL);
+ *bytes = (gsize) lbytes;
}
g_free (utf8);
} else {
- res=g_convert (in, -1, "UTF16", encodings[i], NULL,
- bytes, NULL);
+ res=g_convert (in, -1, "UTF16", encodings[i], NULL, bytes, NULL);
}
if(res!=NULL) {
g_strfreev (encodings);
+ *bytes *= 2;
return((gunichar2 *)res);
}
}
g_strfreev (encodings);
+ if(g_utf8_validate (in, -1, NULL)) {
+ gunichar2 *unires=g_utf8_to_utf16 (in, -1, NULL, (glong *)bytes, NULL);
+ *bytes *= 2;
+ return(unires);
+ }
+
return(NULL);
}
@@ -106,13 +104,9 @@ gchar *mono_utf8_from_external (const gchar *in)
return(NULL);
}
- if(g_utf8_validate (in, -1, NULL)) {
- return(g_strdup (in));
- }
-
encoding_list=g_getenv ("MONO_EXTERNAL_ENCODINGS");
if(encoding_list==NULL) {
- return(NULL);
+ encoding_list = "";
}
encodings=g_strsplit (encoding_list, ":", 0);
@@ -142,6 +136,10 @@ gchar *mono_utf8_from_external (const gchar *in)
g_strfreev (encodings);
+ if(g_utf8_validate (in, -1, NULL)) {
+ return(g_strdup (in));
+ }
+
return(NULL);
}
diff --git a/monowiz.win32.nsi b/monowiz.win32.nsi
index 81f0bbe964c..bd016197618 100644
--- a/monowiz.win32.nsi
+++ b/monowiz.win32.nsi
@@ -1,13 +1,16 @@
-; =====================================================
-; mono.nsi - Mono Setup wizard for windows
-; =====================================================
+; =================================================================
+; mono.nsi - This NSIS script creates Mono Setup wizard for Windows
+;
+; Requires NSIS 2.0 (Nullsoft Scriptable Install System)
+; From http://nsis.sourceforge.net/site/index.php
+; =================================================================
;
; (C) Copyright 2003 by Johannes Roith
-; (C) Copyright 2003 by Daniel Morgan
+; (C) Copyright 2003, 2004 by Daniel Morgan
;
; Authors:
; Johannes Roith <johannes@jroith.de>
-; Daniel Morgan <danmorg@sc.rr.com>
+; Daniel Morgan <danielmorgan@verizon.net>
;
; This .nsi includes code from the NSIS Archives:
; function StrReplace and VersionCheck
@@ -23,9 +26,9 @@
; SET MILESTONE & SOURCE DIR
; =====================================================
; set by makefile!!
-;
-; !define MILESTONE "0.26" ;
-; !define SOURCE_INSTALL_DIR "/usr/monodist\\*" ;
+
+!define MILESTONE 0.29
+!define SOURCE_INSTALL_DIR E:\cygwin\home\danmorg\mono029\*.*
; =====================================================
; SET LOGO
@@ -58,9 +61,6 @@
; 4. The output file is mono-[MILESTONE]-win32-1.exe
;
;
-;
-;
-;
; =====================================================
; MONO & REGISTRY / DETECTING MONO
; =====================================================
@@ -96,31 +96,59 @@
; GENERAL SETTING - NEED NOT TO BE CHANGED
; =====================================================
- !define NAME "Mono" ;
- !define TARGET_INSTALL_DIR "$PROGRAMFILES\Mono-${MILESTONE}" ;
- !define OUTFILE "mono-${MILESTONE}-win32-1.exe" ;
+!define NAME "Mono"
+!define TARGET_INSTALL_DIR "$PROGRAMFILES\Mono-${MILESTONE}"
+!define OUTFILE mono-${MILESTONE}-win32-1.exe
-; =====================================================
-; SCRIPT
-; =====================================================
+Name ${NAME}
+Caption "Mono ${MILESTONE} Setup"
- !define MUI_PRODUCT "${NAME}"
- !define MUI_VERSION "${MILESTONE}"
- !define FULLNAME "${MUI_PRODUCT} ${MUI_VERSION}"
- !define MUI_UI "${NSISDIR}\Contrib\UIs\modern2.exe"
- !define MUI_ICON "${NSISDIR}\Contrib\Icons\setup.ico"
- !define MUI_UNICON "${NSISDIR}\Contrib\Icons\normal-uninstall.ico"
- !define MUI_WELCOMEPAGE
- !define MUI_DIRECTORYPAGE
- !define MUI_DIRECTORYSELECTIONPAGE
- !include "${NSISDIR}\Contrib\Modern UI\System.nsh"
- !insertmacro MUI_SYSTEM
- !insertmacro MUI_LANGUAGE "ENGLISH"
+!include "MUI.nsh"
+!include "Sections.nsh"
+SetCompressor lzma
+SilentInstall normal
+ShowInstDetails show
+SetDateSave on
+SetDatablockOptimize on
+CRCCheck on
+BGGradient 000000 800000 FFFFFF
+InstallColors FF8080 000030
+XPStyle on
+AutoCloseWindow false
- OutFile "${OUTFILE}"
- InstallDir "${TARGET_INSTALL_DIR}"
+; =====================================================
+; SCRIPT
+; =====================================================
+#!define MUI_WELCOMEPAGE
+#!define MUI_DIRECTORYPAGE
+#!define MUI_DIRECTORYSELECTIONPAGE
+
+!define MUI_WELCOMEPAGE_TEXT "This wizard will guide you through the installation of Mono for Windows.\r\n\r\n\r\n$_CLICK"
+
+!insertmacro MUI_PAGE_WELCOME
+!insertmacro MUI_PAGE_LICENSE "E:\cygwin\home\danmorg\mono029\license.txt"
+!insertmacro MUI_PAGE_DIRECTORY
+!insertmacro MUI_PAGE_INSTFILES
+
+!define MUI_FINISHPAGE_LINK "Visit Mono's website for the latest news"
+!define MUI_FINISHPAGE_LINK_LOCATION "http://www.go-mono.com/"
+
+!define MUI_FINISHPAGE_NOREBOOTSUPPORT
+
+!insertmacro MUI_PAGE_FINISH
+
+!insertmacro MUI_UNPAGE_CONFIRM
+!insertmacro MUI_UNPAGE_INSTFILES
+
+!insertmacro MUI_LANGUAGE "ENGLISH"
+
+AutoCloseWindow false
+ShowInstDetails show
+
+OutFile ${OUTFILE}
+InstallDir "${TARGET_INSTALL_DIR}"
;========================
; Uninstaller
@@ -186,8 +214,11 @@ SectionEnd
NoAskInstall:
+ DetailPrint "Installing Mono Files..."
+ SetOverwrite on
SetOutPath $INSTDIR
- File /r "${SOURCE_INSTALL_DIR}"
+ File /r ${SOURCE_INSTALL_DIR}
+
WriteUninstaller Uninst.exe
WriteRegStr HKEY_LOCAL_MACHINE SOFTWARE\Mono\${MILESTONE} SdkInstallRoot $INSTDIR
@@ -320,7 +351,7 @@ FileClose $0
FileOpen $0 "$WINDIR\monobasepath.bat" "w"
FileWrite $0 'set MONO_BASEPATH="$INSTDIR"$\r$\n'
FileWrite $0 'set MONO_PATH=$INSTDIR\lib$\r$\n'
-FileWrite $0 'set MONO_CFG_DIR="$INSTDIR\etc\mono"'
+FileWrite $0 'set MONO_CFG_DIR=$INSTDIR\etc'
FileClose $0
@@ -573,7 +604,6 @@ FileClose $0
FileOpen $0 "$WINDIR\cilc.bat" "w"
-
FileWrite $0 "@echo off$\r$\n"
FileWrite $0 "call monobasepath.bat$\r$\n"
FileWrite $0 "set MONOARGS=$\r$\n"
@@ -590,6 +620,85 @@ FileWrite $0 "endlocal$\r$\n"
FileClose $0
+; ============= glib-2.0.pc ===============
+FileOpen $0 "$INSTDIR\lib\pkgconfig\glib-2.0.pc" "w"
+FileWrite $0 "prefix=$6$\r$\n"
+FileWrite $0 "exec_prefix=$${prefix}$\r$\n"
+FileWrite $0 "libdir=$${exec_prefix}/lib$\r$\n"
+FileWrite $0 "includedir=$${prefix}/include$\r$\n"
+FileWrite $0 "$\r$\n"
+FileWrite $0 "glib_genmarshal=glib-genmarshal$\r$\n"
+FileWrite $0 "gobject_query=gobject-query$\r$\n"
+FileWrite $0 "glib_mkenums=glib-mkenums$\r$\n"
+FileWrite $0 "$\r$\n"
+FileWrite $0 "Name: GLib$\r$\n"
+FileWrite $0 "Description: C Utility Library$\r$\n"
+FileWrite $0 "Version: 2.0.4$\r$\n"
+FileWrite $0 "Libs: -L$${libdir} -lglib-2.0 -lintl -liconv $\r$\n"
+FileWrite $0 "Cflags: -I$${includedir}/glib-2.0 -I$${libdir}/glib-2.0/include $\r$\n"
+FileClose $0
+
+; ============= gmodule-2.0.pc ===============
+FileOpen $0 "$INSTDIR\lib\pkgconfig\gmodule-2.0.pc" "w"
+FileWrite $0 "prefix=$6$\r$\n"
+FileWrite $0 "exec_prefix=$${prefix}$\r$\n"
+FileWrite $0 "libdir=$${exec_prefix}/lib$\r$\n"
+FileWrite $0 "includedir=$${prefix}/include$\r$\n"
+FileWrite $0 "$\r$\n"
+FileWrite $0 "gmodule_supported=true$\r$\n"
+FileWrite $0 "$\r$\n"
+FileWrite $0 "Name: GModule$\r$\n"
+FileWrite $0 "Description: Dynamic module loader for GLib$\r$\n"
+FileWrite $0 "Requires: glib-2.0$\r$\n"
+FileWrite $0 "Version: 2.0.4$\r$\n"
+FileWrite $0 "Libs: -L$${libdir} -lgmodule-2.0 $\r$\n"
+FileWrite $0 "Cflags:$\r$\n"
+FileClose $0
+
+; ============= gobject-2.0.pc ===============
+FileOpen $0 "$INSTDIR\lib\pkgconfig\gobject-2.0.pc" "w"
+FileWrite $0 "prefix=$6$\r$\n"
+FileWrite $0 "exec_prefix=$${prefix}$\r$\n"
+FileWrite $0 "libdir=$${exec_prefix}/lib$\r$\n"
+FileWrite $0 "includedir=$${prefix}/include$\r$\n"
+FileWrite $0 "$\r$\n"
+FileWrite $0 "Name: GObject$\r$\n"
+FileWrite $0 "Description: GLib Type, Object, Parameter and Signal Library$\r$\n"
+FileWrite $0 "Requires: glib-2.0$\r$\n"
+FileWrite $0 "Version: 2.0.4$\r$\n"
+FileWrite $0 "Libs: -L$${libdir} -lgobject-2.0$\r$\n"
+FileWrite $0 "Cflags:$\r$\n"
+FileClose $0
+
+; ============= gthread-2.0.pc ===============
+FileOpen $0 "$INSTDIR\lib\pkgconfig\gthread-2.0.pc" "w"
+FileWrite $0 "prefix=$6$\r$\n"
+FileWrite $0 "exec_prefix=$${prefix}$\r$\n"
+FileWrite $0 "libdir=$${exec_prefix}/lib$\r$\n"
+FileWrite $0 "includedir=$${prefix}/include$\r$\n"
+FileWrite $0 "$\r$\n"
+FileWrite $0 "Name: GThread$\r$\n"
+FileWrite $0 "Description: Thread support for GLib$\r$\n"
+FileWrite $0 "Requires: glib-2.0$\r$\n"
+FileWrite $0 "Version: 2.0.4$\r$\n"
+FileWrite $0 "Libs: -L$${libdir} -lgthread-2.0 $\r$\n"
+FileWrite $0 "Cflags: -D_REENTRANT$\r$\n"
+FileClose $0
+
+; ============= libintl.pc ===============
+FileOpen $0 "$INSTDIR\lib\pkgconfig\libintl.pc" "w"
+FileWrite $0 "prefix=$6$\r$\n"
+FileWrite $0 "exec_prefix=$${prefix}$\r$\n"
+FileWrite $0 "libdir=$${exec_prefix}/lib$\r$\n"
+FileWrite $0 "includedir=$${prefix}/include$\r$\n"
+FileWrite $0 "$\r$\n"
+FileWrite $0 "Name: libintl$\r$\n"
+FileWrite $0 "Description: The intl library from GNU gettext$\r$\n"
+FileWrite $0 "Version: 0.10.40-tml$\r$\n"
+FileWrite $0 "Libs: -L$${libdir} -lintl$\r$\n"
+FileWrite $0 "Cflags: -I$${includedir}$\r$\n"
+FileClose $0
+
NoInstall:
SectionEnd
@@ -696,4 +805,4 @@ Function VersionCheck
Pop $R0
Pop $1
Exch $0
-FunctionEnd \ No newline at end of file
+FunctionEnd
diff --git a/runtime/Makefile.am b/runtime/Makefile.am
index 318e50e381c..bbc49dbe5df 100644
--- a/runtime/Makefile.am
+++ b/runtime/Makefile.am
@@ -56,10 +56,9 @@ assemblies_DATA = \
System.Web.dll \
System.Web.Services.dll \
System.Windows.Forms.dll \
- System.Xml.dll \
- libgdiplus.dll.so
+ System.Xml.dll
-monobins_DATA = mcs.exe mbas.exe monoresgen.exe secutil.exe ilasm.exe cilc.exe xsd.exe wsdl.exe genxs.exe disco.exe sqlsharp.exe signcode.exe chktrust.exe soapsuds.exe
+monobins_DATA = mcs.exe mbas.exe monoresgen.exe secutil.exe ilasm.exe cilc.exe xsd.exe wsdl.exe genxs.exe al.exe disco.exe sqlsharp.exe signcode.exe chktrust.exe soapsuds.exe
EXTRA_DIST = $(monobins_DATA) $(assemblies_DATA)
@@ -82,13 +81,14 @@ $(monobins_DATA):
-cp $(top_srcdir)/../mcs/tools/mono-xsd/xsd.exe . || cp $(monobinsdir)/xsd.exe .
-cp $(top_srcdir)/../mcs/tools/wsdl/wsdl.exe . || cp $(monobinsdir)/wsdl.exe .
-cp $(top_srcdir)/../mcs/tools/genxs/genxs.exe . || cp $(monobinsdir)/genxs.exe .
+ -cp $(top_srcdir)/../mcs/tools/al/al.exe . || cp $(monobinsdir)/al.exe .
-cp $(top_srcdir)/../mcs/tools/disco/disco.exe . || cp $(monobinsdir)/disco.exe .
-cp $(top_srcdir)/../mcs/tools/soapsuds/soapsuds.exe . || cp $(monobinsdir)/soapsuds.exe .
-cp $(top_srcdir)/../mcs/tools/SqlSharp/sqlsharp.exe . || cp $(monobinsdir)/sqlsharp.exe .
-cp $(top_srcdir)/../mcs/tools/security/chktrust.exe . || cp $(monobinsdir)/chktrust.exe .
-cp $(top_srcdir)/../mcs/tools/security/signcode.exe . || cp $(monobinsdir)/signcode.exe .
-cp $(top_srcdir)/../mcs/tools/browsercaps-updater/browsercaps-updater.exe . || cp $(monobinsdir)/browsercaps-updater.exe .
-
+
dist-hook:
for i in $(monobins_DATA) $(assemblies_DATA); do \
if test ! -s $(srcdir)/$$i; then echo $$i is empty && exit 1; fi \
diff --git a/scripts/Makefile.am b/scripts/Makefile.am
index 2ea4c184471..280d7f4928a 100644
--- a/scripts/Makefile.am
+++ b/scripts/Makefile.am
@@ -1,8 +1,8 @@
-EXTRA_DIST = mcs.in mbas.in ilasm.in cilc.in monoresgen.in secutil.in sqlsharp.in xsd.in wsdl.in genxs.in soapsuds.in chktrust.in signcode.in disco.in
+EXTRA_DIST = mcs.in mbas.in ilasm.in cilc.in monoresgen.in secutil.in sqlsharp.in xsd.in wsdl.in genxs.in soapsuds.in chktrust.in signcode.in disco.in sn.in al.in
-bin_SCRIPTS = mcs mbas ilasm cilc monoresgen secutil sqlsharp xsd wsdl genxs soapsuds chktrust signcode disco
+bin_SCRIPTS = mcs mbas ilasm cilc monoresgen secutil sqlsharp xsd wsdl al genxs soapsuds chktrust signcode disco sn
-CLEANFILES = mcs mbas ilasm cilc monoresgen secutil sqlsharp xsd wsdl genxs soapsuds chktrust signcode disco
+CLEANFILES = mcs mbas ilasm cilc monoresgen secutil sqlsharp xsd wsdl al genxs soapsuds chktrust signcode disco sn
if X86
MONO_INTERP = mono
@@ -19,7 +19,7 @@ endif
mcs: mcs.in
sed -e 's^\@bindir\@^$(bindir)^g' -e 's^\@mono_interp\@^$(MONO_INTERP)^g' -e's^\@plat_bindir\@^$(plat_bindir)^g' < $(srcdir)/mcs.in > mcs.tmp \
&& mv mcs.tmp mcs
-
+
mbas: mbas.in
sed -e 's^\@bindir\@^$(bindir)^g' -e 's^\@mono_interp\@^$(MONO_INTERP)^g' -e's^\@plat_bindir\@^$(plat_bindir)^g' < $(srcdir)/mbas.in > mbas.tmp \
&& mv mbas.tmp mbas
@@ -52,6 +52,10 @@ wsdl: wsdl.in
sed -e 's^\@bindir\@^$(bindir)^g' -e 's^\@mono_interp\@^$(MONO_INTERP)^g' -e's^\@plat_bindir\@^$(plat_bindir)^g' < $(srcdir)/wsdl.in > wsdl.tmp \
&& mv wsdl.tmp wsdl
+al: al.in
+ sed -e 's^\@bindir\@^$(bindir)^g' -e 's^\@mono_interp\@^$(MONO_INTERP)^g' -e's^\@plat_bindir\@^$(plat_bindir)^g' < $(srcdir)/al.in > al.tmp \
+ && mv al.tmp al
+
genxs: genxs.in
sed -e 's^\@bindir\@^$(bindir)^g' -e 's^\@mono_interp\@^$(MONO_INTERP)^g' -e's^\@plat_bindir\@^$(plat_bindir)^g' < $(srcdir)/genxs.in > genxs.tmp \
&& mv genxs.tmp genxs
@@ -71,3 +75,7 @@ chktrust: chktrust.in
signcode: signcode.in
sed -e 's^\@bindir\@^$(bindir)^g' -e 's^\@mono_interp\@^$(MONO_INTERP)^g' -e's^\@plat_bindir\@^$(plat_bindir)^g' < $(srcdir)/signcode.in > signcode.tmp \
&& mv signcode.tmp signcode
+
+sn: sn.in
+ sed -e 's^\@bindir\@^$(bindir)^g' -e 's^\@mono_interp\@^$(MONO_INTERP)^g' -e's^\@plat_bindir\@^$(plat_bindir)^g' < $(srcdir)/sn.in > sn.tmp \
+ && mv sn.tmp sn
diff --git a/scripts/al.in b/scripts/al.in
new file mode 100644
index 00000000000..e421f135e68
--- /dev/null
+++ b/scripts/al.in
@@ -0,0 +1,2 @@
+#!/bin/sh
+@bindir@/@mono_interp@ @plat_bindir@/al.exe "$@"
diff --git a/scripts/sn.in b/scripts/sn.in
new file mode 100644
index 00000000000..ca82b5d724b
--- /dev/null
+++ b/scripts/sn.in
@@ -0,0 +1,2 @@
+#!/bin/sh
+@bindir@/@mono_interp@ @plat_bindir@/sn.exe "$@"
diff --git a/web/ChangeLog b/web/ChangeLog
new file mode 100755
index 00000000000..608e10e6a23
--- /dev/null
+++ b/web/ChangeLog
@@ -0,0 +1,16 @@
+2004-01-22 Atsushi Enomoto <atsushi@ximian.com>
+
+ * xml-classes : status update, additional infos.
+
+2004-01-16 Atsushi Enomoto <atsushi@ximian.com>
+
+ * web/commands : Added xml-classes (forgot to commit).
+ * mono-build-w32.sh : Added icu support as well as glib.
+ * ChangeLog : tiny fix
+
+2004-01-11 Atsushi Enomoto <atsushi@ximian.com>
+
+ * xml-classes : added v2 info. schema status updates.
+
+ Added ChangeLog. (There is no reason not to keep ChangeLog for
+ documents, at least for not a little changes ;-)
diff --git a/web/ado-net b/web/ado-net
index c78b62edfd1..61cd8bda102 100644
--- a/web/ado-net
+++ b/web/ado-net
@@ -47,7 +47,7 @@
<li><a href="http://www.go-mono.com/sqlclient.html">Microsoft SQL Server</a></li>
<li><a href="http://www.go-mono.com/sqlite.html">SQL Lite</a></li>
<li><a href="http://www.go-mono.com/sybase.html">Sybase</a></li>
- <li><a href="http://www.go-mono.com/tdsclient.html">TDS Generic</a></li>
+ <li><a href="http://www.go-mono.com/tdsclient.html">Older Microsoft SQL Server and Sybase databases</a></li>
</ul>
<p>Providers which we do not have, but we would like to have. Currently,
@@ -333,6 +333,12 @@
<td>System.Data /</br> System.Data.SqlClient</td>
<td>SqlTest.cs at</br> System.Data/Test</td>
</tr>
+
+ <tr>
+ <td>PostgreSQL</br> (Npgsql)</td>
+ <td>Npgsql /</br> Npgsql</td>
+ <td>*.cs at</br> Npgsql/Test</td>
+ </tr>
<tr>
<td>PostgreSQL</br> (Mono)</td>
@@ -349,13 +355,13 @@
<tr>
<td>Oracle</br> (Mono)</td>
<td>System.Data.OracleClient /</br> System.Data.OracleClient</td>
- <td>TestOracleClient.cs at</br> System.Data.OracleClient</td>
+ <td>TestOracleClient.cs at</br> System.Data.OracleClient/Test</td>
</tr>
<tr>
<td>ODBC</br> (Mono)</td>
- <td>System.Data.OracleClient /</br> System.Data.OracleClient</td>
- <td>TestOracleClient.cs at</br> System.Data.OracleClient</td>
+ <td>System.Data.Odbc /</br> System.Data</td>
+ <td>OdbcTest.cs (to connect to MS SQL Server)at</br> System.Data/Test</td>
</tr>
</table>
diff --git a/web/blogs b/web/blogs
index 4ed29e1010a..1fb66df3c07 100644
--- a/web/blogs
+++ b/web/blogs
@@ -21,7 +21,7 @@
<a href="http://primates.ximian.com/~martin/blog/rss.xml"><img align="center" src="images/xml.gif"></a>
<a href="http://primates.ximian.com/~martin/blog/">Martin Baulig</a>
<br>
- <a href="http://primates.ximian.com/~miguel/miguel2.rss"><img align="center" src="images/xml.gif"></a>
+ <a href="http://primates.ximian.com/~miguel/miguel.rss2"><img align="center" src="images/xml.gif"></a>
<a href="http://primates.ximian.com/~miguel/activity-log.php">Miguel de Icaza</a>
<br>
<a href="http://primates.ximian.com/~mkestner/blog/index.rdf"><img align="center" src="images/xml.gif"></a>
diff --git a/web/books b/web/books
index 52d454c42b9..00ed239bb73 100644
--- a/web/books
+++ b/web/books
@@ -1,10 +1,10 @@
-* Mono Books
+* Mono
<a href="http://www.amazon.de/exec/obidos/ASIN/3827264928/qid=1050051051/sr=2-1/ref=sr_2_3_1/028-2755135-1623712">
Mono: .NET-kompatible Anwendungen mit dem Open Source-Framework
</a>
-* C# Books
+* C#
A Programmer's Introduction to C# - Second Edition: Eric Gunnerson
@@ -16,8 +16,23 @@
* Remoting
- <a href="http://www.dotnetremoting.cc/book/AdvancedDotNetRemoting.asp">
- Advanced .NET Remoting: Ingo Rammer</a>
+ <a href="http://www.dotnetremoting.cc/book/AdvancedDotNetRemoting.asp">Advanced .NET Remoting: Ingo Rammer</a>
+
+* Threading
+
+ .NET Multithreading: Alan L. Dennis (ISBN 1-930110-54-5)
+
+* Web Services
+
+ Web Services: Architecture and Implementation with .NET: Keith Ballinger
+
+* ASP.NET
+
+ Essential ASP.NET with Examples in C# by Fritz Onion
+
+ ASP.NET in a Nutshell by G. Andrew Duthie & Matthew MacDonald
+
+ Programming ASP.NET by Jessy Liberty & Dan Hurtwitz
* Compiler Implementation
@@ -31,10 +46,6 @@
A Retargetable C Compiler - Design and Implementation: C. Fraser, David
Hanson
-* Threading
-
- .NET Multithreading: Alan L. Dennis (ISBN 1-930110-54-5)
-
* Reference Manuals
<a
diff --git a/web/bugs b/web/bugs
index 0fd50035fea..baf2bd5d7f6 100644
--- a/web/bugs
+++ b/web/bugs
@@ -19,9 +19,16 @@
* <a href="http://bugzilla.ximian.com/buglist.cgi?product=gtk%23&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&email1=&emailtype1=substring&emailassigned_to1=1&email2=&emailtype2=substring&emailreporter2=1&changedin=&chfieldfrom=&chfieldto=Now&chfieldvalue=&short_desc=&short_desc_type=substring&long_desc=&long_desc_type=substring&bug_file_loc=&bug_file_loc_type=substring&keywords=&keywords_type=anywords&op_sys_details=&op_sys_details_type=substring&version_details=&version_details_type=substring&cmdtype=doit&newqueryname=&order=Reuse+same+sort+as+last+time&form_name=query">[Query]</a> <a href="http://bugzilla.ximian.com/enter_bug.cgi?product=gtk%23">[Add]</a> Gtk#
+ * <a href="http://bugzilla.ximian.com/buglist.cgi?product=Mono%2FClass+Libraries&component=System.Web&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&email1=&emailtype1=substring&emailassigned_to1=1&email2=&emailtype2=substring&emailreporter2=1&changedin=&chfieldfrom=&chfieldto=Now&chfieldvalue=&short_desc=&short_desc_type=substring&long_desc=&long_desc_type=substring&bug_file_loc=&bug_file_loc_type=substring&keywords=&keywords_type=anywords&op_sys_details=&op_sys_details_type=substring&version_details=&version_details_type=substring&cmdtype=doit&order=Reuse+same+sort+as+last+time&form_name=query">[Query]</a> <a href="http://bugzilla.ximian.com/enter_bug.cgi?product=Mono%2FClass%20Libraries&component=System.Web">[Add]</a> ASP.NET WebForms
+
+ * <a href="http://bugzilla.ximian.com/buglist.cgi?product=Mono%2FClass+Libraries&component=System.Web.Services&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&email1=&emailtype1=substring&emailassigned_to1=1&email2=&emailtype2=substring&emailreporter2=1&changedin=&chfieldfrom=&chfieldto=Now&chfieldvalue=&short_desc=&short_desc_type=substring&long_desc=&long_desc_type=substring&bug_file_loc=&bug_file_loc_type=substring&keywords=&keywords_type=anywords&op_sys_details=&op_sys_details_type=substring&version_details=&version_details_type=substring&cmdtype=doit&order=Reuse+same+sort+as+last+time&form_name=query">[Query]</a> <a href="http://bugzilla.ximian.com/enter_bug.cgi?product=Mono%2FClass%20Libraries&component=System.Web.Services">[Add]</a> ASP.NET Web Services
+
* <a href="http://bugzilla.ximian.com/buglist.cgi?product=Mono%2FDebugger&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&email1=&emailtype1=substring&emailassigned_to1=1&email2=&emailtype2=substring&emailreporter2=1&changedin=&chfieldfrom=&chfieldto=Now&chfieldvalue=&short_desc=&short_desc_type=substring&long_desc=&long_desc_type=substring&bug_file_loc=&bug_file_loc_type=substring&keywords=&keywords_type=anywords&op_sys_details=&op_sys_details_type=substring&version_details=&version_details_type=substring&cmdtype=doit&newqueryname=&order=Reuse+same+sort+as+last+time&form_name=query">[Query]</a> <a href="http://bugzilla.ximian.com/enter_bug.cgi?product=Mono%2FDebugger">[Add]</a> Debugger.
+ * <a href="http://bugzilla.ximian.com/buglist.cgi?product=Mono+Develop&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&cmdtype=doit&order=Reuse+same+sort+as+last+time&form_name=query">[Query]</a> <a href="http://bugzilla.ximian.com/enter_bug.cgi?product=Mono+Develop">[Add]</a> Mono Develop.
+
* <a href="http://bugzilla.ximian.com/buglist.cgi?product=Mono+Tasks&product=Mono%2FClass+Libraries&product=Mono%2FCompilers&product=Mono%2FDebugger&product=Mono%2FDoctools&product=Mono%2FRuntime&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&email1=&emailtype1=substring&emailassigned_to1=1&email2=&emailtype2=substring&emailreporter2=1&changedin=&chfieldfrom=&chfieldto=Now&chfieldvalue=&short_desc=&short_desc_type=substring&long_desc=&long_desc_type=substring&bug_file_loc=&bug_file_loc_type=substring&keywords=&keywords_type=anywords&op_sys_details=&op_sys_details_type=substring&version_details=&version_details_type=substring&cmdtype=doit&newqueryname=&order=Reuse+same+sort+as+last+time&form_name=query">[Query]</a> All core components.
+
</ul>
<a name="goodbugreport"/>
diff --git a/web/ccvs b/web/ccvs
index 7cf37a8f821..85331cec89a 100644
--- a/web/ccvs
+++ b/web/ccvs
@@ -262,6 +262,77 @@
cvs commit file-1.cs file-2.cs
</pre>
+* Using SVN
+
+ This is a small tutorial for using SVN (subversion).
+ For a more complete tutorial on subversion, look at
+ <a href="http://svnbook.red-bean.com/">the svn book</a>
+ or <a href="http://subversion.tigris.org">the svn homepage</a>
+
+** Generating a key
+
+ Follow the cvs instructions above.
+
+** Checking out the sources
+
+ To checkout the sources for the first time use the command:
+
+ Note: You should be running 0.35.1 (latest) of svn before attempting
+ anything here.
+
+<pre>
+ svn co svn+ssh://mono-cvs.ximian.com/svn/monodevelop/trunk/MonoDevelop
+</pre>
+
+ If you have a different username on mono-cvs and the local computer
+ you can do the following:
+
+<pre>
+ svn co svn+ssh://username@mono-cvs.ximian.com/svn/monodevelop/trunk/MonoDevelop
+</pre>
+
+ before checking out.
+
+** Updating your sources
+
+ You can update your repository to the latest copy of MonoDevelop by
+ running the following command:
+
+<pre>
+ svn up
+</pre>
+
+ from inside your repository.
+
+** Committing your work
+
+ Before you commit anything, you should first update to the latest
+ sources by following the updating directions. After you are up to date
+ you need to run a:
+
+<pre>
+ svn add filename
+</pre>
+
+ for every file that you have created. You can get a list of these files
+ by running:
+
+<pre>
+ svn status
+</pre>
+
+ After all the files are added, run:
+
+<pre>
+ svn commit
+</pre>
+
+ to commit your changes.
+
+** For more information
+
+ Look at the MonoDevelop website (coming soon)
+
* Keeping track of changes.
We provide two e-mail based mechanisms to keep track of
diff --git a/web/compiling b/web/compiling
new file mode 100644
index 00000000000..521945434f1
--- /dev/null
+++ b/web/compiling
@@ -0,0 +1,235 @@
+* Compiling Mono
+
+ This document describes how to compile and install Mono from
+ its source code. If you are only interested in running Mono,
+ you might want to install Mono from packages, which have been
+ tested.
+
+ The core of Mono is split in two components:
+
+ <ul>
+ * C components (available in the mono package)
+
+ * C# components (available in the mcs package).
+ </ul>
+
+ Mono is also available in various forms:
+
+ <dl>
+ <dt>Officially <a href="download.html">released</a> packages.</dt>
+ <dd>
+ <p>This is the format of choice for people to use, since these
+ have been tested and are known to build and work.
+ </dd>
+ <dt><a href="daily">Daily</a> packages.</dt>
+ <dd>
+ <p>This is a service offered for people who want to try out the
+ daily changes. Baked daily.</dd>
+ <dt>CVS source code.</dt>
+ <dd>
+ <p>These are available to Mono <a href="ccvs.html">developers</a> and
+ also for enthusiasts through <a href="anoncvs.html">anonymous CVS</a>.
+ </dd>
+ <dt>CVS snapshots.</dt>
+ <dd>
+ <p>Available for curious developers which do not necessarily want to
+ install the CVS source. Baked daily.
+ </dd>
+ </dl>
+
+* Compiling the code
+
+ There are a number of ways of compiling Mono
+
+ <ul>
+ <li>From the <a href="#scripts">scripts</A>
+
+ <LI><a href="#install">Manually</a> for the first time.
+
+ <li>Manually, <a href="#upgrade">while upgrading</a> to CVS
+ </ul>
+
+ (which is an easy way to get the latest CVS information)
+
+<a name="scripts">
+* Compiling with scripts
+
+ These scripts should be used for installing from packages, specially
+ on Windows, where dependencies have not always been installed.
+
+ There are scripts to help build mono for both Unix and Windows. Get
+ <a href="mono-build.sh">mono-build.sh</a> for Unix, or <a
+ href="mono-build-w32.sh">mono-build-w32.sh</a> for Windows.
+ These scripts automate the installation of GLIB and pkgconfig
+ (building from source on Unix, and using binary packages
+ provided by the GIMP for Windows project on Windows.) To use
+ the script, follow these simple steps:
+
+ <ul>
+ * Save the script for your platform somewhere (e.g. /usr/local/bin)
+ * Make the script executable (i.e chmod 755 /usr/local/bin/mono-build.sh)
+ * Create a directory to hold the mono source, and the compiled binaries (e.g. mkdir ~/mono)
+ * Change to the new directory (i.e. cd ~/mono)
+ * run the script (i.e. /usr/local/bin/mono-build.sh)
+ </ul>
+
+ The script requires wget on either platform, and building the
+ software requires make, gcc, automake, autoconf, and libtool.
+ You should install these packages from your distribution or
+ with the cygwin installer. You should also take care of setting
+ the right environment variables as the PKG_CONFIG_FLAGS, etc.
+
+ The script will download required packages from
+ www.go-mono.com and do a cvs checkout of mono in the current
+ directory. <b>IMPORTANT!:</b> The cvs server chosen defaults to
+ anonymous cvs;
+ set your CVSROOT environment variable before running the script to
+ select a particular cvs server.
+
+<a name="install">
+
+** Building the software manually
+
+ You will need to obtain the Mono dependencies first: <a
+ href="http://www.gtk.org">glib 2.x</a> and
+ <a href="http://www.freedesktop.org/software/pkgconfig">pkg-config</a>.
+
+*** Building From Packages
+
+ This applies to both the officially released packages, as well as the
+ daily tarball packages.
+
+ <ul>
+ Unpack the Mono runtime distribution:
+ <pre class="shell">
+ tar xzvf mono-X.XX.tar.gz
+ cd mono-X.XX</pre>
+ <p>
+
+ Then configure, compile and install:
+
+ <pre class="shell">
+ ./configure --prefix=/usr/local
+ make
+ make install</pre>
+
+ This will give you a runtime, C# compiler and runtime
+ libraries.
+
+ If you want to recompile the runtime and the compiler,
+ follow these steps, first unpack the MCS package:
+
+ <pre class="shell">
+ tar xzvf mcs-X.XX.tar.gz</pre>
+
+ Then use the following command to compile and install:
+
+ <pre class="shell">
+ ./configure --profile=atomic
+ make</pre>
+
+ You can change /usr/local to something else if you want.
+ </ul>
+
+*** Building from CVS
+
+ To upgrade your Mono installation from CVS, it is very
+ important that you update your Mono and MCS modules from CVS
+ at the same time. Failure to do so might result in a
+ problematic installation as the runtime and the class
+ libraries will be out of sync.
+
+ Run the following commands to update your CVS tree (more
+ details in <a href="ccvs.html">Cvs and Mono</a> and the <A
+ href="anoncvs.html">AnonCVS and Mono</a> pages).
+
+ <pre>
+ (cd mono; cvs update -dP .)
+ (cd mcs; cvs update -dP .)
+ </pre>
+
+ Then you can run:
+
+ <pre>
+ (cd mono; make fullbuild)
+ </pre>
+
+ Now you can install the result:
+
+ <pre>
+ (cd mono; make install)
+ </pre>
+
+ Notice that following the above procedure does not require you
+ to manually install the software in the `mcs' directory, as
+ the relevant files will be copied by the `mono' makefiles.
+
+* Software resources and notes
+
+ The required and additional software can be downloaded here:
+
+ * Microsoft's .NET Framework SDK from
+ <a href="http://msdn.microsoft.com/downloads">
+ msdn.microsoft.com/downloads</a>.
+
+ * Cygwin and the GNU Make tools from
+ <a href="http://www.cygwin.com">www.cygwin.com</a>.
+ Some people observed problems with autoconf 2.52. Installing
+ autoconf 2.13 helped in those cases.
+
+ * Precompiled GLIB 2.0 and pkg-config packages (and
+ their dependencies) by the <a href="http://www.gimp.org/~tml/gimp/win32//index.html">GIMP for Windows</a> project from
+ <a href="http://www.go-mono.com/archive/pkgconfig-0.11-20020310.zip">http://www.go-mono.com/archive/pkgconfig-0.11-20020310.zip</a><br>
+ <a href="http://www.go-mono.com/archive/glib-2.0.4-20020703.zip">http://www.go-mono.com/archive/glib-2.0.4-20020703.zip</a> <br>
+ <a href="http://www.go-mono.com/archive/glib-dev-2.0.4-20020703.zip">http://www.go-mono.com/archive/glib-dev-2.0.4-20020703.zip</a> <br>
+ <a href="http://www.go-mono.com/archive/libiconv-1.7.zip">http://www.go-mono.com/archive/libiconv-1.7.zip</a> <br>
+ <a href="http://www.go-mono.com/archive/libiconv-dev-1.7.zip">http://www.go-mono.com/archive/libiconv-dev-1.7-20020101.zip</a> <br>
+ <a href="http://www.go-mono.com/archive/libintl-0.10.40-20020101.zip">http://www.go-mono.com/archive/libintl-0.10.40-20020101.zip</a><br>
+
+
+ * Download the Mono source code from the
+ <a href="download.html">packaged versions</a> or
+ the <a href="http://www.go-mono.com/snapshots">
+ nightly snapshots</a> or the <a href="anoncvs.html">
+ Anonymous CVS</a>. The nightly snapshots are done every
+ night at 10pm EST (Boston Time). The nightly snapshots are
+ not guaranteed to build, but most of the time they should.
+ </ul>
+
+
+*** Notes on compiling GLIB 2.0 and pkg-config from source:
+
+
+ <ul>
+
+ * Some people observed problems with autoconf 2.52. Installing
+ autoconf 2.13 helped in those cases (don't forget to do a
+ `make maintainer-clean' after the update).
+
+ * Download, compile and install <a href="http://www.freedesktop.org/software/pkgconfig">pkg-config</a> from source.
+ (I had to change line 674 of
+ <nobr><tt>pkg-config-0.8.0/glib-1.2.8/gstrfuncs.c</tt></nobr> from
+ <nobr><tt>extern char *strsignal (int sig);</tt></nobr> to
+ <nobr><tt>extern const char *strsignal (int sig);</tt></nobr>.
+
+<pre class="shell">
+tar xzvf pkg-config-0.8.0.tar.gz
+cd pkg-config-0.8.0
+./configure --prefix=/usr
+make
+make install
+</pre>
+
+ * Download, compile and install <a href="ftp://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.7.tar.gz">libiconv</a> from source.<br>
+ If you dont have MS Visual C/C++ 4.0 or 5.0 or 6.0 you can also try
+ the binary package available at <a
+ href="http://www.gimp.org/~tml/gimp/win32/libiconv-1.9.1.bin.woe32.zip">
+ http://www.gimp.org/~tml/gimp/win32/libiconv-1.9.1.bin.woe32.zip</a>
+
+
+ * Download, compile and install the
+ <a href="ftp://ftp.gtk.org/pub/gtk/v2.0/glib-2.0.6.tar.gz">
+ glib 2.0</a> from source.
+
+ </ul>
+
diff --git a/web/crypto b/web/crypto
index d89b78cc45c..8080eb67709 100644
--- a/web/crypto
+++ b/web/crypto
@@ -138,9 +138,11 @@
* Additional algorithms: MD2, MD4, ARCFOUR (required for SSL)
* Convertion helpers
</ul>
-*** Namespace: Mono.Security.Protocol.Tls
+*** Namespace: Mono.Security.Protocol.*
<ul>
- * An 100% managed TLS implementation from Carlos Guzman Alvarez.
+ * Tls: An 100% managed TLS implementation from Carlos Guzman
+ Alvarez.
+ * Ntlm: NTLM authentication (used for HTTP and SQL Server).
</ul>
*** Namespace: Mono.Security.X509
<ul>
@@ -375,9 +377,8 @@
<b>monodoc</b> as I'm not a very good writer (at least in English).
</ul>
- Contact Sebastien Pouliot (<a href="mailto:spouliot@videotron.ca">home</a>
- , <a href="mailto:spouliot@motus.com">work</a>) if you need additional
- informations about the status of the cryptographic classes.
-
+ Contact <a href="mailto:spouliot@videotron.ca">Sebastien Pouliot</a> if
+ you need additional informations about the status of the cryptographic
+ classes.
<hr>
-Last reviewed: December 15, 2003 (post mono 0.29)
+Last reviewed: January 26, 2004 (post mono 0.29)
diff --git a/web/download b/web/download
index 31fbc7ea58d..ffce2efe8dc 100644
--- a/web/download
+++ b/web/download
@@ -33,7 +33,7 @@
<li><a href="archive/mono-0.29.tar.gz">Mono Runtime</a>
<li><a href="archive/xsp-0.8.tar.gz">XSP web server (0.8)</a>
<li><a href="archive/mod_mono-0.6.tar.gz">Apache Mono module 0.6 (mod_mono)</a>
- <li><a href="archive/monodoc-0.8.tar.gz">MonoDoc 0.8</a>
+ <li><a href="archive/monodoc-0.9.tar.gz">MonoDoc 0.9</a>
</ul>
</td>
</tr>
@@ -46,9 +46,8 @@
<td>
Packages are available on <a
href="http://www.ximian.com/products/redcarpet/download.html">Red
- Carpet's</a> Mono channel. <p>
- Install the Red Carpet client, or wait
- for the Mono installer to be made available this week.
+ Carpet's</a> Mono channel.
+
</td>
</tr>
<tr>
@@ -56,7 +55,7 @@
<img src="images/windows-36.gif"><b>Windows installer</b>
</td>
<td>
- Not available yet.
+ <a href="archive/mono-0.29-win32-1.exe">mono-0.29-win32-1.exe</a>
</td>
</tr>
</table>
@@ -95,7 +94,7 @@
<td>
<ul>
<li><a href="archive/redhat-90-i386/mono-0.28-1.ximian.6.1.src.rpm">mono-0.28-1.src.rpm (RH9)</a>
- <li><a href="archive/redhat-90-i386/mono-0.28-1.ximian.5.1.src.rpm">mono-0.28-1.src.rpm (RH8)</a>
+ <li><a href="archive/redhat-90-i386/mono-0.28-1.ximian.6.1.src.rpm">mono-0.28-1.src.rpm (RH8)</a>
</ul>
</td>
</tr>
@@ -194,7 +193,7 @@
<td>
<ul>
<li><a href="archive/redhat-90-i386/mono-0.26-1.ximian.6.1.src.rpm">mono-0.26-1.src.rpm (RH9)</a>
- <li><a href="archive/redhat-90-i386/mono-0.26-1.ximian.5.1.src.rpm">mono-0.26-1.src.rpm (RH8)</a>
+ <li><a href="archive/redhat-90-i386/mono-0.26-1.ximian.6.1.src.rpm">mono-0.26-1.src.rpm (RH8)</a>
</ul>
</td>
</tr>
@@ -221,7 +220,7 @@
<li><a href="archive/redhat-90-i386/monodoc-0.6-1.ximian.6.1.i386.rpm">monodoc-0.6-1.ximian.6.1.i386.rpm</a> (To be used only with CVS gtk-sharp)
<li><a href="archive/redhat-90-i386/monodoc-debuginfo-0.5-1.ximian.6.1.i386.rpm">monodoc-debuginfo-0.5-1.ximian.6.1.i386.rpm</a>
<li><a href="archive/redhat-90-i386/mono-wine-20030318-1.ximian.6.3.i386.rpm">mono-wine-20030318-1.ximian.6.3.i386.rpm</a>
- <li><a href="archive/redhat-90-i386/mono-wine-debuginfo-20030318-1.ximian.6.2.i386.rpm">mono-wine-debuginfo-20030318-1.ximian.6.3.i386.rpm</a>
+ <li><a href="archive/redhat-90-i386/mono-wine-debuginfo-20030318-1.ximian.6.3.i386.rpm">mono-wine-debuginfo-20030318-1.ximian.6.3.i386.rpm</a>
</ul>
</td>
<td bgcolor="#999999">
@@ -301,7 +300,7 @@
</td>
<td>
<ul>
- <li><a href="archive/mono-0.25-1.ximian.5.src.rpm">mono-0.25-1.src.rpm</a>
+ <li><a href="archive/redhat-80-i386/mono-0.25-1.ximian.5.1.src.rpm">mono-0.25-1.src.rpm</a>
</ul>
</td>
</tr>
@@ -856,7 +855,7 @@
<td>
<ul>
<li><a href="archive/libgc-6.1-1.src.rpm">libgc-6.1-1.src.rpm</a>
- <li><a href="archive/mono-0.20-1.src.rpm">mono-0.20-1.src.rpm</a>
+ <li><a href="archive/redhat-73-i386/mono-0.20-1.src.rpm">mono-0.20-1.src.rpm</a>
</ul>
</td>
</tr>
@@ -1170,7 +1169,6 @@
<ul>
* <a href="http://www.debianplanet.org/mono/">DebianPlanet</a>
- * <a href="http://www.superin.formativ.net/mono/mono.htm">Windows</a> (works without cygwin!)
</ul>
* Snapshots
@@ -1185,256 +1183,7 @@
The <a href="anoncvs.html">anoncvs</a> mirrors provided by
Hispalinux are updated every six hours.
-* Compiling the code
-
- There are a number of ways of compiling Mono
-
- <ul>
- <li>From the <a href="#scripts">scripts</A>
-
- <LI><a href="#install">Manually</a> for the first time.
-
- <li>Manually, <a href="#upgrade">while upgrading</a> to CVS
- </ul>
-
- (which is an easy way to get the latest CVS information)
-
-<a name="scripts">
-* Compiling with scripts
-
- There are scripts to help build mono for both Unix and Windows. Get
- <a href="mono-build.sh">mono-build.sh</a> for Unix, or <a
- href="mono-build-w32.sh">mono-build-w32.sh</a> for Windows.
- These scripts automate the installation of GLIB and pkgconfig
- (building from source on Unix, and using binary packages
- provided by the GIMP for Windows project on Windows.) To use
- the script, follow these simple steps:
-
- <ul>
- * Save the script for your platform somewhere (e.g. /usr/local/bin)
- * Make the script executable (i.e chmod 755 /usr/local/bin/mono-build.sh)
- * Create a directory to hold the mono source, and the compiled binaries (e.g. mkdir ~/mono)
- * Change to the new directory (i.e. cd ~/mono)
- * run the script (i.e. /usr/local/bin/mono-build.sh)
- </ul>
-
- The script requires wget on either platform, and building the
- software requires make, gcc, automake, autoconf, and libtool.
- You should install these packages from your distribution or
- with the cygwin installer. You should also take care of setting
- the right environment variables as the PKG_CONFIG_FLAGS, etc.
-
- The script will download required packages from
- www.go-mono.com and do a cvs checkout of mono in the current
- directory. <b>IMPORTANT!:</b> The cvs server chosen defaults to
- anonymous cvs;
- set your CVSROOT environment variable before running the script to
- select a particular cvs server.
-
-<a name="install">
-** Building the software manually
-
- You will need to obtain the Mono dependencies first: <a
- href="http://www.gtk.org">glib 2.x</a> and
- <a href="http://www.freedesktop.org/software/pkgconfig">pkg-config</a>.
-
-*** Building on Linux
-
- <ul>
- Unpack the Mono runtime distribution:
- <pre>
- tar xzvf mono-X.XX.tar.gz
- cd mono-X.XX
-
- </pre>
- <p>
-
- Then configure, compile and install:
-
- <pre>
-
- ./configure --prefix=/usr/local
- make
- make install</pre>
-
- This will give you a runtime, C# compiler and runtime
- libraries.
-
- If you want to recompile the runtime and the compiler,
- follow these steps, first unpack the MCS package:
-
- <pre>
- tar xzvf mcs-X.XX.tar.gz
-
- cd mcs-X.XX
- </pre>
-
- Then use the following command to compile and install:
-
- <pre>
-
- make -f makefile.gnu install prefix=/usr/local
- </pre>
-
- You can change /usr/local to something else if you want.
- </ul>
-
-
-*** On Windows, to install and work on the compiler and the class libraries:
-
-**** Install Cygwin and the GNU build tools, Microsoft's .NET Framework SDK and the precompiled GLIB 2.0 and pkg-config libraries.
-
- <ul>
-
- * Install <a href="http://www.cygwin.com">Cygwin</a>.
-
- * Install <a href="http://msdn.microsoft.com/downloads">
- Microsoft .NET Framework SDK</a>.
-
- * Change to the /usr/local directory
- of your Cygwin installation.<br>
- Unzip the precompiled packages listed above.
-
- </ul>
- <ul>
-
- * If you downloaded the Mono
- <a href="http://www.go-mono.com/snapshots">nightly snapshot
- </a>, untar the snapshot.
-
- * Change directories to "mcs".
-
- * Compile:
-
- <pre>
- make
- </pre>
- </ul>
-
-*** On Windows, to compile the mono runtime:
-
- <ul>
-
- * If you downloaded the Mono
- <a href="http://www.go-mono.com/snapshots">nightly snapshot
- </a>, untar the snapshot.
-
- * Change directories to "mono".
-
- * Configure, compile and install:
- <pre>
- ./configure --prefix=c:/mono
- make
- make install
- </pre>
-
- </ul>
-
-* Software resources and notes
-
- The required and additional software can be downloaded here:
-
- * Microsoft's .NET Framework SDK from
- <a href="http://msdn.microsoft.com/downloads">
- msdn.microsoft.com/downloads</a>.
-
- * Cygwin and the GNU Make tools from
- <a href="http://www.cygwin.com">www.cygwin.com</a>.
- Some people observed problems with autoconf 2.52. Installing
- autoconf 2.13 helped in those cases.
-
- * Precompiled GLIB 2.0 and pkg-config packages (and
- their dependencies) by the <a href="http://www.gimp.org/~tml/gimp/win32//index.html">GIMP for Windows</a> project from
- <a href="http://www.go-mono.com/archive/pkgconfig-0.11-20020310.zip">http://www.go-mono.com/archive/pkgconfig-0.11-20020310.zip</a><br>
- <a href="http://www.go-mono.com/archive/glib-2.0.4-20020703.zip">http://www.go-mono.com/archive/glib-2.0.4-20020703.zip</a> <br>
- <a href="http://www.go-mono.com/archive/glib-dev-2.0.4-20020703.zip">http://www.go-mono.com/archive/glib-dev-2.0.4-20020703.zip</a> <br>
- <a href="http://www.go-mono.com/archive/libiconv-1.7.zip">http://www.go-mono.com/archive/libiconv-1.7.zip</a> <br>
- <a href="http://www.go-mono.com/archive/libiconv-dev-1.7.zip">http://www.go-mono.com/archive/libiconv-dev-1.7-20020101.zip</a> <br>
- <a href="http://www.go-mono.com/archive/libintl-0.10.40-20020101.zip">http://www.go-mono.com/archive/libintl-0.10.40-20020101.zip</a><br>
-
-
- * Download the Mono source code from the
- <a href="#feb-11">packaged versions</a> or
- the <a href="http://www.go-mono.com/snapshots">
- nightly snapshots</a> or the <a href="anoncvs.html">
- Anonymous CVS</a>. The nightly snapshots are done every
- night at 10pm EST (Boston Time). The nightly snapshots are
- not guaranteed to build, but most of the time they should.
-
-
- </ul>
-
-
-*** Notes on compiling GLIB 2.0 and pkg-config from source:
-
-
- <ul>
-
- * Some people observed problems with autoconf 2.52. Installing
- autoconf 2.13 helped in those cases (don't forget to do a
- `make maintainer-clean' after the update).
-
- * Download, compile and install <a href="http://www.freedesktop.org/software/pkgconfig">pkg-config</a> from source.
- (I had to change line 674 of
- <nobr><tt>pkg-config-0.8.0/glib-1.2.8/gstrfuncs.c</tt></nobr> from
- <nobr><tt>extern char *strsignal (int sig);</tt></nobr> to
- <nobr><tt>extern const char *strsignal (int sig);</tt></nobr>.
-
-<pre>
-tar xzvf pkg-config-0.8.0.tar.gz
-cd pkg-config-0.8.0
-./configure --prefix=/usr
-make
-make install
-</pre>
-
- * Download, compile and install <a href="ftp://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.7.tar.gz">libiconv</a> from source.<br>
- If you dont have MS Visual C/C++ 4.0 or 5.0 or 6.0 you can also try
- the binary package available at <a
- href="http://www.gimp.org/win32/libiconv-dev-20001007.zip">
- http://www.gimp.org/win32/libiconv-dev-20001007.zip</a>.
-
-
- * Download, compile and install the
- <a href="ftp://ftp.gtk.org/pub/gtk/v2.0/glib-2.0.6.tar.gz">
- glib 2.0</a> from source.
-
- </ul>
-
-<a name="upgrading">
-** Upgrading
-
- To upgrade your Mono installation from CVS, it is very
- important that you update your Mono and MCS modules from CVS
- at the same time. Failure to do so might result in a
- problematic installation as the runtime and the class
- libraries will be out of sync.
-
- Run the following commands to update your CVS tree (more
- details in <a href="ccvs.html">Cvs and Mono</a> and the <A
- href="anoncvs.html">AnonCVS and Mono</a> pages).
-
- <pre>
- (cd mono; cvs update -dP .)
- (cd mcs; cvs update -dP .)
- </pre>
-
- Once you have updated your sources, remove any cached
- assemblies or old binaries from the Mono "runtime" directory,
- and then compile each component:
-
- <pre>
- (cd mono/runtime; rm *exe *dll)
- (cd mono; make)
- (cd mcs; make)
- </pre>
-
- Now you can install the result:
-
- <pre>
- (cd mono; make install)
- </pre>
+* Compilation
- Notice that following the above procedure does not require you
- to manually install the software in the `mcs' directory, as
- the relevant files will be copied by the `mono' makefiles.
+ For instructions on how to build Mono, please refer to the
+ <a href="compiling.html">compiling</a> page. \ No newline at end of file
diff --git a/web/drawing b/web/drawing
index 741e1606d2b..eb152415655 100644
--- a/web/drawing
+++ b/web/drawing
@@ -15,14 +15,20 @@
href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdicpp/GDIPlus/GDIPlusReference.asp">"GDI+
Flat API"</a>).
+ This means that the C# code is the same for Windows and Unix
+ systems. The following graph explains the situation:
+
<center>
<img src="images/system-drawing.png">
</center>
- In Windows Mono uses the GDI+ library that is included
- with the operating system, while in Unix we provide an
- implementation of this API which uses Cairo to do the heavy
- lifting.
+ In Windows Mono uses the GDI+ library that is included with
+ the operating system (<tt>GDIPLUS.DLL</tt>, while in Unix we
+ provide an implementation of this API in the
+ <tt>libgdiplus.so</tt> shared library. Our
+ <tt>libgdiplus.so</tt> has the same C Flat API as the
+ <tt>GDIPLUS.DLL</tt>. Our implementation uses Cairo to do
+ the heavy lifting.
The implementation of GDI+ lives in mcs/class/System.Drawing
in the gdiplus directory and requires <a
diff --git a/web/faq b/web/faq
index 5024fa67fdb..7646c85e73d 100644
--- a/web/faq
+++ b/web/faq
@@ -23,8 +23,8 @@
<a href="#problems">Mono Common Problems</a><br>
A <a
-href="http://www.es.gnome.org/documentacion/articulos/mono-puf/mono-puf/">Spanish
-translation</a> is also available
+href="http://www.monohispano.org/tutoriales/mono-puf//">Spanish
+translation</a> is also available (it is outdated though)
<a name="basics"></a>
** Basics
@@ -353,7 +353,7 @@ A: As long as your applications are 100% .NET and do not make use
Q: Where can I learn more about Gtk#?
-A: The following <a href="http://gtk-sharp.sourceforge.net>link</a> sends you to the page of the project.
+A: The following <a href="http://gtk-sharp.sourceforge.net">link</a> sends you to the page of the project.
Q: What can I do with Gtk#?.
@@ -760,7 +760,7 @@ Q: What about Soup? Can I use Soup without Mono?
A: Soup is a library for GNOME applications to create SOAP servers and
SOAP clients, and can be used without Mono. You can browse the
source code for soup using <a
- href="http://cvs.gnome.org/bonsai">GNOME's Bonsai</a>.
+ href="http://cvs.gnome.org/bonsai/">GNOME's Bonsai</a>.
Q: Can I use CORBA?
@@ -1053,12 +1053,13 @@ Q: Why don't you use Java? After all, there are many languages that
A: You can get very good tools for doing Java development on free
systems right now. <a href="http://www.redhat.com">Red Hat</a> has
contributed a <a href="http://gcc.gnu.org">GCC</a> <a
- href="http://gcc.gnu.org/java">front-end for Java</a> that can take
+ href="http://gcc.gnu.org/java/">front-end for Java</a> that can take
Java sources or Java byte codes and generate native executables; <a
- href="http://www.transvirtual.com">Transvirtual</a> has implemented
+ href="http://www.google.com/search?q=transvirtual">Transvirtual</a>
+ implemented
<a href="http://www.kaffe.org">Kaffe</a> a JIT engine for Java;
Intel also has a Java VM called <a
- href="http://www.intel.com/research/mrl/orp">ORP</a>.
+ href="http://www.intel.com/research/mrl/orp/">ORP</a>.
The JVM is not designed to be a general purpose virtual machine.
The Common Intermediate Language (CIL), on the other hand, is
diff --git a/web/gtk-sharp b/web/gtk-sharp
index 4d1bbf223c8..1630277d618 100644
--- a/web/gtk-sharp
+++ b/web/gtk-sharp
@@ -21,7 +21,7 @@
** Where to learn more.
Visit the official site for the <a href="http://gtk-sharp.sourceforge.net">Gtk# Project</a>.
- The <a href="http://www.go-mono.org/faq">Mono FAQ</a> has some useful
+ The <a href="http://www.go-mono.org/faq.html">Mono FAQ</a> has some useful
information too.
** GTK# On Linux
@@ -75,11 +75,6 @@ following:
<li>Microsoft .NET Framework at
<a href="http://msdn.microsoft.com/downloads/default.asp?url=/downloads/sample.asp?url=/msdn-files/027/000/976/msdncompositedoc.xml&frame=true">here</a> </li>
-<p>If you are running Windows 95/98/ME, then you will need Unicode support.
-Look in
-mono-list archives for information about how to get
-Mono to work on Windows 9x.
-<a href="http://lists.ximian.com/archives/public/mono-list/2002-December/004158.html">here</a>
<p>Environment Variables to set:
<ul>
diff --git a/web/ibmdb2 b/web/ibmdb2
index 3f148232652..0e395fffd38 100755
--- a/web/ibmdb2
+++ b/web/ibmdb2
@@ -49,14 +49,14 @@ In order to test.
<li>Have working mono and mcs setup</li>
<li>Have access to an IBM DB2 database. If you do not have access, download the
- <a href="http://www-3.ibm.com/software/data/db2/">IBM DB2</a> software. There
+ <a href="http://www-306.ibm.com/software/data/db2/">IBM DB2</a> software. There
are versions for Windows, Linux, AIX, and Sun Solaris.</li>
<li>Make sure the assembly Mono.Data.DB2Client.dll was built and installed
where the other class libraries are installed.</li>
<li>If you do not have the source to mcs, get the source from
- <a href="http://www.go-mono.com/download">here</a></li>
+ <a href="http://www.go-mono.com/download.html">here</a></li>
<li>Has a ConnectionString format like ODBC</li>
diff --git a/web/index b/web/index
index b6494fe705b..ca9dcb6c4bb 100644
--- a/web/index
+++ b/web/index
@@ -2,7 +2,7 @@
<table>
<tr>
- <td>
+ <td valign="top">
<a href="http://www.ximian.com">Ximian</a> announced the
launch of the Mono project, an effort to create an open source
implementation of the .NET Development Framework.
@@ -117,7 +117,8 @@
<img src="images/netmagazine.png">
</td>
<td>
- <a href="http://www.fawcette.com/dotnetmag/2003_TE/magazine/columns/trends/default.asp">May 31st, 2003</a>: CLI integration.
+
+ <a href="http://www.ftponline.com/wss/2003_TE/magazine/columns/trends">May 31st, 2003</a>: CLI integration.
</td>
</tr>
<tr>
@@ -149,6 +150,28 @@
</tr>
</table>
+@item Jan 18th, 2004: LDAP class libraries in Mono tutorial.
+
+ Sunil Kumar has written an <a
+ href="http://www.novell.com/coolsolutions/cooldev/features/a_net_cplus_ldap_library_cdev.html">introduction
+ to Novell.LDAP</a> class libraries, which are part of Mono.
+
+@item Jan 13th, 2004: MonoDoc 0.9 released.
+
+ A new edition of MonoDoc, the Mono Documentation Browser, has been released, available in source form from:
+ <a href="archive/monodoc-0.9.tar.gz">archive/monodoc-0.9.tar.gz</a>
+
+@item Jan 11th, 2004: Call for Stories
+
+ If you have a success story about using Mono or one of the Mono
+ components in any way, we want to hear about you. Please mail
+ your details to miguel@ximian.com
+
+@item Jan 4th, 2004: Windows Installer for Mono 0.29
+
+ There is a <a href="archive/mono-0.29-win32-1.exe">Windows
+ Installer for Mono 0.29</a> available now.
+
@item Dec 21st: Mono on PowerPC Progress.
Paolo reports today that the Mono JIT on the PowerPC was able
@@ -230,7 +253,8 @@
@item Oct 25th: GTK# 0.11+ Windows Installer available
- Johannes created a <a href="http://java.thn.htu.se/~toor/gtk-sharp/gtk-sharp-0.11-cvs.exe">Windows Installer for GTK# 0.11+</a> and works
+ Johannes created a Windows
+ Installer for GTK# 0.11+ and works
with Mono 0.28 for Windows.
@item Oct 21st: Mono Community at Novell Forge
@@ -336,7 +360,7 @@
href="images/finddlg.png">here</a>.
Johannes has patches to have Wine track the Gtk theme,
- screenshot <a href="http://www.sport-huettn.de/jroith/swfsample.png">here</a>
+ screenshot here (link got broken).
<b>Security:</b> New authenticode support from Sebastien has
been checked into CVS.
@@ -580,984 +604,6 @@
build system, we will be able to expose it (as part of the
NET_1_1 build).
-@item Jul 9th, 2003: ASP.NET web services, coverage tools.
-
- Web Services keep advancing: now we also support server-side
- authoring of Web Services as well as web service clients
- (which shipped in Mono 0.25). This works using our ASP.NET
- runtime, so it works with either XSP or the Apache module. The
- new Web Services work from Lluis added the missing bits:
- <ul>
- <li> .asmx files.
- <li> Method calls with complex parameters (whatever XmlSerializer can currently serialize, which is a quite a lot).
- <li> ref and out parameters.
- <li> Soap headers (In, Out and InOut).
- <li> Soap extensions, both global (configured in web.config) and particular to methods (configured using attributes).
- </ul>
-
- For more details, see Lluis <a href="http://lists.ximian.com/archives/public/mono-devel-list/2003-July/001449.html">post</a>
-
- GUI-wise: Work on <a href="http://xr.xwin.org">Xr</a> to
- implement System.Drawing continues. This will provide a full
- GDI+ implementation for Mono, and this will be hooked up into
- Gtk# and System.Windows.Forms.
-
- MonoDoc keeps moving along, with a new web-based version
- coming up next, and we are also exploring a collaborative
- extension to allow people to contribute documentation through
- their web browsers.
-
- Zoltan's Coverage analysis tool has been checked into CVS.
- With this tool it is now possible to find which class library
- code paths are missing regression tests. The module is
- `monocov'. Details are <a
- href="http://www.nexus.hu/vargaz/">here</a>. A fresh Gtk#
- version is available now.
-
- Jean's remoting-based Soap implenentation is also maturing.
-
-@item Jun 26th: Mono 0.25 has been released.
-
- We have released Mono 0.25. A list of the new features is
- available <a href="archive/mono-0.25.html">here</a>.
-
- Packages for Windows, and various Linux distributions are
- available on our <a href="download.html">download</a> page.
-
-@item Jun 17th, 2003: Web Services client; Profiling hooks
-
- Lluis and Gonzalo have checked into CVS the support for web
- services in the Mono runtime. This allows Mono to work as a
- web services client. We still require a WSDL compiler to
- compile the initial stub, but Erik has the beginning of a WSDL
- compiler ready and Atsushi has continued work on his
- experimental Xml Schema to C# class generator.
-
- As part of this, the Mono Http runtime has been rewritten to
- increase reliability, scalability and conformance to the
- specs. Also our io-layer has been extended to not have
- arbitrary limits. This was done as part of our collaboration
- with SourceGear.
-
- Paolo has commited the new pluggable profiling API to the Mono
- runtime: now the profiler is built as a module, and a new code
- coverage analysis has been checked in (and Zoltan already
- added improvements to it).
-
- Mark's Mozilla bindings continue to improve, and we will shortly
- migrate the Mono documentation browser to use Mozilla, to take
- advantage of the tutorial's use of CSS.
-
- Jackson's work on the IL assembler and Ben on running
- regression tests have provided us with a very needed tool in
- the Mono toolkit. One of the last missing pieces on the SDK.
-
- On the crypto world, we got Sebastien's certificate viewer
- checked into CVS and the crypto code keeps advancing by leaps
- and bounds.
-
- Alexandre and Aleksey Work continues on Windows.Forms on top
- of Wine and Gtk# (the former for full compatibility, the later
- for ease-of-authoring).
-
- Cesar checked in the beginning of the semantic analysis code
- for his JScript compiler, and will be working on it full time.
-
-@item Jun 11th, 2003: SourceGear and Ximian announce partnership
-
- Ximian, Inc., the leading provider of desktop and server
- solutions enabling enterprise Linux adoption, today announced
- that SourceGear Corporation will use Mono\x{2122} Project
- technology to offer cross-platform versions of its
- products. In addition, the companies have entered into a
- development partnership under which Ximian will provide
- custom Mono development to enable delivery of SourceGear
- products later this year. As a result, SourceGear will offer
- both UNIX and Linux clients for its SourceGear Vault source
- code management tool, enabling broader use of its solutions in
- mixed-platform development organizations.
-
- <a href="http://www.ximian.com/about_us/press_center/press_releases/index.html?pr=sourcegear">Read more...</a>
-
- Some technical details are available <a
- href="http://lists.ximian.com/archives/public/mono-list/2003-June/014334.html">here</a>.
-
-@item May 20th, 2003: OpenLink releases WineLib patches.
-
- OpenLink <a
- href="http://lists.ximian.com/archives/public/mono-winforms-list/2003-May/000284.html">announced</a>
- the release of Vladimir's work to turn Wine into a library
- that can be used dynamically from Mono. This work simplifies
- the work on System.Windows.Forms as it is no longer necessary
- have a special version of the GC, nor have a stub program.
- The patches are available <a
- href="http://www.openlinksw.com/mono/">here</a>.
-
- Mono packages for the Linux/s390 are available now in the <a
- href="download.html">download page</a>.
-
-@item May 10th, 2003: Eclipse runs on Mono
-
- Today Zoltan Varga announced that he got the <a
- href="http://www.eclipse.org">Eclipse IDE</a> running on top
- of Mono+<a href="http://www.ikvm.net">IKVM</a>.
-
- A screenshot of Eclipse running with Mono can be found <a
- href="images/ikvm-screenshot.png">here</a>
-
-@item May 6th, 2003: Mono 0.24 ships
-
- We have released Mono 0.24 which includes our new code
- generation engine. A list of the new features is available <a
- href="archive/mono-0.24.html">here</a>.
-
- Packages for Windows, and various Linux distributions are
- available on our <a href="download.html">download</a> page.
- We are shipping Gtk# and MonoDoc packages for the first time.
-
-@item Apr 21st, 2003: Virtuoso 3.0 ships.
-
- <a href="http://www.openlinksw.com">OpenLink's</a> released
- their <a href="http://www.openlinksw.com/press/virt3rel.htm">Virtuoso
- 3.0</a> database system. Virtuoso ships on Windows and Linux.
- On Linux they use Mono as their runtime to host C#, .NET and
- ASP.NET. Congratulations to OpenLink for their release.
-
- Virtuoso can be downloaded <a
- href="http://oplweb2.openlinksw.com:8080/download/virtuoso.vsp">here</a>
- and a demo is available <a
- href="http://demo.openlinksw.com:8890/tutorial/hosting/ho_s_2/ho_s_2.vsp">here</a>.
-
- OpenLink is contributing fixes and code to the Mono project on
- an ongoing basis.
-
- Jon Udell wrote a small <a
- href="http://www.infoworld.com/article/03/03/14/11stratdev_1.html">entry</a>
-
-@item Apr 19th, 2003: RelaxNG validating reader; Activities.
-
- Atsushi has created a <a
- href="http://www24.brinkster.com/ginga/RelaxngValidatingReader/">RelaxNG</a>
- validating XML reader.
-
- There is activity on the <a
- href="http://www.gotmono.com">GotMono forums</a> and the <a
- href="http://www.nullenvoid.com/gtksharp/wiki/">Gtk# Wiki</a>
-
-@item Apr 11th, 2003: First Mono Book is out; Team pages.
-
- The first book to cover Mono is out. This book is currently
- only available in German, you can find it <a
- href="http://www.amazon.de/exec/obidos/ASIN/3827264928/qid=1050051051/sr=2-1/ref=sr_2_3_1/028-2755135-1623712">here</a>
-
- We now have a page for the <a href="team.html">Mono Team</a>
- where we include a list of some of the people who have made
- Mono possible. If you have CVS access, please update the page
- to include your information.
-
-@item Apr 5th, 2003: New compilation engine.
-
- The new Mono compilation engine has been placed on CVS, the
- details are <a
- href="http://lists.ximian.com/archives/public/mono-list/2003-April/013269.html">here</a>
-
- Zoltan has commited his <a
- href="http://lists.ximian.com/archives/public/mono-devel-list/2003-April/000274.html">typed
- allocation</a> patches to CVS as well.
-
-@item Apr 3rd, 2003: NUnit 2.0 GTK# GUI; GtkMozEmbed; SWT#
-
- Gonzalo has checked in his <a href="http://gtk-sharp.sf.net">Gtk#</a>-based
- <a href="http://nunit.org">NUnit</a> tool. Screenshots are <a
- href="http://primates.ximian.com/~gonzalo/mono/shots/running.png">here</a>
- and <a
- href="http://primates.ximian.com/~gonzalo/mono/shots/finished.png">here</a>
-
- Mark has checked his bindings for Gtk-based Mozilla into CVS,
- module name: `GtkMozEmbed'. Read the <a
- href="http://lists.ximian.com/archives/public/mono-list/2003-April/013247.html">details</a>
-
- The SWT port to C# using Gtk is <a
- href="http://lists.ximian.com/archives/public/sd-mono-port/2003-March/000114.html">progressing</a>. Screenshots are
- <a href="http://www.roboto.ch/swt">here</a>.
-
-@item Mar 28th: Mono community site.
-
- <a href="http://www.gotmono.com">www.gotmono.com</a> has
- openend its door: Got Mono is a Mono Community site.
-
-@item Mar 25th: Second Mono Survey
-
- <table width="100%" cellpadding="0" cellspacing="1" border="0" bgcolor="blue">
- <tr>
- <td valign="top">
- <div style="background: #c0d0ff; margin: 0px 0px 0px 0px; padding: 1px;">
- What do you think about Mono?
-
- Is your company involved with the development and
- deployment of web applications? Is Linux becoming an
- important part of your company's business application
- strategy? Are you considering Mono for your next
- project? Would you like to shape the future of Mono
- and the use of Linux in business critical
- applications?
-
- If you answered yes to any of these questions, we
- would like to talk with you. If interested, please
- email us at <a
- href="mailto:mbadgett@ximian.com">mbadgett@ximian.com</a>.
- </div>
- </td>
- </tr>
- </table>
-
-@item Mar 20th: Windows.Forms and Wine.
-
- Alexandre has provided a modified version of the GC system
- that will work with and Mono. See the mono-winforms-list. It
- is now possible to run our Win32-based implementation of
- Windows.Forms with Mono on Linux.
-
-@item Mar 7th: Mono 0.23
-
- A new freshly baked release of Mono is available. Release
- notes are <a href="archive/mono-0.23">here</a>. This is mostly a
- bug fix release. No new features.
-
-@item Mar 5th, 2003: Mono 0.22; MonoDoc 0.2; Debugger 0.2.1: Release-o-Rama.
-
- Mono 0.22 has been released. See the <a
- href="archive/mono-0.22">release notes</a>. This is a bug fix
- release.
-
- A new preview of MonoDoc 0.2, the Mono Documentation browser
- has been <a href="http://lists.ximian.com/archives/public/gtk-sharp-list/2003-March/001266.html">released</a>.
-
- Martin also announced a <a
- href="http://lists.ximian.com/archives/public/mono-list/2003-March/012756.html">new
- release</a> of the Mono Debugger (both GUI and command line).
-
-@item Mar 3rd, 2003: The Mono Hackers Hall Of Fame welcomes Zoltan Varga
-
- The <a href="hackers.html">Mono Hackers Hall Of Fame</a>
- continues to show our appreciation to the excellent
- contributors that make <b>mono::</b> a successful free
- software project.
-
- Zoltan has contributed significantly to Mono, with bug reports and bug
- fixes as well as pushing the envelope of the things that can be done in
- and with the mono runtime: the gcc-based ngen compiler, code coverage
- and more recently his work with Reflection.Emit that got mono to the
- point of running the <a href="http://www.ikvm.net">IKVM</a> Java virtual
- machine.
-
-@item Mar 2nd, 2003: New Mono mailing list.
-
- A new mailing list for <a
- href="http://lists.ximian.com/mailman/listinfo/mono-devel-list">Mono
- Development</a> has been created.
-
-@item Feb 27th, 2003: Mono 0.21 released
-
- Mono 0.21 has been released. This is only a bug fix release.
- The <a href="archive/mono-0.21">release notes</a> are available.
-
- Windows binary is available <a href="archive/mono-0.21-win32-1.exe">here</a>
-
-@item Feb 25th, 2003: Mono 0.20 for Windows released; New Apache module released.
-
- Packages of Mono for Windows have been <a
- href="archive/mono-0.20-stable-win32-2.exe">released</a>.
- Thanks to Daniel, Johannes and Paolo for setting this up.
-
- Daniel has released a new version of his Mono Apache module that
- handles ASP.NET. The code is available at <a
- href="http://apacheworld.org/modmono/">here</a>
-
- Nick has posted an update on the progress on our <a
- href="http://lists.ximian.com/archives/public/mono-list/2003-February/012467.html">regression
- tests</a>. We are looking for more tests, and more volunteers to write them.
-
- Also, remember to contribute to the Gtk# documentation effort,
- momentum is picking up! See the entry for Feb 18th for more details.
-
-@item Feb, 23rd, 2003: Mono 0.20 released; Gtk# 0.8 released.
-
- Mono 0.20 has been released. Check out the <a
- href="archive/mono-0.20">release notes</a> for an overview of
- the changes. You can get it <a href="download.html">here</a>.
- There are no major features in this release, mostly bug fixes
- and performance improvements.
-
- Gtk# 0.8 has been <a
- href="http://lists.ximian.com/archives/public/gtk-sharp-list/2003-February/001114.html">released</a>
-
- <b>Important</b>: The contributed binaries for Windows
- binaries of Mono 0.20 contain a virus. Please read <a
- href="virus.html">this</a> if you installed the binary.
-
-@item Feb 18th, 2003: Volunteers to document Gtk#
-
- With the availability of a documentation browser, we are
- looking for volunteers to help us complete the documentation
- of the Gtk# binding for Mono.
-
- Experience with Gtk is useful, but not mandatory. We have
- checked in stubs, and we have instructions, and resources to
- how to complete this process <a
- href="documentation.html">here</a>. Mail the <a
- href="mailto:mono-docs-list@ximian.com">mono-docs-list@ximian.com</a>
- for further discussion.
-
-@item Feb 14th, 2003: OpenGL# bindings for Mono; Mono Basic updates.
-
- Mark Crichton has completed his OpenGL/GLUT bindings for
- Gnome. A screenshot can be seen <a
- href="sshots/oglcs.png">here</a>. The bindings are available
- on the Mono CVS repository on the module `glgen'. This is a
- straight binding to the C API.
-
- Marco has <a
- href="http://lists.ximian.com/archives/public/mono-list/2003-February/011752.html">posted
- an update</a> on the current state of the free VB.NET compiler
- for Mono.
-
- We are looking for contributors and maintainers to the
- JavaScript compiler as well (Janet)
-
-@item Feb 12th, 2003: New assemblies, Gtk# stub documentation, Authenticode, Polish site
-
- Mono now distributes a few new assemblies: Mono.Security.Win32
- as a layer to use the crypto functionality on Win32. The
- Mono.Posix assembly which contains functionality for taking
- advantage of Unix facilities.
-
- A <a href="http://www.go-mono.pl/">Mono site in Poland</a>.
-
- Stubs for the Gtk# documentation have been checked into CVS.
- If you want to contribute please read <a
- href="http://lists.ximian.com/archives/public/mono-list/2003-February/012108.html">this
- message</a>
-
- Mono development is moving quickly: Tim and Daniel have been
- improving the Oracle database provider and Sebastien Pouliot
- has got code signing to work using Authenticode with pure open
- source and managed code. Plenty of new VB.NET work from Marco
- (compiler) and Daniel (runtime). Also Jackson has resumed
- work on the IL assembler and the fully managed library to
- generate CIL images (Sergey wrote the first Mono.PEToolkit).
-
-@item Feb 11th, 2003: Mono Weekly News, New assemblies.
-
- <a href="http://monoevo.sourceforge.net/mwn/index.html">Mono
- Weekly News</a>: Includes a new interview, software
- announcements and the PHP/Mono integration.
-
-@item Feb 5th, 2003: MonoDoc 0.1
-
- A <a
- href="http://www.go-mono.com/archive/monodoc-0.1.tar.gz">preliminary
- release</a> of the Mono Documentation Browser is now availble.
- Release <a
- href="http://lists.ximian.com/archives/public/mono-list/2003-February/011935.html">notes</a>
-
-@item Jan, 22th, 2003: Mono wins award, OpenLink releases Virtuoso.
-
- Mono won the `Best Open Source Project' award at the Linux
- World Expo. A description is <a
- href="http://linuxtoday.com/news_story.php3?ltsn=2003-01-23-024-26-OP-EV">here</a>
-
- Open Link has a <a
- href="http://biz.yahoo.com/prnews/030123/neth013_1.html">press
- release</a> about Virtuoso 3.0: the first commercial product
- shipping that uses Mono.
-
-@item Jan, 20th, 2003: Mono 0.19 released; Screenshots page; Gtk# 0.7
-
- Mono 0.19 has been released. Check out the <a
- href="archive/mono-0.19">release notes</a> for an overview of
- the changes. You can get it <a href="download.html">here</a>.
- There are no major features in this release, mostly bug fixes
- and performance improvements.
-
- We have now a new section <a href="screenshots.html">with
- screenshots</a> of various Mono applications. You can see
- there the new released Debugger, as well as the work in
- progress on the documentation browser.
-
- <a href="http://gtk-sharp.sf.net">Gtk# 0.7</a> has been <a
- href="http://lists.ximian.com/archives/public/mono-list/2003-January/005222.html">released</a>
-
-@item Jan, 19th, 2003: Mono Debugger released.
-
- After six month of extensive development, Martin Baulig has
- released the first version of the Mono debugger. The Mono
- debugger is written in C# and can debug both managed and
- unmanaged applications, support for multiple-threaded
- applications and should be relatively easy to port to new
- platforms.
-
- Details of the release are available in <a
- href="http://lists.ximian.com/archives/public/mono-list/2003-January/005192.html">post</a>.
-
- The debugger contains both Gtk# and command line interfaces.
- The debugging file format used in Dwarf (its already supported
- by our class libraries and the Mono C# compiler; To debug C
- applications, you need a recent GCC, or to pass the -gdwarf-2
- flag to gcc).
-
-@item Jan, 17th, 2003: DB2 provider, MacOS X
-
- Christopher Bockner has contributed a DB2 System.Data client.
-
- MacOS X support on the runtime has been integrated into the
- distribution, and MCS works with it.
-
- Zoltan has managed to get <a
- href="http://radio.weblogs.com/0109845/">IKVM</a> (a Java VM
- for .NET) to run with Mono. The HelloWorld.class runs with
- the Mono runtime.
-
-@item Jan, 13th, 2003: Mono 0.18 released
-
- Mono 0.18 has been released. Check out the <a
- href="archive/mono-0.18">release notes</a> for an overview of
- the changes. You can get it <a href="download.html">here</a>.
-
-@item Jan 10th, 2003: Mono Weekly News.
-
- A new issue of the <a
- href="http://lists.ximian.com/archives/public/mono-list/2003-January/004903.html">Mono
- Weekly News</a> has been published.
-
- Check out the <a href="crypto.html">Crypto status</a> page
- that Sebastien has put together.
-
-@item Jan 3rd, 2003: Glade#, Code Coverage, Apache, MBas, Debugger.
-
- Rachel has made Glade# use attributes so binding C# widgets to
- the designed widgets is now easier than ever. Alp has
- improved this to use implicit names as well.
-
- Martin's Mono debugger now has support for multi-thread
- debugging. Special feature: breakpoints can be defined in a
- per-thread basis now.
-
- Daniel López has checked in his Apache module to integrate
- Mono and Mono's ASP.NET support as an Apache module. Gonzalo
- has folded his new Mono hosting classes into this module (they
- are now shared between XSP and mod_mono). You can get the
- mod_apache from CVS (module name: mod_mono).
-
- Mono Basic improvements: Marco has added support for more
- statements on the grammar.
-
- Zoltan has <a href="http://www.nexus.hu/vargaz2/">posted</a>
- his Code Coverage analysis tool for Mono.
-
-@item Dec 17th, 2002: Mono: Commercial uses.
-
- <a href="http://www.tipic.com">Tipic</a> today <a
- href="http://www.ximian.com/about_us/press_center/press_releases/index.html?pr=tipic_mono">announced</a>
- their work on porting their Instant Messaging Server platform
- to run on Mono.
-
- <a href="http://www.winfessor.com">Winfessor</a> also <a
- href="http://www.winfessor.com/press.asp">announced</a> the
- availability of their Jabber SDK to run on Mono.
-
- Also two weeks ago we mentioned <a
- href="http://www.openlinksw.com">OpenLink Software's</a> <a
- href="http://www.ximian.com/about_us/press_center/press_releases/index.html?pr=openlink_mono">announcement</a>
- of their product, also using Mono.
-
-@item Dec 10th, 2002: Gtk# 0.6 released; Mono 0.17 packages for Windows and Debian.
-
- Mike Kestner <a
- href="http://lists.ximian.com/archives/public/mono-list/2002-December/003961.html">announced
- Gtk# 0.6</a>. This new release includes many new features and
- bug fixes, and is the perfect companion to the <a
- href="archive/mono-0.17">Mono 0.17</a> release.
-
- Johannes has contributed a Windows-ready package of Mono 0.17,
- and its available from our <a
- href="download.html">download</a> page.
-
- Alp Toker has <a href="http://www.atoker.com/mono/">Debian packages</a>
-
-@item Dec 9th, 2002: Mono 0.17 has been released
-
- Mono 0.17 has been released. Check out the <a
- href="archive/mono-0.17">release notes</a> for a more detailed
- list. You can get it <a href="download.html">here</a>.
-
- Many new features as well as plenty of bug fixes. Many new
- System.Data providers and a more mature System.Web (ASP.NET)
- which can now be hosted in any web server. A simple <a
- href="archive/xsp-0.2.tar.gz">test web server</a> to host
- asp.net has been released as well.
-
- This version also integrates Neale's s390 port.
-
- This release also includes a new exception handling system
- that uses the gcc exception information that vastly improves
- our internalcall speed (15% faster mcs compilation times).
-
-@item Dec 8th, 2002: VB.NET, Oracle Provider.
-
- Marco has got the Mono Basic compiler up to speed (support for
- classes, modules, expressions, object creation, method
- invocation, local variables, and some statements). The
- compiler is based on the work from Rafael Teixeira on MCS.
-
- Screenshots: <a
- href="http://modgb.sourceforge.net/monobasic_snap.png">in
- Windows doing Windows.Forms</a> and in Linux doing <a
- href="images/gtk-vb.png">VB with Gtk#</a> (courtesy of Alp).
-
- Daniel Morgan has checked in his Oracle provider to the CVS
- repository as well.
-
-@item Nov 27th, 2002: Press release, tutorials, Windows Forms, ADO.NET, Magazine.
-
- <a
- href="http://www.business2.com/articles/mag/0,1640,45454,FF.html">The
- Penguin Takes Flight</a>: an article written by Erick
- Schonfeld appears on the December issue of <a
- href="http://www.business2.com/">Business 2.0</a> magazine.
-
- <a href="http://www.openlinksw.com">OpenLink</a> and <a
- href="http://www.ximian.com">Ximian</a> made <a
- href="http://www.ximian.com/about_us/press_center/press_releases/index.html?pr=openlink_mono">joint
- announcement</a> on the plans of OpenLink to ship their <a
- href="http://www.openlinksw.com/virtuoso/index.htm">Virtuoso</a>
- server on Unix using Mono.
-
- Martin Willemoes's <a href="gnometutorial">GNOME.NET
- tutorial</a> is now available from the main Mono site. This
- tutorial is a collaborative effort to teach developers how to
- use Mono to create Mono applications using <a href="http://gtk-sharp.sf.net">Gtk#</a>
-
- Dennis Hayes has posted and <a
- href="http://lists.ximian.com/archives/public/mono-list/2002-December/003800.html">update</a>
- on the work to get Windows.Forms working on Mono. There is a
- new test application that people can use to test their
- controls. If you are interested in working on Windows.Forms,
- you can participate in the <a
- href="http://lists.ximian.com/mailman/listinfo/mono-winforms-list">mono-winforms
- mailing list</a>
-
- Brian Ritchie has been working on an ADO.NET <a
- href="http://brianritchie.webhop.net/ideas/adocodegen.aspx">data
- layer</a> and an <a
- href="http://brianritchie.webhop.net/ideas/appserver.aspx">application
- server</a> for Mono.
-
- Dan Morgan has checked in his Oracle provider, and Tim Coleman
- continues to work on the TDS implementation of the data classes.
-
- The rest of the team has been working on bug fixing in the
- runtime, the compiler, and the class libraries. Also,
- compilation speed has increased recently by performing a
- number of simple optimizations in the compiler.
-
-@item Nov 19th, 2002: Crypto update; Books; Gtk# Datagrid; .NET ONE Slides
-
- Sebastien has got DSA and RSA signatures <a
- href="http://lists.ximian.com/archives/public/mono-list/2002-November/003497.html">working</a>
- as well as RSA <a
- href="http://lists.ximian.com/archives/public/mono-list/2002-November/003502.html">encryption</a>.
- We now distribute Chew Keong TAN's BigInteger classes.
-
- Brian has contributed a System.Data multiplexor in Mono, it
- can be found in the Mono.Data assembly. The details of this
- new technology are <a
- href="http://lists.ximian.com/archives/public/mono-list/2002-November/003400.html">here</a>.
- It works in Mono and the .NET Framework.
-
- Larry O'Brien has announced the candidate book for <a
- href="http://lists.ximian.com/archives/public/mono-list/2002-November/003500.html">
- Thinking in C#</a>. The book is Mono-friendly.
-
- Another book that covers mono (available in German only) is <a
- href="http://www.databecker.de/frames.php?PHPSESSD=4948515556575049525459495248485949485348&PHPSESSID=6cc68dbcfbcbacd7b82a984b0700d5d6&t=2">
- here</a>.
-
- Dan Morgan has implemented a DataGrid widget for Gtk#, you can
- see Windows screenshots for it <a
- href="images/GtkSharpDataGridScreenshot.png">here</a> and <a
- href="images/SqlSharpGtkScreenshot4.png">here</a>.
-
- Slides from the Mono developers for the .NET ONE conference are available now:
- <ul>
- <li><a
- href="http://primates.ximian.com/~miguel/slides-europe-nov-2002/DotNetOneKeynote.sxi">
- Mono Keynote presentation</a>
-
- <li><a href="http://primates.ximian.com/~lupus/slides/embed/">Hosting the Mono Runtime</a><br>
- The simple embedding of Mono in Perl is available <a
- href="http://primates.ximian.com/~lupus/slides/embed/Mono-0.01.tar.gz">here</a>
-
- <li><a href="http://primates.ximian.com/~lupus/slides/jit/">The Mono JIT compiler</a>
-
- <li><a href="http://primates.ximian.com/~miguel/slides-europe-nov-2002/Mono_C_Sharp_Overview_1007.sxi">
- Mono C# Compiler Overview</a>
- </ul>
-
- A couple of other presentations from Miguel's trip to Europe
- are available <a
- href="http://primates.ximian.com/~miguel/slides-europe-nov-2002/">here</a>
- in Open Office file format.
-
-@item Nov 8th, 2002: Mono s390, Database work, new JIT updates.
-
- Neale Ferguson has contributed <a href="download.html">RPM
- packages</a> of Mono for the Linux/s390.
-
- Tim Coleman posted an <a
- href="http://lists.ximian.com/archives/public/mono-list/2002-November/003329.html">update</a>
- on the improvements in the System.Data
-
- The new JIT engine can run 72 out of our 154 tests for the
- virtual machine, and it also got exception support this week.
-
-@item Nov 1st, 2002: TDS, Crypto, Gtk#, Winforms, bug fixes.
-
- Tim's SqlClient is <a
- href="http://lists.ximian.com/archives/public/mono-list/2002-November/003161.html">now
- capable</a> of communicating with the Microsoft SQL server
- using the TDS protocol. A screenshot showing a sample client
- running with <a href="http://gtk-sharp.sf.net">Gtk#</a> on
- Windows is shown <a
- href="images/SqlSharpGtkSceenshot3.png">here</a>
-
- Sebastien has made all symetric ciphers functional on all
- supported modes; All the classes in Security.Cryptography are
- present and the X590 certificates are now in too. Jackson has
- been working on the Security classes.
-
- Many bug fixes all over the place: class libraries (Dick,
- Piers, Ville, Zoltan, Gonzalo, Dan, Atsushi, Nick, Phillip),
- compiler, runtime engine. A big thank goes for everyone who
- has been providing bug reports for us to track down.
-
- Gaurav has been working on multiple WebControls. Gonzalo migrated
- the ASP.NET engine to use POST for interaction.
-
- In the Gtk# land saw the integration of gda, gnome-db and GStreamer
- bindings.
-
- Windows.Forms classes now build on Linux and Windows, check
- out the status pages for areas of collaboration.
-
-@item Oct 24th, 2002: S390 support, XSP/ASP.NET, Win32 contributors, TDS.
-
- Today Neal Ferguson's support for the IBM S390 was checked
- into CVS.
-
- The XSP processor has been fully integrated into the
- System.Web assembly, and Gonzalo has finished the hosting
- interfaces in Mono. This means that it is possible to embed
- ASP.NET with the same APIs used in Windows, and is possible to
- easily embed it with Apache for example. The XSP module has
- now become a shell for testing the System.Web classes.
-
- We are looking for contributors that know Win32 to contribute
- to the Windows.Forms implementation. If you want to help
- write some controls using the Win32 API, get in touch with our new <a
- href="http://lists.ximian.com/mailman/listinfo/mono-winforms-list">mono-winforms-list@ximian.com
- list</a> mailing list.
-
- Tim's TDS System.Data set of classes can now talk to SQL
- servers using the TDS protocol (version 4.2) with
- connection pooling. Currently it can connect, run
- transactions, update/insert/delete, and read some types. A
- data adapter is also coming soon.
-
-@item Oct 21th, 2002: Crypto, Winforms list, Database, GConf, Debugger.
-
- Sebastien Poliot has made a lot of progress, he reports that
- DES and TripleDES have been fixed; Rijndael and CFB modes
- still have problems in some configurations and some areas that
- are not supported by the .NET framework.
-
- Last week we created a new <a
- href="http://lists.ximian.com/mailman/listinfo/mono-winforms-list">mailing
- list</a> to discuss the Mono Winforms implementation.
-
- Tim has started a full C# implementation of the TDS protocol
- and the providers, and Brian continues his work on his ODBC
- binding.
-
- Rachel Hestilow has also checked in a binding for GConf. This
- binding <a
- href="http://toxic.magnesium.net/~hestilow/gconfsharp/intro.html">is
- unique</a> in that it uses some features in the CLI to support
- complex data types, and allows the user to keep only one
- representation of the types instead of two (the master types
- is defined in CLI-land). Also Property Editors (<a
- href="http://primates.ximian.com/~miguel/shots/gconf-shot.png">shot</a>)
- simplify the creation of user interfaces that bind their
- configuration to backend keys, following the <a
- href="http://developer.gnome.org/projects/gup/hig/1.0/">GNOME
- Human Interface Guidelines.</a>
-
- Martin is now on vacation, but before leaving he produced a
- number of documents detailing the state of the debugger. The
- major missing feature is full support for debugging unmanaged
- applications (it requires dwarf-2 handlers for types). We
- will do some polishing of the user interface (<a
- href="http://primates.ximian.com/~miguel/shots/debugger-4.png">new
- shot</a>) to expose the existing and rich functionality to the
- users and try to release a preview of the debugger at the same
- time as Mono 0.17.
-
-@item Oct 14th, 2002: Crypto, Database work, Debugger, Documentation.
-
- Brian, Daniel and Rodrigo have been busy working on the ODBC
- provider for Mono. Daniel posted some <a
- href="http://lists.ximian.com/archives/public/mono-list/2002-October/002755.html">updates</a>.
- Brian posted <a
- href="http://lists.ximian.com/archives/public/mono-list/2002-October/002758.html">details
- about the ODBC.NET</a> provider.
-
- Also Sebastien Pouliot has been improving the various
- cryptographic classes in Mono, something that we had not done
- in quite some time. We are looking for a way to handle
- big-nums. We need either a managed or unmanaged set of
- classes for handling large numbers, and some volunteers to
- expose this functionality to C# (Either as an internal
- assembly, or as a set of P/Invoke, Internal call wrappers).
-
- Martin has got our debugger to support adding breakpoints at
- file/line combos. This was more complex than generic
- breakpoints in routines, because these breakpoints are set on
- routines that probably have not been JITed just yet. Martin's
- focus now is on stabilizing our debugger and aim for a public
- release of it.
-
- We have also imported the ECMA documentation into a separate
- module, and with the help from Scott Bronson we will have the
- necessary XSLT tools to finish our native documentation
- browser for Mono. This together with the work from Adam will
- be the foundation for the <a href="classlib-doc.html">Mono
- Documentation Tools</a>.
-
-@item Oct 9th, 2002: Various Mono updates.
-
- Brian Ritchie, Daniel Morgan, Rodrigo Moya and Ville Palo have
- been working on various database providers. The MySQL has
- seen a lot of work, and a new ODBC provider is now on CVS and
- more extensive regression tests have been checked in.
-
- Dick Porter is our background hero and keeps fixing the
- low-level bugs in the portability layer. Now the Mono handle
- daemon should be a lot more robust and will no longer leave IPC
- regions. Gonzalo Paniagua has initiated the migration of XSP
- into the System.Web class libraries now that we have a
- complete HttpRuntime implementation. This means that you are
- able to embed the ASP.NET processor into any web server you
- want. This also includes support for the system-wide
- configuration file `machine.config'.
-
- Martin Baulig has been busy with the Mono Debugger, you can see how
- it looks <a
- href="http://primates.ximian.com/~miguel/debugger-1.png">here</a>
- and <a
- href="http://primates.ximian.com/~miguel/debugger-2.png">here</a>.
- Now local variables and breakpoints are supported, and we are
- working on the UI elements to simplify their use (as seen on
- the screenshot).
-
- <a href="http://gtk-sharp.sf.net">Gtk#</a> has seen a lot of
- activity specially as we start to build larger applications.
- Vladimir Vukicevic, Kristian Rietveld, Rachel Hestilow, Mike
- Kestner and Miguel de Icaza have been busy improving it.
- mPhoto which is a Photo management application for Mono and
- Gtk# is seen <a
- href="http://primates.ximian.com/~miguel/shots/mphoto-2.jpg">here</a>.
-
- Chris Toshok the man behind LDAP in Evolution continues to
- work on the Mono.LDAP# implementation.
-
- Dietmar Maurer and Paolo Molaro are still busy working on our
- new optimized JIT/ATC engine and are making great progress.
- The code base has been designed to ease the implementation of
- more advanced compiler optimizations, and optimizations can be
- chosen individually so they can be tuned for a particular
- processor, or use profile-based information to improve the
- performance.
-
-@item Oct 1st, 2002: Mono 0.16 released; Debugger updates.
-
- Mono 0.16 has been released. Source and RPMs are <a
- href="download.html">available</a>. The release notes are <a
- href="archive/mono-0.16">here</a>.
-
- Martin's debugger can debug both managed and unmanaged code.
- Recently Martin added support for locals, parameters, and
- breakpoints on top of the existing infrastructure (his
- debugger supported instruction-level and source-code level
- single-stepping).
-
-@item Sep 19th, 2002: Mono Survey.
-
- Help us plan for the future of Mono by filing out the <a
- href="http://primates.ximian.com/~miguel/monosurvey">First Mono
- Survey</a>
-
-@item Sep 17th, 2002: Mono Hackers Hall of Fame: Sergey Chaban
-
- The <a href="hackers.html">Mono Hackers Hall Of Fame</a>
- continues to show our appreciation to the excellent
- contributors that made <b>mono::</b> a successful free
- software project.
-
- This time the Hall of Fame welcomes Sergey Chaban. Sergey has
- been a long time contributor to the project, from the early
- work on the class libraries that were critical to Mono's
- origin: every time you use a Hashtable in Mono, it runs
- Sergey's code, to the low-level optimizations on the JIT
- engine and to his work on ILASM and the PEToolkit.
-
-
-@item Sep 16th, 2002: Documentation Tools, ILASM, Debugger, Mono LDAP, Winforms
-
- Adam Treat has started moving the documentation universe again. We
- have a new strategy to document our APIs (given that we have
- chosen <a href="classlib-doc.html">not to document the code
- inline</a>). This includes the use of a master reference file
- that will hold the entry points to document. All master files
- for our assemblies have been checked into CVS now.
-
- Sergey Chaban's Mono.PEToolkit and ILASM tools have been
- checked into CVS. Although ILASM is old and will soon be
- updated, we wanted to get the build issues sorted out.
-
- Martin Baulig's Mono Debugger is still on its early stages,
- but you can run and run step by step your C# code and C code
- (including the Mono runtime). Dwarf-2 is required to compile
- your code. The regular step, step-into, and assembly-level
- step and step-into are supported. And comes with a Gtk#
- UI. The debugger is written mostly in C# with some C glue
- code. Most of the work is on the engine, we will be working
- on making a good UI in the future.
-
- Chris Toshok of the Hungry Programmer's fame has checked in
- Mono.Directory.LDAP, a C# wrapper for the LDAP libraries.
- This is the substrate for implementing the
- System.DirectoryServices assembly.
-
- Andrew has also continued with some of the cryptographic
- classes implementation.
-
- After much public debate, we have chosen a new <a
- href="winforms.html">strategy to implement winforms</a>.
- Implementing a Gtk, Qt or Aqua based version of Winforms was
- going to be almost as complex as implementing Wine itself. So
- the new strategy is to only roll out a WineLib-based
- implementation.
-
-@item Sep 4th, 2002: .NET One 2002 Program available
-
- The <a
- href="http://www.sigs-datacom.de/sd/kongresse/dotnet_2002/index.htm">.NET
- ONE 2002</a> conference in Frankfurt is now available. Paolo
- will be talking about the Mono JIT and embedding the Mono
- runtime in your Windows and Linux applications. Mike Kestner
- will talk about <a href="http://gtk-sharp.sf.net">Gtk#</a> and
- the automatic binding generator used by Gtk# and Miguel will
- be talking about the Mono project on Monday's keynote and on
- the Mono C# compiler on Tuesday.
-
-@item Sep 3rd, 2002: Apache integration
-
- <a
- href="http://lists.ximian.com/archives/public/mono-list/2002-September/001862.html">Sterling</a>
- announced an Apache module that hosts
- Mono, and allows CIL code to run from within Apache, giving the
- module access to the Apache runtime. This uses the Mono embedding
- API.
-
-@item Aug 24th, 2002: Gtk# 0.4 released
-
- Shortly after <a href="download.html">Mono 0.15</a> was
- released a fresh version of <a
- href="http://gtk-sharp.sf.net">Gtk#</a> was <a
- href="http://lists.ximian.com/archives/public/mono-list/2002-August/001702.html">announced</a>.
-
-@item Aug 23rd, 2002: Mono 0.15 released
-
- Mono 0.15 has been released. Source and RPMs are <a
- href="download.html">available</a>. The release notes are <a
- href="archive/mono-0.15">here</a>
-
-@item Aug 21th, 2002: Portable.NET encodings integrated into Mono.
-
- Rhys Weatherley has contributed the Portable.NET encoders to
- the Mono class libraries. This is a great step towards
- cooperation between these projects. Thanks to Paolo for doing the
- merger on our side.
-
- His encoders are more complete than the iconv-based approach
- that mono used, which was unreliable under certain
- circumstances.
-
-@item Aug 20th, 2002: Remoting work, Resources, SPARC checkins, ADO.NET
-
- <b>San Francisco</b>: August 14th. Linux World Expo.
-
- Mark Crichton has checked in his patches to get the SPARC port
- on par with the PPC port.
-
- Dick has checked-in the resource reader and resource writers
- to the class libraries, and Dietmar checked in the C# support
- code for the remoting infrastructure.
-
- More work on System.Data: the LibGDA (our OleDB backend) based
- providers are quickly maturing, and recently they executed
- their first query.
-
-@item Aug 13th, 2002: MCS news, Gtk# progress, Windows.Forms, ADO.NET
-
- Martin Baulig has been fixing all the known bugs in the C#
- compiler and now has moved into improving the compilation
- speed and the generated code quality of MCS. Today we got a
- 50% speedup in the bootstrap of MCS going from 24 seconds to 12 seconds.
-
- Gtk# has been making a lot of progress, some interesting
- corner cases are now supported:, you can now create canvas items as
- well as using the tree widget. Here is a shot of <a
- href="images/mocil.png">MonoCIL</a>.
-
- On the runtime front, focus has been on improving remoting
- support, exception handling, as well as completing the support
- for structure marshaling.
-
- Patrik is also back in action: the HttpRuntime infrastructure
- is rapidly improving, and Gonzalo is working into moving XSP
- into our main class library and providing the missing pieces
- to integrate with Patrik's code.
-
- Dennis and his team are working on a WineLib-based
- implementation of Windows Forms to guarantee that the corner
- cases of Windows.Forms can be handled, and we are back on track again.
-
- A lot more work on the ADO.NET and WebServices has also been
- checked into CVS.
-
-@item Aug 1st, 2002: Mono Hackers Hall of Fame
-
- The <a href="hackers.html">Mono Hackers Hall Of Fame</a> has been started
- to show our appreciation to the excellent contributors that made <b>mono::</b>
- a successful free software project.
-
- The first, deserved, entry goes to
- Nick Drochak, who joined us in the first days of Mono and built the testing
- infrastructure for the C# assemblies, fixed tons of bugs and even adventured
- himself in the lands of the C runtime. His work is invaluable for keeping
- Mono on the right track through the daily changes in the codebase.
-
<h2>Older News</h2>
Click <a href="oldnews.html">here</a> to see the olds news.
diff --git a/web/languages b/web/languages
index 0f53720613b..046945817a2 100755
--- a/web/languages
+++ b/web/languages
@@ -34,7 +34,7 @@
* <a href="#python">Python</a>
</ul>
-<a name="Java">
+<a name="Java"></a>
** Java
There is a very interesting project to make a JavaVM for .NET
@@ -78,9 +78,6 @@
Examples:
<a href="http://www.oberon.ethz.ch/oberon.net/examples/">http://www.oberon.ethz.ch/oberon.net/examples/</a>
-
- <a href="http://www.superin.formativ.net/mono/oberon/oberon.zip">http://www.superin.formativ.net/mono/oberon/oberon.zip</a>
-
<a name="ComponentPascal">
** Component Pascal
@@ -93,9 +90,8 @@
<a name="Forth">
** Delta Forth
- The Delta Forth.NET project: <a
- href="www.dataman.ro/dforth">Home
- Page</a> and <a href="http://www.dataman.ro/dforth/index.html">more
+ The Delta Forth.NET project: <a href="http://www.dataman.ro/dforth">Home
+ Page</a> and <a href="http://www.dataman.ro/dforth">more
details here</a>.
@@ -105,17 +101,15 @@
A subset of Scheme language called <a
href="http://radio.weblogs.com/0101156/stories/2002/03/19/tachy.html">Tachy</a>
-<a name="Python">
+<a name="Python"></a>
** Python
<a href="mailto:brian@No.Spam.zope.com">Brian Lloyd</a> is
working on linking the Python runtime with the .NET runtime.
More information on the PS.NET project can be found <a
href="http://www.zope.org/Members/Brian/PythonNet">here</a>.
- An FAQ document is available <a
- href="http://www.zope.org/Members/Brian/PythonNet/FAQ.html">here</a>.
-<a name="dotlisp">
+<a name="dotlisp"></a>
** dotLisp
DotLisp is available from: <a
@@ -149,6 +143,13 @@
LCC is not an open source compiler, but it is free as long as you
do not profit from selling it.
+<a name="ada"></a>
+* ADA
+
+ A# is an ADA compiler for the CIL platform, it can be downloaded from:
+ <a
+ href="http://www.usafa.af.mil/dfcs/bios/mcc_html/a_sharp.html">http://www.usafa.af.mil/dfcs/bios/mcc_html/a_sharp.html</a>
+
<a name="Java">
* Java
diff --git a/web/mailing-lists b/web/mailing-lists
index 6955e35d8fb..ad2aa170ae4 100644
--- a/web/mailing-lists
+++ b/web/mailing-lists
@@ -159,7 +159,7 @@
<table>
<tr>
-<td><a href="http://www.google.com/search"><img src="mailing-lists_files/Logo_40wht.gif" border="0" alt="Google" align="middle"></a></td>
+<td><a href="http://www.google.com/search"><img src="images/Logo_40wht.gif" border="0" alt="Google" align="middle"></a></td>
<td>
<table>
diff --git a/web/mono-build-w32.sh b/web/mono-build-w32.sh
index d9e1f963c79..4e011f24d04 100755
--- a/web/mono-build-w32.sh
+++ b/web/mono-build-w32.sh
@@ -59,11 +59,13 @@ else
echo "Automake version new enough."
fi
-# Select the stable version anyway...
-if [ ! -z "${AUTO_STABLE}" -o -e /usr/autotool/stable ]; then
- export AUTO_STABLE=${AUTO_STABLE:-/usr/autotool/stable}
- export AUTO_DEVEL=${AUTO_STABLE}
-fi
+# This causes libgc-not-found problem
+#
+## Select the stable version anyway...
+#if [ ! -z "${AUTO_STABLE}" -o -e /usr/autotool/stable ]; then
+# export AUTO_STABLE=${AUTO_STABLE:-/usr/autotool/stable}
+# export AUTO_DEVEL=${AUTO_STABLE}
+#fi
# Need to install pkgconfig and set ACLOCAL_FLAGS if there is not a
# pkgconfig installed already. Otherwise set PKG_CONFIG_PATH to the
@@ -98,6 +100,15 @@ function aclocal_scan () {
return 1
}
+function install_icuconfig() {
+ if [ ! -f $here/install/bin/icu-config ]; then
+ wget http://www.go-mono.com/archive/icu-config
+ mv icu-config $here/install/bin
+ chmod 755 $here/install/bin/icu-config
+ fi
+}
+
+
function install_package() {
zipfile=$1
markerfile=$2
@@ -123,11 +134,13 @@ else
install_pkgconfig=yes
fi
-# But we still need to use the mingw libs for glib & co
-ACLOCAL_FLAGS="-I $here/install/share/aclocal $ACLOCAL_FLAGS"
+# This causes libgc-not-found problem
+#
+## But we still need to use the mingw libs for glib & co
+#ACLOCAL_FLAGS="-I $here/install/share/aclocal $ACLOCAL_FLAGS"
-export PATH
-export ACLOCAL_FLAGS
+#export PATH
+#export ACLOCAL_FLAGS
# Grab pkg-config, glib etc
if [ ! -d $here/install ]; then
@@ -146,6 +159,9 @@ install_package glib-dev-2.0.4-20020703.zip lib/glib-2.0.lib glib-dev
install_package libiconv-1.7.zip lib/iconv.dll iconv
install_package libintl-0.10.40-20020101.zip lib/libintl-1.dll intl
install_package libgc-dev.zip lib/gc.dll gc-dev
+install_package icu-2.6.1-Win32_msvc7.zip icu/bin/icuuc26.dll icu
+
+install_icuconfig
if [ $install_pkgconfig = "no" ]; then
echo "Fixing up the pkgconfig paths"
@@ -158,10 +174,9 @@ if [ $install_pkgconfig = "no" ]; then
fi
# Needed to find the libgc bits
-CPPFLAGS="$CPPFLAGS -I$here/install/include"
-LDFLAGS="$LDFLAGS -L$here/install/lib"
-export CPPFLAGS
-export LDFLAGS
+export CFLAGS="-I $here/install/include -I $here/install/icu/include"
+export LDFLAGS="-L$here/install/lib -L$here/install/icu/lib"
+export PATH="$here/install/icu/bin:$PATH"
# Make sure we build native w32, not cygwin
#CC="gcc -mno-cygwin"
diff --git a/web/mono-roadmap.html b/web/mono-roadmap.html
index 8f4b8037333..c57b040b058 100644
--- a/web/mono-roadmap.html
+++ b/web/mono-roadmap.html
@@ -73,6 +73,8 @@ vertical-align: top;
<p>
</center>
+<i>Last update: Jan 18th, 2004</i>
+
<h3>Introduction</h3>
<p>This document describes the high-level roadmap for <a
diff --git a/web/mono-todo b/web/mono-todo
index 4fc9d30087f..6f2a69c6fc7 100644
--- a/web/mono-todo
+++ b/web/mono-todo
@@ -91,7 +91,7 @@ Happy hacking!
by the MS runtime.
<td>Medium-hard (thesis subject)
<td>2-4 months
- <td>not assigned
+ <td><a href="http://bugzilla.ximian.com/show_bug.cgi?id=52605">52605</a>
</tr>
<tr>
@@ -126,13 +126,13 @@ Happy hacking!
support the generics requirements.
<td>Medium-hard
<td>2-3 months
- <td>not assigned
+ <td>lupus and Martin
</tr>
<tr>
<td>JIT (mono/mini/)
<td>Port the JIT to additional architectures.
- Currently ports are in the works for ppc, arm, sparc, s390. None of the ports
+ Currently ports are in the works for mips, arm, sparc, s390. None of the ports
are as feature-complete as the x86 one, yet, so help is needed in getting them
up to speed. Ports to more architectures are welcome as well.
<td>Medium-hard
@@ -162,7 +162,7 @@ Happy hacking!
stack walking to collect security info.
<td>Medium-hard (thesis subject)
<td>4-5 months
- <td>not assigned
+ <td><a href="http://bugzilla.ximian.com/show_bug.cgi?id=52606">52606</a>
</tr>
<tr>
diff --git a/web/odbc b/web/odbc
index 1381062048c..80143fcb7eb 100755
--- a/web/odbc
+++ b/web/odbc
@@ -25,7 +25,7 @@
<li>List of unixODBC <a href="http://www.unixodbc.org/drivers.html">drivers</a>
- <li>List of <a href="http://ourworld.compuserve.com/homepages/Ken_North/odbcvend.htm">ODBC Vendors</a>
+ <li>List of <a href="http://www.sqlsummit.com/odbcvend.htm">ODBC Vendors</a>
<li>ODBC can connect to various databases which has an ODBC driver installed:
<ul>
@@ -38,7 +38,7 @@
<li><a href="http://www.microsoft.com/sql/default.asp">Microsoft SQL Server</a> (
via <a href="http://www.freetds.org/">FreeTDS</a> on UNIX)</li>
<li><a href="http://www-3.ibm.com/software/data/db2/">IBM DB2 Universal Database</a></li>
- <li><a href="http://www.microsoft.com/office/access/default.asp">MS Access</a>
+ <li><a href="http://www.microsoft.com/office/access">MS Access</a>
(via <a href="http://mdbtools.sourceforge.net/">MDB Tools</a> on UNIX)</li>
</ul>
@@ -105,14 +105,14 @@
<li>For Unix, you will need unixODBC or iODBC installed</li>
- <li>Have acess to a <a href="http://www-3.ibm.com/software/data/db2/">IBM DB2 Universal Database</a> or
+ <li>Have acess to a <a href="http://www-306.ibm.com/software/data/db2/">IBM DB2 Universal Database</a> or
you can download from IBM</li>
<li>Read these web pages about Unix, ODBC, and IBM DB2
<ul>
<li><a href="http://www.unixodbc.com/doc/db2.html">unixODBC web page about IBM DB2</a></li>
- <li><a href="http://www-3.ibm.com/software/data/db2/udb/ad/v8/cli/t0010406">IBM web page about unixODBC and DB2</a></li>
+ <li><a href="http://www-306.ibm.com/software/data/db2/udb/ad/v8/cli/t0010406.htm">IBM web page about unixODBC and DB2</a></li>
</ul>
</li>
diff --git a/web/oldnews b/web/oldnews
index d88896302fa..a24afbd651f 100644
--- a/web/oldnews
+++ b/web/oldnews
@@ -1,3 +1,981 @@
+@item Jul 9th, 2003: ASP.NET web services, coverage tools.
+
+ Web Services keep advancing: now we also support server-side
+ authoring of Web Services as well as web service clients
+ (which shipped in Mono 0.25). This works using our ASP.NET
+ runtime, so it works with either XSP or the Apache module. The
+ new Web Services work from Lluis added the missing bits:
+ <ul>
+ <li> .asmx files.
+ <li> Method calls with complex parameters (whatever XmlSerializer can currently serialize, which is a quite a lot).
+ <li> ref and out parameters.
+ <li> Soap headers (In, Out and InOut).
+ <li> Soap extensions, both global (configured in web.config) and particular to methods (configured using attributes).
+ </ul>
+
+ For more details, see Lluis <a href="http://lists.ximian.com/archives/public/mono-devel-list/2003-July/001449.html">post</a>
+
+ GUI-wise: Work on <a href="http://xr.xwin.org">Xr</a> to
+ implement System.Drawing continues. This will provide a full
+ GDI+ implementation for Mono, and this will be hooked up into
+ Gtk# and System.Windows.Forms.
+
+ MonoDoc keeps moving along, with a new web-based version
+ coming up next, and we are also exploring a collaborative
+ extension to allow people to contribute documentation through
+ their web browsers.
+
+ Zoltan's Coverage analysis tool has been checked into CVS.
+ With this tool it is now possible to find which class library
+ code paths are missing regression tests. The module is
+ `monocov'. Details are <a
+ href="http://www.nexus.hu/vargaz/">here</a>. A fresh Gtk#
+ version is available now.
+
+ Jean's remoting-based Soap implenentation is also maturing.
+
+@item Jun 26th: Mono 0.25 has been released.
+
+ We have released Mono 0.25. A list of the new features is
+ available <a href="archive/mono-0.25.html">here</a>.
+
+ Packages for Windows, and various Linux distributions are
+ available on our <a href="download.html">download</a> page.
+
+@item Jun 17th, 2003: Web Services client; Profiling hooks
+
+ Lluis and Gonzalo have checked into CVS the support for web
+ services in the Mono runtime. This allows Mono to work as a
+ web services client. We still require a WSDL compiler to
+ compile the initial stub, but Erik has the beginning of a WSDL
+ compiler ready and Atsushi has continued work on his
+ experimental Xml Schema to C# class generator.
+
+ As part of this, the Mono Http runtime has been rewritten to
+ increase reliability, scalability and conformance to the
+ specs. Also our io-layer has been extended to not have
+ arbitrary limits. This was done as part of our collaboration
+ with SourceGear.
+
+ Paolo has commited the new pluggable profiling API to the Mono
+ runtime: now the profiler is built as a module, and a new code
+ coverage analysis has been checked in (and Zoltan already
+ added improvements to it).
+
+ Mark's Mozilla bindings continue to improve, and we will shortly
+ migrate the Mono documentation browser to use Mozilla, to take
+ advantage of the tutorial's use of CSS.
+
+ Jackson's work on the IL assembler and Ben on running
+ regression tests have provided us with a very needed tool in
+ the Mono toolkit. One of the last missing pieces on the SDK.
+
+ On the crypto world, we got Sebastien's certificate viewer
+ checked into CVS and the crypto code keeps advancing by leaps
+ and bounds.
+
+ Alexandre and Aleksey Work continues on Windows.Forms on top
+ of Wine and Gtk# (the former for full compatibility, the later
+ for ease-of-authoring).
+
+ Cesar checked in the beginning of the semantic analysis code
+ for his JScript compiler, and will be working on it full time.
+
+@item Jun 11th, 2003: SourceGear and Ximian announce partnership
+
+ Ximian, Inc., the leading provider of desktop and server
+ solutions enabling enterprise Linux adoption, today announced
+ that SourceGear Corporation will use Mono\x{2122} Project
+ technology to offer cross-platform versions of its
+ products. In addition, the companies have entered into a
+ development partnership under which Ximian will provide
+ custom Mono development to enable delivery of SourceGear
+ products later this year. As a result, SourceGear will offer
+ both UNIX and Linux clients for its SourceGear Vault source
+ code management tool, enabling broader use of its solutions in
+ mixed-platform development organizations.
+
+ <a href="http://www.ximian.com/about_us/press_center/press_releases/index.html?pr=sourcegear">Read more...</a>
+
+ Some technical details are available <a
+ href="http://lists.ximian.com/archives/public/mono-list/2003-June/014334.html">here</a>.
+
+@item May 20th, 2003: OpenLink releases WineLib patches.
+
+ OpenLink <a
+ href="http://lists.ximian.com/archives/public/mono-winforms-list/2003-May/000284.html">announced</a>
+ the release of Vladimir's work to turn Wine into a library
+ that can be used dynamically from Mono. This work simplifies
+ the work on System.Windows.Forms as it is no longer necessary
+ have a special version of the GC, nor have a stub program.
+ The patches are available <a
+ href="http://www.openlinksw.com/mono/">here</a>.
+
+ Mono packages for the Linux/s390 are available now in the <a
+ href="download.html">download page</a>.
+
+@item May 10th, 2003: Eclipse runs on Mono
+
+ Today Zoltan Varga announced that he got the <a
+ href="http://www.eclipse.org">Eclipse IDE</a> running on top
+ of Mono+<a href="http://www.ikvm.net">IKVM</a>.
+
+ A screenshot of Eclipse running with Mono can be found <a
+ href="images/ikvm-screenshot.png">here</a>
+
+@item May 6th, 2003: Mono 0.24 ships
+
+ We have released Mono 0.24 which includes our new code
+ generation engine. A list of the new features is available <a
+ href="archive/mono-0.24.html">here</a>.
+
+ Packages for Windows, and various Linux distributions are
+ available on our <a href="download.html">download</a> page.
+ We are shipping Gtk# and MonoDoc packages for the first time.
+
+@item Apr 21st, 2003: Virtuoso 3.0 ships.
+
+ <a href="http://www.openlinksw.com">OpenLink's</a> released
+ their <a href="http://www.openlinksw.com/press/virt3rel.htm">Virtuoso
+ 3.0</a> database system. Virtuoso ships on Windows and Linux.
+ On Linux they use Mono as their runtime to host C#, .NET and
+ ASP.NET. Congratulations to OpenLink for their release.
+
+ Virtuoso can be downloaded <a
+ href="http://oplweb2.openlinksw.com:8080/download/virtuoso.vsp">here</a>
+ and a demo is available <a
+ href="http://demo.openlinksw.com:8890/tutorial/hosting/ho_s_2/ho_s_2.vsp">here</a>.
+
+ OpenLink is contributing fixes and code to the Mono project on
+ an ongoing basis.
+
+ Jon Udell wrote a small <a
+ href="http://www.infoworld.com/article/03/03/14/11stratdev_1.html">entry</a>
+
+@item Apr 19th, 2003: RelaxNG validating reader; Activities.
+
+ Atsushi has created a <a
+ href="http://www24.brinkster.com/ginga/RelaxngValidatingReader/">RelaxNG</a>
+ validating XML reader.
+
+ There is activity on the <a
+ href="http://www.gotmono.com">GotMono forums</a> and the <a
+ href="http://www.nullenvoid.com/gtksharp/wiki/">Gtk# Wiki</a>
+
+@item Apr 11th, 2003: First Mono Book is out; Team pages.
+
+ The first book to cover Mono is out. This book is currently
+ only available in German, you can find it <a
+ href="http://www.amazon.de/exec/obidos/ASIN/3827264928/qid=1050051051/sr=2-1/ref=sr_2_3_1/028-2755135-1623712">here</a>
+
+ We now have a page for the <a href="team.html">Mono Team</a>
+ where we include a list of some of the people who have made
+ Mono possible. If you have CVS access, please update the page
+ to include your information.
+
+@item Apr 5th, 2003: New compilation engine.
+
+ The new Mono compilation engine has been placed on CVS, the
+ details are <a
+ href="http://lists.ximian.com/archives/public/mono-list/2003-April/013269.html">here</a>
+
+ Zoltan has commited his <a
+ href="http://lists.ximian.com/archives/public/mono-devel-list/2003-April/000274.html">typed
+ allocation</a> patches to CVS as well.
+
+@item Apr 3rd, 2003: NUnit 2.0 GTK# GUI; GtkMozEmbed; SWT#
+
+ Gonzalo has checked in his <a href="http://gtk-sharp.sf.net">Gtk#</a>-based
+ <a href="http://nunit.org">NUnit</a> tool. Screenshots are <a
+ href="http://primates.ximian.com/~gonzalo/mono/shots/running.png">here</a>
+ and <a
+ href="http://primates.ximian.com/~gonzalo/mono/shots/finished.png">here</a>
+
+ Mark has checked his bindings for Gtk-based Mozilla into CVS,
+ module name: `GtkMozEmbed'. Read the <a
+ href="http://lists.ximian.com/archives/public/mono-list/2003-April/013247.html">details</a>
+
+ The SWT port to C# using Gtk is <a
+ href="http://lists.ximian.com/archives/public/sd-mono-port/2003-March/000114.html">progressing</a>. Screenshots are
+ <a href="http://www.roboto.ch/swt">here</a>.
+
+@item Mar 28th: Mono community site.
+
+ <a href="http://www.gotmono.com">www.gotmono.com</a> has
+ openend its door: Got Mono is a Mono Community site.
+
+@item Mar 25th: Second Mono Survey
+
+ <table width="100%" cellpadding="0" cellspacing="1" border="0" bgcolor="blue">
+ <tr>
+ <td valign="top">
+ <div style="background: #c0d0ff; margin: 0px 0px 0px 0px; padding: 1px;">
+ What do you think about Mono?
+
+ Is your company involved with the development and
+ deployment of web applications? Is Linux becoming an
+ important part of your company's business application
+ strategy? Are you considering Mono for your next
+ project? Would you like to shape the future of Mono
+ and the use of Linux in business critical
+ applications?
+
+ If you answered yes to any of these questions, we
+ would like to talk with you. If interested, please
+ email us at <a
+ href="mailto:mbadgett@ximian.com">mbadgett@ximian.com</a>.
+ </div>
+ </td>
+ </tr>
+ </table>
+
+@item Mar 20th: Windows.Forms and Wine.
+
+ Alexandre has provided a modified version of the GC system
+ that will work with and Mono. See the mono-winforms-list. It
+ is now possible to run our Win32-based implementation of
+ Windows.Forms with Mono on Linux.
+
+@item Mar 7th: Mono 0.23
+
+ A new freshly baked release of Mono is available. Release
+ notes are <a href="archive/mono-0.23">here</a>. This is mostly a
+ bug fix release. No new features.
+
+@item Mar 5th, 2003: Mono 0.22; MonoDoc 0.2; Debugger 0.2.1: Release-o-Rama.
+
+ Mono 0.22 has been released. See the <a
+ href="archive/mono-0.22">release notes</a>. This is a bug fix
+ release.
+
+ A new preview of MonoDoc 0.2, the Mono Documentation browser
+ has been <a href="http://lists.ximian.com/archives/public/gtk-sharp-list/2003-March/001266.html">released</a>.
+
+ Martin also announced a <a
+ href="http://lists.ximian.com/archives/public/mono-list/2003-March/012756.html">new
+ release</a> of the Mono Debugger (both GUI and command line).
+
+@item Mar 3rd, 2003: The Mono Hackers Hall Of Fame welcomes Zoltan Varga
+
+ The <a href="hackers.html">Mono Hackers Hall Of Fame</a>
+ continues to show our appreciation to the excellent
+ contributors that make <b>mono::</b> a successful free
+ software project.
+
+ Zoltan has contributed significantly to Mono, with bug reports and bug
+ fixes as well as pushing the envelope of the things that can be done in
+ and with the mono runtime: the gcc-based ngen compiler, code coverage
+ and more recently his work with Reflection.Emit that got mono to the
+ point of running the <a href="http://www.ikvm.net">IKVM</a> Java virtual
+ machine.
+
+@item Mar 2nd, 2003: New Mono mailing list.
+
+ A new mailing list for <a
+ href="http://lists.ximian.com/mailman/listinfo/mono-devel-list">Mono
+ Development</a> has been created.
+
+@item Feb 27th, 2003: Mono 0.21 released
+
+ Mono 0.21 has been released. This is only a bug fix release.
+ The <a href="archive/mono-0.21">release notes</a> are available.
+
+ Windows binary is available <a href="archive/mono-0.21-win32-1.exe">here</a>
+
+@item Feb 25th, 2003: Mono 0.20 for Windows released; New Apache module released.
+
+ Packages of Mono for Windows have been <a
+ href="archive/mono-0.20-stable-win32-2.exe">released</a>.
+ Thanks to Daniel, Johannes and Paolo for setting this up.
+
+ Daniel has released a new version of his Mono Apache module that
+ handles ASP.NET. The code is available at <a
+ href="http://apacheworld.org/modmono/">here</a>
+
+ Nick has posted an update on the progress on our <a
+ href="http://lists.ximian.com/archives/public/mono-list/2003-February/012467.html">regression
+ tests</a>. We are looking for more tests, and more volunteers to write them.
+
+ Also, remember to contribute to the Gtk# documentation effort,
+ momentum is picking up! See the entry for Feb 18th for more details.
+
+@item Feb, 23rd, 2003: Mono 0.20 released; Gtk# 0.8 released.
+
+ Mono 0.20 has been released. Check out the <a
+ href="archive/mono-0.20">release notes</a> for an overview of
+ the changes. You can get it <a href="download.html">here</a>.
+ There are no major features in this release, mostly bug fixes
+ and performance improvements.
+
+ Gtk# 0.8 has been <a
+ href="http://lists.ximian.com/archives/public/gtk-sharp-list/2003-February/001114.html">released</a>
+
+ <b>Important</b>: The contributed binaries for Windows
+ binaries of Mono 0.20 contain a virus. Please read <a
+ href="virus.html">this</a> if you installed the binary.
+
+@item Feb 18th, 2003: Volunteers to document Gtk#
+
+ With the availability of a documentation browser, we are
+ looking for volunteers to help us complete the documentation
+ of the Gtk# binding for Mono.
+
+ Experience with Gtk is useful, but not mandatory. We have
+ checked in stubs, and we have instructions, and resources to
+ how to complete this process <a
+ href="documentation.html">here</a>. Mail the <a
+ href="mailto:mono-docs-list@ximian.com">mono-docs-list@ximian.com</a>
+ for further discussion.
+
+@item Feb 14th, 2003: OpenGL# bindings for Mono; Mono Basic updates.
+
+ Mark Crichton has completed his OpenGL/GLUT bindings for
+ Gnome. A screenshot can be seen <a
+ href="sshots/oglcs.png">here</a>. The bindings are available
+ on the Mono CVS repository on the module `glgen'. This is a
+ straight binding to the C API.
+
+ Marco has <a
+ href="http://lists.ximian.com/archives/public/mono-list/2003-February/011752.html">posted
+ an update</a> on the current state of the free VB.NET compiler
+ for Mono.
+
+ We are looking for contributors and maintainers to the
+ JavaScript compiler as well (Janet)
+
+@item Feb 12th, 2003: New assemblies, Gtk# stub documentation, Authenticode, Polish site
+
+ Mono now distributes a few new assemblies: Mono.Security.Win32
+ as a layer to use the crypto functionality on Win32. The
+ Mono.Posix assembly which contains functionality for taking
+ advantage of Unix facilities.
+
+ A <a href="http://www.go-mono.pl/">Mono site in Poland</a>.
+
+ Stubs for the Gtk# documentation have been checked into CVS.
+ If you want to contribute please read <a
+ href="http://lists.ximian.com/archives/public/mono-list/2003-February/012108.html">this
+ message</a>
+
+ Mono development is moving quickly: Tim and Daniel have been
+ improving the Oracle database provider and Sebastien Pouliot
+ has got code signing to work using Authenticode with pure open
+ source and managed code. Plenty of new VB.NET work from Marco
+ (compiler) and Daniel (runtime). Also Jackson has resumed
+ work on the IL assembler and the fully managed library to
+ generate CIL images (Sergey wrote the first Mono.PEToolkit).
+
+@item Feb 11th, 2003: Mono Weekly News, New assemblies.
+
+ <a href="http://monoevo.sourceforge.net/mwn/index.html">Mono
+ Weekly News</a>: Includes a new interview, software
+ announcements and the PHP/Mono integration.
+
+@item Feb 5th, 2003: MonoDoc 0.1
+
+ A <a
+ href="http://www.go-mono.com/archive/monodoc-0.1.tar.gz">preliminary
+ release</a> of the Mono Documentation Browser is now availble.
+ Release <a
+ href="http://lists.ximian.com/archives/public/mono-list/2003-February/011935.html">notes</a>
+
+@item Jan, 22th, 2003: Mono wins award, OpenLink releases Virtuoso.
+
+ Mono won the `Best Open Source Project' award at the Linux
+ World Expo. A description is <a
+ href="http://linuxtoday.com/news_story.php3?ltsn=2003-01-23-024-26-OP-EV">here</a>
+
+ Open Link has a <a
+ href="http://biz.yahoo.com/prnews/030123/neth013_1.html">press
+ release</a> about Virtuoso 3.0: the first commercial product
+ shipping that uses Mono.
+
+@item Jan, 20th, 2003: Mono 0.19 released; Screenshots page; Gtk# 0.7
+
+ Mono 0.19 has been released. Check out the <a
+ href="archive/mono-0.19">release notes</a> for an overview of
+ the changes. You can get it <a href="download.html">here</a>.
+ There are no major features in this release, mostly bug fixes
+ and performance improvements.
+
+ We have now a new section <a href="screenshots.html">with
+ screenshots</a> of various Mono applications. You can see
+ there the new released Debugger, as well as the work in
+ progress on the documentation browser.
+
+ <a href="http://gtk-sharp.sf.net">Gtk# 0.7</a> has been <a
+ href="http://lists.ximian.com/archives/public/mono-list/2003-January/005222.html">released</a>
+
+@item Jan, 19th, 2003: Mono Debugger released.
+
+ After six month of extensive development, Martin Baulig has
+ released the first version of the Mono debugger. The Mono
+ debugger is written in C# and can debug both managed and
+ unmanaged applications, support for multiple-threaded
+ applications and should be relatively easy to port to new
+ platforms.
+
+ Details of the release are available in <a
+ href="http://lists.ximian.com/archives/public/mono-list/2003-January/005192.html">post</a>.
+
+ The debugger contains both Gtk# and command line interfaces.
+ The debugging file format used in Dwarf (its already supported
+ by our class libraries and the Mono C# compiler; To debug C
+ applications, you need a recent GCC, or to pass the -gdwarf-2
+ flag to gcc).
+
+@item Jan, 17th, 2003: DB2 provider, MacOS X
+
+ Christopher Bockner has contributed a DB2 System.Data client.
+
+ MacOS X support on the runtime has been integrated into the
+ distribution, and MCS works with it.
+
+ Zoltan has managed to get <a
+ href="http://radio.weblogs.com/0109845/">IKVM</a> (a Java VM
+ for .NET) to run with Mono. The HelloWorld.class runs with
+ the Mono runtime.
+
+@item Jan, 13th, 2003: Mono 0.18 released
+
+ Mono 0.18 has been released. Check out the <a
+ href="archive/mono-0.18">release notes</a> for an overview of
+ the changes. You can get it <a href="download.html">here</a>.
+
+@item Jan 10th, 2003: Mono Weekly News.
+
+ A new issue of the <a
+ href="http://lists.ximian.com/archives/public/mono-list/2003-January/004903.html">Mono
+ Weekly News</a> has been published.
+
+ Check out the <a href="crypto.html">Crypto status</a> page
+ that Sebastien has put together.
+
+@item Jan 3rd, 2003: Glade#, Code Coverage, Apache, MBas, Debugger.
+
+ Rachel has made Glade# use attributes so binding C# widgets to
+ the designed widgets is now easier than ever. Alp has
+ improved this to use implicit names as well.
+
+ Martin's Mono debugger now has support for multi-thread
+ debugging. Special feature: breakpoints can be defined in a
+ per-thread basis now.
+
+ Daniel López has checked in his Apache module to integrate
+ Mono and Mono's ASP.NET support as an Apache module. Gonzalo
+ has folded his new Mono hosting classes into this module (they
+ are now shared between XSP and mod_mono). You can get the
+ mod_apache from CVS (module name: mod_mono).
+
+ Mono Basic improvements: Marco has added support for more
+ statements on the grammar.
+
+ Zoltan has <a href="http://www.nexus.hu/vargaz2/">posted</a>
+ his Code Coverage analysis tool for Mono.
+
+@item Dec 17th, 2002: Mono: Commercial uses.
+
+ <a href="http://www.tipic.com">Tipic</a> today <a
+ href="http://www.ximian.com/about_us/press_center/press_releases/index.html?pr=tipic_mono">announced</a>
+ their work on porting their Instant Messaging Server platform
+ to run on Mono.
+
+ <a href="http://www.winfessor.com">Winfessor</a> also <a
+ href="http://www.winfessor.com/press.asp">announced</a> the
+ availability of their Jabber SDK to run on Mono.
+
+ Also two weeks ago we mentioned <a
+ href="http://www.openlinksw.com">OpenLink Software's</a> <a
+ href="http://www.ximian.com/about_us/press_center/press_releases/index.html?pr=openlink_mono">announcement</a>
+ of their product, also using Mono.
+
+@item Dec 10th, 2002: Gtk# 0.6 released; Mono 0.17 packages for Windows and Debian.
+
+ Mike Kestner <a
+ href="http://lists.ximian.com/archives/public/mono-list/2002-December/003961.html">announced
+ Gtk# 0.6</a>. This new release includes many new features and
+ bug fixes, and is the perfect companion to the <a
+ href="archive/mono-0.17">Mono 0.17</a> release.
+
+ Johannes has contributed a Windows-ready package of Mono 0.17,
+ and its available from our <a
+ href="download.html">download</a> page.
+
+ Alp Toker has <a href="http://www.atoker.com/mono/">Debian packages</a>
+
+@item Dec 9th, 2002: Mono 0.17 has been released
+
+ Mono 0.17 has been released. Check out the <a
+ href="archive/mono-0.17">release notes</a> for a more detailed
+ list. You can get it <a href="download.html">here</a>.
+
+ Many new features as well as plenty of bug fixes. Many new
+ System.Data providers and a more mature System.Web (ASP.NET)
+ which can now be hosted in any web server. A simple <a
+ href="archive/xsp-0.2.tar.gz">test web server</a> to host
+ asp.net has been released as well.
+
+ This version also integrates Neale's s390 port.
+
+ This release also includes a new exception handling system
+ that uses the gcc exception information that vastly improves
+ our internalcall speed (15% faster mcs compilation times).
+
+@item Dec 8th, 2002: VB.NET, Oracle Provider.
+
+ Marco has got the Mono Basic compiler up to speed (support for
+ classes, modules, expressions, object creation, method
+ invocation, local variables, and some statements). The
+ compiler is based on the work from Rafael Teixeira on MCS.
+
+ Screenshots: <a
+ href="http://modgb.sourceforge.net/monobasic_snap.png">in
+ Windows doing Windows.Forms</a> and in Linux doing <a
+ href="images/gtk-vb.png">VB with Gtk#</a> (courtesy of Alp).
+
+ Daniel Morgan has checked in his Oracle provider to the CVS
+ repository as well.
+
+@item Nov 27th, 2002: Press release, tutorials, Windows Forms, ADO.NET, Magazine.
+
+ <a
+ href="http://www.business2.com/articles/mag/0,1640,45454,FF.html">The
+ Penguin Takes Flight</a>: an article written by Erick
+ Schonfeld appears on the December issue of <a
+ href="http://www.business2.com/">Business 2.0</a> magazine.
+
+ <a href="http://www.openlinksw.com">OpenLink</a> and <a
+ href="http://www.ximian.com">Ximian</a> made <a
+ href="http://www.ximian.com/about_us/press_center/press_releases/index.html?pr=openlink_mono">joint
+ announcement</a> on the plans of OpenLink to ship their <a
+ href="http://www.openlinksw.com/virtuoso/index.htm">Virtuoso</a>
+ server on Unix using Mono.
+
+ Martin Willemoes's <a href="gnometutorial">GNOME.NET
+ tutorial</a> is now available from the main Mono site. This
+ tutorial is a collaborative effort to teach developers how to
+ use Mono to create Mono applications using <a href="http://gtk-sharp.sf.net">Gtk#</a>
+
+ Dennis Hayes has posted and <a
+ href="http://lists.ximian.com/archives/public/mono-list/2002-December/003800.html">update</a>
+ on the work to get Windows.Forms working on Mono. There is a
+ new test application that people can use to test their
+ controls. If you are interested in working on Windows.Forms,
+ you can participate in the <a
+ href="http://lists.ximian.com/mailman/listinfo/mono-winforms-list">mono-winforms
+ mailing list</a>
+
+ Brian Ritchie has been working on an ADO.NET <a
+ href="http://brianritchie.webhop.net/ideas/adocodegen.aspx">data
+ layer</a> and an <a
+ href="http://brianritchie.webhop.net/ideas/appserver.aspx">application
+ server</a> for Mono.
+
+ Dan Morgan has checked in his Oracle provider, and Tim Coleman
+ continues to work on the TDS implementation of the data classes.
+
+ The rest of the team has been working on bug fixing in the
+ runtime, the compiler, and the class libraries. Also,
+ compilation speed has increased recently by performing a
+ number of simple optimizations in the compiler.
+
+@item Nov 19th, 2002: Crypto update; Books; Gtk# Datagrid; .NET ONE Slides
+
+ Sebastien has got DSA and RSA signatures <a
+ href="http://lists.ximian.com/archives/public/mono-list/2002-November/003497.html">working</a>
+ as well as RSA <a
+ href="http://lists.ximian.com/archives/public/mono-list/2002-November/003502.html">encryption</a>.
+ We now distribute Chew Keong TAN's BigInteger classes.
+
+ Brian has contributed a System.Data multiplexor in Mono, it
+ can be found in the Mono.Data assembly. The details of this
+ new technology are <a
+ href="http://lists.ximian.com/archives/public/mono-list/2002-November/003400.html">here</a>.
+ It works in Mono and the .NET Framework.
+
+ Larry O'Brien has announced the candidate book for <a
+ href="http://lists.ximian.com/archives/public/mono-list/2002-November/003500.html">
+ Thinking in C#</a>. The book is Mono-friendly.
+
+ Another book that covers mono (available in German only) is <a
+ href="http://www.databecker.de/frames.php?PHPSESSD=4948515556575049525459495248485949485348&PHPSESSID=6cc68dbcfbcbacd7b82a984b0700d5d6&t=2">
+ here</a>.
+
+ Dan Morgan has implemented a DataGrid widget for Gtk#, you can
+ see Windows screenshots for it <a
+ href="images/GtkSharpDataGridScreenshot.png">here</a> and <a
+ href="images/SqlSharpGtkScreenshot4.png">here</a>.
+
+ Slides from the Mono developers for the .NET ONE conference are available now:
+ <ul>
+ <li><a
+ href="http://primates.ximian.com/~miguel/slides-europe-nov-2002/DotNetOneKeynote.sxi">
+ Mono Keynote presentation</a>
+
+ <li><a href="http://primates.ximian.com/~lupus/slides/embed/">Hosting the Mono Runtime</a><br>
+ The simple embedding of Mono in Perl is available <a
+ href="http://primates.ximian.com/~lupus/slides/embed/Mono-0.01.tar.gz">here</a>
+
+ <li><a href="http://primates.ximian.com/~lupus/slides/jit/">The Mono JIT compiler</a>
+
+ <li><a href="http://primates.ximian.com/~miguel/slides-europe-nov-2002/Mono_C_Sharp_Overview_1007.sxi">
+ Mono C# Compiler Overview</a>
+ </ul>
+
+ A couple of other presentations from Miguel's trip to Europe
+ are available <a
+ href="http://primates.ximian.com/~miguel/slides-europe-nov-2002/">here</a>
+ in Open Office file format.
+
+@item Nov 8th, 2002: Mono s390, Database work, new JIT updates.
+
+ Neale Ferguson has contributed <a href="download.html">RPM
+ packages</a> of Mono for the Linux/s390.
+
+ Tim Coleman posted an <a
+ href="http://lists.ximian.com/archives/public/mono-list/2002-November/003329.html">update</a>
+ on the improvements in the System.Data
+
+ The new JIT engine can run 72 out of our 154 tests for the
+ virtual machine, and it also got exception support this week.
+
+@item Nov 1st, 2002: TDS, Crypto, Gtk#, Winforms, bug fixes.
+
+ Tim's SqlClient is <a
+ href="http://lists.ximian.com/archives/public/mono-list/2002-November/003161.html">now
+ capable</a> of communicating with the Microsoft SQL server
+ using the TDS protocol. A screenshot showing a sample client
+ running with <a href="http://gtk-sharp.sf.net">Gtk#</a> on
+ Windows is shown <a
+ href="images/SqlSharpGtkSceenshot3.png">here</a>
+
+ Sebastien has made all symetric ciphers functional on all
+ supported modes; All the classes in Security.Cryptography are
+ present and the X590 certificates are now in too. Jackson has
+ been working on the Security classes.
+
+ Many bug fixes all over the place: class libraries (Dick,
+ Piers, Ville, Zoltan, Gonzalo, Dan, Atsushi, Nick, Phillip),
+ compiler, runtime engine. A big thank goes for everyone who
+ has been providing bug reports for us to track down.
+
+ Gaurav has been working on multiple WebControls. Gonzalo migrated
+ the ASP.NET engine to use POST for interaction.
+
+ In the Gtk# land saw the integration of gda, gnome-db and GStreamer
+ bindings.
+
+ Windows.Forms classes now build on Linux and Windows, check
+ out the status pages for areas of collaboration.
+
+@item Oct 24th, 2002: S390 support, XSP/ASP.NET, Win32 contributors, TDS.
+
+ Today Neal Ferguson's support for the IBM S390 was checked
+ into CVS.
+
+ The XSP processor has been fully integrated into the
+ System.Web assembly, and Gonzalo has finished the hosting
+ interfaces in Mono. This means that it is possible to embed
+ ASP.NET with the same APIs used in Windows, and is possible to
+ easily embed it with Apache for example. The XSP module has
+ now become a shell for testing the System.Web classes.
+
+ We are looking for contributors that know Win32 to contribute
+ to the Windows.Forms implementation. If you want to help
+ write some controls using the Win32 API, get in touch with our new <a
+ href="http://lists.ximian.com/mailman/listinfo/mono-winforms-list">mono-winforms-list@ximian.com
+ list</a> mailing list.
+
+ Tim's TDS System.Data set of classes can now talk to SQL
+ servers using the TDS protocol (version 4.2) with
+ connection pooling. Currently it can connect, run
+ transactions, update/insert/delete, and read some types. A
+ data adapter is also coming soon.
+
+@item Oct 21th, 2002: Crypto, Winforms list, Database, GConf, Debugger.
+
+ Sebastien Poliot has made a lot of progress, he reports that
+ DES and TripleDES have been fixed; Rijndael and CFB modes
+ still have problems in some configurations and some areas that
+ are not supported by the .NET framework.
+
+ Last week we created a new <a
+ href="http://lists.ximian.com/mailman/listinfo/mono-winforms-list">mailing
+ list</a> to discuss the Mono Winforms implementation.
+
+ Tim has started a full C# implementation of the TDS protocol
+ and the providers, and Brian continues his work on his ODBC
+ binding.
+
+ Rachel Hestilow has also checked in a binding for GConf. This
+ binding <a
+ href="http://toxic.magnesium.net/~hestilow/gconfsharp/intro.html">is
+ unique</a> in that it uses some features in the CLI to support
+ complex data types, and allows the user to keep only one
+ representation of the types instead of two (the master types
+ is defined in CLI-land). Also Property Editors (<a
+ href="http://primates.ximian.com/~miguel/shots/gconf-shot.png">shot</a>)
+ simplify the creation of user interfaces that bind their
+ configuration to backend keys, following the <a
+ href="http://developer.gnome.org/projects/gup/hig/1.0/">GNOME
+ Human Interface Guidelines.</a>
+
+ Martin is now on vacation, but before leaving he produced a
+ number of documents detailing the state of the debugger. The
+ major missing feature is full support for debugging unmanaged
+ applications (it requires dwarf-2 handlers for types). We
+ will do some polishing of the user interface (<a
+ href="http://primates.ximian.com/~miguel/shots/debugger-4.png">new
+ shot</a>) to expose the existing and rich functionality to the
+ users and try to release a preview of the debugger at the same
+ time as Mono 0.17.
+
+@item Oct 14th, 2002: Crypto, Database work, Debugger, Documentation.
+
+ Brian, Daniel and Rodrigo have been busy working on the ODBC
+ provider for Mono. Daniel posted some <a
+ href="http://lists.ximian.com/archives/public/mono-list/2002-October/002755.html">updates</a>.
+ Brian posted <a
+ href="http://lists.ximian.com/archives/public/mono-list/2002-October/002758.html">details
+ about the ODBC.NET</a> provider.
+
+ Also Sebastien Pouliot has been improving the various
+ cryptographic classes in Mono, something that we had not done
+ in quite some time. We are looking for a way to handle
+ big-nums. We need either a managed or unmanaged set of
+ classes for handling large numbers, and some volunteers to
+ expose this functionality to C# (Either as an internal
+ assembly, or as a set of P/Invoke, Internal call wrappers).
+
+ Martin has got our debugger to support adding breakpoints at
+ file/line combos. This was more complex than generic
+ breakpoints in routines, because these breakpoints are set on
+ routines that probably have not been JITed just yet. Martin's
+ focus now is on stabilizing our debugger and aim for a public
+ release of it.
+
+ We have also imported the ECMA documentation into a separate
+ module, and with the help from Scott Bronson we will have the
+ necessary XSLT tools to finish our native documentation
+ browser for Mono. This together with the work from Adam will
+ be the foundation for the <a href="classlib-doc.html">Mono
+ Documentation Tools</a>.
+
+@item Oct 9th, 2002: Various Mono updates.
+
+ Brian Ritchie, Daniel Morgan, Rodrigo Moya and Ville Palo have
+ been working on various database providers. The MySQL has
+ seen a lot of work, and a new ODBC provider is now on CVS and
+ more extensive regression tests have been checked in.
+
+ Dick Porter is our background hero and keeps fixing the
+ low-level bugs in the portability layer. Now the Mono handle
+ daemon should be a lot more robust and will no longer leave IPC
+ regions. Gonzalo Paniagua has initiated the migration of XSP
+ into the System.Web class libraries now that we have a
+ complete HttpRuntime implementation. This means that you are
+ able to embed the ASP.NET processor into any web server you
+ want. This also includes support for the system-wide
+ configuration file `machine.config'.
+
+ Martin Baulig has been busy with the Mono Debugger, you can see how
+ it looks <a
+ href="http://primates.ximian.com/~miguel/debugger-1.png">here</a>
+ and <a
+ href="http://primates.ximian.com/~miguel/debugger-2.png">here</a>.
+ Now local variables and breakpoints are supported, and we are
+ working on the UI elements to simplify their use (as seen on
+ the screenshot).
+
+ <a href="http://gtk-sharp.sf.net">Gtk#</a> has seen a lot of
+ activity specially as we start to build larger applications.
+ Vladimir Vukicevic, Kristian Rietveld, Rachel Hestilow, Mike
+ Kestner and Miguel de Icaza have been busy improving it.
+ mPhoto which is a Photo management application for Mono and
+ Gtk# is seen <a
+ href="http://primates.ximian.com/~miguel/shots/mphoto-2.jpg">here</a>.
+
+ Chris Toshok the man behind LDAP in Evolution continues to
+ work on the Mono.LDAP# implementation.
+
+ Dietmar Maurer and Paolo Molaro are still busy working on our
+ new optimized JIT/ATC engine and are making great progress.
+ The code base has been designed to ease the implementation of
+ more advanced compiler optimizations, and optimizations can be
+ chosen individually so they can be tuned for a particular
+ processor, or use profile-based information to improve the
+ performance.
+
+@item Oct 1st, 2002: Mono 0.16 released; Debugger updates.
+
+ Mono 0.16 has been released. Source and RPMs are <a
+ href="download.html">available</a>. The release notes are <a
+ href="archive/mono-0.16">here</a>.
+
+ Martin's debugger can debug both managed and unmanaged code.
+ Recently Martin added support for locals, parameters, and
+ breakpoints on top of the existing infrastructure (his
+ debugger supported instruction-level and source-code level
+ single-stepping).
+
+@item Sep 19th, 2002: Mono Survey.
+
+ Help us plan for the future of Mono by filing out the <a
+ href="http://primates.ximian.com/~miguel/monosurvey">First Mono
+ Survey</a>
+
+@item Sep 17th, 2002: Mono Hackers Hall of Fame: Sergey Chaban
+
+ The <a href="hackers.html">Mono Hackers Hall Of Fame</a>
+ continues to show our appreciation to the excellent
+ contributors that made <b>mono::</b> a successful free
+ software project.
+
+ This time the Hall of Fame welcomes Sergey Chaban. Sergey has
+ been a long time contributor to the project, from the early
+ work on the class libraries that were critical to Mono's
+ origin: every time you use a Hashtable in Mono, it runs
+ Sergey's code, to the low-level optimizations on the JIT
+ engine and to his work on ILASM and the PEToolkit.
+
+
+@item Sep 16th, 2002: Documentation Tools, ILASM, Debugger, Mono LDAP, Winforms
+
+ Adam Treat has started moving the documentation universe again. We
+ have a new strategy to document our APIs (given that we have
+ chosen <a href="classlib-doc.html">not to document the code
+ inline</a>). This includes the use of a master reference file
+ that will hold the entry points to document. All master files
+ for our assemblies have been checked into CVS now.
+
+ Sergey Chaban's Mono.PEToolkit and ILASM tools have been
+ checked into CVS. Although ILASM is old and will soon be
+ updated, we wanted to get the build issues sorted out.
+
+ Martin Baulig's Mono Debugger is still on its early stages,
+ but you can run and run step by step your C# code and C code
+ (including the Mono runtime). Dwarf-2 is required to compile
+ your code. The regular step, step-into, and assembly-level
+ step and step-into are supported. And comes with a Gtk#
+ UI. The debugger is written mostly in C# with some C glue
+ code. Most of the work is on the engine, we will be working
+ on making a good UI in the future.
+
+ Chris Toshok of the Hungry Programmer's fame has checked in
+ Mono.Directory.LDAP, a C# wrapper for the LDAP libraries.
+ This is the substrate for implementing the
+ System.DirectoryServices assembly.
+
+ Andrew has also continued with some of the cryptographic
+ classes implementation.
+
+ After much public debate, we have chosen a new <a
+ href="winforms.html">strategy to implement winforms</a>.
+ Implementing a Gtk, Qt or Aqua based version of Winforms was
+ going to be almost as complex as implementing Wine itself. So
+ the new strategy is to only roll out a WineLib-based
+ implementation.
+
+@item Sep 4th, 2002: .NET One 2002 Program available
+
+ The <a
+ href="http://www.sigs-datacom.de/sd/kongresse/dotnet_2002/index.htm">.NET
+ ONE 2002</a> conference in Frankfurt is now available. Paolo
+ will be talking about the Mono JIT and embedding the Mono
+ runtime in your Windows and Linux applications. Mike Kestner
+ will talk about <a href="http://gtk-sharp.sf.net">Gtk#</a> and
+ the automatic binding generator used by Gtk# and Miguel will
+ be talking about the Mono project on Monday's keynote and on
+ the Mono C# compiler on Tuesday.
+
+@item Sep 3rd, 2002: Apache integration
+
+ <a
+ href="http://lists.ximian.com/archives/public/mono-list/2002-September/001862.html">Sterling</a>
+ announced an Apache module that hosts
+ Mono, and allows CIL code to run from within Apache, giving the
+ module access to the Apache runtime. This uses the Mono embedding
+ API.
+
+@item Aug 24th, 2002: Gtk# 0.4 released
+
+ Shortly after <a href="download.html">Mono 0.15</a> was
+ released a fresh version of <a
+ href="http://gtk-sharp.sf.net">Gtk#</a> was <a
+ href="http://lists.ximian.com/archives/public/mono-list/2002-August/001702.html">announced</a>.
+
+@item Aug 23rd, 2002: Mono 0.15 released
+
+ Mono 0.15 has been released. Source and RPMs are <a
+ href="download.html">available</a>. The release notes are <a
+ href="archive/mono-0.15">here</a>
+
+@item Aug 21th, 2002: Portable.NET encodings integrated into Mono.
+
+ Rhys Weatherley has contributed the Portable.NET encoders to
+ the Mono class libraries. This is a great step towards
+ cooperation between these projects. Thanks to Paolo for doing the
+ merger on our side.
+
+ His encoders are more complete than the iconv-based approach
+ that mono used, which was unreliable under certain
+ circumstances.
+
+@item Aug 20th, 2002: Remoting work, Resources, SPARC checkins, ADO.NET
+
+ <b>San Francisco</b>: August 14th. Linux World Expo.
+
+ Mark Crichton has checked in his patches to get the SPARC port
+ on par with the PPC port.
+
+ Dick has checked-in the resource reader and resource writers
+ to the class libraries, and Dietmar checked in the C# support
+ code for the remoting infrastructure.
+
+ More work on System.Data: the LibGDA (our OleDB backend) based
+ providers are quickly maturing, and recently they executed
+ their first query.
+
+@item Aug 13th, 2002: MCS news, Gtk# progress, Windows.Forms, ADO.NET
+
+ Martin Baulig has been fixing all the known bugs in the C#
+ compiler and now has moved into improving the compilation
+ speed and the generated code quality of MCS. Today we got a
+ 50% speedup in the bootstrap of MCS going from 24 seconds to 12 seconds.
+
+ Gtk# has been making a lot of progress, some interesting
+ corner cases are now supported:, you can now create canvas items as
+ well as using the tree widget. Here is a shot of <a
+ href="images/mocil.png">MonoCIL</a>.
+
+ On the runtime front, focus has been on improving remoting
+ support, exception handling, as well as completing the support
+ for structure marshaling.
+
+ Patrik is also back in action: the HttpRuntime infrastructure
+ is rapidly improving, and Gonzalo is working into moving XSP
+ into our main class library and providing the missing pieces
+ to integrate with Patrik's code.
+
+ Dennis and his team are working on a WineLib-based
+ implementation of Windows Forms to guarantee that the corner
+ cases of Windows.Forms can be handled, and we are back on track again.
+
+ A lot more work on the ADO.NET and WebServices has also been
+ checked into CVS.
+
+@item Aug 1st, 2002: Mono Hackers Hall of Fame
+
+ The <a href="hackers.html">Mono Hackers Hall Of Fame</a> has been started
+ to show our appreciation to the excellent contributors that made <b>mono::</b>
+ a successful free software project.
+
+ The first, deserved, entry goes to
+ Nick Drochak, who joined us in the first days of Mono and built the testing
+ infrastructure for the C# assemblies, fixed tons of bugs and even adventured
+ himself in the lands of the C runtime. His work is invaluable for keeping
+ Mono on the right track through the daily changes in the codebase.
+
@item Looking for volunteers
We are looking for volunteers to help complete various pieces
diff --git a/web/oracle b/web/oracle
index 16188b522ab..28d81bee4eb 100755
--- a/web/oracle
+++ b/web/oracle
@@ -8,9 +8,7 @@
<li>Works on Windows and Linux</li>
- <li>Works with Oracle 8i</li>
-
- <li>May work with Oracle 9i</li>
+ <li>Works with Oracle 8i and 9i.</li>
<li>Uses the Oracle CLI (Call Level Interface) which is a C library (API) for the Oracle Client
software</li>
@@ -30,23 +28,15 @@
** Current Status
<ul>
- <li>OracleConnection can connect and disconnect to an Oracle 8i database on
+ <li>OracleConnection can connect and disconnect to an Oracle 8i or 9i database on
Windows and Linux via OCI (Oracle Call-level Interface)</li>
- <li>No longer uses a glue library (a library between the System.Data.OracleClient.dll
- assembly and the oci library). In Current Mono cvs, System.Data.OracleClient
- directly platform invokes into the oci library thanks to Tim Coleman.</li>
-
<li>Can have multiple connections with different transactions where each transaction is
separated from the others, so a rollback or commit in one transaction
does not affect the other.</li>
<li>Can execute simple DML SQL statements, such as,
INSERT a row into the EMP table via the OracleCommand's ExecuteNonQuery method</li>
-
- <li>The System.Data.OracleClient.dll assembly can be built with mcs/mono via
- the makefile.gnu for System.Data.OracleClient or csc/.net via the
- System.Data.OracleClient.build nant build file.</li>
<li>Can retrieve data via ExecuteReader and OracleDataReader. Currently,
supports character, numeric, some date data types. ExecuteScalar
@@ -66,8 +56,7 @@
<li>Lots of missing functionality and bugs.</li>
- <li>Works with SQL# command-line and GTK# versions in cvs. Only works with
- simple character data though.</li>
+ <li>Works with SQL# command-line and GTK# GUI versions.</li>
</ul>
@@ -79,12 +68,12 @@
<li>transactions (WORKING)</li>
<li>Stored Procedures, Functions, and Packages support</li>
<li>Be able to fill a DataTable in a DataSet via a data adapter (IN PROGRESS)</li>
- <li>Support for Oracle 8i (WORKING</li>
- <li>Support for Oracle 9i (UNKNOWN)</li>
+ <li>Support for Oracle 8i and 9i (WORKING)</li>
<li>Support LOBs</li>
<li>Support all the data types</li>
<li>Implement Connection pooling</li>
<li>Security</li>
+ <li>Once Oracle 10g is released, make sure Mono works with Oracle 10g.</li>
</ul>
@@ -99,9 +88,7 @@
Registration to the <a href="http://technet.oracle.com/">Oracle Technology Network</a> is free. If installing on Linux,
I suggest you do a lot of searching to see how others installed Oracle on Linux.</li>
- <li>Make sure System.Data.OracleClient.dll assembly is built, if not, go
- into System.Data.OracleClient and do a make -f makefile.gnu (on Linux) or
- ../../nant/NAnt.exe (on Windows using Cygwin).</li>
+ <li>Make sure System.Data.OracleClient.dll assembly is built.</li>
<li>Take a look at TestOracleClient.cs found at mcs/class/System.Data.OracleClient/Test</li>
@@ -161,12 +148,10 @@
-r System.Data.OracleClient.dll
</pre>
</li>
- <li>Build on Windows via Cygwin:
+ <li>Build on Windows:
<pre>
- mono C:/cygwin/home/MyHome/mono/install/bin/mcs.exe \
- TestExample.cs \
- -lib:C:/cygwin/home/MyHome/mono/install/lib \
- -r System.Data.dll -r System.Data.OracleClient.dll
+ mcs TestExample.cs /r:System.Data.dll \
+ /r:System.Data.OracleClient.dll
</pre>
</li>
</ul>
diff --git a/web/other b/web/other
index 5dcc7e40fa3..0c259caea7b 100644
--- a/web/other
+++ b/web/other
@@ -10,6 +10,8 @@
<li><a href="http://www.go-mono.pl">Mono Poland</a>:
Mono site for polish users.
+ <li><a href="http://primates.ximian.com/~atsushi/mono-jp/">Mono Japanese Translation</a>:
+ Mono site Japanese translation pages. Translated sources are maintained at <a href="http://forge.novell.com/modules/xfmod/project/?mono-jp">Novell Forge</a>.
</ul>
* User sites
diff --git a/web/performance b/web/performance
index dfe1e475373..96f687b5ec1 100644
--- a/web/performance
+++ b/web/performance
@@ -5,13 +5,19 @@
These are just guidelines, and you should still profile your
code to find the actual performance problems in your
- application.
+ application. It is never a smart idea to make a change with the
+ hopes of improving the performance of your code without first
+ measuring. In general, these guidelines should serve as ideas
+ to help you figure out `how can I make this method run faster'.
+
+ It is up to you to figure out, `Which method is running slowly.'
** Using the Mono profiler
-
- To obtain memory consumption and measure the time spent on
- functions and the number of times a function is called in
- Mono, you can invoke the runtime with the --profile flag, like this:
+
+ So, how does one measure what method are running slowly? A profiler
+ helps with this task. Mono includes a profiler that is built
+ into the runtime system. You can invoke this profiler on your program
+ by running with the --profile flag.
<pre>
mono --profile program.exe
@@ -21,8 +27,16 @@
for profiling. The default Mono profiler will record the time
spent on a routine, the number of times the routine called,
the memory consumed by each method broken down by invoker, and
- the total amount of memory consumed, this is what it looks
- like:
+ the total amount of memory consumed.
+
+ It does this by asking the JIT to insert a call to the profiler
+ every time a method is entered or left. The profiler times the
+ amount of time elapsed between the beginning and the end of the
+ call. The profiler is also notified of allocations.
+
+ When the program has finished executing, the profiler prints the
+ data in human readable format. It looks like:
+
<pre>
Total time spent compiling 227 methods (sec): 0.07154
Slowest method to compile (sec): 0.01893: System.Console::.cctor()
@@ -44,10 +58,42 @@ Total mem Method
Total memory allocated: 448 KB
</pre>
+ At the top, it shows each method that is called. The data is sorted
+ by the total time that the program spent within the method. Then
+ it shows how many times the method was called, and the average time
+ per call.
+
+ Below this, it shows the top callers of the method. This is very useful
+ data. If you find, for example, that the method Data::Computate () takes
+ a very long time to run, you can look to see if any of the calls can be
+ avoided.
+
+ Two warnings must be given about the method data. First,
+ the profiler has an overhead associated with it. As such,
+ a high number of calls to a method may show up as comsuming
+ lots of time, when in reality they do not consume much time
+ at all. If you see a method that has a very high number of
+ calls, you may be able to ignore it. However, do consider
+ removing calls if possible, as that will sometimes help
+ performance. This problem is often seen with the use
+ of built in collection types.
+
+ Secondly, due to the nature of the profiler, recursive calls
+ have extermely large times (because the profiler double counts
+ when the method calls itself). One easy way to see this problem
+ is that if a method is shown as taking more time than the Main
+ method, it is very likely recursive, and causing this problem.
+
+ Below the method data, allocation data is shown. This shows
+ how much memory each method allocates. The number beside
+ the method is the total amount of memory. Below that, it
+ is broken down into types. Then, the caller data is given. This
+ data is again useful when you want to figure out how to eliminate calls.
+
You might want to keep a close eye on the memory consumption
and on the method invocation counts. A lot of the
performance gains in MCS for example came from reducing its
- memory usage, as opposed to changes in the execution path.
+ memory usage, as opposed to changes in the execution path.
** Memory Management in the .NET/Mono world.
@@ -57,6 +103,83 @@ Total memory allocated: 448 KB
is a great productivity gain, but if you create thousands of
objects, that will make the garbage collector do more work,
and it might slow down your application.
+
+ Remember, each time you allocate an object, the GC is forced
+ to find space for the object. Each object has an 8 byte overhead
+ (4 to tell what type it is, then 4 for a sync block). If
+ the GC finds that it is running out of room, it will scan every
+ object for pointers, looking for unreferenced objects. If you allocate
+ extra objects, the GC then must take the effort to free the objects.
+
+ Mono uses the Boehm GC, which is a conservative collector,
+ and this might lead to some memory fragmentation and unlike
+ generational GC systems, it has to scan the entire allocated
+ memory pool.
+
+*** Boxing
+ The .NET framework provides a rich hierchy of object types.
+ Each object not only has value information, but also type
+ information associated with it. This type information makes
+ many types of programs easier to write. It also has a cost
+ associated with it. The type information takes up space.
+
+ In order to reduce the cost of type information, almost every
+ Object Oriented language has the concept of `primitatives'.
+ They usually map to types such as integers and bools. These
+ types do not have any type information associated with them.
+
+ However, the language also must be able to treat primitatives
+ as first class datums -- in the class with objects. Languages
+ handle this issue in different ways. Some choose to make a
+ special class for each primative, and force the user to do an
+ operation such as:
+<pre>
+// This is Java
+list.add (new Integer (1));
+System.out.println (list.get (1).intValue ());
+</pre>
+
+ The C# design team was not satisfied with this type
+ of construct. They added a notion of `boxing' to the language.
+
+ Boxing preforms the same thing as Java's <code>new Integer (1)</code>.
+ The user is not forced to write the extra code. However,
+ behind the scenes the <em>same thing</em> is being done
+ by the runtime. Each time a primative is cast to an object,
+ a new object is allocated.
+
+ You must be careful when casting a primative to an object.
+ Note that because it is an implicit conversion, you will
+ not see it in your code. For example, boxing is happening here:
+
+<pre>
+ArrayList foo = new ArrayList ();
+foo.Add (1);
+</pre>
+
+ In high performance code, this operation can be very costly.
+
+*** Using structs instead of classes for small objects
+
+ For small objects, you might want to consider using value
+ types (structs) instead of object (classes).
+
+ However, you must be careful that you do not use the struct
+ as an object, in that case it will actually be more costly.
+
+ As a rule of thumb, only use structs if you have a small
+ number of fields (totaling less than 32 bytes), and
+ need to pass the item `by value'. You should not box the object.
+
+*** Assisting the Garbage Collector
+
+ Although the Garbage Collector will do the right thing in
+ terms of releasing and finalizing objects on time, you can
+ assist the garbage collector by clearing the fields that
+ points to objects. This means that some objects might be
+ elegible for collection earlier than they would, this can help
+ reduce the memory consumption and reduce the work that the GC
+ has to do.
** foreach
@@ -79,18 +202,3 @@ Total memory allocated: 448 KB
when to use a manual loop. The best thing to do is to always
use foreach, and only when profile shows a problem, replace
foreach with for loops.
-
-*** Using structs instead of classes for small objects
-
- For small objects, you might want to consider using value
- types (structs) instead of object (classes).
-
-** Assisting the Garbage Collector
-
- Although the Garbage Collector will do the right thing in
- terms of releasing and finalizing objects on time, you can
- assist the garbage collector by clearing the fields that
- points to objects. This means that some objects might be
- elegible for collection earlier than they would, this can help
- reduce the memory consumption and reduce the work that the GC
- has to do.
diff --git a/web/postgresql b/web/postgresql
index 6e5bb4f2483..cbe6c2f87d8 100644
--- a/web/postgresql
+++ b/web/postgresql
@@ -545,8 +545,8 @@ mono TestExample.exe
"User ID=postgres;" +
"Password=fun2db;";
IDbConnection dbcon;
- dbcon.Open();
dbcon = new NpgsqlConnection(connectionString);
+ dbcon.Open();
IDbCommand dbcmd = dbcon.CreateCommand();
// requires a table to be created named employee
// with columns firstname and lastname
diff --git a/web/ppc b/web/ppc
index 56026d4d6b1..1b6dcbeb0a6 100644
--- a/web/ppc
+++ b/web/ppc
@@ -13,7 +13,9 @@
*** Jitter
- Start the port
+ Works on MacOS X 10.2 and Linux/PPC.
+
+ There are known problems on MacOS 10.3
** Documentation
@@ -28,6 +30,6 @@
*** Calling conventions:
- <a href="http://www.esofta.com/softspecs.html">The PowerPC SystemV ABI specification</a>
+ <a href="http://refspecs.freestandards.org/elf/elfspec_ppc.pdf">The PowerPC SystemV ABI specification</a>
diff --git a/web/resources b/web/resources
index d4ecf266daa..9588bdc9829 100644
--- a/web/resources
+++ b/web/resources
@@ -9,7 +9,7 @@
** Microsoft .NET
- The <a href="http://msdn.microsoft.com/net">Microsoft.NET site.</a>
+ The <a href="http://msdn.microsoft.com/netframework">Microsoft.NET site.</a>
The Microsoft .NET Framework can be downloaded <a
href="http://msdn.microsoft.com/library/default.asp?url=/downloads/list/netdevframework.asp">here</a>
@@ -74,21 +74,13 @@
<li><a href="http://www.gotdotnet.com/userarea/keywordsrch.aspx?keyword=winchurn">http://www.gotdotnet.com/userarea/keywordsrch.aspx?keyword=winchurn</a>
</ul>
-** Presentations
-
- Currently the <a href="Presentations/O-Reilly">O'Reilly</a>
- presentation on Mono is available. Arturo Espinosa has given
- a talk on Mono in Mexico and made <a
- href="http://construct.ximian.com/~arturo/Presentations/Mono.OLS/html">spanish
- slides</a>
-
** ECMA Documentation.
You can get the documentation for the ECMA specs from:
<ul>
- * <a href="http://www.ecma-international.org/publications/standards/ECMA-334.HTM">C# Language Specification</a>
- * <a href="http://www.ecma-international.org/publications/standards/ECMA-335.HTM">Common Language Infrastructure</a>
+ * <a href="http://www.ecma-international.org/publications/standards/Ecma-334.HTM">C# Language Specification</a>
+ * <a href="http://www.ecma-international.org/publications/standards/Ecma-335.HTM">Common Language Infrastructure</a>
</ul>
@@ -97,7 +89,6 @@
<ul>
* <a href="http://msdn.microsoft.com/net/ecma">At MSDN</a>
* <a href="http://www.dotnetexperts.com">Dot Net Experts</a>
- * <a href="http://developer.intel.com/software/idap/ecma">Intel</a>
* <a href="http://lightning.csse.monash.edu.au/.net/CLI">Monash University</a>
</ul>
@@ -153,7 +144,7 @@
<li><b>Class Libraries</b></li>
<ul>
- * <a href="http://9mm.com/~ogl/sdldotnet/">SDL for
+ * <a href="http://cs-sdl.sourceforge.net/">SDL for
.NET:</a> Bindings for the popular SDL graphics library.
@@ -193,10 +184,6 @@
* <a
href="http://www.southern-storm.com.au/portable_net.html">Portable.NET:</a>
Another implementation of the CLI and C# compiler.
-
- * A Free (GFDL) tutorial on C# in Spanish with
- examples, slides, and extras (under development). Get it <a
- href="http://geneura.ugr.es/~jaime/csharp/">here</a>.
</ul>
** GNOME Documentation
diff --git a/web/sqlclient b/web/sqlclient
index d17f4695593..c5eb1f9cc40 100755
--- a/web/sqlclient
+++ b/web/sqlclient
@@ -31,11 +31,14 @@
<ul>
- <li>Able to connect to Microsoft SQL Server 7/2000 databases</li>
+ <li>Thanks to Sebastien Pouliot, we now have NT Authentication (Integrated Security) support. This support was
+ added after the release of Mono 0.29. So, you either get it from cvs or wait for the Mono 0.30 release.</li>
+
+ <li>Able to connect to Microsoft SQL Server 7/2000 databases via SQL Server authentication and NT Authentication.</li>
<li>Connection pooling works.</li>
- <li>Stored Procedures work</li>
+ <li>Stored Procedures work.</li>
<li>Parameters work.</li>
@@ -59,8 +62,6 @@
<li>Uses TDS Protocol Version 7.0</li>
- <li><a href="http://www.go-mono.com/tds-providers.html">Design of the Microsoft SQL Server, Sybase, and TDS Providers in Mono</a></li>
-
<li>Works in the SQL# command-line and GTK# GUI version</li>
</ul>
@@ -71,9 +72,9 @@
<li>Needs more testing</li>
- <li>Would like to figure out how to connect via Trusted_Connection or Integrated Security</li>
-
<li>Start work on TDS Protocol Version 8.0 support</li>
+
+ <li>Add support for .NET 1.2 and 2.0 and Microsoft SQL Server (Yukon) support</li>
</ul>
@@ -89,9 +90,10 @@
</ul>
</li>
- <li>If using Microsoft SQL Server 2000, make sure
+ <li><b>IMPORTANT:</b> If using Microsoft SQL Server 2000, make sure
you are using at least Service Pack 3 for Microsoft SQL Server 2000. If using
- MSDE 2000, make sure you have the special Service Pack 3 for MSDE 2000.</li>
+ MSDE 2000, make sure you have the special Service Pack 3 for MSDE 2000. You
+ can get it from <a href="http://www.microsoft.com/sql/downloads/2000/sp3.asp">here</a></li>
<li>For those that only have MSDE installed. You can change the authentication mode
from Windows Only Authentication to SQL Server and Windows Authentications (also knows as Mixed-mode authentication)
@@ -121,11 +123,17 @@
to explicitly use a User ID and Password
authenticated by SQL Server.</li>
- <li>Has a connection string format:
+ <li>Has a connection string format for SQL Server Authentication:
<pre>
Server=hostname;Database=databaseName;User ID=userid;Password=password
</pre>
</li>
+ <li>Has a connection string format for NT Authentication:
+<pre>
+ Server=hostname;Database=databaseName;User ID=windowsUserid;Password=windowsPassword;Integrated Security=SSPI
+</pre>
+ </li>
+
<li>The Server part can be used three ways:
<table border=1>
diff --git a/web/sqlite b/web/sqlite
index 6730477202c..89dace1c929 100755
--- a/web/sqlite
+++ b/web/sqlite
@@ -25,7 +25,7 @@
<li>Created by Vladimir Vukicevic so he could have a database of
thumbnail images for mPhoto. mPhoto is GUI application
for cataloging images. mPhoto runs on Mono
- and uses <a href="http:www.go-mono.com/gtk-sharp.html">GTK#</a> for its GUI.</li>
+ and uses <a href="http://www.go-mono.com/gtk-sharp.html">GTK#</a> for its GUI.</li>
<li>Bugs with Mono or the data provider should be reported
in Mono's Bugzilla <a href="http://bugzilla.ximian.com/">here</a>. If you
diff --git a/web/sybase b/web/sybase
index 5b0c3ccba81..85deca1a67c 100755
--- a/web/sybase
+++ b/web/sybase
@@ -17,8 +17,6 @@
<li>Requires the assembly Mono.Data.Tds.dll which implements the TDS protocol in 100% C#.</li>
<li>Uses TDS Protocol Version 5.0</li>
-
- <li>Does not support trusted connections</li>
<li>Bugs with Mono or the data provider should be reported
in Mono's Bugzilla <a href="http://bugzilla.ximian.com/">here</a>. If you
diff --git a/web/tdsclient b/web/tdsclient
index fdfe6926c9f..2c58aea698f 100755
--- a/web/tdsclient
+++ b/web/tdsclient
@@ -18,8 +18,6 @@
<li>Uses TDS Protocol Version 4.2 by default</li>
- <li>Does not support trusted connections</li>
-
<li>Bugs with Mono or the data provider should be reported
in Mono's Bugzilla <a href="http://bugzilla.ximian.com/">here</a>. If you
do not have Bugzilla user account, it is free
diff --git a/web/testing b/web/testing
index d4d6ecbcc3e..d8504b1f34c 100644
--- a/web/testing
+++ b/web/testing
@@ -17,6 +17,11 @@
<li><a href="#runtime"><b>Runtime tests</b></a>: Tests for
the virtual machine.
+
+ <li><a href="#aspnet"><b>ASP.NET tests</b></a>: ASP.NET tests.
+
+ <li><a href="#ws"><b>Web Services tests</b></a>: Web Services
+ client/server tests.
</ul>
<a name="unit"></a>
@@ -29,6 +34,29 @@
that they work correctly. Mono also needs a testing framework
to make it easy to write and run lots of tests.
+ In some classes, we might also provide standalone tests because of
+ some reasons such as too huge testcases, another downloading and so on.
+ (For example, managed XSLT has standalone test which downloads and
+ expands some megabytes of OASIS test suite.)
+
+ Here I list them up as long as I know. If you are going to add another
+ standalone tests, please add one line here. It is also recommended that
+ you add some notes on how to build and run tests.
+
+ <ul>
+
+ * Mono.Data/test/
+ * System.Data/Test, and some individual ADO.NET libraries:
+ there are some standalone tests. See the bottom of <a href="ado-net.html">
+ ADO.NET page</a> for detail.
+ * System.Web/Test/TestMonoWeb : see README
+ * System.Web.Services/Test/standalone : see README
+ * System.Windows.Forms/SWFTest/
+ * System.XML/Tests/System.Xml.Schema/standalone_tests : see README
+ * System.XML/System.Xml.Serialization/standalone_tests/
+ * System.XML/Tests/System.Xml.Xsl/standalone_tests : see README
+
+ </ul>
** Getting started
@@ -56,8 +84,8 @@
testing.
Once all of that is done, you can do a 'make test' from the top mcs
- directory. Your test class will be automagically included in the
- build and the tests will be run along with all the others.
+ directory. Your test class needs also to be listed in the
+ .sources file at the top of the Test directory.
* Tips on writing Unit tests.
@@ -126,7 +154,7 @@
bug in their runtime or something is misleading or wrong in their
documentation. In this case, please put a detailed description of the
problem to mcs/class/doc/API-notes and do also report it to the
- <a href="mailing-lists">mailing list</a> - we'll forward this to the
+ <a href="mailing-lists.html">mailing list</a> - we'll forward this to the
Microsoft people from time to time to help them fix their documentation
and runtime.
@@ -179,4 +207,63 @@
<pre>
cd mono/mono/tests
make test
-</pre> \ No newline at end of file
+</pre>
+
+<a name="aspnet"></a>
+* ASP.NET tests
+
+ XSP, the Mono ASP.NET server has tests for ASP.NET pages. It uses
+ <a href="http://nunitasp.sourceforge.net">NUnitAsp</a>. Right now
+ it only has standalone tests, ie., tests that do not need their own
+ global.asax or web.config files.
+
+ If you want to run them, get the xsp CVS module and install it. Then:
+<pre>
+ cd xsp/nunit-tests
+ make
+ cd standalone
+ xsp
+</pre>
+
+ And from another terminal:
+<pre>
+ cd xsp/nunit-tests/standalone
+ nunit-console standalone-tests.dll
+</pre>
+
+<a name="ws"></a>
+* Web Services tests
+
+ The Test directory for the System.Web.Services assembly contains a
+ standalone test suite for testing web services. It tests:
+
+ <ul>
+ <li>Proxy generation using the wsdl tool</li>
+ <li>Access to web services using the generated client proxies</li>
+ <li>Execution of web services in the server</li>
+ </ul>
+
+ This suite not only tests web services running on XSP, but it can also test
+ services running on other platforms and that are available in internet. This
+ will help track down interoperability issues.
+
+ To build the test suite, just run:
+
+<pre>
+ cd mcs/class/System.Web.Services/Test/standalone
+ xsp --root server
+</pre>
+
+ And from another terminal:
+<pre>
+ cd mcs/class/System.Web.Services/Test/standalone
+ make
+ nunit-console testclient.dll
+</pre>
+
+ This will download the wsdl documents, generate the proxies, build a dll with
+ the proxies, and build the nunit tests. Then you can use nunit-console or
+ gnunit to run the tests (the nunit dll is testclient.dll).
+
+ Read the README file in mcs/class/System.Web.Services/Test/standalone for
+ more info.
diff --git a/web/web/commands b/web/web/commands
index 64d07a368ff..dd5c6184d44 100644
--- a/web/web/commands
+++ b/web/web/commands
@@ -20,6 +20,7 @@
1,CVS access,ccvs.html,ccvs.src
1,AnonCVS access,anoncvs.html,anoncvs.src
1,Forge,forge.html,forge.src
+1,Compiling,compiling.html,compiling.src
0,Contributing,contributing.html,contributing.src
1,Hackers,hackers.html,hackers.src
1,Documentation,documentation.html,documentation.src
@@ -33,7 +34,7 @@
0,Resources,resources.html,resources.src
1,Beginning,mono-beginning.html,mono-beginning.src
1,Mailing Lists,mailing-lists.html,mailing-lists.src
-1,Blogs,http://www.go-mono.com/monologue
+1,Blogs,http://www.go-mono.com/monologue/
1,Ideas,ideas.html,ideas.src
1,Passport,passport.html,passport.src
1,Books,books.html,books.src
@@ -59,6 +60,7 @@
1,Crypto,crypto.html,crypto.src
1,Java,java.html,java.src
1,Windows.Forms,winforms.html,winforms.src
+1,XML Classes,xml-classes.html,xml-classes.src
0,Class Status,class-status.html,class-status.src,cm/cormissing.css,cm/cormissing.js
1,corlib,class-status-corlib.html,class-status-corlib.src,cm/cormissing.css,cm/cormissing.js
1,System,class-status-System.html,class-status-System.src,cm/cormissing.css,cm/cormissing.js
diff --git a/web/web/deploy/cm/cormissing.js b/web/web/deploy/cm/cormissing.js
index 6ff9d555337..2f2e74dcb85 100644
--- a/web/web/deploy/cm/cormissing.js
+++ b/web/web/deploy/cm/cormissing.js
@@ -216,6 +216,9 @@ function clickHandler (evt)
if (strAssembly)
{
+ if (strAssembly == 'mscorlib')
+ strAssembly = 'corlib';
+
strRoot = strRoot + strAssembly + '/';
if (strNamespace)
{
diff --git a/web/web/makefile b/web/web/makefile
index 763ada755b8..96904620b08 100644
--- a/web/web/makefile
+++ b/web/web/makefile
@@ -21,6 +21,7 @@ OBJECTS= \
deploy/documentation.html \
deploy/download.html \
deploy/drawing.html \
+ deploy/compiling.html \
deploy/crypto.html \
deploy/embedded-api.html \
deploy/faq.html \
@@ -68,6 +69,7 @@ OBJECTS= \
deploy/testing.html \
deploy/tools.html \
deploy/winforms.html \
+ deploy/xml-classes.html \
deploy/class-library.html \
deploy/classlib-doc.html \
deploy/class-status.html \
diff --git a/web/web/masterinfos/Makefile b/web/web/masterinfos/Makefile
new file mode 100644
index 00000000000..15848834024
--- /dev/null
+++ b/web/web/masterinfos/Makefile
@@ -0,0 +1,60 @@
+# Note that you will need Microsoft.NET to generate those masterinfos
+
+# Customize to indicate your own installation dir.
+DLL_PATH=c:/WINDOWS/Microsoft.NET/Framework/v1.1.4322
+
+all: \
+ mscorlib.xml \
+ System.xml \
+ System.Xml.xml \
+ System.Data.xml \
+ System.Web.xml \
+ System.Web.Services.xml \
+ System.Runtime.Serialization.Formatters.Soap.xml \
+ System.Drawing.xml \
+ System.Security.xml \
+ System.DirectoryServices.xml \
+ System.Windows.Forms.xml \
+ Cscompmgd.xml
+
+mscorlib.xml :
+ mono-api-info $(DLL_PATH)/mscorlib.dll > mscorlib.xml
+
+System.xml :
+ mono-api-info $(DLL_PATH)/System.dll > System.xml
+
+System.Xml.xml :
+ mono-api-info $(DLL_PATH)/System.Xml.dll > System.Xml.xml
+
+System.Data.xml :
+ mono-api-info $(DLL_PATH)/System.Data.dll > System.Data.xml
+
+System.Web.xml :
+ mono-api-info $(DLL_PATH)/System.Web.dll > System.Web.xml
+
+System.Web.Services.xml :
+ mono-api-info $(DLL_PATH)/System.Web.Services.dll > System.Web.Services.xml
+
+System.Runtime.Serialization.Formatters.Soap.xml :
+ mono-api-info $(DLL_PATH)/System.Runtime.Serialization.Formatters.Soap.dll > System.Runtime.Serialization.Formatters.Soap.xml
+
+System.Drawing.xml :
+ mono-api-info $(DLL_PATH)/System.Drawing.dll > System.Drawing.xml
+
+System.Security.xml :
+ mono-api-info $(DLL_PATH)/System.Security.dll > System.Security.xml
+
+System.DirectoryServices.xml :
+ mono-api-info $(DLL_PATH)/System.DirectoryServices.dll > System.DirectoryServices.xml
+
+System.Windows.Forms.xml :
+ mono-api-info $(DLL_PATH)/System.Windows.Forms.dll > System.Windows.Forms.xml
+
+Cscompmgd.xml :
+ mono-api-info $(DLL_PATH)/Cscompmgd.dll > Cscompmgd.xml
+
+
+clean:
+ rm mscorlib.xml System.xml System.Xml.xml System.Data.xml System.Web.xml System.Web.Services.xml System.Runtime.Serialization.Formatters.Soap.xml System.Drawing.xml System.Security.xml System.DirectoryServices.xml System.Windows.Forms.xml Cscompmgd.xml
+
+
diff --git a/web/web/team.xml b/web/web/team.xml
index 68eabbc85fb..6b7e7a7e1bf 100644
--- a/web/web/team.xml
+++ b/web/web/team.xml
@@ -418,7 +418,7 @@
<image>timc.png</image>
- <location>Kitchener-Waterloo, Canada</location>
+ <location>Waterloo, Ontario, Canada</location>
<tasks>
@@ -915,7 +915,7 @@
</name>
- <e-mail>justdandy43@hotmail.com</e-mail>
+ <e-mail>danielmorgan@verizon.net</e-mail>
<image>none.png</image>
@@ -1543,7 +1543,7 @@
</name>
- <e-mail>jmas@softcatala.org</e-mail>
+ <e-mail>jordi [at] ximian.com</e-mail>
<image>jordi.png</image>
@@ -1555,9 +1555,39 @@
<tasks>
+ <task>System.Drawing implementation</task>
<task>Windows.Forms implementation</task>
</tasks>
</contributor>
+
+ <contributor>
+
+ <name>
+
+ <first-name>Pedro</first-name>
+
+ <last-name>Abelleira Seco</last-name>
+
+ </name>
+
+ <e-mail>pedroabelleira@yahoo.es</e-mail>
+
+ <image>pedroas.png</image>
+
+ <location>Galicia, Spain</location>
+
+ <organization></organization>
+
+ <description>Developer</description>
+
+ <tasks>
+
+ <task>MonoDevelop</task>
+
+ </tasks>
+
+ </contributor>
+
</contributors>
diff --git a/web/web/team/pedroas.png b/web/web/team/pedroas.png
new file mode 100644
index 00000000000..a639c6f33ab
--- /dev/null
+++ b/web/web/team/pedroas.png
Binary files differ
diff --git a/web/web/template.html.in b/web/web/template.html.in
index f82aeb5e917..87f42ed24ef 100644
--- a/web/web/template.html.in
+++ b/web/web/template.html.in
@@ -2,7 +2,7 @@
<html>
<head>
<title>#TITLE#</title>
-<link rel="icon" href="../MonoIcon.png" type="image/png">
+<link rel="icon" href="MonoIcon.png" type="image/png">
<!-- background-image: url("images/bgsquares.gif"); -->
<style type="text/css">
<!--
@@ -38,6 +38,12 @@
border-bottom: 2px solid #dddddd;
}
+ .shell {
+ border-style: solid; background: #000000; color: #bbbbbb;
+ #777777; border-width:
+ 1px; padding: 2pt;
+ margin:15px;
+ }
// -->
</style>
#CSS#
@@ -58,11 +64,11 @@
</td>
<td>
<a class="topmenu" href="download.html">Downloads</a> |
- <a class="topmenu" href="http://go-mono.com/daily">Daily snapshots</a> |
+ <a class="topmenu" href="http://go-mono.com/daily/">Daily snapshots</a> |
<a class="topmenu" href="screenshots.html">Screenshots</a> |
<a class="topmenu" href="http://www.go-mono.com:8080">Documentation</a> |
<a class="topmenu" href="bugs.html">Bugs</a> |
- <a class="topmenu" href="blogs.html">Blogs</a>
+ <a class="topmenu" href="http://www.go-mono.com/monologue/">Blogs</a>
</td>
</tr>
</table>
diff --git a/web/xml-classes b/web/xml-classes
new file mode 100755
index 00000000000..eb2607e34c6
--- /dev/null
+++ b/web/xml-classes
@@ -0,0 +1,310 @@
+* XML Classes
+
+** Abstract
+
+ XML library is used by several field of Mono such as ADO.NET and XML
+ Digital Signature (xmldsig). Here I write about System.Xml.dll and
+ related tools. This page won't include any classes which are in other
+ assemblies such as XmlDataDocument.
+
+ Note that current corlib has its own XML parser class named Mono.Xml.MiniParser.
+
+ Basically System.XML.dll feature has finished, or almost finished, so
+ I write this page mainly for bugs and improvement hints.
+
+
+** System.Xml namespace
+
+
+*** Document Object Model (Core)
+
+ DOM feature has already implemented. There is still missing feature.
+
+ <ul>
+ * ID constraint support is problematic because W3C DOM does not
+ specify handling of ID attributes into non-adapted element.
+ (MS.NET also looks incomplete in this area).
+ * I think, event feature is not fully tested. There are no
+ concrete desctiption on which events are risen, so we have to
+ do some experiment on MS.NET.
+ </ul>
+
+*** Xml Writer
+
+ Here XmlWriter almost equals to XmlTextWriter. If you want to see
+ another implementation, check XmlNodeWriter.cs used in monodoc.
+
+ XmlTextWriter is completed. However, it looks nearly twice as slow as
+ MS.NET (I tried 1.1)
+
+*** XmlResolver
+
+ Currently XmlTextReader uses specified XmlResolver. If nothing was supplied,
+ then it uses XmlUrlResolver. XmlResolver is used to parse external DTD,
+ importing XSL stylesheets and schemas etc.
+
+ However, XmlUrlResolver is still buggy (mainly because System.Uri is also
+ incomplete yet) and this results in several loading error.
+
+ XmlSecureResolver, which is introduced in MS .NET Framework 1.1 is basically
+ implemented, but it requires CAS (code access security) feature. We need to
+ fixup this class after ongoing CAS effort works.
+
+ You might also be interested in an improved <a href="http://codeblogs.ximian.com/blogs/benm/archives/000039.html">XmlCachingResolver</a> by Ben Maurer.
+
+*** XmlNameTable
+
+ XmlNameTable itself is implemented. However, it should be actually used in
+ several classes. Currently it makes sense if compared names are both in
+ the table, they should be simply compared using ReferenceEquals(). We
+ have partially done in XmlNamespaceManager (in .NET 1.2 methods; if the
+ build is not NET_1_2 then it is internal use only).
+
+*** Xml Stream Reader
+
+ When we are using ASCII document, we don't care which encoding we are using.
+ However, XmlTextReader must be aware of the specified encoding in XML
+ declaration. So we have internal XmlStreamReader class (and currently
+ XmlInputStream class. This may disappear since XmlStreamReader is enough to
+ handle this problem).
+
+ However, there seems some problems in these classes on reading network
+ stream (especially on Linux). This should be fixed soon, if we found the
+ actual reason.
+
+*** XML Reader
+
+ XmlTextReader, XmlNodeReader and XmlValidatingReader are almost finished.
+
+ <ul>
+ * Most of the OASIS conformance test passes as Microsoft
+ does, but about W3C tests, it is still not perfect.
+ * I won't add any XDR support on XmlValidatingReader. (I haven't
+ ever seen XDR used other than Microsoft's BizTalk Server 2000,
+ and Now they have 2002 with XML Schema support)
+ </ul>
+
+ XmlTextReader and XmlValidatingReader should be faster than now. Currently
+ XmlTextReader looks nearly twice as slow as MS.NET, and XmlValidatingReader
+ (which uses this slow XmlTextReader) looks nearly three times slower. (Note
+ that XmlValidatingReader won't be slow as itself. It uses schema validating
+ reader and dtd validating reader.)
+
+
+**** Some Advantages
+
+ The design of Mono's XmlValidatingReader is radically different from
+ that of Microsoft's implementation. Under MS.NET, DTD content validation
+ engine is in fact simple replacement of XML Schema validation engine.
+ Mono's DTD validation is designed fully separate and does validation
+ as normal XML parser does. For example, Mono allows non-deterministic DTD.
+
+ Another advantage of this XmlValidatingReader is support for *any* XmlReader.
+ Microsoft supports only XmlTextReader.
+
+ I added extra support interface named "IHasXmlParserContext", which is
+ considered in XmlValidatingReader.ResolveEntity(). Microsoft failed to
+ design XmlReader to support pluggable use of XmlReader (i.e. wrapping use
+ of other XmlReader) since XmlParserContext is required to support both
+ entity resolution and namespace manager. (In .NET 1.2, Microsoft also
+ supported similar to IHasXmlParserContext, named IXmlNamespaceResolver,
+ but it still does not provide any DTD information.)
+
+ We also have RELAX NG validating reader. See mcs/class/Commons.Xml.Relaxng.
+
+
+** System.Xml.Schema
+
+*** Summary
+
+ Basically it is completed. We can compile complex and simple types, refer to
+ external schemas, extend or restrict other types, or use substitution groups.
+ You can test how current schema validation engine is (in)complete by using
+ standalone test module
+ (see mcs/class/System.XML/Test/System.Xml.Schema/standalone_tests).
+ At least in my box, msxsdtest fails only 30 cases with bugfixed catalog.
+
+*** Schema Object Model
+
+ Completed, except for some things to be fixed:
+
+ <ul>
+ * Complete facet support. Currently some of them is missing.
+ Recently David Sheldon is doing several fixes on them.
+ * ContentTypeParticle for pointless xs:choice is incomplete
+ (It is because fixing this arose another bugs in
+ compilation. Interestingly, MS.NET also fails around here,
+ so it might be nature of ContentTypeParticle design)
+ * Some derivation by restriction (DBR) handling is incorrect.
+ </ul>
+
+*** Validating Reader
+
+ XML Schema validation feature is (currently) implemented on
+ Mono.Xml.Schema.XsdValidatingReader, which is internally used in
+ XmlValidatingReader.
+
+ Basically this is implemented and actually its feature is almost complete,
+ but I have only did validation feature testing. So we have to write more
+ tests on properties, methods, and events (validation errors).
+
+
+** System.Xml.Serialization
+
+ Lluis rules ;-)
+
+ Well, in fact XmlSerializer is almost finished and is on bugfix phase.
+
+ However, we appliciate more tests. Please try
+
+ <ul>
+ * System.Web.Services to invoke SOAP services.
+ * xsd.exe and wsdl.exe to create classes.
+ </ul>
+
+ And if any problems were found, please file it to bugzilla.
+
+ Lluis also built interesting standalone test system placed under
+ mcs/class/System.Web.Services/Test/standalone.
+
+ You might also interested in genxs, which enables you to create custom
+ XML serializer. This is not included in Microsoft.NET.
+ See mcs/tools/genxs for the details.
+
+
+** System.Xml.XPath and System.Xml.Xsl
+
+ There are two implementations for XSLT. One (and historical) implementation
+ is based on libxslt. Now we uses fully implemented managed XSLT.
+
+ As for Managed XSLT, we support msxsl:script.
+
+ It would be nice if we can support <a href="http://www.exslt.org/">EXSLT</a>.
+ <a href="http://msdn.microsoft.com/WebServices/default.aspx?pull=/library/en-us/dnexxml/html/xml05192003.asp">Microsoft has already done it</a>, but it
+ is not good code since it depends on internal concrete derivatives of
+ XPathNodeIterator classes. In general, .NET's "extension objects" is not
+ usable to return node-sets, so if we support EXSLT, it has to be done
+ internally inside our System.XML.dll. Volunteers are welcome.
+
+ Our managed XSLT implementation is still inefficient. XslTransform.Load()
+ and .Transform() looks three times slower (However it depends on
+ XmlTextReader which is also slow, so we are starting optimization from
+ that class, not XSLT itself). These number are only for specific cases,
+ and there might be more critical point on XSLT engine (mainly
+ XPathNodeIterator).
+
+
+** System.Xml and ADO.NET v2.0
+
+ Microsoft introduced the first beta version of .NET Framework 1.2 runtime
+ and sdk (and Visual Studio Whidbey). They are now available on MSDN
+ _subscriber_ download (i.e. it is not publicly downloadable yet). It
+ contains several new classes.
+
+ There are two assemblies related to System.Xml v2.0; System.Xml.dll and
+ System.Data.SqlXml.dll (here I treat sqlxml.dll as part of System.Xml v2.0,
+ but note that it is also one of the ADO.NET 2.0 feature). There are several
+ namespaces such as MS.Internal.Xml and System.Xml. Note that .NET Framework
+ is pre-release version and MS.Internal.Xml namespace apparently shows that
+ it is not in stable status as yet.
+
+ System.Xml 2.0 contains several features such as:
+
+ <ul>
+ * XPathNavigator2 and XPathDocument2
+ * XML Query
+ * XmlAdapter
+ * XSLT IL generator (similar to Apache XSLTC) - it is
+ internal use
+ </ul>
+
+ Tim Coleman started ADO.NET 2.0 related works. Currently I have no plan to
+ implement System.Xml v2.0 classes and won't touch with them immediately,
+ but will start in next some months. If any of you wants to try this
+ frontier, we welcome your effort.
+
+*** XPathNavigator2
+
+ System.Xml v2.0 implementation will be started from XPathDocument2 and
+ XPathNavigator2 implementations. Firstly, its document structure and
+ basic navigation feature will be implemented. And next, XPath2 engine
+ should be implemented (XPathNavigator2 looks very different from
+ XPathNavigator). Another requirement is schema based validation feature.
+ It needs some schema improvements, such like IXmlInfosetReader support.
+ (IXmlInfosetReader is in MS.Internal.Xml.)
+
+*** XML Query
+
+ XML Query is a new face XML data manipulation language (well, at least new
+ to .NET world). It is similar to SQL, but intended to manipulate and to
+ support XML. It is similar to XSLT, but extended to support new features
+ such as XML Schema based datatypes.
+
+ XML Query implementation can be found mainly in System.Xml.Query and
+ MS.Internal.Xml.Query namespaces. Note that they are in
+ System.Data.SqlXml.dll.
+
+ MSDN documentation says that there are two kind of API for XML Query: High
+ Level API and Low Level API. At the time of this beta version, the Low Level
+ API is described not released yet (though it may be MS.Internal.Xml.*
+ classes). However, to implement the High Level API, the Low Level API will
+ be used. They looks to have interesting class structures in MS.Internal.Xml
+ related stuff, so it would be nice (and I will) start to learn about them.
+
+ They looks to have IL generator classes, but it would be difficult to
+ start from them.
+
+*** System.Data.Mapping
+
+ System.Data.Mapping and System.Data.Mapping.RelationalSchema are the
+ namespaces for mapping support between database and xml. This is at
+ stubbing phase (incomplete as yet).
+
+*** XmlAdapter
+
+ XmlAdapter is used to support XML based query and update using
+ XPathDocument2 and XPathNavigator2. This class is designed to synthesize
+ ADO.NET and System.Xml. It connects to databases, and querys data however
+ in XML shape into XPathDocument2, using Mapping schema above. This must be
+ done after several classes such as XPathDocument2 and MappingSchema.
+
+
+** Miscellaneous Class Libraries
+
+*** RELAX NG
+
+ I implemented an experimental RelaxngValidatingReader. It is far from
+ complete, especially simplification stuff (see RELAX NG spec chapter 4),
+ some constraints (in chapter 7), and datatype handling.
+
+ I am planning improvements (starts with renaming classes, giving more
+ kind error messages, supporting compact syntax and even object mapping),
+ but it is still my wishlist.
+
+
+** Tools
+
+*** xsd.exe
+
+ See <a href="ado-net.html">ADO.NET page</a>.
+
+ Microsoft has another inference class from XmlReader to XmlSchemaCollection
+ (Microsoft.XsdInference). It may be useful, but it won't be so easy.
+
+
+** Miscellaneous
+
+ Sometimes I hear complain about System.dll and System.Xml.dll mutual
+ dependency: System.dll references to System.Xml.dll (e.g.
+ System.Configuration.ConfigXmlDocument extended from XmlDocument), while
+ System.Xml.dll vice versa (e.g. XmlUrlResolver.ResolveUri takes System.Uri).
+ Since they are in public method signatures, so at least we cannot get rid
+ of these mutual references.
+
+ However, for those who really want to build System.Xml.dll without System.dll,
+ I created <a href="http://primates.ximian.com/~atsushi/System_DummyClasses.cs">dummy classes in System.dll</a>. To build System.Xml.dll in such way, remove
+ <code>/r:System.dll</code> from Makefile, and add this source to
+ System.Xml.dll.sources. Note that this is at the point of Mono 0.30 release.
+
+ Also note that you still need System.dll to run mcs.
+